RE: [AMPL 14830] Solver slow when invoked from bash script

16 views
Skip to first unread message

Robert Fourer

unread,
Sep 29, 2017, 3:05:52 PM9/29/17
to am...@googlegroups.com
There isn't any obvious reason why Gurobi runs would be much faster when called from the command-line interface than when called from a script. So it will be necessary to collect more information about the Gurobi runs, to see more clearly what is different about them. For this purpose, you should add the following two commands before the "solve":

option show_stats 1;
option gurobi_options 'mipdisplay=2';

(If you are already setting a gurobi_options string, then add mipdisplay=2 to it.) Do this both for the situation where Gurobi is fast and the situation where it is slow, and compare the additional output that results. It will be different at some point, and that will provide an important clue. If you need further help, you can post the two listings to this forum; they can be in attached files if that is convenient.

Bob Fourer
am...@googlegroups.com

=======

From: am...@googlegroups.com [mailto:am...@googlegroups.com] On Behalf Of Hend Ben Saad
Sent: Thursday, September 28, 2017 12:22 AM
To: AMPL Modeling Language
Subject: [AMPL 14830] Solver slow when invoked from bash script

I am running a .run file from a bash script, the problem is when I run it from outside (using ampl CLI), the solution (using Gurobi) is returned very fast, but when I call it from inside the script it just spends a whole hour to return the result, sometimes more with no result what makes me interrupt the process and it displays that in fact there is a feasible solution but it is spending that time to look for the optimal one.
The line in the script:
echo "reset; commands ilp.run;" |./ampl

And from outside, I've even tried to make a smaller script containing only this line, thinking that the problem is with the fact of calling it from a bash script, that script was also as fast as just invoking ./ampl from terminal and typing the commands manually...

I've also tried to replace (echo "reset; commands ilp.run;" |./ampl) by (./ampl) and then type the commands manually. That also was slow so I just interrupted the process.

My script contains many other instructions before reaching the stage of calling ampl. it runs in a loop and basically ampl is invoked within the 6th or 7th time.
Why the optimal solution is found quickly from outside and it is slow from inside the script ?


Hend Ben Saad

unread,
Oct 5, 2017, 12:25:13 AM10/5/17
to AMPL Modeling Language
Ok, thanks for your reply. I only face this problem when I increase the problem size. However, sometimes both ways behave the same, so there is no obvious trend or reason for this behavior.
Reply all
Reply to author
Forward
0 new messages