Originally posted by: taylor318
Hello.
I have been studying OPL for about two weeks, but I am not sure how to formulate a code for multi-period location problem.
I have formulated a code for the basic location problem, which works! and by fixing some of the code, i have to make it as a multi-period (t = 1,2,3) problem.
so the problem that I am having is that
when I use the data from the excel, my data's density should increase by 10 percent each year. (i am only doing for 3 periods)
1) First year's data = D
Second year's data = D*1.1
Third year's data = D*1.2
I tried to do it but I get the correct answer till the second year but in third year I get the value of D*1.32 which is D*1.1*1.2.
range Time = 0..2;
execute Density{
for (var i in PatientData){
for (var t in Time){
Patient[i].x = Patient[i].x*(1.0+0.1*t);
Patient[i].y = Patient[i].y*(1.0+0.1*t);
}
writeln(Patient[i]); }
}
what should i change to fix it?
2) for the objective and constraint function, i need to maximize the number of patients for each period using limited number of ambulance in that specific period. So for period 1= 2, period 2 =3, period 3 =1.
What is the formulation of the iteration be like for this?
Also, for the objective function, I need to maximize the number of patients for each period, which requires double summation for each period.
how should i change from the code below?
maximize
sum (i in PatientNum) Y[i];
subject to{
forall(i in PatientNum){
sum(j in AmbulanceNum)
W[i][j]*X[j] >= Y[i];
}
sum(j in AmbulanceNum)
X[j] <= P;
}
#DecisionOptimization#OPLusingCPLEXOptimizer