I need to measure the CPU time CPLEX takes to solve a model. I am confused that the values returned by RESOURCE USAGE and Cplex Time (in the .lst file) are different: For example, the current model has a cplex time of 0.88 seconds and a RESOURCE USAGE of 6.8.

In the GAMS Documentation it says that resUSD is the "Time the solver used to solve the model in CPU seconds ". I am using the CPLEX option “clocktype 1” which returns CPLEX time in CPU time and a single thread, Linux Mint system.

So my question is: How can I output the solver CPU time to a parameter? And why are these values so different?

The resUsd includes time to set up the model in Cplex and to report the solution to GAMS. For quadratic models it also included the time to extract the Q matrices from the non-linear instructions. Usually the time between resUsd and the time Cplex reports in the log is small and of not much practical relevance (you get time differences based on where the kernel loads your module anyway). If the difference is large (as in your case) one should look more closely were the time is spend. There is a model attribute called mymodel.etAlg which may be set by the GAMS solver to report the pure algorithm time. Sometimes that is not even so easy, because e.g. with MIP GAMS solves by default two problems: the MIP and the fixed MIP. Moreover, the GAMS/Cplex link does not set the etAlg attribute. If you can’t figure out where the difference comes from I suggest you contact support@gams.com with a reproducible example.

I ran a program which uses CPLEX Solver and it coudl not reach the optimum solution because the resource limit exceeded and no integer solution has been found.

I used the “reslim” command and made the resource limitation more extent.

But says that the time limit exceeded.
Here is the execution report:

**** SOLVER STATUS 3 Resource Interrupt
**** MODEL STATUS 14 No Solution Returned
**** OBJECTIVE VALUE NA

Space for names approximately 116.27 Mb
Use option ‘names no’ to turn use of names off
MIP status(108): time limit exceeded, no integer solution
Cplex Time: 1001.07sec (det. 199404.39 ticks)
Resource limit exceeded, no integer solution found.

No solution returned

I’ll be so thankful if you help me whit this problem.

to what value did you set the reslim? It seems that it was too low, your limit is 1000 and the resource usage is 1017. Can you post the last part of your code with the solver options?

yes, it was too low, so I set it to 5000.
it took a long long time (almost 4 hours) and it did not exported the answer to the excel file I’ve considered for it.

I’m looking for a way to reduce its run time, because as you saw on the blue line I’ve mentioned, the time limit exceeded too.