Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
Expand all | Collapse all

[Problem] Several if-Then for one constraint

  • 1.  [Problem] Several if-Then for one constraint

    Posted 05/09/15 10:49 AM

    Originally posted by: TikiBlue


    Hello Guys!

    As seen in the attached files i want to implement a mathematical formulation as a constraint. (Note co.c1 = i and co.c2=j in the formulation)

    In this case the value of the difference between two sums has to depend on the index of one of the variables.

    If the index is the same as the one of the Starter Node "co.c1", the sum must result 1, if it is the same index as "co.c2" the sum must result -1, otherwise 0.

    The mathematical formulation is attached as well. 

     

    At the moment i have to split the constraint into three and include for every case a statement if the condition is not fullfilled (always >=0), which is not really defined by my original mathematical formulation.

    On the other hand it doesnt accept an If clause for the case that the index does not equal both "co.c1" AND "co.c2". 

    Does someone has a clue how to solve this problem and formulate it as a 

    {

    if (u==co.c1) then

    else if (u==co.c2) then

    else 

    }

    Regards

     

    for easy copy and paste:

    ct11:
    forall(co in cc)
    forall(u in Intermediate)
    (u == co.c1) ? sum(v in Node)z[co][<u,v>] - sum(v in Node)z[co][<v,u>]==1:sum(v in Node)z[co][<u,v>] - sum(v in Node)z[co][<v,u>]>=0;
     
    ct12:
    forall(co in cc)
    forall(u in Intermediate)
    (u == co.c2) ? sum(v in Node)z[co][<u,v>] - sum(v in Node)z[co][<v,u>]==-1:sum(v in Node)z[co][<u,v>] - sum(v in Node)z[co][<v,u>]>=0;
     
    ct13:
    forall(co in cc)
    forall(u in Intermediate)
    (u != co.c1 and co.c2) ? sum(v in Node)z[co][<u,v>] - sum(v in Node)z[co][<v,u>]==0:sum(v in Node)z[co][<u,v>] - sum(v in Node)z[co][<v,u>]>=0;

    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: [Problem] Several if-Then for one constraint

    Posted 05/09/15 03:18 PM

    Hi

    you should use slicing:

    for ct12

    forall(co in cc)
    forall(u in Intermediate:u==co.c2)

    regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer