0

[Representation of feasible solution][1] [1]: https://i.stack.imgur.com/83ESm.png

Hi Everyone,

I'm currently working on an adaptation of a 3-Stage Two Dimensional Bin Packing Problem on Cplex. Unfortunately when I try to run the problem some errors appear. The goal of the model is to allocate an n ount of items with height and width to a minimum number of bins. The items are gonna be first assigned to stacks, then the stacks are gonna be assigned to stripes and last stripes are gonna be assigned to a bin (example on image attached). Items are ordered according their height (highest item is gonna be first with the smallest index (e.g. 1)). The stacks/stripes have the index of the heighest item (smallest index). The original model has the resctriction that the items withtin a stack must have the same width. I'm trying to change this formulation, so that the items within the stack can have different widths. My approach was to define a new decision variable (float), which is gonna sequentelly delimit by max width of every every item on every stack (second last constraint) and then restrict the width of the stripe, which can not be bigger than the width of the bin (last constraint).

"Bin=Trolley" on my descriptions

I would greatly appreciate a review to see what I am overlooking.

Error on Engine Log Legacy callback pi Warning: Non-integral bounds for integer variables rounded. Infeasibility row 'c160': 0 <= -5.

row 160 make reference to the second last added constraint. c160: - _e(1)(2)#26 + 5 a(2)(2)#52 <= 0

When I increase the width capacity, I got this error: Legacy callback pi Warning: Non-integral bounds for integer variables rounded. Row 'c255' infeasible, all entries at implied bounds.

c255: _e(1)(1)#25 + _e(1)(2)#26 + _e(1)(3)#27 + _e(1)(4)#28 + _e(1)(5)#29
   - 20 b(1)(1)#65 <= 0

I tried giving a feasible soultion, but I still get the error on the new constraint.
/*a[1][1]==1; a[1][3]==1;

a[2][2]==1; a[2][4]==1;

a[5][5]==1;

b[1][1]==1; b[1][2]==1;

c[1][1]==1;

b[5][5]==1; c[5][5]==1;*/

Summary of the model:

int n=...; //number of items
range iitem=1..n;

float heighttrolley=...;    //length of bin j
float widthtrolley=...; //width of bin j

float heightitem[iitem]=...;    //length of item i
float widthitem[iitem]=...;     //width of item i

dvar boolean a[1..n][1..n]; //if item i is assigned to stack j
dvar boolean b[1..n][1..n]; //if stack j is contained in stripe k
dvar boolean c[1..n][1..n]; //if stripe k is contained in bin l
dvar boolean d[1..n-1][2..n][1..n-1]; //if item i contributes to the total height of all stripes in bin l and is contained in stack j
dvar float e[1..n][1..n];   //max width of an item in stack j contained in stripe k


minimize sum (l in 1..n) c[l][l];

subject to{
  
forall(j in 1..n, i in 1..n: i<j)
a[j][i]==0;   
forall(l in 1..n, k in 1..n: k<l)
c[l][k]==0;
forall(l in 1..n-1, i in l+1..n, j in l..n-1: i<l+1 && j<l && j>i-1)  
d[l][i][j]==0;

forall(j, k in iitem)
e[j][k]<=widthtrolley;
        
forall(i in iitem)
sum (j in 1..i) a[j][i]==1; //each item has to be packed once

forall(j in 1..n-1)
sum (i in j+1..n)a[j][i]<=(n-j)*a[j][j];    //items can be assigned to unused stacks

forall(j in 1..n-1, i in iitem: i>j && heightitem[i]+heightitem[j]>heighttrolley)// && widthitem[i]<=widthitem[j])  //total height of any pair of stacked items must not exceed height of bin
a[j][i]==0;

forall(j in 1..n)
sum (k in 1..n) b[k][j]==a[j][j];  // every item j is packed exactly once into a stripe k

forall(k in 2..n, j in 1..k-1)
sum(i in j..n) heightitem[i]*a[j][i]<= sum(i in k..n)heightitem[i]*a[k][i]+(heighttrolley+1)*(1-b[k][j]); //ensure that the height of each stack j never exceeds the height of the stripe k it is contained in (1)

forall(k in 1..n-1, j in k+1..n)
sum(i in j..n) heightitem[i]*a[j][i]<= sum(i in k..n)heightitem[i]*a[k][i]+heighttrolley*(1-b[k][j]);    //ensure that the height of each stack j never exceeds the height of the stripe k it is contained in (2)

forall(k in 1..n)
sum(l in 1..k)c[l][k]==b[k][k]; //force each used stripe k to be packed into exactly one bin

forall(l in 1..n-1)
sum(i in l..n)heightitem[i]*c[l][i]+sum(i in l+1..n)heightitem[i]*sum(j in l..i-1)d[l][i][j]<=heighttrolley*c[l][l];    //bins used height has to be smaller than the height of bin 

forall(l in 1..n-1, i in l+1..n, j in l..i-1){  //force variable d to be set to 1, when item i contributes to the total height of all stripes in bin l and is contained in stack j
a[j][i]+c[l][j]-1<=d[l][i][j];
d[l][i][j]<=(a[j][i]+c[l][j])/2;}

forall(l in 1..n-1)
sum(k in l+1..n)c[l][k]<=(n-l)*c[l][l]; //ensure that no stripes are packed into an unused bin

forall(i,j,k in iitem)              //if item i is assigned to stack j, then e[k][j] has to be at least bigger than the width of item i
widthitem[i]*a[j][i]<=e[k][j];          

forall(k in iitem)
sum(j in iitem)e[k][j]<=widthtrolley*b[k][k];   //for every stripe, the sum of the max width of every stack j on the sripe k must be smaller than the width of the bin 

Link to data: https://1drv.ms/u/s!Ajgu5Yf1URAAe7xcGOjaudRwhbQ?e=cKH7Ui

1 Answers1

0

Your model is not feasible.

If you name your constraints like this for instance:

forall(j in 1..n, i in 1..n: i<j)
    ct1:a[j][i]==0;   
  forall(l in 1..n, k in 1..n: k<l)
    ct2:c[l][k]==0;
  forall(l in 1..n-1, i in l+1..n, j in l..n-1: i<l+1 && j<l && j>i-1)  
    ct3:d[l][i][j]==0;
  
  forall(j, k in iitem)
    ct4:e[j][k]<=widthtrolley;
            
  forall(i in iitem)
    ct5:sum (j in 1..i) a[j][i]==1; //each item has to be packed once

then in the IDE you will get a set of relaxations and conflicts that will help you debug the model.

enter image description here

Alex Fleischer
  • 9,276
  • 2
  • 12
  • 15