constraints programming
Answeredhi
how are you?
Please , can you help write the code to program the optimization solution of the following constraints:
To Maximize x
such that :
R1P1p1M1+ R2P2p2M2+ R3P3p3M3=5E+06x-0.682
and the parameters should satisfy the intervals given:
400<=R1<=750
750<=R2<=1200
400<=R3<=1200
4670330<=M1 <=188888889
4670330<=M2 <=188888889
4670330<=M3 <=188888889
p1=2.2
p2= 3
p3=5
100<= P1<=300
5<= P2<=100
10<= P3<=60
0
-
Official comment
This post is more than three 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 why not try our AI Gurobot?. -
You should be able to use the qp example on the Gurobi Example Tour to get you started on the model. This will show you how to create a Gurobi model, add variables, add bounds to variables, add constraints, and set an objective.
Most of the modeling should be quite straightforward. However, the nonlinear equality you described will need a bit of care when adding it to the model. To add this, here are a few tips
- Gurobi can solve with linear, bilinear, and quadratic terms. However, the \( p_i\cdot R_i\cdot P_i\cdot M_i\) terms are trilinear. To use these, I recommend following the recommendations in How do I model multilinear terms in Gurobi?
- The \(x^{-0.682}\) term also does not fall under the functional forms that Gurobi can use as-is. Instead, I recommend creating a piecewise linear approximation. Luckily, Gurobi can do most of the work for you to create such an approximation. To get started, please check out the documentation on piecewise linear objectives and constraints. There are also two examples you can review on the Gurobi Example page: piecewise and gc_pwl.
- Since this is a nonlinear equality constraint, it is also a nonconvex constraint. Gurobi can certainly handle this type of constraint. To pass the information along to Gurobi, set the Nonconvex parameter to 2. (e.g., \(\texttt{m.Params.Nonconvex=2}\)).
0
Post is closed for comments.
Comments
2 comments