Originally posted by: UYPJ_Ha-eun_Park
Hello, I'm a beginner of CPLEX and need your help.
I wanna solve a simple integer programming problem for scheduling and my whole code is below.
The errors are generated in ct2 and ct3 and I think yellow blocked code is wrong.
My question is, how can I make array ranges for "forall" and "sum" function?
Really hope I can get some answer at this forum.
----
int NbGroup = ...;
int NbAutoclave = ...;
int NbTimeslot = ...;
range Group = 1..NbGroup;
range Autoclave = 1..NbAutoclave;
range Timeslot = 1..NbTimeslot;
int MonthlyProduct[Group] = ...;
int CycleTime[Group] = ...;
int CureTime[Group] = ...;
dvar int Assign[Group][Autoclave][Timeslot] in 0..1;
minimize
sum( g in Group, a in Autoclave, t in Timeslot ) t * Assign[g][a][t];
subject to {
forall (g in Group)
ct1:
sum( a in Autoclave, t in Timeslot )
Assign[g][a][t] == MonthlyProduct[g];
forall (g in Group)
forall (t in 1..(NbTimeslot-CycleTime[g]+1))
ct2:
sum( a in Autoclave, cy in 1..CycleTime[g] )
Assign[g][a][t+cy-1] <= 1;
forall( a in Autoclave, t in Timeslot )
ct3:
sum( g in Group, cu in 1..CureTime[g])
Assign[g][a][t-cu+1] <= 1;
}
tuple SolutionT{
int a;
int b;
int c;
int d;
};
{SolutionT} Solution = {<a0,b0,c0,Assign[a0][b0][c0]> | a0 in Group, b0 in Autoclave, c0 in Timeslot};
execute{
writeln(Solution);
}
#CPLEXOptimizers#DecisionOptimization