Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  subset syntax

    Posted 07/28/08 08:12 AM

    Originally posted by: SystemAdmin


    [UDOPS said:]

    The OPL documentation mentions the existence of a subset function, but I cannot find the syntax for it anywhere. Anyone know how to test the validity of a subset, say for example in an assert statement?
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: subset syntax

    Posted 07/28/08 07:27 PM

    Originally posted by: SystemAdmin


    [afleischer said:]

    Hi,

    there is no direct method in OPL 6.0 but there are many ways to check this.

    For example to check that set A is a subset of B

    you could write

    assert card(A inter B)==card(A)

    or

    assert forall(i in A) i in B




    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 3.  Re: subset syntax

    Posted 07/28/08 08:58 PM

    Originally posted by: SystemAdmin


    [UDOPS said:]

    Thanks. I like the latter method better, because the first method leaves some doubt in my mind about elements counts versus actual membership checks. Is there a way to test equivalence of sets? Could I have "assert {A inter B} == A" ?
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 4.  Re: subset syntax

    Posted 07/28/08 09:08 PM

    Originally posted by: SystemAdmin


    [afleischer said:]

    equivalence could be checked thru both subset

    assert forall(i in A) i in B
    assert forall(i in B) i in A

    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 5.  Re: subset syntax

    Posted 07/30/08 10:34 PM

    Originally posted by: SystemAdmin


    [UDOPS said:]

    OK, lets make this harder. Neither of these syntaxes work. Any suggestions?

    assert forall(r in TrainData) pathvalid: forall(i in minl(r.origin, r.destination)..maxl(r.origin, r.destination)) <i, c, t, n> in Profile;

    assert forall(r in TrainData) pathvalid: forall(i in minl(r.origin, r.destination)..maxl(r.origin, r.destination)) i in {<p.block> | p in Profile};


    //Profile is a 4 element tuple set.
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 6.  Re: subset syntax

    Posted 07/31/08 01:47 AM

    Originally posted by: SystemAdmin


    [afleischer said:]

    could

    assert forall(r in TrainData) pathvalid: forall(i in minl(r.origin, r.destination)..maxl(r.origin, r.destination))
    card({<i, c, t, n> | <i, c, t, n> in Profile})!=0;

    work better?

    Alex
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 7.  Re: subset syntax

    Posted 07/31/08 05:12 AM

    Originally posted by: SystemAdmin


    [UDOPS said:]

    Thank you, that worked.

    There seems to be a pattern here. I have to start considering aggregate functions more often.
    #DecisionOptimization
    #OPLusingCPLEXOptimizer