Is there a way to fix non-basic variables (mainly non-basic slack variables)?
AnsweredHello,
I am trying to solve an LP problem, and the idea goes as follows: After solving the initial model, I want to fix all non-basic variables while keeping basic ones free, then add a new variable into the model and solve it again. For example, in a maximization problem with 2 vars X1, X2, and 3 constraints (thus 3 slack variables), if the bvs for the initial problem are X1,X2,X3, then I want to fix X4 and X5.
I know how to fix variables that I created (by equaling their ub and lb). For the slack variables, I think creating them while building the model enables me to the same thing, but can I fix them without adding them to the model?
-
Hi Sadaki,
For the slack variables, I think creating them while building the model enables me to the same thing, but can I fix them without adding them to the model?
Unfortunately, there is currently no way to fix the slack variables added by Gurobi. The only way would be to create the slack variables yourself as you already mentioned.
Depending on your application you might want to consider trying an open-source LP solver such as SoPlex or HiGHS, which might give you more freedom with slack variables. You could probably even extend the respective code and add some functionalities yourself.
Best regards,
Jaromił0
Please sign in to leave a comment.
Comments
1 comment