How to define a cut constraint like ..

16 views
Skip to first unread message

tcsnwgl

unread,
Sep 26, 2015, 1:09:48 PM9/26/15
to YALMIP
Hi  guys,

Say I want to define a function of variables  x in yalmip as follows:

$\sum\limits_{i<j} q_ij abs{x_i - x_j} < = C$....

What should I do ?


Best Regards

Johan Löfberg

unread,
Sep 26, 2015, 2:21:53 PM9/26/15
to YALMIP
Nothing special as far as I can see. Simple for-loop is one way

lhs = 0;
for i= 1:N
 
for j = 1:i-1
  lhs
= lhs+q(i,j)*abs(x(i)-x(j));
 
end
end
Model =lhs<=C;

If q is non-negative, you get LP constraints, if some q is negative, YALMIP will have to do MILP modelling



Reply all
Reply to author
Forward
0 new messages