Questions about conditional statements in gurobi
Answered
I'm a beginner and I want to know what's wrong with this code, it says: unsupported operand type(s) for ** or pow(): 'Var' and 'float', and if I delete **, it says again: Additional sense argument provided for general constraint of indicator type
0
-
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. -
- Indeed the ** operator can't be used with Gurobi variables. Consider using addGenConstrPow to define a helper variable holding YSAL_t[t]**0.624 and then use that helper variable in your indicator constraint.
- The other error message is shown because the fourth (unnamed) argument to addGenConstrIndicator, is normally the "sense" of the constraint (e.g. <=, >=, ==). Since you include that already in the third argument, you should explicitly mention the argument name by stating name=f"RD_t_{t}_constraint". See also this question.
0 -
Thank you very much for your answer!
0
Post is closed for comments.
Comments
3 comments