Variables with defined value
AnsweredHello together,
I have a question regarding the definition range of a variable, and was wondering if you could help me with this.
In my optimization problem I have defined the variable x as follows: x = m.addVar(lb=1.0, ub=7.0, name="x")
Now I wanted to exclude values via the restrictions so that the variable cannot accept the values 3 and 4, for example. However, inequality conditions do not work like e.g. m.addConstr(4!=x, name = "c2").
Is there perhaps a way to specify an exact definition set for the variable? So that the variable can only take the values 1, 3, 6 and 7 for example?
Thanks a lot in advance.
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 try Gurobot, our chatbot interface offering instant, expert-level support. -
Hi Jonasz,
thanks for the help i will try to implement this in my model.
Best regards
Tobias0
Post is closed for comments.
Comments
3 comments