Decision Optimization

Decision Optimization

Delivers prescriptive analytics capabilities and decision intelligence to improve decision-making.

 View Only
  • 1.  Stop execution Branch-and-Bound MIP

    Posted Thu February 27, 2014 07:45 AM

    Originally posted by: Zele


    Hello, 
    I am solving a mixed integer programming problem with CPLEX interactive optimizer . My problem is that I want to stop the execution of Branch-and-Bound because previous heuristics (in zero node before branching begins) already give me a good solution. Do you now is there is any command, execution or even global functions to implement it with c++?
    I've been looking in the forum but I have not seen any solution. 
    I would appreciate if you could help me. 
    Thanks in advance 
    regards

    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Stop execution Branch-and-Bound MIP

    Posted Thu February 27, 2014 08:20 AM

    There are many ways to do this but I am unclear what exactly you want to do. Are you using Concert C++ to solve the model and want to interrupt the solve being run with an instance of IloCplex? Or do you start the interactive optimizer from a C++ program via system() or execve()/CreateProcess()?


    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: Stop execution Branch-and-Bound MIP

    Posted Thu February 27, 2014 10:00 AM

    Originally posted by: Zele


    I'm actually doing two parallel ways: 
    -First, using a terminal with interactive optimizer. I do this to test a problem in .mps format quickly. 
    -Second, I am creating a program with c, making calls to CPLEX, with features like "CPXreadcopyprob (), CPXmipopt()", etc.. I will use this form to let CPLEX solve a battery problem and not have to write by hand one by one in the interactive optimizer.

    The fact is that we are seeing in most of the problems that only using heuristics algorithms previous to Branch-and-Bound, according to the log, the solution is good enough, without waiting for all the time it takes for the branching later, which improves until the optimal solution, but in a rather longer time. So, we would like to stop the execution and CPLEX will return the solution at that time.

    I hope now it is clearer now.

    Thanks.

     


    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: Stop execution Branch-and-Bound MIP

    Posted Thu February 27, 2014 10:33 AM

    Yep, much clearer.

    There are several ways to achieve what you want:

    1. To stop the optimization at an arbitrary point, just hit Ctrl-C in the interactive optimizer or use CPXsetterminate() in your C program.
    2. If you always want to stop after the root node then set CPX_PARAM_NODELIM to 1. Note that when you do that, CPXmipopt() returns and if you are not satisfied with the solution then you can extend CPX_PARAM_NODELIM and call CPXmipopt() again. CPLEX will then continue the solve where it stopped.
    3. You may want to consider using CPX_PARAM_EPGAP or CPX_PARAM_EPAGAP. With these parameters you can instruct CPLEX to stop once it has reached a solution of a specified quality.
    4. In a C program you can use a callback (see for example here). Such a callback allows you to monitor progress of the solution process and terminate it whenever you decide to do so. This approach is used when your stopping criterion is too complex to be expressed by parameter settings.

    #CPLEXOptimizers
    #DecisionOptimization


  • 5.  Re: Stop execution Branch-and-Bound MIP

    Posted Thu February 27, 2014 11:51 AM

    Originally posted by: Zele


    Thanks for such a complete response,

    Then, in case I want to use some  of the parameters you presented in the comment above (CPX_PARAM_NODELIMCPX_PARAM_EPGAP or CPX_PARAM_EPAGAP), I suppose that I have to use CPXsetintparam, right?

    Regards

     


    #CPLEXOptimizers
    #DecisionOptimization


  • 6.  Re: Stop execution Branch-and-Bound MIP

    Posted Thu February 27, 2014 01:31 PM

    CPX_PARAM_NODE_LIM is set via CPXsetintparam() (or CPXsetlongparam()), the other two must be set by CPXsetdblparam(). You will get an error code if you use the wrong function. So just check the return value of CPXset*param() and you will see if you picked the right one :-)


    #CPLEXOptimizers
    #DecisionOptimization


  • 7.  Re: Stop execution Branch-and-Bound MIP

    Posted Thu February 27, 2014 01:35 PM

    Originally posted by: Zele


    ok, 

    thank you very much! you have been very helpful!

     


    #CPLEXOptimizers
    #DecisionOptimization