Decision Optimization

Decision Optimization

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

 View Only
  • 1.  Question about writing a boolean sum?

    Posted Sat June 12, 2010 12:16 AM

    Originally posted by: SystemAdmin


    In the part where I write the constraints, I am having some trouble making a summation.

    The problem is the following:

    Decision Variables:
    Y_ij = 1 if link (i,j) is used by an active path, 0 otherwise
    Xp1 = 1 if path 1 is used, 0 otherwise
    Xp2 = 1 if path 1 is used, 0 otherwise
    Xp3 = 1 if path 1 is used, 0 otherwise

    The constraint I am trying to write is that if any of the paths Xp1, Xp2 or Xp3 = 1, then Y_ij = 1. Otherwise (if none of the paths = 1), Y_ij = 0.

    I am trying to do this the following way:

    sum(p in Paths) X[p] <= Y_ij

    But if more than 1 path is used, then it gives me trouble because it makes it as:

    Xp1 + Xp2 + Xp3 <= Y_ij

    1 + 1 + 0 <= 1
    2 <= 1
    Error

    Is there any way to make a binary sum, boolean sum, or XOR or something to make it so that if I have:

    1 + 1 + 1 <= 1
    1 <= 1

    Thanks very much for your help!

    Tomas.
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: Question about writing a boolean sum?

    Posted Sun June 13, 2010 01:27 PM

    Originally posted by: UDOPS


    You use a technique called a "big M" constraint. You assign a coefficient to Y that is very large, thus when all X are zero, Y may be zero, but when any or all X are one, then the right hand side will satisfy with Y equal to one.

    You could either use a large number or possibly "infinity" in OPL?
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 3.  Re: Question about writing a boolean sum?

    Posted Mon June 14, 2010 03:13 AM

    Originally posted by: SystemAdmin


    Did you try using an implication:
    (sum(p in Paths) X[p]>=0) => (Y_ij==1)

    Tschau, Frank
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 4.  Re: Question about writing a boolean sum?

    Posted Mon June 14, 2010 05:57 AM

    Originally posted by: SystemAdmin


    To me it looks like you are looking for something like
    forall(p in Paths) X[p] <= Y_ij
    <code>
    (*forall* instead of sum / if one the the x[p] is 1 y is 1 as well)

    Dependent on the objective, you might add
    Y_ij <= sum(p in Paths) X[p]
    <code>
    in order to force y to be 0 if all x are 0
    #DecisionOptimization
    #OPLusingCPLEXOptimizer