Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  acessing array set

    Posted 04/24/14 11:14 AM

    Originally posted by: PhilDac


    Hello all, 

    i created a powerset by using information from this forum :

    {int} I = {0,1,2,3,4,5,6,7};

    range r=1.. ftoi(pow(2,card(I)));

    {int} s2 [k in r] = {i | i in I: ((k div (ftoi(pow(2,(ord(I,i))))) mod 2) == 1)};

    Now I am trying to formulate a constraint:

    forall(S in s2: card(S) > 1 && card(S) < (card(I)-1))
       sum(i in S, j in S) x[i][j] <= (card(S)-1) ;

    It doesnt work right now. Can anyone help me with this problem?

    What I am trying to do is take all the subsets S of the powerset s2 which are bigger than 2 and smaller than the cardinality of I -1 and then compare the sum of a variable x(i,j) where i and j should be each of the numbers in subsets s to the cardinality of S -1

     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: acessing array set

    Posted 04/27/14 02:41 PM

    Hi,

    could the following help ?

    {int} I = {0,1,2,3,4,5,6,7};

    range r=1.. ftoi(pow(2,card(I)));
    {int} s2 [k in r] = {i | i in I: ((k div (ftoi(pow(2,(ord(I,i))))) mod 2) == 1)};

    dvar int x[I,I];

    subject to
    {
    forall(k in r: card(s2[k]) > 1 && card(s2[k]) < (card(I)-1))
       sum(i in s2[k], j in s2[k]) x[i][j] <= (card(s2[k])-1) ;
     }   
     

    regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer