Decision Optimization

Decision Optimization

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

 View Only
  • 1.  Best way to avoid round off error

    Posted Tue June 25, 2013 03:03 PM

    Originally posted by: AmyliaZ


    I'm solving integer(binary) problems in a cutting plane fashion. I started by defining the problem as the linear relaxation (original constraint has integer coefficients and right hand side), after some iterations of adding cuts (with cplex.addLe() ), I used cplex.conversion to force variables (x) back to integers just to see the integer results. 

    - Since x was defined with 0 and 1 as lower and upper bounds, I used cplex.add(cplex.conversion(x, IloNumVarType.Int)) to make it integer array. However, I'm not getting the correct integer solution (the difference was 0.002%, but there were value/solution differences which bothers me), unless I define the original right hand side 1e-5 higher than its true value. But this makes the optimal value (and one of x_ j's ) about .000001 higher than the true integer value. 

    - If I convert x values to IloNumVarType.Bool, it gives me the true optimal value/solution, but with significantly longer run time.

    I guess my question in general is, what is the best way of defining the integer problem and variables if I need the relaxed version to generate cuts and the integer version to get the integer solution. 

    I'm using Concert, Java.

    Thank you.


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Best way to avoid round off error

    Posted Wed June 26, 2013 04:53 PM

     

    Just to be clear, after you adds the conversions you call solve again, right?

    You can reduce the integrity tolerance (EpInt), which will likely reduce the fuzz in the binary variables (but may increase solution time, and may cause difficulties if your model has numerical stability issues). I don't know why you get different behaviors between IloIntVar and IloBoolVar.

    Paul

     

     

     


    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: Best way to avoid round off error

    Posted Sun June 30, 2013 04:54 PM

    Originally posted by: EdKlotz


    If the differences in objective values are very small, CPLEX's default MIP gap setting of .0001 may be involved here.This tells CPLEX to stop as soon as it finds a solution within 0.01% of optimality.    So, if you want to obtain the exact same objective out to many digits of precision, you should probably set the relative MIP gap to 0 instead of using the default.   This still doesn't guarantee CPLEX will find the same optimal solution with or without your cuts.   After all, your model may have multiple integer optimal solutions, and I don't know of any way to guarantee that to runs of the same model that take different paths will find the same optimal solution if several are available.  

    That said, if you are primarily interested in just running tests to make sure your cuts are correct, here are a few  tests to try.

     

    1. Assuming you are generating globally valid cuts rather than cuts that can remove some (but not all) optimal solutions (e.g. symmetry breaking constraints), then reversing the direction of each individual cut you add should result in an integer feasible model.   This is easier to test with all integral data; if your cut is ax <= b with all integral data, then adding ax >= b+1 should make your model infeasible.   If it doesn't, your cut has removed the integer feasible solution that the run with the reversed cut finds.   This is a bit harder with non integral cuts, but in many cases you can set a suitable tolerance given the magnitude of your model and cut coefficients to reverse the cut.
    2. Use CPLEX's solution pool/populate feature to tell CPLEX to enumerate all optimal solutions.   You should probably make use of the integrality tolerance Paul mentioned in this case, setting it to 0.   You should see the same set of optimal solutions with or without your cuts.   However, not that on some models enumerating all optimal solutions can consume a lot of time.    So, the effectiveness of this approach will depend on your model.   But, this might help at least on some small test cases.
    3. Use IloCplex.exportModel() to generate SAV files of the models before and after cuts, and after converting continuous variables to integers.   Read the SAV files into interactive CPLEX and examine the problem statistics using the 'display problem stats' command.    Make sure that everything looks correct, i.e. you don't see fewer integer variables than expected, and the cut coefficients look right.   You can also then write an LP file and examine the individual cuts in text format to make sure they look correct.

    Ed

     

     


    #CPLEXOptimizers
    #DecisionOptimization