Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  summation condition

    Posted 08/17/18 03:50 PM

    Originally posted by: Janisch


    Hello,

    I want to tie a condition to the sum. And that should only be summed if the end times of both stations are the same, the product instances differ and each overload is greater than zero. Unfortunately, an error appears on the says that I can not use intervall variables. how can I fix the mistake?

    definitions:

    • dvar interval station[1..N][s in 1..S][g in 1..G]
    • dexpr int overload [i in 1..N][s in 1..S][g in 1..G]
    • int binaerueberlast[1..N][s in 1..S][g in 1..G]

     

    dexpr int wieoftgleichzeitig[s in 1..S][g in 1..G]= sum(i in 1..N,f in 1..N: endOf(station[i][s][g])==endOf(station[f][s][g])&&i!=f&&overload[i][s][g]>0&&overload[f][s][g]>0)binaerueberlast[i][s][g];

     

    regards


    #DecisionOptimization
    #OPLusingCPOptimizer


  • 2.  Re: summation condition

    Posted 08/19/18 03:16 AM

    Hi

    the condition you use in the slicing should be bound

    but it is not!

    what you could try is to change

    sum(I in set : condition) I

    into 

    sum(I in set) (condition)*I

    regards


    #DecisionOptimization
    #OPLusingCPOptimizer


  • 3.  Re: summation condition

    Posted 08/19/18 07:12 AM

    Originally posted by: Janisch


    Thank you.
    But now another problem arises:

    "Decision variable (or expression)" station "not allowed"


    dexpr int wieoftgleichzeitig[s in 1..S][g in 1..G]= sum(i in 1..N,f in 1..N: (endOf(station[i][s][g])==endOf(station[f][s][g])&&i!=f&&overload[i][s][g]>0&&overload[f][s][g]>0))binaerueberlast[i][s][g];

     

    How can I fix this?

    regards


    #DecisionOptimization
    #OPLusingCPOptimizer


  • 4.  Re: summation condition

    Posted 08/21/18 04:08 AM

    Originally posted by: Petr Vilím


    Hello,

    what Alex meant is that decision variables cannot be used in the sum condition (they are not bound at the time the sum expression is created). If you want to exclude some operands from the sum depending on the values of decision variables then you have to modify the operand to be 0 when necessary.

    In your case only condition i != f does not depend on decision variables so it could be used as an argument to the sum. So your expression will start by:

    dexpr int wieoftgleichzeitig[s in 1..S][g in 1..G]= sum(i in 1..N,f in 1..N: i!=f) 

    All the remaining conditions must be moved into the sum operands. You can use boolean expressions as 0/1 expressions. And using multiplication the result will be 0 whenever the codition is false. So the rest of the expression:

    ((endOf(station[i][s][g])==endOf(station[f][s][g]) && overload[i][s][g]>0 && overload[f][s][g]>0) * binaerueberlast[i][s][g])

    Note that in general long expressions like this do not propagate very well though.

    Petr


    #DecisionOptimization
    #OPLusingCPOptimizer