Skip to content

[Feature Request] Support Boolean Indexing for Constraints #707

@RoyiAvital

Description

@RoyiAvital

It seems there is no support for using BitVector in constraints.

A simple (Stupid) example:

using Convex;
using ECOS;

numSamples = 100;
vY = rand(numSamples);

valThr = sort(vY, rev = true)[5];
vP = vY .>= valThr; #<! Set of boolean indices

vX = Variable(numSamples);
sConvProb = minimize( 0.5 * sumsquares(vX - vY), [vX[vP] == vY[vP]] ); #<! Will fail
solve!(sConvProb, ECOS.Optimizer; silent = true);

If one define vPi = findall(vP); then [vX[vPi] == vY[vPi]] will work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions