Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  LP relaxation with Cplex 12.1

    Posted 07/08/09 08:22 PM

    Originally posted by: SystemAdmin


    [biaggi said:]

    Hello,

    We've just replaced Cplex 9.1 for Cplex 12.1.

    With Cplex 9.1, one could use the function .solveRelaxed() to get the LP-relaxation of a MIP model.

    Unfortunately, such a function does not exist (at least, I did not find it...) in Cplex 12.1.

    Does someone know how to easily get the LP-relaxation of a MIP model ?

    All my variables are declared as IntVar... I hope there is an easier solution than re-declaring all my model with NumVar and LinearNumExpr...

    Thanks !
    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: LP relaxation with Cplex 12.1

    Posted 07/09/09 12:05 AM

    Originally posted by: SystemAdmin


    [prubin said:]

    I don't have 12 yet, so this answer applies to 11 (and probably to 12).  There are two approaches I can think of.  One is to add IloConversion instances for each integer variable or variable array, then delete them when you are ready to "unrelax" the problem.  The other (which I confess I've never tried) is easier (if it works):  set the integer tolerance parameter (EpInt) to 0.5 and solve it as a MIP.  The solution to the root relaxation should look sufficiently integer to CPLEX, and so there should be no branching.

    /Paul
    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: LP relaxation with Cplex 12.1

    Posted 07/09/09 12:44 PM

    Originally posted by: SystemAdmin


    [biaggi said:]

    Thank you Paul !

    Good ideas ! The second one looks really pretty. I tried it and it works ! but it seems to be not really clean... I may try to look if it is as faster than solving a real LP-model. I fear that too many useless preprocessing stages are able because of the declared nature (MIP) of the problem.

    I'm going to convert all my variables, even if it is tiresome to do it, I think it is the best way to do.

    I just wonder why Ilog has not kept the solveRelaxed() function. I don't think it is hard for them to do (they use it for the root relaxation of a MIP...) and I don't think I'm the only one to compare the LP-relaxation of a problem with an heuristic or optimal solution I found with any method...

    Olivier
    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: LP relaxation with Cplex 12.1

    Posted 07/09/09 01:11 PM

    Originally posted by: SystemAdmin


    [biaggi said:]

    I tried to do a generic method for any MIP but I failed... I don't think we can easily access (iterator or anything else...) integer variables of a MIP...

    I' like to get something like :


    For each integer variable x of the model ...
    cplex.add(cplex.conversion(x, IloNumVarType.Float));


    #CPLEXOptimizers
    #DecisionOptimization


  • 5.  Re: LP relaxation with Cplex 12.1

    Posted 07/09/09 07:16 PM

    Originally posted by: SystemAdmin


    [prubin said:]

    You can do it with an iterator, but it's a bit tricky -- each time you bump the iterator, you need to check the class of the object it picked up, and I don't think you can add any conversions until after you've iterated through the entire model (changing the model invalidates the iterator).  However, there's a simple solution: store all your integer variables in an array (or list, or something), then just iterate over that array/list when you want to add conversions.

    /Paul
    #CPLEXOptimizers
    #DecisionOptimization


  • 6.  Re: LP relaxation with Cplex 12.1

    Posted 07/09/09 07:52 PM

    Originally posted by: SystemAdmin


    [biaggi said:]

    Yes I've already thought for that solution but I wanted to code this function in a superclass in which I have many usefull functions managing any MIP or LP model.

    In such a super class, I don't have access to variables (I don't even know what they will be), I only manage an object model. One option would be to declare a list of integer variables I could fill in in any sub classes...

    Anyway, thank you very much Paul, you've been a great help !

    I only hope some programmers of IBM will see my post because I'm sure this could be really usefull for many users to get such a solveRelaxed() function...
    #CPLEXOptimizers
    #DecisionOptimization


  • 7.  Re: LP relaxation with Cplex 12.1

    Posted 07/09/09 09:01 PM

    Originally posted by: SystemAdmin


    [prubin said:]

    Well, running an iterator over the model (in the superclass) should work if done correctly (and carefully).  I used an iterator once before, although I've forgotten the details.  Just keep in mind that you have to queue up the integer variables it finds and postpone adding the conversions until after you're done iterating over the model object.

    /Paul

    #CPLEXOptimizers
    #DecisionOptimization


  • 8.  Re: LP relaxation with Cplex 12.1

    Posted 07/10/09 01:56 AM

    Originally posted by: SystemAdmin


    [Sylvain said:]

    [quote author=prubin link=topic=1252.msg3542#msg3542 date=1247079879]
    I don't have 12 yet, so this answer applies to 11 (and probably to 12).  There are two approaches I can think of.  One is to add IloConversion instances for each integer variable or variable array, then delete them when you are ready to "unrelax" the problem.  The other (which I confess I've never tried) is easier (if it works):  set the integer tolerance parameter (EpInt) to 0.5 and solve it as a MIP.  The solution to the root relaxation should look sufficiently integer to CPLEX, and so there should be no branching.

    /Paul


    Just a follow up here to mention that in the first case (integer variables considered as continuous), a true LP relaxation is solved.

    However, in the second case, a tighter relaxation is obtained.
    Indeed, keeping the information on integrality of some variables might allow the MIP presolve to fix some variable or tigthen the bounds of some other variables, etc... Also if cut generation is kept active, new cuts (depending on the integrality information) will probably be added to the root node. All that will allow you to get a tighter (thus better) relaxation of your MIP.

    This last method answers one of my previous question on this forum.
    Thanks Paul.
    #CPLEXOptimizers
    #DecisionOptimization