Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Equality constraint

    Posted 08/02/08 02:58 AM

    Originally posted by: SystemAdmin


    [ArushGadkar said:]

    Hello ,
    I want to impose the  constraint :
    I have a matrix say X[10][4] which is a integer variable matrix.

    for all  i = 1 to 10 if

    i = sum over j ( x[i][j] )    ( j = 1 to 4 )
    then i want point[i] = 1;

    else

    if it is not equal then i want point [i] = 0 .

    Thanks for your help
    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Equality constraint

    Posted 08/02/08 05:10 AM

    Originally posted by: SystemAdmin


    [jgregory said:]

    "Not equals" is traditionally a difficult thing to model in MIP.  (It's even harder in continuous LP, as you need to think explicitly about the numerical tolerance versus zero.)  However I think yours might be a nice case for Indicator Constraints.

    The messaging system may have obscured your indexing of i, so I'll replace brackets with parentheses:
      let y(i) = sum over j (x(i)(j)) - i
      if y(i) = 0 then you want point(i) = 1, else point(i) = 0.

    The difficulty is that there are 3 cases, not 2: the sum could be over i, or under i, or exactly i.  So for each (i) let's define three binary variables, over(i) + point(i) + under(i) = 1.  With this constraint in your model, exactly one of these three cases will hold.  Your model will also need to include constraints to define y(i) as above.

    With these concepts in place, you can include the following indicator constraints, which use those binary variables:

      over(i) = 1 -> y(i) >= 1
      over(i) = 0 -> y(i) <= 0<br />  under(i) = 1 -> y(i) <= -1<br />  under(i) = 0 -> y(i) >= 0

    Note that the binary point(i) is not explicitly modeled, except as the difference of 1 - over(i) - under(i). In effect, it's the remainder after eliminating the two non-equality cases of your sum.

    Once the model is formulated with indicator constraints, CPLEX will handle finding the solution.

    If you are using OPL, then I think you can use constraints involving logic rather than explicitly modeling with the binaries.  I'm not enough of an OPL expert to confidently suggest how to go about it, though.
    #CPLEXOptimizers
    #DecisionOptimization