Hi,
I am working on a problem which involves placing a number of blocks on a straight line, without any overlap. I tried solving it in Gurobi and CPLEX and in both cases, after the first 2-3 second (when the Gap reduces from say 20% to 17%), the solution does not improve at all for several hours. I am wondering if the problem is the formulation.
Let the left X coordinate and the width of block i be represented by Li and Wi. Wi is fixed, Li is variable. For block i and block j to be non overlapping, I am introducing a binary variable Zij which is 1 if block i is on right of block j and 0 if block i is on left of block j. To model this, I am writing the following two constraints for each pair of blocks i and j
Li - Lj - Wi * Zij - M * Zij <= -Wi
Li - Lj - Wj * Zij - M * Zij >= -M
Where M is a large number (I am putting it equal to the sum of width of all blocks, as that is the maximum distance between Li and Lj). So, for a total of N blocks, there are N^2 binary variables and 2*N^2 constraints. I understand that this may be too much, but in my application, the number of blocks will always be less than 80 (thus, no more than 6K binary variables and 12K constraints.
Is there a better way to write this problem which hopefully will lead to solving this to closer to optimality? I know the initial feasible solution to the problem, and did try with and without passing this solution as an mst file. This did not effect the observed behavior where the solution does not improve after first few second, for several hours.
regards,
Ashutosh