Originally posted by: ClemsonTiger
Hi
I am having trouble modelling a sequencing problem, I don't know if recursion is the reason.
Problem statement:
a number of product to be placed on a moving production line that runs through different stations. Each station has a worker that perform the jobs needed for each product. Job duration are different for each product/station. There is a cycle time (c )that is defined by the speed of the line and there is a length (l) for stations that is bigger than the cycle time. If a job took a worker the full length of the station he will not be able to start working on the next product in the sequence until (l-c) . Each worker position for each period/station is denoted by variable (s). If a job will take an amount over the length of the station another worker is called to take care of that job and the original worker move to work on the next product in the sequence. A flag variable indicates if an additional worker is needed (u), The objective is to find a sequence that will minimize the need for additional workers.
here is my small model.
using CP;
int nbrProds=...;
range Products=1..nbrProds;
int nbrPeriods=nbrProds;
range Periods=1..nbrPeriods;
range PeriodsP=1..nbrPeriods+1;
int nbrStations=...;
range Stations=1..nbrStations;
int c=...;
int l=...;
int duration[Products][Stations]=...;
dvar int seq[Periods] in Products;
dvar int s[Stations][PeriodsP] in 0..c;
dvar int f[Stations][PeriodsP] in 0..2*c;
dvar boolean u[k in Stations][t in Periods];
minimize sum(k in Stations, t in Periods) u[k][t];
subject to {
forall (k in Stations)
s[k][1]==0;
forall (k in Stations)
forall (t in Periods) f[k][t]==s[k][t]+duration[seq[t]][k];
forall (k in Stations)
forall (t in PeriodsP:t<=nbrPeriods)
if (f[k][t]>l){
s[k][t+1]==maxl(0,s[k][t]-c);
u[k][t]==true;
}
else{
s[k][t+1]==maxl(0,f[k][t]-c);
u[k][t]==false;
}
allDifferent(all (t in Periods) seq[t]);
}
example data:
nbrProds=5;
nbrStations=2;
c=10;
l=15;
duration=[
[11,6]
[12,9]
[10,15]
[5,14]
[13,14]];
I am trying to avoid the use of if else function but the dexpr will not work here since recursion is not supported.
Any help is appreciated.
Thanks
#DecisionOptimization#OPLusingCPOptimizer