how to write a square constraint?
AnsweredHello,when i using python API to establish a model,i can't write the constraint in gurobi 8.1.
5*(x1^2+x2^2)^0.5<30
Thank you very much for your answer
1
-
Hi,
You can divide both sides of the inequality by 5, then square each side to get an equivalent form. You can then use
m.addConstr(x1*x1 + x2*x2 <= 36)
- Riley
0 -
Thanks.This inequality is just a small example I gave to illustrate the problem, and it may not be very appropriate. I successfully wrote this constraint by introducing auxiliary variables .
0
Please sign in to leave a comment.
Comments
2 comments