Fix a variable and evaluate the Objective function value
AnsweredHello,
Is there any efficient way to fix a variable at a specific value? I want to give the solution for a variable to the model as input and see what will be the value of objective function for that specific point. The only way came to my thoughts is to add a new constraint that makes that variable equal to specific value but this increases my computational time as the number of constraints are larger now. This is part of my model and if that helps, variable w is the order of visited nodes. I want to be able to change the order by setting the value of w at specific values. The whole model solves to optimal in 60 seconds but when I add those new constraints at the end in the following screen shot, it takes much longer to solve. Any help is much appreciated.
-
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?. -
I usually make this by change the variable bounds
try:
w[(7,1)].ub = 2
w[(7,1)].lb = 20 -
Thank you very much.
Azadeh
0
Post is closed for comments.
Comments
3 comments