Topic
  • 4 replies
  • Latest Post - ‏2016-05-30T05:30:44Z by DanielJunglas
Lessi
Lessi
6 Posts

Pinned topic CPLEX behavoir with and without callback function

‏2016-05-21T20:27:31Z |

 

I use the callback function to estimate how long a solution is found. Without the callback function, it took about 100 secs, and with the callback function, it took more than  5 minutes. What should I do to obtain the similar performance to the one without the callback function.

 

Another question, I set the optimal gap is 1%, so why the solver stopped with the gap  9.36%. There are other runs with other instances that the gaps were 0.0%

 


This is the callback function
IloNum bestSolnTime;

ILOINCUMBENTCALLBACK0(BestSolnCPUTimeCallback)
{
   bestSonTime = cplex.getTime();
}

 

Without callback function  

39298  6818     2568.0000    11     2650.0000     2402.0000   380691    9.36%
  39299  6818     2568.0000    10     2650.0000     2402.0000   380694    9.36%
Elapsed time = 98.84 sec. (51366.20 ticks, tree = 8.45 MB, solutions = 3)

Cover cuts applied:  2
Flow cuts applied:  4
Mixed integer rounding cuts applied:  3
Gomory fractional cuts applied:  1

Root node processing (before b&c):
  Real time             =    0.88 sec. (306.66 ticks)
Sequential b&c:
  Real time             =  100.13 sec. (52188.00 ticks)
                          ------------
Total (root+branch&cut) =  101.00 sec. (52494.65 ticks)
Objective value:2650

 

With callback function

  185848 152322     2506.0000     8     2650.0000     2241.0000  2050007   15.43%         z_1.638 D 185848 185847    449
 185849 152323     2506.0000     8     2650.0000     2241.0000  2050009   15.43%         z_1.642 D 185849 185848    450
Elapsed time = 321.80 sec. (142953.75 ticks, tree = 170.72 MB, solutions = 3)

.....

Thanks,

Lessi

 

Updated on 2016-05-21T21:51:51Z at 2016-05-21T21:51:51Z by Lessi
  • DanielJunglas
    DanielJunglas
    3505 Posts
    ACCEPTED ANSWER

    Re: CPLEX behavoir with and without callback function

    ‏2016-05-23T05:08:54Z  

    The incumbent callback is a control callback. Using a control callback will do two things:

    1. It will switch CPLEX to sequential mode by default (you can go back to multi-threaded mode by explicitly setting CPX_PARAM_THREADS),
    2. it will turn off dynamic search (this does not work with control callbacks).

    Depending on how accurate your measurements need to be, you can either use an info callback (which is not a control callback) or use CPX_PARAM_INTSOLFILEPREFIX and check the creation times of the created files.

    What is the CPLEX status when CPLEX stops with a gap that looks too big for the current parameter settings? Could it be that some other termination criterion was satisfied? Do your read the final gap from the log or do you get it from IloCplex::getMipRelativeGap()? The last gap reported in the log may not be the gap with which CPLEX stopped.

  • DanielJunglas
    DanielJunglas
    3505 Posts

    Re: CPLEX behavoir with and without callback function

    ‏2016-05-23T05:08:54Z  

    The incumbent callback is a control callback. Using a control callback will do two things:

    1. It will switch CPLEX to sequential mode by default (you can go back to multi-threaded mode by explicitly setting CPX_PARAM_THREADS),
    2. it will turn off dynamic search (this does not work with control callbacks).

    Depending on how accurate your measurements need to be, you can either use an info callback (which is not a control callback) or use CPX_PARAM_INTSOLFILEPREFIX and check the creation times of the created files.

    What is the CPLEX status when CPLEX stops with a gap that looks too big for the current parameter settings? Could it be that some other termination criterion was satisfied? Do your read the final gap from the log or do you get it from IloCplex::getMipRelativeGap()? The last gap reported in the log may not be the gap with which CPLEX stopped.

  • Lessi
    Lessi
    6 Posts

    Re: CPLEX behavoir with and without callback function

    ‏2016-05-23T13:28:29Z  

    The incumbent callback is a control callback. Using a control callback will do two things:

    1. It will switch CPLEX to sequential mode by default (you can go back to multi-threaded mode by explicitly setting CPX_PARAM_THREADS),
    2. it will turn off dynamic search (this does not work with control callbacks).

    Depending on how accurate your measurements need to be, you can either use an info callback (which is not a control callback) or use CPX_PARAM_INTSOLFILEPREFIX and check the creation times of the created files.

    What is the CPLEX status when CPLEX stops with a gap that looks too big for the current parameter settings? Could it be that some other termination criterion was satisfied? Do your read the final gap from the log or do you get it from IloCplex::getMipRelativeGap()? The last gap reported in the log may not be the gap with which CPLEX stopped.


    Thank you very much. I tried your suggestion and it works. getMipRelativeGap returns 0 as I expect.

     

  • EhsanN
    EhsanN
    47 Posts

    Re: CPLEX behavoir with and without callback function

    ‏2016-05-23T18:23:36Z  

    The incumbent callback is a control callback. Using a control callback will do two things:

    1. It will switch CPLEX to sequential mode by default (you can go back to multi-threaded mode by explicitly setting CPX_PARAM_THREADS),
    2. it will turn off dynamic search (this does not work with control callbacks).

    Depending on how accurate your measurements need to be, you can either use an info callback (which is not a control callback) or use CPX_PARAM_INTSOLFILEPREFIX and check the creation times of the created files.

    What is the CPLEX status when CPLEX stops with a gap that looks too big for the current parameter settings? Could it be that some other termination criterion was satisfied? Do your read the final gap from the log or do you get it from IloCplex::getMipRelativeGap()? The last gap reported in the log may not be the gap with which CPLEX stopped.

    Dear Daniel,

    Thanks for your answer. The CPX_PARAM_INTSOLFILEPREFIX parameter is interesting and useful for other purposes as well. However, I cannot figure out how to use the information callback to achieve the aforementioned goal. I checked the documentation and the most relevant information it could return is the objective value of the best integer solution found so far. Can you elaborate on that.

     

    Thanks,

    Ehsan

  • DanielJunglas
    DanielJunglas
    3505 Posts

    Re: CPLEX behavoir with and without callback function

    ‏2016-05-30T05:30:44Z  
    • EhsanN
    • ‏2016-05-23T18:23:36Z

    Dear Daniel,

    Thanks for your answer. The CPX_PARAM_INTSOLFILEPREFIX parameter is interesting and useful for other purposes as well. However, I cannot figure out how to use the information callback to achieve the aforementioned goal. I checked the documentation and the most relevant information it could return is the objective value of the best integer solution found so far. Can you elaborate on that.

     

    Thanks,

    Ehsan

    The idea is to remember the incumbent objective value reported in the last invocation of the callback. If that value changed then you know that the new solution was found between the two invocations of the callback.