which solver can solve this model?

65 views
Skip to first unread message

覃岭

unread,
Jun 8, 2014, 7:07:25 AM6/8/14
to yal...@googlegroups.com

my model has a following constraint:
A'XAY==C,
in which A is a symmetrical matrix with 0, 1 constants, 
X is a diag matrix of 0-1 variables, 
Y is a matrix of real variables,
C is a constant matrix.
 
obviously nonlinear terms are contained in this constraint,
is there any tricks to convert it into linear constraints, or any solver can solve it directly?

Johan Löfberg

unread,
Jun 8, 2014, 1:37:04 PM6/8/14
to yal...@googlegroups.com
Yes, products between continuous variables and binaries can easily be converted to a pure MILP model by using the fact that x*y is equal to y if x is 1 and equal to 0 if x is zero, i.e., a purely logical property.

YALMIP implements this for general polynomial expressions in binmodel. Hence, your model can be solved with any MILP solver and YALMIP as

A = randn(3,3);
X
= diag(binvar(3,1));
Y
= sdpvar(3,3,'full');
knownY
= randn(3);
C
= A'*A*knownY;

[AXAY, milpmodel] = binmodel(A'
*X*A*Y,[-10 <= Y(:)<=10]);

solvesdp
([AXAY == C, milpmodel])

[knownY double(Y)]


Note that known bounds on the continuous variable is required.

Johan Löfberg

unread,
Jun 9, 2014, 2:47:32 AM6/9/14
to yal...@googlegroups.com
BTW, if binmodel crashes, comment out line 50 in binmodel.m. I seem to have introduced a bug in the latest release

覃岭

unread,
Jun 10, 2014, 11:21:12 AM6/10/14
to yal...@googlegroups.com
thanks, johan, your answer is very good. And I have another way to deal with it:
A'xAy ==C can be extracted as a set of constraints with polynomial in left hand side, for first constraint:
x1*y1 + ... + xn*yn == c, where variables xi∈{0,1}, yi∈R,and constant b∈R
    I try to add a series of auxiliary variables zi:
    z1+...+zn==c,
    for i=1,...n
    yi - M*(1-xi) <= zi <= yi + M*(1-xi)
    -M*xi <= zi <=  M*xi

Johan Löfberg

unread,
Jun 10, 2014, 12:03:03 PM6/10/14
to yal...@googlegroups.com
That's basically the model binmodel derives automatically for you.
Reply all
Reply to author
Forward
0 new messages