How do I set a subset for the variable
Answered
0
-
Official comment
This post is more than three 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 why not try our AI Gurobot?. -
Hi Zühal,
You should be able to define the variables like this:
collect = m.addVars(H, N, NH, vtype=GRB.BINARY, name="collect")
You should just write some example code with lots of print statements to see what kind of objects you are actually working with. Interactive Python environments like IPython or Jupyter Notebook can also be very helpful in understanding and learning Python.
Cheers,
Matthias0 -
Hi Matthias,
Thank you so much for your answer. As you realise, I keep my variables in a list right now.
However, as I understand in order to define the variables as you have shown; I should use a dictionary type variables.
I am going to do your suggestions; I hope I could solve the issue at the end..
Thanks again,
Cheers,
Zühal.
0
Post is closed for comments.
Comments
3 comments