Re: Problem in set configuration

Hi,

you could use union.

.mod

range H = 1..2 ;

   range tasKRange = 1..5 ;

    

tuple predtask{
    int h;     // Líne num
    int i;      // task
    int tt;   // task time
    int taskP;   // Predecesor task
    int taskS;  // Sucesor task
}
{predtask} PredTask=…;

 


{int} conjuntoPredTot [h in H, i in tasKRange] = union (j in tasKRange)  { e.i | e in PredTask  : h == e.h  && j == e.taskS && j <= i } ;

execute
{
writeln(conjuntoPredTot);
}  

.dat

 

PredTask={//Line Task Time Pred  Suce
                       < 1     1     2      0      2    >,
                      <  1     2     1      1      3    >,
                      <  1     2     1      1      4    >,
                      <  1     3     3      2      5    >,
                      <  1     4     4      2      5    >,
                      <  1     5     2      3      0   >
                      <  1     5     2      4      0   >,
                      <  2     1     4      0      2    >,
                      <  2     2     4      1      0    >,
               };

gives

 

[[{} {1} {1 2} {1 2} {1 2 3 4}]          [{} {1} {1} {1} {1}]]

regards

Source: Re: Problem in set configuration