Different CPLEX threads influences final results?

Problems with syntax of GAMS
Post Reply
GabrielYin
User
User
Posts: 54
Joined: 9 months ago
Location: Dallas, TX, USA

Different CPLEX threads influences final results?

Post by GabrielYin » 2 months ago

Hi all,

I have tried to set different threads for CPLEX solver to facilitate my computation, but weirdly, different threads gave different final results. Based on my knowledge, setting threads will only influence the speed because it is for parallel computing, but will not have any impact on the execution results. I state my program as follows:

Each iteration runs a MIQCP problem (obtain UB) and a MILP problem (obtain LB). The maximum iteration limit is 10. I also set a convergence criterion (UB-LB)/UB<1e-2 at 16th iteration. The following are the three reports of results based on different thread settings.

First: option threads = 8;

Code: Select all

----    809 PARAMETER LB  

1  5965.400,    2 49104.258,    3 53720.551,    4 58302.189,    5 58786.475


----    809 PARAMETER UB  

1 589447.897,    2 589447.897,    3 444602.048,    4 134614.155
At iteration 5, it terminated with an error (UB=0) when calculating the convergence criterion (UB-LB)/UB<1e-2.
elapsed time: 2min42sec

Second: option threads = 4;

Code: Select all

----    809 PARAMETER LB  

1   5965.400,    2  50115.912,    3  53957.301,    4  56612.179,    5  58400.315
6  59126.019,    7  59962.922,    8  59261.724,    9  59705.817,    10 59691.876


----    809 PARAMETER UB  

1  589447.897,    2  589447.897,    3  418927.137,    4  418927.137
5  134227.995,    6  108560.247,    7  108560.247,    8  107887.845
9   60539.785,    10  60539.785
elapsed time:

Third: option threads = 1;

Code: Select all

----    809 PARAMETER LB  

1   5965.400,    2  52546.437,    3  55356.249,    4  59074.509,    5  58976.462
6  59126.019,    7  59323.676,    8  59126.019,    9  59705.414,    10 59261.724


----    809 PARAMETER UB  

1 589447.897,    2 589447.897,    3 461349.575,    4  61684.534,    5  61684.534
6  61684.534,    7  61684.534,    8  61684.534,    9  61684.534
elapsed time: 6min37sec

I did not use GUSS or other advanced tools, just regular coding. Any idea about the treads issue? Which one should I trust as the true results? Thanks in advance!

Gabriel

GabrielYin
User
User
Posts: 54
Joined: 9 months ago
Location: Dallas, TX, USA

Re: Different CPLEX threads influences final results?

Post by GabrielYin » 2 months ago

Sorry, for threads = 4 case, the elapsed time is 5min38sec.

Gabriel

User avatar
bussieck
Moderator
Moderator
Posts: 210
Joined: 2 years ago

Re: Different CPLEX threads influences final results?

Post by bussieck » 2 months ago

No, the threads selection may have an impact on your results. If you have different optimal solutions (or have positive optimality tolerances) you will have a different path through the algorithm if you change something (threads, OS, different bit-ness of the software (32/64bit), ...). Only if you do exactly the same twice in a row (with parallelMode set to deterministic) you will get the same path in the algorithm and hence the same solution.

-Michael

GabrielYin
User
User
Posts: 54
Joined: 9 months ago
Location: Dallas, TX, USA

Re: Different CPLEX threads influences final results?

Post by GabrielYin » 2 months ago

bussieck wrote:
2 months ago
No, the threads selection may have an impact on your results. If you have different optimal solutions (or have positive optimality tolerances) you will have a different path through the algorithm if you change something (threads, OS, different bit-ness of the software (32/64bit), ...). Only if you do exactly the same twice in a row (with parallelMode set to deterministic) you will get the same path in the algorithm and hence the same solution.

-Michael
Thank you for your reply!

Actually, all of the results obtained from different threads are reported as "optimal", and my problem is an semi-convex MIQCP problem so it should not have multiple optima. I even tried to change my solver from CPLEX to GUROBI, and found they got different results too! But they were very close anyway.

But you are right, the positive optimality tolerance would be different with respect to the threads setting. I also spotted the detailed flow of CPLEX in the solution report using multiple threads, and it told me they used different algorithms (like B&B and Penalty) to solve the problem if the thread is different.

One of my colleague said it would not be a problem since higher threads always report better optimality, which means I can just use the result from higher threads.

Cheers,
Gabriel

User avatar
bussieck
Moderator
Moderator
Posts: 210
Joined: 2 years ago

Re: Different CPLEX threads influences final results?

Post by bussieck » 2 months ago

Replace 'always' by 'often'. Different path through the algorithms means often different running times of the algorithms. If you take a bad path with double speed you might still be slower that a slow walker on a good path. If you want to read more about this google (or search this forum) for "performance variability", e.g.

- http://www.thequestforoptimality.com/pe ... -readings/
- Section 5 in MIPLIB 2010 paper http://mpc.zib.de/index.php/MPC/article/viewFile/56/28

-Michael

Post Reply