Incremental solve with Glop is almost as slow as solving from scratch (?) #4651
-
Hi all, The short story: I am using Glop through the MPSolver API in C++, OR-Tools 9.6. My task is solving a series of incremental LPs: before each subsequent run, I add to the model a few constraints and variables, and change some coefficients. Then I re-solve. This incremental process is repeated up to 30-40 times. However, except the first run which is super fast, the subsequent runs are almost as slow as solving the augmented model from scratch. This comes in contrast to other solvers like HiGHs: when I solve exactly the same sequence of problems with HiGHs, the first run is about 50x slower than the corresponding run with Glop. But the next runs are what one could expect: each subsequent run takes only a fraction of the time of the first run. Eventually the total runtime among all sequential runs is 2-3X faster with HiGHS than with Glop. Same pattern when using Clp. The details: My problem is quite sparse i.e. each constraint has max 20 non-zeros. This is the case for all constraints except one major constraint which is very large. With every successive run, I add approximatelly 10% more small constraints and variables, and I add as many non-zeros to my major constraint. The interface I use for adding constraints/variables and modifying coefficients is the same as in the simplest OR-tools example online: Variables are added individually with: MPSolver::MakeNumVar I have set use_dual_simplex as the algorithm used. After each time I add a batch of new data, I run MPSolver::Solve with no further options. My main concern is that in every run, even after the initial run, presolve is called, then there is a "Dual feasibility" phase, and then a "Dual optimization" phase. I wonder if there is an option that I can set in order to avoid presolve and the dual feasibility phase. As an experiment, I checked what would happen if, before every new run, I deleted the solver and build/solve from scratch. The difference in runtime/iterations was small: runtime was pretty much the same, iterations increased only by 20% when solving from scratch. Please let me know if there is any option that I can use to improve the performance of the incremental solve. Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
Glop used through the linear_solver or model_builder does not support any incrementalism. It is support from what I saw in math_opt. |
Beta Was this translation helpful? Give feedback.
-
When you are using GLOP and want incrementalism, you should typically:
Not all solvers require (1), e.g. Gurobi, although you still may want to try tweaking this for a little extra performance. I think that if you disable presolve, I think you may be able to get an incremental solve with GLOP + MPSolver (this is not what lperron said). This does not look like it from linear_solver/glop_interface.cc, but incremental changes are detected inside of glop. Perhaps I am wrong, I would just try it. Big picture, if you want incremental solves with or-tools, you should try to use mathopt if you can instead of mpsolver, there is better support for it. Note that MathOpt + Highs does not yet support incrementalism, we just have not taken the time to do this. |
Beta Was this translation helpful? Give feedback.
Glop used through the linear_solver or model_builder does not support any incrementalism.
It is support from what I saw in math_opt.