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;)

Thank you, but with this information, is there a variable that stores the time for loading the model into RAM?

Regards,

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.

Sure, I usually use Cplex and Gurobi for solving these linear models.

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.

Thank you, it was what I was looking for.