constraint with parameter that has variable as an index
Answeredi wanna add d[i, x[c, d]] in an addConstrs() environment
d is defined as d[i, j] and is binary , the values are stored in a dict
x[c, d] is a variable of the model, it is an integer
I get this error: GurobiError: Variable has not yet been added to the model
thanks for helping!
0
-
Hi,
This:
d[i, x[c, d]]
will not work. Variables do not have a value until the model is solved, and so you cannot use their values as an index.
I recommend dedicating the appropriate effort to learning the basics of mathematical modelling. The following Udemy course may interest you.
https://www.udemy.com/course/intro-to-optimization-pt1/
- Riley
0
Please sign in to leave a comment.
Comments
1 comment