coin-or / SHOT

A solver for mixed-integer nonlinear optimization problems
https://shotsolver.dev
Eclipse Public License 2.0
117 stars 25 forks source link

user termination check not checked during (long) MIP solve #86

Closed svigerske closed 4 years ago

svigerske commented 4 years ago

I wanted to try out the MIP reformulation that SHOT can do on models like MINLPLib/tln5 (binarizing integer variables and linearizing products of binary variables). By looking into the SHOT code, I figured out that I needed to set Model.Reformulation.Constraint.PartitionNonlinearTerms = 0 to make this happen. I then get a MIP which takes CPLEX very long to solve.

I cannot interrupt the solve via SIGINT, which is something that should happen through this callback in the GAMS interface:

            solver.registerCallback(
                E_EventType::UserTerminationCheck, [&env, gev = (gevHandle_t)gmoEnvironment(gs->gmo)] {
                    if(gevTerminateGet(gev))
                        env->tasks->terminate();
                });

It would be nice if this termination check could be executed from time to time during a MIP solver run, too.

andreaslundell commented 4 years ago

Good suggestion, for Gurobi, this is trivial to implement since I already have an informational callback there. For CPLEX and Cbc, it would take a little bit more work. But I'll take a look.