Pass time limit to Couenne

745 views
Skip to first unread message

Johannes Bethcke

unread,
Nov 10, 2015, 8:13:19 AM11/10/15
to Pyomo Forum
Hello,

I'm using Pyomo to generate MINLPs and solve them with the MINLP solver Couenne. It would be nice to pass Couenne a time limit when solving an instance. So I tried the following code.

opt = SolverFactory("couenne-0.5.3")
instance = model.create_instance("instance_1.dat")
results = opt.solve(instance, timelimit=10)

The instance solves in less than 10 seconds. Everything runs smoothly. However, if I use timelimit=1, the following error is produced:

pyutilib.common._exceptions.ApplicationError: Solver (asl) did not exit normally

Would you know a workaround? Or should I just pass the timelimit manually to Couenne?

Johannes

Gabriel Hackebeil

unread,
Nov 10, 2015, 7:45:52 PM11/10/15
to pyomo...@googlegroups.com
I believe the better approach would be to set the timelimit using a Couenne option if possible. E.g., assuming the option name is ‘timelimit’,

# persistent option
opt.options[‘timelimit’] = 1
opt.solve(instance)
# or one-time option
opt.solve(instance, options={‘timelimit’: 1})

The ‘timelimit’ keyword for the solve() method is at best implemented by killing the child solver process, which likely won’t result in any candidate solution being stored unless the solver has special signal handling (and I’m not sure what signal we send to the child process).

Gabe

--
You received this message because you are subscribed to the Google Groups "Pyomo Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyomo-forum...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Johannes Bethcke

unread,
Nov 12, 2015, 4:54:53 AM11/12/15
to Pyomo Forum
I tried this before but it seems that the only way to pass a time limit option to Couenne is via a settings file couenne.opt. It has to reside in the same directory as the Couenne executable.

Thanks for your help:)

Johannes Bethcke

unread,
Nov 23, 2015, 5:54:04 AM11/23/15
to Pyomo Forum
Okay this indeed seems to be the only way. The problem now is: Pyomo seems to ignore the settings file couenne.opt. When I call Couenne directly from the command prompt this works fine and I can e.g. limit computation time.

One reason I can think of is: Pyomo does call Couenne from different directory than the one where the couenne.opt file reside. Could that be true? Would it be possible to find out that directory. I already checked the path variables on my Windows 10 sytem.

Regards,

Johannes

Johannes Bethcke

unread,
Dec 2, 2015, 4:22:15 AM12/2/15
to Pyomo Forum
Got it! The couenne.opt file needs to be in same directory as the python file that is being called to call pyomo. In my case the PyCharm Workspace.

Johannes

Nesrine

unread,
Apr 17, 2018, 3:18:22 AM4/17/18
to Pyomo Forum
Hello Johannes,

I am confronted with a similar problem. Trying to pass the time_limit option to couenne, but since I've installed Pyomo through Anaconda, I'm having trouble finding the directory where Pyomo is being called by a python file. 

Any thoughts on this? 

Nesrine 
Reply all
Reply to author
Forward
0 new messages