Decision Optimization

Decision Optimization

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

 View Only
Expand all | Collapse all

OPL - Retrieving Root relaxation value in a MIP

  • 1.  OPL - Retrieving Root relaxation value in a MIP

    Posted Mon September 23, 2013 11:05 AM

    Originally posted by: gianessipaolo


    Hello everybody,

    I'm dealing with a MIP and I was wondering if OPL offers a way to know, at the end of the computation, what was the value of the LP relaxation at root node.

    I mean, I can surely look at the log, but I was looking for a way to retrieve it programmatically.

    I have already tried to apply an approach made up of:

    1. calling convertAllIntVars()
    2. calling solve()
    3. calling getObjValue()
    4. calling unconvertAllIntVars()
    5. calling solve() again

    and clearly it works; but the second call to solve() restarts the solving procedure from scratch - at least it seems so, since in the log of the second call to solve() you clearly find the "Root relaxation solution time" message.

    The problem is that I would like to impose an overall time limit T. Suppose T = 3600s, and also that root LP relaxation solution takes an important share -say, the half- of such a time limit.  If I follow the aforementioned approach and impose the 3600s limit on both the call to solve(), it is going to take me one and a half times T to get all the informations I'm looking for, whereas if there was a way to access time and value of LP relaxation of the root node after the MIP computation ends, it would cost only the time T of one run.

    Does anyone know if there's a way to retrieve such informations in OPL?

    Thank you in advance for your help,

    Best regards,

    Paolo Gianessi


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: OPL - Retrieving Root relaxation value in a MIP

    Posted Thu September 26, 2013 07:46 AM

    I think the following should work:

    main {
      thisOplModel.generate();
      // Solve only 1 node (the root node)
      cplex.nodelim = 1;
      cplex.solve();
      // Root node solved. The objective value of the LP relaxation
      // is now the best known dual bound.
      writeln("First solve: " + cplex.getBestObjValue());
      // Reset node limit.
      cplex.nodelim = 9223372036800000000;
      cplex.solve();
    }

    This first solves a single node (the root node). When the root node is complete it stops. At this point the best known dual bound is the objective function value of the root node relaxation (including cuts).

    After extracting this information it resets the node limit (so that there no longer is a node limit) and calls solve() again. CPLEX will continue the solve at the point at which the first solve stopped. In particular, it will not re-solve the root node.


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 3.  Re: OPL - Retrieving Root relaxation value in a MIP

    Posted Thu September 26, 2013 12:06 PM

    Originally posted by: gianessipaolo


    Hi Daniel,

    thank you for your answer, I will write  you whether the trick works or not as soon as I try it.

    Best regards,

    Paolo Gianessi 


    #DecisionOptimization
    #OPLusingCPLEXOptimizer