### How to get CPLEX time

Posted:

**Wed Nov 21, 2018 12:27 pm**Hi folks,

I am using GAMS with CPLEX as the solver. I want to get the exectution time of the solver (CPLEX time) as a parameter. I serached in the internet and found these two recommendations

Source: https://support.gams.com/gams:how_do_i_ ... me_in_gams
AND

Source: https://support.gams.com/gams:what_is_t ... ution_time
Here you see the results of these parameters for a certain run:

tcomp: 7.594

texec: 0

telapsed1: 7.60199998039752

telapsed2: 5.16199988778681

Unfortunately none of them is the exectution time of the solver. Here you see the output by CPLEX:

What I basically want is to get the first CPLEX time of 4.66 seconds (it is market in the code). How can I get this? I tried it with both the CPU time and the normal time in the CPLEX option file, but in every case I do not get the CPLEX time.

Does anyone have a clue? I would really appreciate every comment.

I am using GAMS with CPLEX as the solver. I want to get the exectution time of the solver (CPLEX time) as a parameter. I serached in the internet and found these two recommendations

Source: https://support.gams.com/gams:how_do_i_ ... me_in_gams

Code: Select all

```
Scalar tcomp, texec, telapsed1;
1tcomp = TimeComp;
texec = TimeExec;
telapsed1 = TimeElapsed;
Display tcomp, texec, telapsed;
```

Source: https://support.gams.com/gams:what_is_t ... ution_time

Code: Select all

```
scalar starttime; starttime = jnow; (at the beginning of the code)
scalar telapsed2; elapsed = (jnow - starttime)*24*3600; (at the end of the code)
```

tcomp: 7.594

texec: 0

telapsed1: 7.60199998039752

telapsed2: 5.16199988778681

Unfortunately none of them is the exectution time of the solver. Here you see the output by CPLEX:

Root node processing (before b&c):

Real time = 0.28 sec. (196.62 ticks)

Sequential b&c:

Real time = 4.38 sec. (4347.31 ticks)

------------

Total (root+branch&cut) = 4.66 sec. (4543.94 ticks)

MIP status(102): integer optimal, tolerance

Cplex Time: 4.66sec (det. 4543.95 ticks)

Fixing integer variables, and solving final LP...

CPXPARAM_Advance 2

CPXPARAM_ClockType 1

CPXPARAM_Simplex_Limits_Iterations 2000000000

CPXPARAM_TimeLimit 600

CPXPARAM_WorkDir "C:\Users\wi9632\bwSyncAndShare\Graduiertenkolleg\Code\GAMS\Residential Area\225o\"

CPXPARAM_Threads 1

CPXPARAM_Parallel 1

CPXPARAM_Tune_TimeLimit 120

CPXPARAM_MIP_Tolerances_AbsMIPGap 0

CPXPARAM_MIP_Tolerances_MIPGap 1.0000000000000001e-05

CPXPARAM_MIP_Display 4

CPXPARAM_Emphasis_MIP 4

Tried aggregator 1 time.

LP Presolve eliminated 2732 rows and 2604 columns.

Aggregator did 1476 substitutions.

Reduced LP has 132 rows, 258 columns, and 388 nonzeros.

Presolve time = 0.00 sec. (2.89 ticks)

Initializing dual steep norms . . .

Iteration log . . .

Iteration: 1 Dual objective = 102089.890948

Fixed MIP status(1): optimal

Cplex Time: 0.02sec (det. 4.75 ticks)

Solution satisfies tolerances.

MIP Solution: 22173.860889 (26508 iterations, 3238 nodes)

Final Solve: 22173.860889 (32 iterations)

Best possible: 22174.082398

Absolute gap: 0.221510

Relative gap: 0.000010

What I basically want is to get the first CPLEX time of 4.66 seconds (it is market in the code). How can I get this? I tried it with both the CPU time and the normal time in the CPLEX option file, but in every case I do not get the CPLEX time.

Does anyone have a clue? I would really appreciate every comment.