Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  dexpr for a specific element

    Posted 11/06/13 09:57 AM

    Originally posted by: carope


    Hello, 

    i do have a problem to define dexpr for my OPL Model. I have a dynamic model with demand functions different for each period and quality. I defined a range "time"{1..2} and a set "quality" {good, bad}. 

    The usual way to declare a dexpr named demand is: 

    dexpr float demand [q in quality][t in time] = a[t]+b[t]+c[t];

    So the demand for all q/t combinations is the same "a[t]+b[t]+c[t]". 

    Unfortunately, I have different demand functions for each quality/time combination (or matrix-field). This means if q in quality is "good" and time is "1" (e.g. a[t]+b[t]+c[t]) it is a different function than for quality"bad" and time"1" (d[t]+e[t]+f[t]) and so on.  I need this dexpr for further use in a similar way.

    So my question is, is there any way to declare dexpr like 

    dexpr float demand [q in quality: q!="bad"][t in time:t==1] = a[t]+b[t]+c[t];

    or 

    dexpr float demand ["good"][1] = a[t]+b[t]+c[t]; ???

    OPL says it is not possible to use filter in generic arrays. Any ideas how to work around that without defining dexpr like demand_good_1 and so on? 

    Thanks for ideas in advance!


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: dexpr for a specific element

    Posted 11/06/13 10:33 AM

    Hi

     

    have you thought about using the ternary operator ?

    dexpr float demand [q in quality][t in time] = (t==1)?(expr1):(expr2);

    ?

     

    regards

     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 3.  Re: dexpr for a specific element

    Posted 11/07/13 04:15 AM

    Originally posted by: carope


    Hi, 

    i didn't know about that operator before, but this is exactly the right one.

    Thanks a lot!

     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer