coin-or / Bonmin

Basic Open-source Nonlinear Mixed INteger programming

Home Page:https://coin-or.github.io/Bonmin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Incorrect termination condition reported by Pyomo when exiting due to max time limit

rmapap opened this issue · comments

When exiting early due to a time limit (specified with bonmin.time_limit), Pyomo incorrectly reports the termination condition as maxIterations instead of maxTimeLimit. Since Pyomo accesses Bonmin through ASL, my guess is that the issue is in Bonmin.

I am using Pyomo 5.6.1 and Bonmin 1.8.6 with Cbc 2.9.9 and Ipopt 3.12.10.

Thank you in advance for your help.

Yes, Bonmin only returns TMINLP::LIMIT_EXCEEDED, but does not reveal in its status codes which limit has been exceeded. The AMPL/Bonmin interface does not try to figure out further which limit it was that has been reached:

    else if (status == TMINLP::LIMIT_EXCEEDED) {
      status_str = "\t\"Not finished\"";
      message = "\n" + appName_ + ": Optimization interrupted on limit.";
      if(x)
        solve_result_num = 421; /* Limit reached or user interrupt with integer feasible solution.*/
      else
        solve_result_num = 410; /* Limit reached or user interrupt without solution.*/
    }

Thank you for the quick reply. It sounds like this is by design and that there are no plans to introduce additional status codes. If that's the case, then you can go ahead and close the issue.

Can leave it open for now. Other Bonmin interfaces check how much iterations or time has been spend to do a better guess which limit may have been reached.

Hello, I have the same issue with two solvers (BARON and DICOPT) accessed via GAMS via Pyomo (using the pyomo.solvers.plugins.solvers.GAMS.GAMSDirect API).

When I set the GAMS time limit option (resLim aka "resource limit", which specifies the number of seconds the solver can run for), I find no way to distinguish between solutions where the solver has stopped due to exceeding the time I specified and solutions that have reached optimality (within my specified relative optimality gap).

I use the Pyomo option tee, and in the output from both solvers, it is clear why the solver stops. Pyomo's solution objects do not seem to be aware of this, though.

Hello, I have the same issue with two solvers (BARON and DICOPT) accessed via GAMS via Pyomo (using the pyomo.solvers.plugins.solvers.GAMS.GAMSDirect API).

When I set the GAMS time limit option (resLim aka "resource limit", which specifies the number of seconds the solver can run for), I find no way to distinguish between solutions where the solver has stopped due to exceeding the time I specified and solutions that have reached optimality (within my specified relative optimality gap).

I use the Pyomo option tee, and in the output from both solvers, it is clear why the solver stops. Pyomo's solution objects do not seem to be aware of this, though.

Solvers in GAMS return a model and a solve status to GAMS, which indicate why the solver has stopped and whether it has found a solution: https://distdocs.gams.com/36/docs/UG_GAMSOutput.html#UG_GAMSOutput_ModelStatus
This works for Bonmin, BARON, DICOPT (and all others, I believe). (The GAMS/Bonmin interface also distinguishes between iteration and timelimit)
It might be up to the GAMS wrapper in Pyomo to make these status codes available in Python. Or you can access them via model attributes modelstat and solvestat in your GAMS model.