Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  ILOG CPLEX CONCERT TECHNOLOGY, non integer IloIntVar variables

    Posted 10/15/11 09:33 AM

    Originally posted by: KTAT_Leonardo_Lamorgese


    Hi,

    I am developing a code using Java and the CPLEX Concert Technology interface.

    My optimization model starts as a Linear Program, with only IloNumVar variables and a series of linear constraints.

    I then compute to find if the solution is acceptable(for the actual real life application),and if it is not I introduce some new bigM constraints and generate a new IloIntVar variable Y ( with 0 as lower bound and 1 as upperbound, which HAS to be INTEGER) adding it to my IloCplex object as an IloColumn.

    This works fine because when I print the .lp file the constraints and variables are added correctly.

    The problem is that once I compute this model with the new constraints and variables (cplex.solve() ), the cplex.getValue method, applied to the IloIntVar's Y does not return,as I would expect, ONLY 0 and 1's, for example:

    y_0 = 0.0
    y_1= 1.0
    y_2= 0.0
    ........
    .......

    but also returns decimal values very close to 0 and 1 like :
    y_0 = 0.0
    y_1= 0.9999999999967543
    y_2= 2.0235567788 E-9
    y_3=1.0

    and so on.
    Is this to be considered normal? because I need to be modeling, when I introduce these variables, only integer values (specifically only 0 or 1). Is there some sort of casting that I have to apply? Or have I missed out some step?
    Any help would be very appreciated,

    L
    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: ILOG CPLEX CONCERT TECHNOLOGY, non integer IloIntVar variables

    Posted 10/15/11 09:53 AM

    Originally posted by: KTAT_Leonardo_Lamorgese


    I ran into another thread explaining how to set the integrality gap to 0 and that solved my problem.

    Thanks anyway!
    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: ILOG CPLEX CONCERT TECHNOLOGY, non integer IloIntVar variables

    Posted 10/25/11 08:19 AM

    Originally posted by: SystemAdmin


    Setting the integrality gap to 0 is not necessarily the best thing you can do here. Some very small round-off errors are expected so that the numbers are fractional but very close to 0 or 1. You can just filter the result through Math.round() to get non-fractional values.
    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: ILOG CPLEX CONCERT TECHNOLOGY, non integer IloIntVar variables

    Posted 11/09/11 08:28 AM

    Originally posted by: KTAT_Leonardo_Lamorgese


    thank you Daniel
    #CPLEXOptimizers
    #DecisionOptimization