Dependent variables
AnsweredHi,
I was wondering how dependent variables should be handled within Gurobi. For instance, the decision variable in the model is X_{t}. Another variable, S_{t} is dependent on the value of the decision variable:
S_{t+1} = S_{t} - X_{t}
Should the variable be added with model.addVars() like the decision variable, or should this be handled in a different matter?
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. -
Hi Sander,
- You need to define both \(X\) and \(S\) as decision variables using the Model.addVars() method.
- You can then enforce the relationship between \(X\) and \(S\) variables by adding the constraints \(S_{t+1} = S_t - X_t\) using the Model.addConstrs() method.
Best regards,
Maliheh
0 -
Thank you!
0
Post is closed for comments.
Comments
3 comments