Decision Optimization

Decision Optimization

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


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

Assert that set contains another set

  • 1.  Assert that set contains another set

    Posted 01/04/11 07:34 AM

    Originally posted by: DanielFelixFerber


    Hi,

    I want to employ the 'assert' construct assure that C contains all elements of A and of B.
    However, I found no 'contains' operator in the documentation.
    I workaround I found was:
    assert {
       card(A symdiff (A inter C)) == 0;
       card(B symdiff (A inter C)) == 0;
    }
    


    Could this be done with less words? I think it is too verbose to read 'card/symdiff/inter' as 'contains'.

    Best regards,
    Daniel Felix Ferber
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: Assert that set contains another set

    Posted 01/04/11 10:15 AM
    Hi,

    first, you wrote

    card(B symdiff (A inter C)) == 0;
    


    but did not you mean

    card(B symdiff (B inter C)) == 0;
    


    ?

    second, could

    assert forall(x in A union B) x in C;
    


    be what you are looking for?

    Regards

    Alex
    #DecisionOptimization
    #OPLusingCPLEXOptimizer