Originally posted by: sonny.plankton
Hi,
yes sure, the model is based on the attached research paper and assignment
//Declaration of time range
range D = 1..14; //planning horizon
range S = 1..4; //surgical groups
range P = 1..4; //patient groups
range W = 1..3; //wards
range A = 1..14; //active days range
//Declaration of Parameters
int SW[W][S]=[[1,2,4],[1,2],[1,3]]; //surgical subgroups (ward specific)
int PW[W][P]=[[1,2,3],[2,3,4],[2,4]]; //patient subgroups (ward specific)
int PS[S][P]=[[1,4],[2,4],[3]]; //patient subgroups (surgical specific)
int r[P] = [2200,4100,1070,600]; //profit values
int dur[P] = [120,60,160,200]; //surgery duration
int LB[P] = [10,5,6,2]; //Lower Bound of patients treated
int UB[P] = [30,15,17,22]; //Upper Bound of patients treated
int BLOCKS = 5; //sugery blocks
int LENGTH = 480; //block length
int BEDS = 100; //bed capacity
//Declaration of decision variables
dvar int y[W]; //assigned Beds to Wards
dvar int x[P][A]; //treated patients
dvar int z[S][A]; //assinged surgery blocks
//Objective Function
maximize sum (p in P) r[p]* sum (p in P, a in A) x[p][a]; //maximize revenue
//constraints
subject to {
forall (d in D){
forall (w in W, p in P, a in A, s in S){
sum(w in W) y[w] <= BEDS; //restriction of number of beds
sum(p in P, a in A: (d<10)? a <= d+6: a<=14-d+1, w in W) x[p][a] <= y[w]; //restriction number of new patients <= beds assinged to ward
sum (s in S, a in A: (d<10)? a <= d+6: a<=14-d+1) z[s][a] <= BLOCKS; //restriction of blocks
sum (s in S, a in A: (d<10)? a <= d+6: a<=14-d+1, p in P) dur[p]*x[p][a] <= z[s][a]*LENGTH; //surgery duration do not exceed block length
LB[p]<=sum (a in A: (d<10)? a <= d+6: a<=14-d+1, p in P) x[p][a] <= UB[p];} //treated patiens within lower and upper bounds
}};
Tanks again for your help
#DecisionOptimization#OPLusingCPLEXOptimizer