# Why \_solve\_elapsed\_time is more than timelimit?

**URL:** <https://discuss.ampl.com/t/why-solve-elapsed-time-is-more-than-timelimit/129>\
**Category:** Support\
**Tags:** general, solvers\
**Created:** [November 10, 2022, 9:40pm UTC](https://discuss.ampl.com/t/why-solve-elapsed-time-is-more-than-timelimit/129 "2022-11-10T21:40:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bala](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.ampl.com/bala/32/59_2.png) [@bala](https://discuss.ampl.com/u/bala)\
**Post date:** [November 10, 2022, 9:40pm UTC](https://discuss.ampl.com/t/why-solve-elapsed-time-is-more-than-timelimit/129/1 "2022-11-10T21:40:20Z")

</div>

I have set the time limit to 30 seconds to solve my optimization problem but the AMPL \_solve\_elapsed\_time is coming as 45 seconds. Below are the AMPL options I used.

option auxfiles ‘cr’;  
option presolve 0;  
option solution\_precision 8;  
option solution\_round 6; # SOA: Adding to control solution precision  
option display\_precision 0;  
option display\_round 6;  
option gentimes 0;  
option log\_file ‘ampl\_log.txt’;  
option cplex\_options  
‘ordertype = 2’  
‘mipdisplay = 5’  
‘scale = 1’  
‘objdifference=0.0’  
'mipgap = 0.0000010 ’  
'timelimit = 30 ’  
‘comptol = .000000001000’  
‘rinsheur = 100’  
‘mipstartvalue = 1’  
‘memoryemphasis = 1’  
‘workfilelim = 1000’  
‘prestats = 1’  
‘iisfind 1’  
‘integrality = .00000000100’  
‘threads = 1’  
‘bestnode’

May I know why \_solve\_elapsed\_time is more than the time-limit? your response will be a great help to me.

---

<div class="post-metadata">

**Author:** ![fdabrandao](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.ampl.com/fdabrandao/32/63_2.png) [@fdabrandao](https://discuss.ampl.com/u/fdabrandao)\
**Post date:** [November 28, 2022, 5:48pm UTC](https://discuss.ampl.com/t/why-solve-elapsed-time-is-more-than-timelimit/129/2 "2022-11-28T17:48:21Z")

</div>

The _mipbasis_ setting works as follows: By default, after the CPLEX run is finished, all of the integer variables are fixed at the values that were returned, and CPLEX is called again to solve the resulting continuous LP; then basis statuses from that LP are returned to AMPL along with the solution. Setting _mipbasis=0_ causes this “LP solve” to be skipped. Instead the solution returned by CPLEX is sent directly back to AMPL, without any basis statuses. Except in rare applications, the basis statuses are not used for anything, and turning off the LP solve does not impact the solution in any significant way.

The time for the LP solve is included in \_solve\_elapsed\_time, but not in the “Total (root+branch&cut)” time reported by the CPLEX log. Usually this only causes the \_solve\_elapsed\_time to be slightly larger, because the time for the LP solve is very small. For the problem you are solving, however, it appears that the LP solve requires a lot of computational effort. So when you set _mipbasis=0_ the reported \_solve\_elapsed\_time is reduced significantly.

**Note:** This had been answered by email by @AMPL and I am just copying the answer here.
