The time taken by the most recent call to a solver can be measured in either of two ways:
- _solve_time = "CPU time" = the processor time used by the solver, not counting time taken by other processes that are also running
- _solve_elapsed_time = "wall-clock time" = the time you had to wait between invoking "solve" and getting a solution back
For single-threaded solves (running on one processor core), _solve_time tends to be more accurate. For multi-threaded solves (running on more than one core in parallel), _solve_elapsed_time should be used. BARON runs single-threaded by default but can be made to run multi-threaded; search for "thread" in the
BARON manual to learn more.
Also if you set outlev=1 in your
baron_options string then BARON will display the CPU and wall-clock times in the summary at the end of its listing. These times do not include the overhead of the AMPL-BARON interface, and so they will be a little less than the times reported in _solve_time and _solve_elapsed_time.
AMPL runs single-threaded, so for the time spent in AMPL you should use _ampl_time. This is the time since the AMPL session began, so to find the time spent in AMPL for generating a problem file and processing results, you need to measure _ampl_time before and after a solve, and record the difference. For example, you could define "param ampl_start_time;" and then proceed like this:
let ampl_start_time := _ampl_time;
solve;
display _ampl_time - ampl_start_time;In fact you can use "_ampl_time - ampl_start_time" in any AMPL statement where a number is appropriate.