Hi AMPL teams,
I am using visual studio community 2022 with API of AMPL for C++ to solve large instances of MIP problems. when calculating the solution time of a large problem, I do it with the c++ chrono commands calculating only the “solve” line (time cpp). and when comparing with the AMPL solver time commands. I find that the closest time to the cpp is the “_ampl_elapsed_time”.
- Does this last time represent the calculation of the whole AMPL process, from reading, to solving?
- Why does the “_total_solve_elapsed_time” differ so much from the real time?
I attach a sample of the time calculation in c++, and a .mod and .dat of a large worked problem
Times:
_ampl_elapsed_time = 4.953
_ampl_system_time = 0.203125
_ampl_user_time = 4.67188
_ampl_time = 4.875
_shell_elapsed_time = 0
_shell_system_time = 0
_shell_user_time = 0
_shell_time = 0
_solve_elapsed_time = 0.156
_solve_system_time = 0.15625
_solve_user_time = 0.53125
_solve_time = 0.6875
_total_shell_elapsed_time = 0
_total_shell_system_time = 0
_total_shell_user_time = 0
_total_shell_time = 0
_total_solve_elapsed_time = 0.156
_total_solve_system_time = 0.15625
_total_solve_user_time = 0.53125
_total_solve_time = 0.6875
time cpp: 5.101 s.
c++ chrono time:
auto tiniR5 = chrono::high_resolution_clock::now(); //inicicializo el tiempo
ampl.getOutput(“solve;”);
auto tfinR5 = chrono::high_resolution_clock::now(); //inicicializo el tiempo
double durationauxR5 = chrono::duration_castchrono::milliseconds (tfinR5 - tiniR5).count() / double(1000);
cout << durationauxR5 << " ";
Many thanks in advance for your help.
Modex.mod (23 KB)
eje.run (774 Bytes)
date.dat (33.5 KB)