Do not hesitate to vote for the wish to have CPLEX deal with non convex quadratic constraints
Original Message:
Sent: Thu November 21, 2024 12:42 AM
From: Fatin Nur Amirah Mahamood
Subject: Error: CPLEX(default) cannot extract expression
Thank you for your response. However, I need to clarify that my decision variable (dvar) should be in float. The expected result is x=-1/sqrt(2) , y=1/sqrt(2). This result matches both the textbook example and my manual calculations, as well as results obtained using Python's scipy
library (via the Lagrange method).
From my understanding, "using cp;"
does not allow for float dvar. Is there an alternative approach to solving this problem?
Additionally, I came across this statement in the documentation:
"When you call the barrier optimizer, your quadratic constraints will be checked for the necessary PSD property, and an error status 5002 will be returned if any of them violate it."
I also verified that my constraint is not convex. Does this imply that my function cannot be solved using CPLEX?
Thank you for your guidance.
------------------------------
Fatin Nur Amirah Mahamood
Original Message:
Sent: Wed November 20, 2024 12:00 PM
From: ALEX FLEISCHER
Subject: Error: CPLEX(default) cannot extract expression
Since your decision variables are integer you could use CPOptimizer within CPLEX:
using CP; dvar int x in -1..1;dvar int y in -1..1; minimize 5*x*x + 5*y*y + 4*x*y; subject to { x*x + y*y == 1;} execute { writeln("Results:"); writeln("-----------------"); writeln("x = ", x); writeln("y = ", y); writeln("objective = ", 5*x*x + 5*y*y + 4*x*y); }
------------------------------
[Alex] [Fleischer]
[Data and AI Technical Sales]
[IBM]
Original Message:
Sent: Wed November 20, 2024 04:53 AM
From: Fatin Nur Amirah Mahamood
Subject: Error: CPLEX(default) cannot extract expression
Hi can help to assist on this error? i've tried lots of ways including make the constraint piecewise etc (suggested by claude). Besides iam very new to this. this is my second day. i just don't know where else to find the answer. i keep getting this error.
execute {
cplex.optimalitytarget = 3;
}
dvar int x in -1..1;
dvar int y in -1..1;
minimize
5*x*x + 5*y*y + 4*x*y;
subject to {
x*x + y*y == 1;
}
execute {
writeln("Results:");
writeln("-----------------");
writeln("x = ", x);
writeln("y = ", y);
writeln("objective = ", 5*x*x + 5*y*y + 4*x*y);
}
CPLEX(default) cannot extract expression: 1*y*y + 1*x*x == 1.
#Decision Optimization
------------------------------
Fatin Nur Amirah Mahamood
------------------------------