How to define a lower bound for POW function?
進行中Dear community,
I have looked at the recent posts, however, they did not find a solution to my problem.
Here is my current codes:
# continuous variable indicating flow through link ij.
q = m.addVars(mstree[9].edges(),lb = 0, vtype = GRB.CONTINUOUS, name = "FLOW")
qhelper = m.addVars(mstree[9].edges(), vtype = GRB.CONTINUOUS, name = "qhelper")
# binary variable indicating if at link ij pipe of diameter k is implemented
d = m.addVars(mstree[9].edges(), pipesize, vtype = GRB.BINARY, name = "DIAMETER")
#q^1.85
m.addGenConstrPow(q[i,j],qhelper[i,j],1.85)
m.addConstr(loss[i,j] ==
10.67*qhelper[i,j]/(150**1.825)*gp.quicksum(d[i,j,k]/k**4.8704 for k in pipesize)
, "Hydro loss")
However, I got such an error.
lower bound of x variable is less than zero for POW function
I think the lower bound of qhelper is already determined by q but it seems something different. I would be happy if anyone can help me.
Thanks.
-
It looks like the lower bound of your \(q\) variables can be slightly negative due to numerical issues in the model. Note that you set the lower bound to \(0\) explicitly, but there can still be tolerances in play. Could you try setting the lower bound of your \(q\) variables to something slightly positive, e.g., \(10^{-5}\)?
If the above does not help, could you please write the model you have to a file via the write method
m.write("myLP.lp")
and share the file as described in Posting to the Community Forum?
Best regards,
Jaromił0 -
Hello Jaromił,
Thanks for your help.
I set a positive lower bound of variables but it did not work.
Here is my current model and I will be appreciate if you can give further advance.
0
サインインしてコメントを残してください。
コメント
2件のコメント