In [1] a problem is posted:
Given \(n\) points and a collection of tiles (rectangles) of given size, try to cover all all points with the minimum number of tiles.
There are a number of things to consider:
- Are the tiles of equal size or have they different sizes?
- Can tiles overlap?
- After minimizing the number of tiles, should we minimize the total size of the selected tiles, so we select the smaller tiles when possible.
Data
Let's generate some data, assuming tiles have different sizes:
---- 19 PARAMETER plocation of points
x y
p1 17.17584.327
p2 55.03830.114
p3 29.22122.405
p4 34.98385.627
p5 6.71150.021
p6 99.81257.873
p7 99.11376.225
p8 13.06963.972
p9 15.95225.008
p10 66.89343.536
p11 35.97035.144
p12 13.14915.010
p13 58.91183.089
p14 23.08266.573
p15 77.58630.366
p16 11.04950.238
p17 16.01787.246
p18 26.51128.581
p19 59.39672.272
p20 62.82546.380
p21 41.33111.770
p22 31.4214.655
p23 33.85518.210
p24 64.57356.075
p25 76.99629.781
p26 66.11175.582
p27 62.74528.386
p28 8.64210.251
p29 64.12554.531
p30 3.15279.236
---- 19 PARAMETER rsize of rectangles
x y
r1 12.18315.270
r2 25.76932.506
r3 15.34411.024
r4 27.55428.637
r5 21.68120.761
r6 17.29117.393
r7 13.91538.003
r8 21.39833.502
r9 19.00113.764
r10 32.46612.077
![]() |
Random points
|
Model
To model this problem, we introduce binary variables \(\mathit{select}_j \in \{0,1\}\): \[\mathit{select}_j = \begin{cases} 1 & \text{if tile $j$ is selected}\\ 0 & \text{otherwise}\end{cases}\] and a continuous variable \(\mathit{place}_{j,c}\) indicating the \(x\) and \(y\) coordinates of (selected) tile \(j\). To be precise: it is the left-lower corner of the rectangle. The set \(c\) is simply \(c=\{x,y\}\). In addition we need a variable indicating if a point is covered by a tile:\[\mathit{cov}_{i,j}=\begin{cases} 1 & \text{if point $i$ is covered by tile $j$} \\ 0 &\text{otherwise}\end{cases} \]
The model can look like:
MIP Model |
---|
\[\begin{align}\min &\sum_j \color{darkred}{\mathit{select}}_j \\ & \color{darkred}{\mathit{place}}_{j,c} \le \color{darkblue}p_{i,c}+\color{darkblue}M\cdot(1-\color{darkred}{\mathit{cov}}_{i,j}) && \forall i,j,c \\ &\color{darkred}{\mathit{place}}_{j,c}+\color{darkblue}r_{j,c}\ge\color{darkblue}p_{i,c}-\color{darkblue}M\cdot(1-\color{darkred}{\mathit{cov}}_{i,j}) && \forall i,j,c \\ & \color{darkred}{\mathit{cov}}_{i,j} \le \color{darkred}{\mathit{select}}_j && \forall i,j \\ & \sum_j \color{darkred}{\mathit{cov}}_{i,j} \ge 1 && \forall i \\ & \color{darkred}{\mathit{select}}_j \in \{0,1\} \\ & \color{darkred}{\mathit{cov}}_{i,j} \in \{0,1\} \end{align}\] |
Our points are drawn from \[p_{i,c}\sim U(0,100)\] So it make sense to restrict the placement of tiles to: \[0 \le \mathit{place}_{j,c} \le 100-r_{j,c}\] Using this, a good value for \(M\) is \(M=100\).
Results
---- 55 VARIABLE z.L = 7.000objective
---- 55 PARAMETER tileplacement of tiles
x y w h
r1 53.92867.81912.18315.270
r2 5.65225.76932.506
r4 27.4846.50727.55428.637
r5 78.13155.46421.68120.761
r6 5.79149.18117.29117.393
r8 56.18822.57321.39833.502
r10 2.51775.16932.46612.077
![]() |
Points are covered by tiles |
No overlap
We can add no-overlap constraints [2] to the model soo that no pair of tiles can overlap. Just to be sure, I'll allow tiles to go outside the area \([0,100]\times [0,100]\). Of course, that also has an impact on the value for \(M\). The new solution looks like:
![]() |
With no-overlap constraints
|
Same-sized tiles
If all tiles are identical, we just have a special case of our original problem. It may make sense to add an ordering constraint: \[\mathit{select}_j \le \mathit{select}_{j-1}\] We can also consider additional symmetry-breaking constraints, such as \[\mathit{place}_{j,x} \ge \mathit{place}_{j,x-1}\] It requires some experimentation if these constraints pay off in performance.
![]() |
All tiles have the same size
|
In this example all the times are \((20 \times 20)\). Below is a larger example with \(n=50\) points and \((10 \times 10)\) tiles.
![]() |
Larger example
|
A multi-criteria version
Instead of just minimizing the number of tiles, we can subsequently minimize the total area covered by the tiles. I.e. use smaller tiles if possible. This is essentially a multi-objective problem. We used here a lexicographic approach (i.e. do two solves in sequence). In our experiment, we reduced the total size of the selected tiles from 3672.5809 to 3004.0812.
![]() |
Multi-objective model results |
Obviously, this additional step makes only sense if the tiles have different sizes.
Conclusion
The small MIP model presented above can be used as a basis for alternative, related problems.
References