how to declare a subset from a set in cplex?

454 Views Asked by At

i am a new in Cplex , so i want to know how to declare a subset included in a set . i have a S_i : the set of flight i's Feasible start time tuples. and i declare this et like this :

        int F=...;
        range flights = 1..F; // set of flights
        {int} S[flights]=...; //Set of feasible start time 

and i have a subset S_i (w) ⊆ S_i denote the subset of feasible start time tuples , if w working stations assigned are assigned to flight i.

i declare :

int W=...;
range workingstations=1..W;

but i couldn' t know how to declare the subset, Please help!!!

1

There are 1 best solutions below

4
On
{string} flights={"A1","A2"};
{string} workingstations={"W1","W2"};

tuple tup {


int sd ; //start time of bagage handling
  int sh ; // start time of storage depletion

}
{tup} ttt = {};
tuple Starttime {
  int elt; //earlist_starttime
  int lst; //lastest_starttime
  int  ed; //end time of baggage handling
  tup tt;
  
  }
  
  tup myt1=<3,4>;
  tup myt2=<4,5>;
  
  
  
Starttime S[flights]=[<1,2,3,myt1>,<1,2,9,myt2>];
Starttime S2[flights][workingstations]=[[<1,2,3,myt1>,<1,2,9,myt2>],[<1,2,3,myt1>,<1,2,9,myt2>]];

execute PREPROCESSING {
//initialize tup
  var t1 = ttt.add(1,11);
  var t2 = ttt.add(2,22);
  
  writeln(ttt);
  writeln(S);
  writeln(S2);
  }
//variables
dvar int+ sd ;
dvar int+ sh;

subject to
{
  
}

works