Originally posted by: SystemAdmin
Hi Tobias,
Thanks a lot for the hint. Actually, when I comment out the "cplex.solve()" line, the timer returns 0 (obviously).
On the other hand, I added the ClockType parameter, but it remains returning the same result...
However, now I'm trying to compare the time returned by CPLEX with a usual time function as "clock_t":
// model is already loaded in object 'cplex'
cplex.setParam(IloCplex::TiLim, TIME_LIMIT);
cplex.setParam(IloCplex::ClockType, 0);
// clock_t and clock reference:
http://www.cplusplus.com/reference/clibrary/ctime/clock/ clock_t clockStart = clock();
IloTimer timer(env);
timer.start();
cplex.solve();
timer.stop();
clock_t clockEnd = clock();
cout << "clock_t: " << (double)(clockEnd - clockStart) / CLOCKS_PER_SEC << " seconds" << endl;
cout << "IloTimer: " << timer.getTime() << " seconds (?)" << endl;
For a particular small problem, I get:
clock_t: 0.23832 seconds
IloTimer: 1300 seconds (?)
Is this normal?
I'll try to make a specific example using the sources that came with CPLEX 12.4, and I'll post the results...
Best regards
>
> This is indeed weird. Did you change the ClockType parameter?
> What happens if you comment out the cplex.solve() call, i.e., just have timer.start() and timer.stop() directly after each other?
>
> Tobias
#CPLEXOptimizers#DecisionOptimization