CPLEX One part of a tuple

24 views Asked by At

    tuple sa_pjt
    {
      int p;
      int j;
      int t;
      int SA_pjt;
    }
    {sa_pjt} SA_pjt =...;

For these tuples, I have the SA_pjt for all t=1, but the remaining t= 2..T will be calculated through the model. How can I modify the code to compensate for this? Do I need to change the .dat file at all?

It is resulting with an output of SA_pjt is undefined for all SA_pjt

1

There are 1 answers

0
Alex Fleischer On

Within OPL you can compute a new set out of an existing set.

.mod

tuple sa_pjt
    {
      int p;
      int j;
      int t;
      int SA_pjt;
    }
    
{sa_pjt} SA_pjt =...;

{sa_pjt} SA_pjt2 = {<a,b,t+k,d> | k in 1..10 , <a,b,t,d> in SA_pjt};

execute
{
  writeln( SA_pjt2 );
}

.dat

SA_pjt ={<1,1,1,1>};

gives

{<1 1 2 1> <1 1 3 1> <1 1 4 1> <1 1 5 1> <1 1 6 1>
     <1 1 7 1> <1 1 8 1> <1 1 9 1> <1 1 10 1>
     <1 1 11 1>}