Reputation: 1
I'm working on a constrained scheduling problem using IBM ILOG CPLEX. Despite having no syntax errors in my code, I keep encountering a "Size Limit Exceeded" error, which prevents the code from running successfully.
Here's a brief overview of my problem setup:
I'm scheduling a set of tasks with various constraints (e.g., resource limitations, task dependencies). I've defined the variables, objective function, and constraints correctly as per the CPLEX documentation. The problem size is substantial but not unreasonably large for CPLEX to handle, to the best of my knowledge.
I tried to make the arrangements I could within my CPLEX knowledge, but I could not obtain any findings.
Here is the code;
**
int n=...;
int m=...; //resources
range i=0..n-1;
range j=0..n-1;
range t=0..n-1;
range k=0..m-1;
range z=0..n-1;
int B[k]= ...; //Capacities
int p[i]= ...; //activity duratio
int ES[i]=...;
int LS[i]=...;
int b[i][k]=...;
range A=0..n-1; //activities
range R=0..m-1; //Resources
range A_plus1 = 0..n-1; // Include n+1 in the range
range H= 0..LS[n-1]; //Time horizon
tuple MyTuple {
int i;
int j;
}
{MyTuple} E = ...; // Use your actual data here
// int V=asSet(1..n);
dvar boolean x[i][t];
minimize sum(i in 0..n-1)
sum(t in ES[i]..LS[i]) t*x[n-1][t];
subject to
{
forall(e in E)
sum(t in ES[e.j]..LS[e.j])t*x[e.j][t]>= sum(t in ES[e.i]..LS[e.i])t*x[e.i][t]+p[e.i];
forall(t in H, k in R)
sum(i in 0..n-1)
b[i][k] * sum(z in maxl(ES[i],t - p[i] + 1) .. minl(LS[i], t))
x[i][z] <= B[k];
forall(i in A_plus1)
sum(t in ES[i]..LS[i])x[i][t]==1;
x[0][0]==1;
//forall(i in A union {n+1})
//forall(t in {ES[i],LS[i]})
forall(i in A_plus1)
forall(t in H : !(t in {ES[i], LS[i]}))
x[i][t]==0;
forall(i in A_plus1)
forall(t in H : (t >= ES[i] && t<= LS[i]))
x[i][t] == 1;
}
**
Here is the dat file I'm using,
n = 32;
m = 4;
Activity durations
p = [0, 6, 1, 4, 5, 7, 3, 5, 6, 9, 9, 5, 7, 4, 10, 10, 5, 10, 6, 10, 7, 9, 10, 1, 6, 6, 9, 4, 4, 7, 1,0 ];
Resource availability
B = [10, 10, 10, 10];
Resource requirements
b = [
[0, 0, 0, 0],
[1, 1, 1,0],
[6,0, 2, 1],
[0,1, 4,3],
[2, 6, 2, 0],
[5, 3, 0, 5],
[6, 4, 4, 0],
[0, 6, 5, 2],
[2, 6, 0, 5],
[6, 6, 6, 0],
[4, 0, 6, 5],
[4, 5, 4, 0],
[2, 3, 0, 3],
[0, 3, 2, 3],
[5, 3, 4, 0],
[2, 5, 4, 0],
[5, 4, 3, 0],
[4, 0, 4, 3],
[7, 1, 0, 4],
[0, 3, 4, 7],
[7, 4, 4, 0],
[0, 4, 6, 7],
[2, 7, 4, 0],
[0, 7, 5, 1],
[2, 0, 4, 3],
[8, 0, 4, 5],
[0, 2, 3, 5],
[2, 6, 3, 0],
[3, 0, 4, 7],
[1, 0, 7, 3],
[6, 2, 5, 0],
[0, 0, 0, 0]
];
Include data for all activities and resources here
Precedence constraints
E = {
<0, 2>,<0, 4>, <0, 5>, <0, 6>, <0, 7>,<0,16>, <0, 17>, <0, 18>, <0, 19>, <0, 20>, <0, 21>, <0, 22>, <0, 23>, <0, 24>, <0, 25>, <0, 26>, <0, 27>, <0, 28>, <0, 29>, <0, 30>, <0, 31>,
<1, 14>, <1, 2>,
<2, 8>, <2, 7>,
<3, 13>, <3, 12>,
<4, 11>, <4, 7>,
<5, 10>,
<6, 9>,
<7, 31>,
<8, 31>,
<9, 31>,
<10, 31>,
<11, 31>,
<12, 31>,
<13, 31>,
<14, 31>,
<15, 31>,
<16, 31>,
<17, 31>,
<18, 31>,
<19, 31>,
<20, 31>,
<21, 31>,
<22, 31>,
<23, 31>,
<24, 31>,
<25, 31>,
<26, 31>,
<27, 31>,
<28, 31>,
<29, 31>,
<30, 31>,
};
Earliest start times
ES = [0, 0, 0, 6, 0, 0, 0, 0, 5, 1, 3, 7, 5, 10, 10, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 0];
Latest start times
LS = [0, 0, 10, 6, 8, 8, 8, 15, 14, 11, 11, 15, 13, 16, 10, 10, 15, 10, 0, 10, 13, 11, 10, 10, 19, 14, 14, 11, 16, 16, 19, 20];
Upvotes: 0
Views: 167
Reputation: 10062
The free community CPLEX edition is limited with regards to problem size, as I explain in https://www.linkedin.com/pulse/what-free-ibm-cplex-alex-fleischer/
With the watsonx / WML service you have some free time whatever the size of the model.
You can also move to a non limited version
https://www.ibm.com/products/ilog-cplex-optimization-studio/pricing
If you run this version, you will see that your model is not feasible.
Then if you name your constraints in order to see some relaxations:
subject to
{
forall(e in E)
ct1:sum(t in ES[e.j]..LS[e.j])t*x[e.j][t]>= sum(t in ES[e.i]..LS[e.i])t*x[e.i][t]+p[e.i];
forall(t in H, k in R)
ct2:sum(i in 0..n-1)
b[i][k] * sum(z in maxl(ES[i],t - p[i] + 1) .. minl(LS[i], t))
x[i][z] <= B[k];
forall(i in A_plus1)
ct3:sum(t in ES[i]..LS[i])x[i][t]==1;
x[0][0]==1;
//forall(i in A union {n+1})
//forall(t in {ES[i],LS[i]})
forall(i in A_plus1)
forall(t in H : !(t in {ES[i], LS[i]}))
ct4:x[i][t]==0;
forall(i in A_plus1)
forall(t in H : (t >= ES[i] && t<= LS[i]))
ct5:x[i][t] == 1;
}
You will see some conflict and relaxation
So your issue is indeed that you use the community edition
Upvotes: -1