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
-
- 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
Please sign in to leave a comment.
Comments
2 comments