Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Sets Operation

    Posted 10/17/11 03:29 PM

    Originally posted by: guvenc


    Hello;

    I have problems about extracting the required information from an array of sets.
    I have such an array of set,
    {int} Pai in z = {...};
    //i=1 3,4,5
    //i=2 3,4
    ...

    What i want to do is that I must look at every i, in z to find and eleminate possible subsets of any set.
    For example
    //i=1 3,4,5
    //i=2 3,4 -->this must be eleminated because it is a subset of i=1

    or
    //i=10 12,13
    //i=z 12,15
    Any of those sets will not be eleminated.

    To do so i thought about a simple algorithm which checks every sets with each other to find out and eleminate subsets.However, in execute script, i couldnt write a code consisting "symdiff, diff,union" operations of sets.(opl does not accept)

    pseudocode may be
    for(a in z)
    for(b in z)
    if (card(Pa[a] difference P[b] == 0)//if the difference is empty set then Pa[a] C Pa[b]
    eleminate subset

    Thanks for your help...
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: Sets Operation

    Posted 10/17/11 06:22 PM

    Originally posted by: SystemAdmin


    Will the following help?
    range z=1..5;
    {int} P[z]=[{3,4,5},{4,5,6},{3,4},{7,8,9},{7,8}];
    {int} duplicateIndex;     
    execute INITIALIZE{
            for(a in z){
                for(b in z){
                    if(a!=b && Opl.card(P[a])<=Opl.card(P[b])){
                            if(Opl.card(Opl.operatorDIFF(P[a],P[b]))==0){
                                            writeln(P[a]+": adding corresponding index in P to duplicateIndex");
                                            duplicateIndex.add(a);
                                            break;
                            }                                      
                    }                       
                }                  
            }
            writeln("duplicateIndex:"+duplicateIndex);                      
    }
    

    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 3.  Re: Sets Operation

    Posted 10/19/11 12:27 PM

    Originally posted by: guvenc


    yes it helped a lot more than I expected :)

    thanks a lot
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 4.  Re: Sets Operation

    Posted 10/19/11 04:04 PM

    Originally posted by: SystemAdmin


    Glad to know. Thank you for keeping us in the loop.
    #DecisionOptimization
    #OPLusingCPLEXOptimizer