On Thursday, January 16, 2014 9:24:05 AM UTC-6, Erik Quaeghebeur wrote: > Hi, > > > Does MixedIntegerLinearProgram allow for warm restarts, meaning that > after solving a first time one changes the objective and resolve, > starting from the feasible solution of the previous solver run? >
It's my understanding (from having worked on the code w/Nathann, & having looked at it just now) that if you merely add constraints & ask MILP to solve, then MILP just passes that all on to the solver. That is, Sage doesn't request a cold start. If no in general, does the GLPK backend (or another specific backend) support it? Perhaps only when using a simplex solver? GLPK has a presolver, which always constructs a valid solution "from scratch" but by default it's off (in GLPK and in Sage, too). Several comments in the GLPK manual suggest that it performs a warm start when minor changes are made. (e.g., "It is much better at fi rst to fi nd an optimal basis with the routine glp_simplex and only then to call glp_exact, in which case only a few simplex iterations need to be performed in exact arithmetic.") That said, this message<http://lists.gnu.org/archive/html/help-glpk/2010-07/msg00060.html>on the mailing list gives me pause. I guess a surefire way would be to run a long loop of adding constraints & solving & see what happens. I just ran a loop, and from what I can tell, it's cold-starting (though I'm not sure). sage: lp = MixedIntegerLinearProgram(maximization = False) sage: lp.add_constraint(lp[0] + lp[1] >= 1) sage: lp.set_objective(lp[0] + lp[1]) sage: i = 2 sage: while i < 10000000: lp.add_constraint(i*lp[0] - lp[1] >= 0) timeit('lp.solve()',repeat=1) i += 1 The times on my machine rise from 33μs to 564μs by the time i=441. That looks to me like a cold start, but I'm not sure this is a good method of testing, since merely creating the same system w/441 constraints solves in 53ns, which I didn't expect at all... john perry -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/groups/opt_out.