2

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);
}
hepark
  • 21
  • 2

1 Answers1

0

Same question at https://community.ibm.com/community/user/datascience/communities/community-home/digestviewer/viewthread?GroupId=5557&MID=87626&CommunityKey=ab7de0fd-6f43-47a9-8261-33578a231bb7&tab=digestviewer

And some answer there

Alex Fleischer
  • 9,276
  • 2
  • 12
  • 15
  • Just to add a clarification - CPLEX does *not* generate any 'solutions' that violate constraints unless they are specifically allowed to be relaxed in some way by the programmer (subject to tolerances etc). If the set of values of the decision variables doesn't satisfy all the constraints, then it is NOT a solution, however good the objective value. – TimChippingtonDerrick Jun 28 '17 at 09:25
  • @Alex: Somehow this link does not point to a forum anymore but gets redirected to some generic IBM Community web page: https://community.ibm.com/community/user/legacy?id=ed9c22c9-9055-4032-a3c7-610fda705554&ps=25 Do you still know how to access the original forum post including the answers? – Jakob Apr 22 '22 at 14:02
  • 1
    The forum link moved to https://community.ibm.com/community/user/datascience/communities/community-home/digestviewer/viewthread?GroupId=5557&MID=87626&CommunityKey=ab7de0fd-6f43-47a9-8261-33578a231bb7&tab=digestviewer – Alex Fleischer Apr 22 '22 at 14:29