GurobiError: Constraint has no bool value (are you trying "lb <= expr <= ub"?)
AnsweredHi, I get the following error for a constraint.
for p in P:
for i in I:
for t in T:
if qsum(SalvageValProd[p,i,t] for i in I for t in T) <= 0.05 * scaling* qsum(delta[p,i,t] for i in I for t in T) * fprod[p]:
SVProd[p]= qsum(SalvageValProd[p,i,t] for i in I for t in T)
else:
SVProd[p]= 0.05 * scaling* qsum(delta[p,i,t] for i in I for t in T) * fprod[p]
I will be very grateful if someone can help me with this error!
Mina
-
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 try Gurobot, our chatbot interface offering instant, expert-level support. -
Hi Mina,
It is not possible to use modelling expressions in an \(\texttt{if}\)-clause because optimization variables have no values before the model has been optimized. Thus, you have to model this conditional statement via additional variables and constraints. The Knowledge Base article How do I model conditional statements in Gurobi? should be helpful.
Best regards,
Jaromił0 -
For additional information, please also see the Knowledge Base article: Constraint has no bool value (are you trying "lb <= expr <= ub"?)
0
Post is closed for comments.
Comments
3 comments