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