I am solving a MILP model in C++ using Gurobi 7.5.2. More specifically, I am determining the CPU time of my C++ program via the following commands:
- clock_t start_time;
- double elapsed_time;
- start_time= clock();
- model.optimize();
- elapsed_time = (double) (clock() - start_time)/CLOCKS_PER_SEC;
When I compare the elapsed_time with the Gurobi runtime, the Gurobi runtime does show the actual duration (measured by a chronometer) but the calculated elapsed_time of C++ is way higher. Why is the elapsed_time not the same as the Gurobi runtime and the actual duration (measured by the chronometer)?