Reputation: 11
I am currently working on an optimization problem in IBM ILOG CPLEX Optimization Studio. I have formulated the problem as a mixed integer conic programming problem. During the process of writing one of the constraints, I encountered an issue when attempting to multiply two variables—one of them is an integer, and the other is a binary variable. The error message I received indicated that the variable is non-convex. I am seeking advice on how to resolve this issue and proceed with the optimization problem successfully. Your help would be greatly appreciated.
The optimization problem involves the constraint of the form x(i)v(i)-x(j)v(j)<=2(c1+c2).Here, x is the binary variable and v is the continuous variable.c1 and c2 are constants.
Upvotes: 0
Views: 45
Reputation: 10059
See https://github.com/AlexFleischerParis/howtowithopl/blob/master/multiplybinarybydecisionvariable.mod
for multiplying a decision variable and a binary decision variable
dvar int x in 2..10;
dvar boolean b;
dvar int bx;
maximize x;
subject to
{
// Linearization
bx<=7;
2*b<=bx;
bx<=10*b;
bx<=x-2*(1-b);
bx>=x-10*(1-b);
// if we use CP we could write directly
// b*x<=7
// or rely on logical constraints within CPLEX
// (b==1) => (bx==x);
// (b==0) => (bx==0);
}
Upvotes: 0