Hi
at https://github.com/AlexFleischerParis/howtowithopl/blob/master/multiplybinarybydecisionvariable.mod I shared ways to linearize such a product.
// suppose we want b * x <= 7
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);
}
------------------------------
[Alex] [Fleischer]
[Data and AI Technical Sales]
[IBM]
------------------------------
Original Message:
Sent: Thu February 20, 2025 07:16 AM
From: Damien Blanchard
Subject: Error CPLEX 5002 help
Hello, I have started using IBM ILOG CPLEX Optimization Studio 22.1.1 and I encounter the following problem when I try to run my model :
Exception from IBM ILOG CPLEX: CPLEX Error 5002: 'q1770' is not convex.->
I believe the error comes from my constraints in which I multiply two decision variables in a sum (a boolean decision variable multiplied by a float decision variable)
Is there any way to make it work?
By changing the settings, rewriting the constraint differently (is there a technique for this scenario? I've heard of McCormick envelopes but am not entirely sure they apply ?) or should I just use another solver such as Gurobi?
So far my attempts have been to set "Solution to compute" (which seems to be cplex.optimalitytarget) to "Global optimal solution" (3)
Which didn't change anything. Though I wasn't too hopeful, I think that only helps if the decision variables multiplication happens in the objective function
(which it also does.. But it also is present in constraints)
------------------------------
Damien Blanchard
------------------------------