Limit time with Couenne

531 views
Skip to first unread message

Ana Belén

unread,
Jul 19, 2016, 12:21:15 PM7/19/16
to AMPL Modeling Language
I'd like to set a time limit using Couenne solver. I've found in user's manual the command option couenne_options 'time_limit = x', but it doesn't work. 

Does someone know the right command for this action? 

Thank you so much. 

Pietro Belotti

unread,
Jul 20, 2016, 6:43:33 AM7/20/16
to AMPL Modeling Language
Unfortunately Couenne can't read options that are specified at the AMPL level. You should create a file called couenne.opt, residing in the same directory from which Couenne is launched (i.e., the current working directory of AMPL) and containing the line "time_limit x".

I hope this helps.

Ana Belén

unread,
Jul 27, 2016, 11:33:18 AM7/27/16
to AMPL Modeling Language
Thanks for your answer. However, I have one more doubt:
I created the couenne.opt file with the command 'time_limit 10' (would it 'x' instead of the number of seconds?), but it doesnt work. Do I have to call the .opt file from AMPL?

Pietro Belotti

unread,
Jul 28, 2016, 6:06:51 AM7/28/16
to AMPL Modeling Language
Perhaps the file is not in the right directory. It should be in the same directory where AMPL is called from, or rather the current working directory when AMPL calls Couenne. So in principle if you are using a shell command line and run the commands

$ echo time_limit 10 > couenne.opt
$ ampl
ampl: model mymodel.mod
ampl: option solver couenne;
ampl: solve;

(where the last three commands are run from the AMPL prompt) in principle it should read the time limit.

Ana Belén Marín

unread,
Aug 3, 2016, 4:46:48 PM8/3/16
to am...@googlegroups.com

Thanks for your answer. However, I have one more doubt:
I created the couenne.opt file with the command 'time_limit 10' (would it 'x' instead of the number of seconds?), but it doesnt work. Do I have to call the .opt file from AMPL?

--
You received this message because you are subscribed to a topic in the Google Groups "AMPL Modeling Language" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ampl/J8ghrTRQzJE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ampl+uns...@googlegroups.com.
To post to this group, send email to am...@googlegroups.com.
Visit this group at https://groups.google.com/group/ampl.
For more options, visit https://groups.google.com/d/optout.

Victor Zverovich

unread,
Aug 4, 2016, 1:37:43 PM8/4/16
to am...@googlegroups.com
You don't have to call the .opt file from AMPL, but make sure that couenne.opt is located in the current AMPL directory. If couenne hits the limit it should print something like:

  couenne: Optimization interrupted on limit.

HTH,
Victor

You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ampl+uns...@googlegroups.com.

Danni Wu

unread,
Sep 5, 2020, 1:43:57 PM9/5/20
to AMPL Modeling Language
Dear Mr. Victor, 

Sorry to bother you four years after you answered that question. I'm new to python, so I'm not sure which is the current AMPL directory. I'm using Anaconda based python, is the current AMPL directory the directory where couenne.exe is located?

AMPL Google Group

unread,
Sep 7, 2020, 10:45:49 AM9/7/20
to AMPL Modeling Language
According to another comment in the same thread, couenne.opt should be in "the current working directory when AMPL calls Couenne." So there is no one answer; it might be the directory that contains couenne.exe and ampl.exe, but it might be the directory that contains your Python program, or the directory that was current when you invoked your Python program. With a few tests, you can probably find the right directory. But as a last resort, just before solving you might write a little file "couenne.test" from your Python program and see where it appears.


--
Robert Fourer
am...@googlegroups.com
{#HS:1274252284-87518#}
Reply all
Reply to author
Forward
0 new messages