Originally posted by: SystemAdmin
Hello,
I've to solve a mathematical model for my master thesis.
I'm not used to work with CPLEX, so I already had some problems with it.
So far, my model is solvable. But I guess I might have made some mistakes in the formulation, since not all constraints are satisfied.
Does someone see some formulation-mistakes?
int i=...;
int c=...;
int d=...;
int p=...;
int f=...;
range shift = 1..i; // possible shifts
range periode=1..p; // periods in a week
range vlucht=1..f;
int w=...; // maximal number of weeks
range cycle=1..c; //cycles
range dag=1..d;
range week=1..w;
float vraag
vlucht=...; //demand in workhours for flight f
int teamgrootte
cycle=...; //teamsize in cycle c
float kost
shiftdag=...; //total cost(per employee) for shift i on day d
float duur
shift=...; //duration of shift i
float buffer=...;
int aanwezig1
shiftperiode=...;// 1 if periode p contains shift i
int ochtendshift = ...;//morningshift
int dagshift = ...; //dayshift
int avondshift=...;//eveningshift
int nachtshift=...;//nightshift
int begin
vlucht=...;
int einde
vlucht=...;
int o
vluchtperiode=...;
float fractie
shift=...;
int g = ...;
range doel = 1..g;
float gewicht
doel=...;
int bep=...;
range beperking = 1..bep;
int rh3=...;
dvar boolean x
shiftdagweekcycle;
dvar float y
vluchtperiode;
dvar boolean z
shiftcycle;
dvar int teamaantal
cycle;//aantal team als beslissingsvariabele meegegeven
dvar int obj
beperking;
minimize
sum(i in shift, d in dag, w in week, c in cycle) kost[i][d]*fractie[i] * teamgrootte[c]* x[i][d][w][c] + gewicht[1]*sum(bep in beperking: bep <=15)obj
bep+gewicht[2]*sum(bep in beperking: 16<= bep <= 26)obj
bep +gewicht[3]*sum(bep in beperking: 27<= bep <= 40)obj
bep;
subject to {
forall (c in cycle)
teamaantal[c] <= 8;
(sum(i in shift, d in dag, w in week, c in cycle) (duur[i] * fractie[i] * x[i][d][w][c]*teamgrootte[c])) >= (sum(f in vlucht) vraag[f]);
forall (p in periode)
(sum ( i in shift, d in dag, w in week, c in cycle) fractie[i]* aanwezig1[i][p] * teamgrootte[c] * x[i][d][w][c]) >= (sum (f in vlucht: (f * (o[f][p])>0)) (y[f][p]));// CONSTRAINT 7
forall(d in dag, c in cycle)
sum(i in shift, w in week) x[i][d][w][c]<=teamaantal[c];
forall (f in vlucht)
(sum (p in periode: (begin[f]<= p <= einde[f])) y[f][p]) == (vraag[f]*2); //constraint 8
forall ( d in dag, w in week, c in cycle)
sum (i in shift) x[i][d][w][c] <=1;
forall(d in dag:6<=d<=7, c in cycle)
(sum(w in week, i in shift) x[i][d][w][c]) <= (0.5 * teamaantal[c]);//constraint2
forall(c in cycle)
(sum(i in shift, d in dag, w in week)x[i][d][w][c]*duur[i]*fractie[i])>=(36*teamaantal[c]);//constraint 3
forall(c in cycle)
(sum(i in shift, d in dag, w in week)x[i][d][w][c]*duur[i]*fractie[i])<= (38*teamaantal[c]); //constraint 3
forall(i in shift, d in dag, w in week, c in cycle)
x[i][d][w][c]<= z[i][c];//constraint 4
forall(c in cycle)
sum( i in shift: i<=ochtendshift)z[i][c]<=1; //constraint 5
forall(c in cycle)
sum( i in shift: ochtendshift < i <= dagshift)z[i][c]<=1; //constraint 5
forall(c in cycle)
sum( i in shift: dagshift < i <= avondshift)z[i][c]<=1; //constraint 5
forall(c in cycle)
sum( i in shift: avondshift< i<= nachtshift)z[i][c]<=1; //constraint 5
forall(p in periode)
(sum(i in shift, d in dag, w in week, c in cycle)(aanwezig1[i][p]*x[i][d][w][c]))>=1; // constraint 6
forall (i in shift:i<= nachtshift, d in dag: d<=6, w in week, c in cycle)
(x[i]
d+1[w][c])<= 1-(sum(i in shift: avondshift < i <= nachtshift)x[i][d][w][c]); // nachtshift mag niet gevolgd worden door M,D,A
forall (i in shift:i<= avondshift, w in week: w<= w-1, c in cycle)
(x[i][1]
w+1[c])<= 1-(sum(i in shift: avondshift < i <= nachtshift)x[i][7][w][c]);
forall (i in shift: i<= dagshift, d in dag: d<=6, w in week, c in cycle)
(x[i]
d+1[w][c])<= 1-(sum(i in shift: dagshift < i <=avondshift) x[i][d][w][c]);
forall (i in shift: i<= dagshift, w in week: w<=w-1, c in cycle)
(x[i][1]
w+1[c])<= 1- (sum(i in shift: dagshift < i <=avondshift)x[i][7][w][c]);
forall (f in vlucht, p in periode)
y[f][p]>=0;
forall (bep in beperking)
obj
bep>=0 ;
}
tuple someTuple{
int shift;
int dag;
int week;
int cycle;
int value;
}
{someTuple} someSet = {<i,d,w,c, x[i][d][w][c]> | i in shift, d in dag, w in week, c in cycle};
I really hope that someone can help me, as my deadline is soon!
Regards,
Aurelie
#DecisionOptimization#OPLusingCPLEXOptimizer