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
-
Official comment
This post is more than two years old. Some information may not be up to date. For current information, please check the Gurobi Documentation or Knowledge Base. If you need more help, please create a new post in the community forum, or try Gurobot, our chatbot interface offering instant, expert-level support. -
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
Post is closed for comments.
Comments
3 comments