I'm having trouble to get guess_basis/set_basis to improve the solver performance, or in some cases to work at all.
Very briefly, my intended use case is to solve a large linear program using an interior point method solver (I'm using one from ALGLIB) and then solve closely related problems by making small changes to the objective and using the solution to the original problem to guess a basis for lpsolve's simplex solver (interior point methods being difficult to warm start themselves).
I didn't get very far, though, before I encountered some issues. The most fundamental issue so far seems to be that even on simple problems, using guess_basis/set_basis doesn't seem to improve the number of iterations required for convergence, even when the solution passed to guess_basis is optimal.
I can reproduce this even with the example from the
guess_basis documentation. But as written I think this example is misleading, because it doesn't set an objective, so the objective function is constant and the problem is trivial. I've modified this example by adding a set_obj_fn call, and I'm working in C# linking to liblpsolve55.so on Linux. This is my code:
var lp = lpsolve.make_lp(0, 2);
lpsolve.set_verbose(lp, 6);
lpsolve.set_trace(lp, 1);
lpsolve.set_outputfile(lp, "/tmp/guessbasis.log");
lpsolve.set_maxim(lp);
lpsolve.set_obj_fn(lp, new double[]{0, 1, 1});
lpsolve.str_add_constraint(lp, "1 0", lpsolve.lpsolve_constr_types.LE, 3);
lpsolve.str_add_constraint(lp, "0 1", lpsolve.lpsolve_constr_types.LE, 3);
var guessvector = new double[]{0, 3, 3};
var basis = new int[5];
lpsolve.guess_basis(lp, guessvector, basis);
lpsolve.set_basis(lp, basis, 1);
lpsolve.solve(lp);
I've attached the trace file after running this. It shows 4 iterations being required for convergence, even though the guess supplied to guess_basis was already optimal. If I remove the call to set_basis, it converges in 2 iterations, so it seems like the choice of basis here is not only not helping, it is actually hurting.
Any help would be appreciated, am I just doing something stupid or is guess_basis not working as expected even in the documented example?