• Gurobi Staff

Hi Changryong,

Can you give more examples?  I think this may help.

- Riley

Of course, examples can be found in statistical learning, e.g lasso, but additional constraint that once the variable is nonzero, then it actually have the same value. In the above example, say b_1, b_2 and b_3 are the regression coefficient we would like to estimate, but it can take zero for sparsity. Furthermore, we would like have the same coefficient once it turns out to be non-zero. As in the above, w_1 =0, w_2 =1 and w_3 =1, then b_1=0 and b_2  = b_3. Some literature says this kind of constraint as "homogeneity pursuit".

I need to express it in a matrix

Want to solve minimize  x'Qx + c'x subject to some sparse constraints Ax <= b.

Sparsity can be solved by introducing w_i's and having -M w_i < b_i < M w_i, but need additional condition

that they share the same vale for x = (b_1, b_2, b_3, w_1, w_2, w_3)'

Thanks a lot!

• Gurobi Staff

Hi Changryong,

Does this. from your first post, contain a mistake?

e.g w_1 =0, w_2 =1 and w_3 =0, then b_2 = b_3

The reason I was asking for more examples is I don't fully understand how this works if this does not have a mistake.

- Riley

My mistake, it should be w_1 =0, w_2=1 and w_3=1 then b_1=0, b_2 = b_3

• Gurobi Staff

Hi Changryong,

With Python you could use a combination of addGenConstrIndicator and addGenConstrAnd (or their shortcuts).  There are similar methods in our other APIs.

So you could introduce 3 more binary variables a_{1,2}, a_{2,3}, a_{1,3} and link them like so:

a_{1,2} = w_1 and w_2a_{2,3} = w_2 and w_3a_{1,3} = w_1 and w_3a_{1,2} == 1 >> b_1 == b_2a_{2,3} == 1 >> b_2 == b_3a_{1,3} == 1 >> b_1 == b_3

I'm not sure this will result in a particularly strong model, but it should work (subject to tolerances).

- Riley