'Solutions not satisfying some constraints
I wanna solve a simple integer programming problem for scheduling with IBM ILOG CPLEX and my whole code is below.
Under specific data, the solution with objective 11,306 is found but some solutions don't satisfy specific constraint, ct2. I wonder if CPLEX is considered an optimal solution even if it does not satisfy some constraints, or is there a problem with my coding? If you need I can send you the data. I wanted to attach the data on this post but couldn't find a way.
Really hope I can get some answer here.
int NbGroup = ...;
int NbAutoclave = ...;
int NbTimeslot = ...;
range Group = 1..NbGroup;
range Autoclave = 1..NbAutoclave;
range Timeslot = 1..NbTimeslot;
int MonthlyProduct[Group] = ...;
int CycleTime[Group][Timeslot] = ...;
int CureTime[Group] = ...;
int Compatibility[Group][Autoclave] = ...;
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 )
Compatibility[g][a] * Assign[g][a][t] == MonthlyProduct[g];
forall (g in Group)
forall (t in 1..NbTimeslot:t in (1..NbTimeslot-CycleTime[g][t]+1))
ct2:
sum( a in Autoclave, cy in 1..CycleTime[g][t] )
Compatibility[g][a] * Assign[g][a][t+cy-1] <= 1;
forall( a in Autoclave, t in Timeslot )
ct3:
sum( g in Group, cu in 1..CureTime[g]: t-cu+1 in Timeslot)
Compatibility[g][a] * Assign[g][a][t-cu+1] <= 1;
ct4:
sum( g in Group, a in 1..1, t in 1..7 )
Assign[g][a][t] == 0;
ct5:
sum( g in Group, a in 2..2, t in 1..6 )
Assign[g][a][t] == 0;
//to fix some solutions
Assign[9][1][23]==1;
Assign[9][1][95]==1;
Assign[9][1][143]==1;
Assign[9][1][167]==1;
Assign[9][1][239]==1;
Assign[9][1][287]==1;
Assign[9][1][311]==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);
}
Solution 1:[1]
And some answer there
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |