IC4NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
2 replies Latest Post - ‏2013-09-26T16:06:27Z by gianessipaolo
4 Posts

Pinned topic OPL - Retrieving Root relaxation value in a MIP

‏2013-09-23T15:05:29Z |

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

Updated on 2013-09-23T15:30:57Z at 2013-09-23T15:30:57Z by gianessipaolo
  • DanielJunglas
    39 Posts

    Re: OPL - Retrieving Root relaxation value in a MIP

    ‏2013-09-26T11:46:09Z  in response to gianessipaolo

    I think the following should work:

    main {
      // Solve only 1 node (the root node)
      cplex.nodelim = 1;
      // 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;

    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.

    • gianessipaolo
      4 Posts

      Re: OPL - Retrieving Root relaxation value in a MIP

      ‏2013-09-26T16:06:27Z  in response to DanielJunglas

      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