Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
rmapap opened this issue Apr 28, 2019 · 5 comments

Comments

@rmapap
Copy link

rmapap commented Apr 28, 2019

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.

@svigerske
Copy link
Member

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.*/
    }

@rmapap
Copy link
Author

rmapap commented Apr 29, 2019

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.

@svigerske
Copy link
Member

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.

@zsiegel92
Copy link

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.

@svigerske
Copy link
Member

svigerske commented Sep 1, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants