CPLEX time vs resUsd

Solver related questions
Post Reply
lisa_herb
User
User
Posts: 3
Joined: 6 years ago

CPLEX time vs resUsd

Post by lisa_herb »

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?

Thank you in advance for any help or suggestions!
User avatar
bussieck
Moderator
Moderator
Posts: 1033
Joined: 7 years ago

Re: CPLEX time vs resUsd

Post by bussieck »

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.

-Michael
lisa_herb
User
User
Posts: 3
Joined: 6 years ago

Re: CPLEX time vs resUsd

Post by lisa_herb »

Thank you very much for the reply, it helped a lot!

I am indeed running a quadratic model and have a large, dense Q matrix. Then I guess that the time is mainly spent on extracting the Q matrix.

The attribute .etAlg reports wall time, unfortunately I can not use it to report the algorithm time.
gnaeidj
User
User
Posts: 8
Joined: 7 years ago

Re: CPLEX time vs resUsd

Post by gnaeidj »

bussieck wrote: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.

-Michael
Dear Michael

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

RESOURCE USAGE, LIMIT 1011.979 1000.000
ITERATION COUNT, LIMIT 65957 2000000000

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.

Best Regards
Ghassem
lisa_herb
User
User
Posts: 3
Joined: 6 years ago

Re: CPLEX time vs resUsd

Post by lisa_herb »

Hey Ghassem,

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?

Mona
gnaeidj
User
User
Posts: 8
Joined: 7 years ago

Re: CPLEX time vs resUsd

Post by gnaeidj »

lisa_herb wrote:Hey Ghassem,

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?

Mona
Dear Mona

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.

Ghassem
Post Reply