Sometimes I need to change the variable coefficient of a constraint and then reoptimise from the previous solution. Whenever this change makes the problem primal infeasible, the dual simplex doesn't seem to start from the previous solution, but from the very beginning.
This small example in C++ illustrates the problem.
GRBEnv env = GRBEnv();
GRBModel model = GRBModel(env);
GRBVar x00 = model.addVar(0.0, 1.0, 0.0, GRB_CONTINUOUS, "x00");
GRBVar x01 = model.addVar(0.0, 1.0, 1.0, GRB_CONTINUOUS, "x01");
GRBVar x10 = model.addVar(0.0, 1.0, 0.0, GRB_CONTINUOUS, "x10");
GRBVar x11 = model.addVar(0.0, 1.0, 1.0, GRB_CONTINUOUS, "x11");
GRBConstr c0 = model.addConstr(x00 + x01 == 1, "c0");
GRBConstr c1 = model.addConstr(x10 + x11 == 1, "c1");
GRBConstr c2 = model.addConstr(x00 + x10 <= 1, "c2");
// First solve
// Modify constraint (adding 2*x01 makes current solution infeas)
model.chgCoeff(c2, x01, 2);
// Second solve
I also tried setting CBasis and VBasis manually before the new solve and although it doesn't discard this basis it still doesn't start from there.
Interesting fact: if I simply add the modified constraint as a new constraint (therefore leaving the current, now redundant constraint in the model), then it does start from the previous basis when I reoptimise!
If this is the only possible workaround, I need to find a way to remove the old constraints somehow or I will have a big issue with problem size in my algorithm.
I someone can shed some light on this, it would be most appreciated.
Please sign in to leave a comment.