Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Handling discontinuous constraints

    Posted 09/29/11 11:56 AM

    Originally posted by: SystemAdmin


    Hi all,

    I'm working on a project in which I need to model that the outcome of a certain constraint must be 0 or 1. The constraint is of the form 'sum(a_i * b_i)'. I have no problem building the constraint and in order to enforce outcome being 0 or 1, I add

    cplex.addLe( constraint, 1 );

    Since my constraint is a IloLinearIntExpr, I'm sure that my outcome will be an int lower than 1, and constraints on a and b ensure the outcome will never be lower than 0. So I know the outcome is 0 or 1.

    But now I want to do the exact same thing, but enforce the outcome to be 0 or 2. I found the semiContVar constructor, which I use to in

    IloNumVar range = cplex.semiContVar( 2, 2, IloNumVarType.Int );
    cplex.addEq( constraint, range );

    My assumption was that 'range' now could be made either 0 or 2 (in my understanding semiContVar can be either 0, or a value between the given lower bound and upper bound, which I both set to 2) and because 'constraint' has to equal 'range', the outcome could also be either 0 or 2.

    But my program only returns 0 as a result, while I am sure that I use examples where, for some i, outcome 2 would be a better choise. Can someone help me out with what I'm doing wrong here? Or provide me with an easier solution to model my problem?

    Thanks in advance.
    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Handling discontinuous constraints

    Posted 09/29/11 11:19 PM

    Originally posted by: SystemAdmin


    Rather than a semicontinuous variable, you could introduce a binary variable rhs and set constraint = 2*rhs.

    I'm not sure that would resolve your problem, though. I don't see anything incorrect in what you did. Assuming you are correct that some of your test instances should have had constraint = 1, it's possible that you are bumping into a numerical precision issue. If you set a larger value for IloCplex.DoubleParam.EpRHS, do you start getting correct solutions with constraint = 1?

    Paul

    Mathematicians are like Frenchmen: whenever you say something to them, they translate it into their own language, and at once it is something entirely different. (Goethe)
    #CPLEXOptimizers
    #DecisionOptimization