Inquiry Regarding Discrepancy in Solve Time Metrics

50 views
Skip to first unread message

dmo...@gmail.com

unread,
Apr 5, 2024, 11:47:25 PMApr 5
to AMPL Modeling Language

Dear AMPL Community,

I hope this email finds you well. I am reaching out to seek clarification regarding some discrepancies I encountered while working with solve time metrics in AMPL.

In my model, I have been monitoring three time metrics: _solve_elapsed_time, _ampl_elapsed_time, and _total_solve_elapsed_time. From my understanding, _solve_elapsed_time represents the solving time, _ampl_elapsed_time represents the time taken for loading into RAM, and _total_solve_elapsed_time is the sum of the two aforementioned times.

However, when I utilized these metrics, I obtained the following values: 317.406, 10.953, and 317.406 respectively. It's evident that the sum does not align with expectations.

Could you please provide some insight or clarification on why this inconsistency might occur? Any guidance or assistance you could offer would be greatly appreciated.

Thank you very much for your time and assistance.

Best regards,

AMPL Google Group

unread,
Apr 6, 2024, 5:04:06 PMApr 6
to AMPL Modeling Language
Those times are determined as follows:
  • _ampl_elapsed_time is the elapsed time in the current AMPL session, not including time that AMPL was paused waiting for solver processes to finish.
  • _solve_elapsed_time is the elapsed time in the most recent solver process of the current AMPL session.
  • _total_solve_elapsed_time is the total elapsed time in all solver processes since the beginning of the current AMPL session.
Thus in particular, if there has been only one solve in the current AMPL session, _solve_elapsed_time and _total_solve_elapsed_time are equal. (The "current AMPL session" begins with the last "reset;", or with the start of the AMPL process if there has been no "reset;" yet;)


--
Robert Fourer

We're switching to a new, enhanced user forum.
Join it now at discuss.ampl.com.
{#HS:2562222635-123599#}

dmo...@gmail.com

unread,
Apr 6, 2024, 7:32:43 PMApr 6
to AMPL Modeling Language
Thank you, but with this information, is there a variable that stores the time for loading the model into RAM?

Regards,

AMPL Google Group

unread,
Apr 8, 2024, 6:47:54 AMApr 8
to AMPL Modeling Language
AMPL only has builtin params for overall measures of solve time and AMPL time. However, some solvers have an option to provide a listing that gives more detailed times, such as the time to read in the AMPL problem file. If you're interested in more details about that, let us know which solver(s) you are using.


--
Robert Fourer

We're switching to a new, enhanced user forum.
Join it now at discuss.ampl.com.
{#HS:2562222635-123599#}
On Sat, Apr 6, 2024 at 11:32 PM UTC, AMPL Modeling Language <am...@googlegroups.com> wrote:
Thank you, but with this information, is there a variable that stores the time for loading the model into RAM?

On Sat, Apr 6, 2024 at 9:03 PM UTC, AMPL Google Group <am...@googlegroups.com> wrote:
Those times are determined as follows:
  • _ampl_elapsed_time is the elapsed time in the current AMPL session, not including time that AMPL was paused waiting for solver processes to finish.
  • _solve_elapsed_time is the elapsed time in the most recent solver process of the current AMPL session.
  • _total_solve_elapsed_time is the total elapsed time in all solver processes since the beginning of the current AMPL session.
Thus in particular, if there has been only one solve in the current AMPL session, _solve_elapsed_time and _total_solve_elapsed_time are equal. (The "current AMPL session" begins with the last "reset;", or with the start of the AMPL process if there has been no "reset;" yet;)


--
Robert Fourer

We're switching to a new, enhanced user forum.
Join it now at discuss.ampl.com.

dmo...@gmail.com

unread,
Apr 8, 2024, 10:54:55 AMApr 8
to AMPL Modeling Language
Sure, I usually use Cplex and Gurobi for solving these linear models.

AMPL Google Group

unread,
Apr 10, 2024, 11:37:34 AMApr 10
to AMPL Modeling Language
If you add timing=1 to your cplex_options or gurobi_options string*, you will get a listing of timings like this:

ampl: solve;
Gurobi 11.0.1:   tech:timing = 1

NL model read time = 0.017579s
NL model conversion time = 0.005686s
Setup time = 0.026512s
Solution time = 0.116632s
Output time = 0.004045s

Gurobi 11.0.1: optimal solution; objective 235625
186 simplex iterations
12 branching nodes

NL model read time is for loading the optimization problem into the AMPL-Gurobi interface, NL model conversion time is for transforming to the formulation required by Gurobi, and setup time is for those plus loading the optimization problem into the Gurobi solver. These timings are not returned to AMPL, however, so you have to extract them from the listing.

Our most recent builds of CPLEX** and Gurobi also recognize reporttimes=1 in the cplex_options or gurobi_options string. After solving with this option, the total setup time and total solve time are displayed in the listing, and are also returned in the AMPL expressions ???.time_setup and ???.time_solver, where ??? is replaced by the name of your objective function.

* Defined by, for example,
option gurobi_options 'timing=1 ...';
where ... is replaced by any other options you may be using.

** Currently, use "option solver cplexmp;" to get the CPLEX version that has all the new features.


--
Robert Fourer

We're switching to a new, enhanced user forum.
Join it now at discuss.ampl.com.
{#HS:2562222635-123599#}
On Mon, Apr 8, 2024 at 2:55 PM UTC, AMPL Modeling Language <am...@googlegroups.com> wrote:
Sure, I usually use Cplex and Gurobi for solving these linear models.

On Mon, Apr 8, 2024 at 10:47 AM UTC, AMPL Google Group <am...@googlegroups.com> wrote:
AMPL only has builtin params for overall measures of solve time and AMPL time. However, some solvers have an option to provide a listing that gives more detailed times, such as the time to read in the AMPL problem file. If you're interested in more details about that, let us know which solver(s) you are using.


--
Robert Fourer

We're switching to a new, enhanced user forum.
Join it now at discuss.ampl.com.

dmo...@gmail.com

unread,
Apr 17, 2024, 12:32:30 PMApr 17
to AMPL Modeling Language
Thank you, it was what I was looking for.
Reply all
Reply to author
Forward
0 new messages