Float exponent of a variable
進行中if the objective function is
x^0.2+y^0.4
the n how to solve such problems?
Do we still have to introduce auxiliary variable and constraint?
-
正式なコメント
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 try Gurobot, our chatbot interface offering instant, expert-level support. -
Hello Biswajit,
I would try to introduce two auxiliary variables:
\begin{array}{l}
a=x^{0.2} \\
b=y^{0.4}
\end{array}$$
\text { min } a+b
$$Then add the two constraints using Model.addGenConstrPow() (gurobi.com) as follow:
model.addGenConstrPow(x, a, 0.2)
model.addGenConstrPow(y, b, 0.4)
PWL piecewise-linear constraints are an approximation, it affects the model's accuracy. Including a non-convex, piecewise linear may significantly increase the cost of solving the model. The Graph below illustrates the non-convex nature of your equation.

Best Regards
Zed
0 -
Dear Zed Dean, Thanks a lot for your response. The above question is just an example. I am solving similar questions.
I am still getting a bit confused. So, is the following how the code is supposed to be written?
import gurobipy as gp
m.gp.Model('float')
x=m.addVar(vtype=GRB.CONTINUOUS, name='x')
y=m.addVar(vtype=GRB.CONTINUOUS, name='y')
#Auxilary verb
a=m.addVar(vtype=GRB.CONTINUOUS, name='a')
b=m.addVar(vtype=GRB.CONTINUOUS, name='b')
m.addGenConstrPow(x, a, 0.2)
m.addGenConstrPow(y, b, 0.4)0 -
Hello Biwajit,
Seems correct so far, you need to add the objective and then you should be fine
Yours
Zed
0
投稿コメントは受け付けていません。
コメント
4件のコメント