Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Annoying Slice Behavior

    Posted 05/27/10 02:14 PM

    Originally posted by: UDOPS


    I am annoyed at the slicing behavior in OPL. Why does OPL allow slicing in the first line but not the next line?

    {int} s1={1,2};

    tuple blockformat {int block; int time;}
    tuple cellformat {int cell; int member;} //not actually different than "blockformat", could have reused "blockformat"
    {blockformat} Blocks={<1, 1>, <1, 2>, <1, 3>, <2, 1>, <2, 2>, <2, 3>, <3, 2>, <3, 4>};
    {cellformat} CellPairs={<1,6>, <1,7>, <3,8>, <3,10>};

    This one works:

    {blockformat} Intersection={<i,t>|<i,t> in Blocks, <i,m> in CellPairs};
    This one generates an error:
    {blockformat} altsection={<i,t>|<i,t> in Blocks, i in s1};
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: Annoying Slice Behavior

    Posted 05/28/10 02:24 AM

    Originally posted by: SystemAdmin


    Hi,

    Although I do not have an explanation why your code
    fragement fails, my guess is that
    {blockformat} altsection={<i,t>|<i,t> in Blocks : i in s1};
    

    will do the job (":" instead of ",").

    Hope this helps.
    Norbert
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 3.  Re: Annoying Slice Behavior

    Posted 05/28/10 02:26 AM

    Originally posted by: SystemAdmin


    Hi again,

    changing the order of the iterators to
    {blockformat} altsection2={<i,t>| i in s1, <i,t> in Blocks};
    

    might work as well.

    But an explanation is still open ...

    Regards
    Norbert
    #DecisionOptimization
    #OPLusingCPLEXOptimizer