exact algorithms for the rectilinear block packing problem

19
Bulletin of the JSME Journal of Advanced Mechanical Design, Systems, and Manufacturing Vol.12, No.3, 2018 Paper No.17-00674 © 2018 The Japan Society of Mechanical Engineers [DOI: 10.1299/jamdsm.2018jamdsm0074] Ken MATSUSHITA * , Yannan HU * , Hideki HASHIMOTO ** , Shinji IMAHORI *** and Mutsunori YAGIURA * * Department of Mathematical Informatics, Graduate School of Informatics, Nagoya University Furo-cho, Chikusa-ku, Nagoya, 464-8601, Japan E-mail: [email protected] ** Department of Logistics and Information Engineering, Tokyo University of Marine Science and Technology 2-1-6 Etchujima Koto-ku, Tokyo 135-8533, Japan *** Department of Information and System Engineering, Chuo University 1-13-27 Kasuga, Bunkyo-ku, Tokyo 112-8551, Japan Abstract The rectilinear block packing problem is a problem of packing a set of rectilinear blocks into a larger rectangular container with fixed width and unrestricted height. A rectilinear block is a polygonal block whose interior angles are either 90 or 270 . The objective is to pack all the blocks into the container so as to minimize the height of the container. This problem is among classical combinatorial optimization problems and is known to be NP-hard. In this paper, we propose two exact algorithms for the rectilinear block packing problem: one is based on two IP problems and the other is based on a new solution representation. The basic idea of our algorithms is that we iteratively compute lower and upper bounds on the optimal value until the lower bound on the value of an optimal solution for the current search space becomes larger than or equal to the best upper bound found during the search by then, or the search space becomes empty, which means that an optimal solution of this problem has been found. The computational results show that both algorithms obtain five exact and one heuristic solutions for six instances. The algorithm based on a new solution representation improves the running time of the algorithm based on two IP problems. 1. Introduction The rectilinear block packing problem is the problem of packing a set of arbitrarily shaped rectilinear blocks into a larger rectangular container, where the rectilinear blocks are polygonal blocks whose interior angles are either 90 or 270 . Given a set of rectilinear blocks, also called items, and a container with fixed width and unrestricted height, the task is to pack all the items into the container without overlapping so as to minimize the height of the container. This problem involves many industrial applications, including VLSI design, timber/glass/cloth cutting, and newspaper layout. The rectilinear block packing problem is among the classical combinatorial optimization problems and is known to be NP-hard (Baker et al., 1980). The rectangle packing problem is a special case of the rectilinear block packing problem. Many ecient heuristic algorithms for rectangle packing have been proposed including simulated annealing (Dowsland, 1993) and quasi-human heuristic algorithm (Wu et al., 2002). Many exact algorithms for the rectangle packing problem are also proposed in papers such as Cˆ ot´ e et al. (2014), Kenmochi et al. (2009) and Martello et al. (2002). The exact algorithm proposed by ot´ e et al. (2014) obtains an optimal solution for the rectangle packing problem by alternately enhancing the lower and upper bounds until the gap between these bounds becomes non-positive. Since rectilinear blocks have properties similar to rectangles, Hu et al. (2015) generalized two construction heuris- tics, the bottom-left and the best-fit algorithms, which were originally proposed for rectangle strip packing, to solve the rectilinear block packing problem. However, such generalizations are not always possible because shapes of rectilinear blocks are more complex than those of rectangles, and it is dicult to represent the relationship among rectilinear blocks 1 Exact algorithms for the rectilinear block packing problem Received: 11 December 2017; Revised: 1 April 2018; Accepted: 20 May 2018 Keywords : Strip packing, Rectilinear blocks, Solution representation, Branch and bound, Exact algorithm

Upload: others

Post on 02-Jan-2022

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Exact algorithms for the rectilinear block packing problem

Bulletin of the JSME

Journal of Advanced Mechanical Design, Systems, and ManufacturingVol.12, No.3, 2018

Paper No.17-00674© 2018 The Japan Society of Mechanical Engineers[DOI: 10.1299/jamdsm.2018jamdsm0074]

Ken MATSUSHITA∗, Yannan HU∗, Hideki HASHIMOTO∗∗, Shinji IMAHORI∗∗∗ and Mutsunori YAGIURA∗∗ Department of Mathematical Informatics, Graduate School of Informatics, Nagoya University

Furo-cho, Chikusa-ku, Nagoya, 464-8601, JapanE-mail: [email protected]

∗∗ Department of Logistics and Information Engineering, Tokyo University of Marine Science and Technology2-1-6 Etchujima Koto-ku, Tokyo 135-8533, Japan

∗∗∗ Department of Information and System Engineering, Chuo University1-13-27 Kasuga, Bunkyo-ku, Tokyo 112-8551, Japan

AbstractThe rectilinear block packing problem is a problem of packing a set of rectilinear blocks into a larger rectangularcontainer with fixed width and unrestricted height. A rectilinear block is a polygonal block whose interior anglesare either 90◦ or 270◦. The objective is to pack all the blocks into the container so as to minimize the height ofthe container. This problem is among classical combinatorial optimization problems and is known to be NP-hard.In this paper, we propose two exact algorithms for the rectilinear block packing problem: one is based on twoIP problems and the other is based on a new solution representation. The basic idea of our algorithms is that weiteratively compute lower and upper bounds on the optimal value until the lower bound on the value of an optimalsolution for the current search space becomes larger than or equal to the best upper bound found during the searchby then, or the search space becomes empty, which means that an optimal solution of this problem has been found.The computational results show that both algorithms obtain five exact and one heuristic solutions for six instances.The algorithm based on a new solution representation improves the running time of the algorithm based on two IPproblems.

1. Introduction

The rectilinear block packing problem is the problem of packing a set of arbitrarily shaped rectilinear blocks intoa larger rectangular container, where the rectilinear blocks are polygonal blocks whose interior angles are either 90◦ or270◦. Given a set of rectilinear blocks, also called items, and a container with fixed width and unrestricted height, thetask is to pack all the items into the container without overlapping so as to minimize the height of the container. Thisproblem involves many industrial applications, including VLSI design, timber/glass/cloth cutting, and newspaper layout.The rectilinear block packing problem is among the classical combinatorial optimization problems and is known to beNP-hard (Baker et al., 1980).

The rectangle packing problem is a special case of the rectilinear block packing problem. Many efficient heuristicalgorithms for rectangle packing have been proposed including simulated annealing (Dowsland, 1993) and quasi-humanheuristic algorithm (Wu et al., 2002). Many exact algorithms for the rectangle packing problem are also proposed inpapers such as Cote et al. (2014), Kenmochi et al. (2009) and Martello et al. (2002). The exact algorithm proposed byCote et al. (2014) obtains an optimal solution for the rectangle packing problem by alternately enhancing the lower andupper bounds until the gap between these bounds becomes non-positive.

Since rectilinear blocks have properties similar to rectangles, Hu et al. (2015) generalized two construction heuris-tics, the bottom-left and the best-fit algorithms, which were originally proposed for rectangle strip packing, to solve therectilinear block packing problem. However, such generalizations are not always possible because shapes of rectilinearblocks are more complex than those of rectangles, and it is difficult to represent the relationship among rectilinear blocks

1

Exact algorithms for the rectilinear block packing problem

Received: 11 December 2017; Revised: 1 April 2018; Accepted: 20 May 2018

Keywords : Strip packing, Rectilinear blocks, Solution representation, Branch and bound, Exact algorithm

Page 2: Exact algorithms for the rectilinear block packing problem

2© 2018 The Japan Society of Mechanical Engineers[DOI: 10.1299/jamdsm.2018jamdsm0074]

Matsushita, Hu, Hashimoto, Imahori and Yagiura,Journal of Advanced Mechanical Design, Systems, and Manufacturing, Vol.12, No.3 (2018)

than those among rectangles. Most algorithms for the rectangle packing problem (e.g., Cote et al., 2014) exploit specialcharacteristics of rectangles, and they are difficult to be generalized to the case of the rectilinear block packing problem.For the rectilinear block packing problem, because of the complicated shapes of the rectilinear blocks, many of such niceproperties become invalid. Several schemes have been designed to represent the relationship among rectilinear blockssuch as the bounded-sliceline grid (BSG) (Kang and Dai, 1997; Nakatake et al., 1998), sequence-pairs (Fujiyoshi andKodama, 2007; Fujiyoshi and Murata, 2000; Kang and Dai, 1998; Xu et al., 1998), O-tree (Pang et al., 2001), B∗-tree(Wu et al., 2003), transitive closure graph (TCG) (Lin et al., 2002) and corner block list (CBL) (Ma et al., 2003). Mostheuristics based on these structures perform well for small-scale instances with up to 100 items in reasonable runningtime, and they are effective for instances consisting of rectilinear blocks of simple shapes (e.g., L- or T-shape). To the bestof our knowledge, no exact algorithm for the rectilinear block packing problem have been proposed in the literature.

In this paper, we propose exact algorithms for the rectilinear block packing problem. Our algorithms are based onthe Benders-like decomposition approach. (Although the framework of our algorithms is different the classical decom-position approach by Benders (1962), this type of algorithms are often called Benders-like decomposition or Benders’decomposition (Cote et al., 2014; Furini et al., 2015) due to their similarity.) We regard every rectilinear block as a set ofrectangles whose relative positions are fixed. We solve this problem by alternately calling two phases: one is to computea good lower bound on the value of an optimal solution of the currently active search space, and the other is to compute acorresponding upper bound.

In the phase of computing lower bounds, we relax the packing problem to a parallel processor scheduling problemin which each rectilinear block is cut into rectangles with width of one unit and only the horizontal relationship of theserectangles are fixed. This problem is regarded as a relaxation problem of the original rectilinear block packing problemand formulated as an integer programming (IP) problem. As a consequence, the optimal value of this relaxation problemcan be used as a lower bound on the optimal value of the rectilinear block packing problem, and we also obtain a set ofx-coordinates for rectilinear blocks.

In the second phase, we fix the x-coordinates of all the rectilinear blocks to those obtained by the relaxation problemand compute a feasible solution with the lowest height H of the rectilinear block packing problem. Solving this problem,we can obtain a feasible solution of the rectilinear block packing problem, and the objective value provides an upperbound on the optimal value of the original problem. In this problem, all the rectilinear blocks are packed as their originalshapes. Our first approach is to formulate this problem as another IP problem and solve it by an IP solver.

However, according to the computational results, it costs long time for this approach to compute upper bounds in theframework of our exact algorithm. To alleviate this, we propose a new solution representation scheme and a correspondingdecoding algorithm to obtain an optimal solution for the packing problem in which the x-coordinates of all blocks arefixed. The basic idea of our decoding algorithm is that given an order and a set of x-coordinates of rectilinear blocks,we compute a feasible layout by placing items according to the given order one by one at the lowest available place ontop of the items that have already been placed. We prove that there exists an order of items that leads to one of the bestlayouts among those in which the x-coodinate of every item is fixed to the given value. Note that the resulting best layoutcan be used as an upper bound of the original problem. We apply a branch-and-bound method to search for an optimalorder for the new solution representation. We consider an enumeration tree whose leaves correspond to orders, and theleft-most leaf corresponds to the nonincreasing order of the priority among the items. For each x-coordinate, we considerthe remaining space below the incumbent height and above the top of the items that have already been placed, and wecheck if this space is sufficient for the remaining items. If we conclude that the remaining space is not sufficient, we canterminate the node and backtracking follows. The check of remaining space can be done in an incremental manner so thatwhenever an item is placed, the time for the check is in the linear order of the width of the item.

The algorithm consists of two phases: phase one is to compute the lower bound on the objective values of thesolutions in the search space of all possible sets of x-coodinates of items; phase two is to compute the correspondingupper bound and add constraints to forbid the set of x-coordinates in the search space. We alternately call the two phasesto strengthen the corresponding lower and upper bounds (i.e., to reduce the gap between the lower and upper bounds)until we obtain an optimal solution.

We perform a series of experiments on six instances. The computational results show that the proposed methodsobtain exact solutions for five instances and a good heuristic solution for one instance.

2

Page 3: Exact algorithms for the rectilinear block packing problem

2© 2018 The Japan Society of Mechanical Engineers[DOI: 10.1299/jamdsm.2018jamdsm0074]

Matsushita, Hu, Hashimoto, Imahori and Yagiura,Journal of Advanced Mechanical Design, Systems, and Manufacturing, Vol.12, No.3 (2018)

2. Problem Description

A set R = {R1,R2, . . . ,Rn} of n rectilinear blocks is given. We are also given a rectangular container C with fixedwidth W and unrestricted height H. The task is to pack all the blocks into the container without overlap. It is assumed thatthe bottom left corner of the container is located at the origin of the coordinate axes O = (0, 0) with its four sides parallelto the x- or y-axis. The objective is to minimize the height H of the container that is necessary to pack all the blocks.Note that the minimization of the height of the container is equal to the maximization of the occupation rate definedby∑n

j=1A(R j)/WH, where A(R j) is the area of a rectilinear shape R j. This type of packing problem is often called thestrip packing problem (e.g., the rectangular strip packing problem for the rectangular case and the irregular strip packingproblem for the case of general shapes), and according to the improved typology of Wascher et al. (2007), strip packingproblems are categorized into the two dimensional open dimension problem (2D ODP) with a single variable dimension.Figure 1 shows an example of the rectilinear block packing problem. The layout of Figure 1 (c) is an example of packinglayout in which all items (Figure 1 (a)) are packed into the container (Figure 1 (b)) without overlap. The number ofrectilinear blocks n is 7. The task is to pack these seven items into the rectangular container so as to minimize the heightof the container.

Fig. 1: An example of the rectilinear block packing problem and a solution

We define the bounding box of a block R j as the smallest rectangle that covers R j, and its width and height are definedas w j and h j, respectivery. We define the bounding area of R j as the area of its bounding box, w jh j. The location of ablock R j is described by the coordinate (x j, y j) of its reference point, where the reference point of block R j is defined asthe bottom-left corner of its bounding box. For convenience, each rectilinear block and the container are regarded as theset of points (including both interior and boundary points) whose coordinates are determined from the origin O = (0, 0).A rectilinear block R j placed at v j = (x j, y j) is represented as the Minkowski sum R j ⊕ v j = {p + v j | p ∈ R j}. For arectilinear block R j, the interior of item R j is denoted as int(R j). Then the rectilinear block packing problem is formallydescribed as follows:

minimize H

subject to 0 ≤ x j ≤ W − w j, ∀ j ∈ [1, n] (1)

0 ≤ y j ≤ H − h j, ∀ j ∈ [1, n] (2)

int(Ri ⊕ vi) ∩ (R j ⊕ v j) = ∅, i , j. (3)

Constraints (1) and (2) require that all rectilinear blocks be packed inside the container. Constraint (3) requires thatthere exist no block overlapping with others. In this paper, we assume that the values given to represent instances areintegers (e.g., the heights and widths of rectilinear blocks and the container are integers). We concentrate on the casewhen all of the blocks are not allowed to be rotated and reflected.

3. Exact Algorithm

In this section, we propose an exact algorithm for the rectilinear block packing problem.

3.1. Basic ideaWe generalize the framework of the exact algorithm for the rectangle packing problem by Cote et al. (2014) to the

case of the rectilinear block packing problem. We treat a rectilinear block as a set of rectangles whose relative positionsare fixed. The basic idea of our exact algorithm is that we iteratively compute lower and upper bounds on the optimalvalue until the lower bound is larger than or equal to the upper bound, which implies that an optimal solution is found.

3

Page 4: Exact algorithms for the rectilinear block packing problem

2© 2018 The Japan Society of Mechanical Engineers[DOI: 10.1299/jamdsm.2018jamdsm0074]

Matsushita, Hu, Hashimoto, Imahori and Yagiura,Journal of Advanced Mechanical Design, Systems, and Manufacturing, Vol.12, No.3 (2018)

To compute a lower bound, we relax the rectilinear block packing problem to a parallel processor scheduling problem.In this relaxation problem, we represent each rectilinear block by a set of rectangles with width of one unit and the relativepositions in the horizontal direction between every pair of such rectangles from a rectilinear block are kept at their originalpositions while their relative positions in the vertical direction between them are ignored. We solve the relaxation of thepacking problem as an IP problem and obtain a lower bound on the optimal value of the original problem as well as aset of x-coordinates of the blocks. We then compute a feasible packing layout and the corresponding upper bound onthe optimal value of the rectilinear block packing problem. We formulate the problem of computing an upper bound asanother IP problem.

3.2. Method to compute a lower boundWe consider a relaxation problem of the rectilinear block packing problem in which each rectilinear block is cut into

a set of rectangles with width of one unit whose horizontal relative positions are fixed. We only consider the constraint onthe horizontal relationship of the positions among the rectangles that represent each rectilinear block (i.e., we ignore thevertical relationship among the rectangles that represent each rectilinear block). This problem is referred to as the parallelprocessor scheduling problem with contiguity constraints (Cote et al., 2014), which is denoted as P|cont|Cmax, for thefollowing reason. If each strip of width one in the container is regarded as the CPU resource of a machine and a rectanglesliced from a rectilinear block is regarded as the processing time of a job, the relaxation problem can be regarded as aparallel processor scheduling problem having an additional constraint that requires the rectangles from each rectilinearblock be assigned to contiguous places. Figure 2 shows an example of the P|cont|Cmax corresponding to an instance ofthe rectilinear block packing problem with four rectilinear blocks. The four rectilinear blocks in Figure 2 (a) are cut intorectangles with width one and are packed into the container as shown in Figure 2 (b), which is a feasible solution of theP|cont|Cmax. As the upper right rectilinear block in Figure 2 (a), in this problem, it is permitted to pack each rectangle ofthe same rectilinear block with transforming the original shape of the rectilinear block by ignoring their relative positionsin the vertical direction between them. Adding to this, the sequential order of rectangles of each rectilinear block shouldbe kept by fixing the horizontal relationship of the positions among the rectangles that represent each rectilinear blockwhen we pack these rectangles into the container.

Fig. 2: An example of the P|cont|Cmax

When relaxing the rectilinear block packing problem to P|cont|Cmax, we cut each rectilinear block R j into a set ofm j rectangles B j = {B j1, B j2, . . . , B jm j }, where the width of each rectangle is one. The height of rectangle B jk in B j isdenoted as h jk. Figure 3 shows an example of this cutting procedure where we cut rectilinear block R j into six rectangles.We pack every rectangle B jk of a rectilinear block R j with width six into the container and ignore the vertical relationshipon the positions among the rectangles in B j. Note that we keep the relative positions in the horizontal direction amongrectangles in B j.

Fig. 3: An example of representing a rectilinear block by a set of rectangles with width one

4

Page 5: Exact algorithms for the rectilinear block packing problem

2© 2018 The Japan Society of Mechanical Engineers[DOI: 10.1299/jamdsm.2018jamdsm0074]

Matsushita, Hu, Hashimoto, Imahori and Yagiura,Journal of Advanced Mechanical Design, Systems, and Manufacturing, Vol.12, No.3 (2018)

We solve the P|cont|Cmax as an IP problem. We define some variables for our formulation. The objective is tominimize the height H of the container. The binary decision variable x jp is a 0-1 variable associated with the jth rectilinearblock R j. If rectilinear block R j is packed at x-coordinate of p, then x jp = 1 and otherwise x jp = 0. The horizontal distancefrom B jk to the reference point of R j is denoted as d jk. As explained before, h jk is the height of B jk. The P|cont|Cmax canbe formulated as an IP problem as follows:

minimize H

subject to∑

p∈[0,W−w j]x jp = 1, ∀ j ∈ [1, n] (4)

∑j∈[1,n]

∑k∈[1,m j]

x j(q−d jk)h jk ≤ H, ∀q ∈ [0,W − 1] (5)

x jp ∈ {0, 1}, ∀ j ∈ [1, n], ∀p ∈ [0,W − w j] (6)

H ∈ {0, 1, 2, . . .}. (7)

The constraint (4) requires that every item be packed at exactly one x-coordinate. The constraint (5) requires that thetotal height of rectangles packed at every x-coordinate be not larger than H. It is easy to see that even if we do not imposethe constraint (7), variable H always takes an integer value in any optimal solution; hence we solve it as a mixed integerprogramming (MIP) problem in which (7) is not imposed.

By solving this P|cont|Cmax problem, we obtain a lower bound and a set of x-coordinates for the rectilinear blocks. Inthis paper, we denote the lower bound obtained by this method as HLB and the set of x-coordinates as x = (x1, x2, . . . , xn).

3.3. Method to compute an upper boundIn this section, we explain a method of computing an upper bound for the rectilinear block packing problem. We fix

the x-coordinates x = (x1, x2, . . . , xn) of all the rectilinear blocks to those obtained by the relaxation problem explained inSection 3.2 and compute a feasible solution with the lowest height H of the rectilinear block packing problem. Solvingthis problem, we can obtain a feasible solution of the rectilinear block packing problem, and the objective value providesan upper bound on the optimal value of the original problem. In this problem, all the rectilinear blocks are packed as theiroriginal shapes. This is done by solving a problem named the rectilinear block packing problem with fixed x-coordinates(RPP-X).

Fig. 4: An example solution obtained by solving RPP-X

This problem requires to pack all the rectilinear blocks into the container with width W and height H under theconstraint that x-coordinates are fixed to a set of given values. The objective of the RPP-X problem is to minimize theheight H of the container. By solving RPP-X, we can find a solution of the rectilinear block packing problem, and theobjective value provides an upper bound HUB on the optimal value of the original problem. In this problem, all therectilinear blocks must be packed as their original shapes, which is different from P|cont|Cmax. For the x-coordinatesgiven to RPP-X, we utilize the solution x obtained by solving the P|cont|Cmax. Because the x-coordinates are fixed, weonly need to consider the y-coordinates of the rectilinear blocks. Figure 4 is an example solution obtained by solvingRPP-X. In this example, we are given four rectilinear blocks that are the same as those used in Figure 2, and Figure 4 (a)shows a solution of the P|cont|Cmax. Figure 4 (b) shows a solution obtained by solving the RPP-X instance in which thex-coordinates of the four blocks are fixed to those of the solution to P|cont|Cmax in Figure 4 (a).

For computing an upper bound for the rectilinear block packing problem, the RPP-X is formulated as another IPproblem. A binary decision variable y jt is a 0-1 variable associated with rectilinear block R j. If rectilinear block R j is

5

Page 6: Exact algorithms for the rectilinear block packing problem

2© 2018 The Japan Society of Mechanical Engineers[DOI: 10.1299/jamdsm.2018jamdsm0074]

Matsushita, Hu, Hashimoto, Imahori and Yagiura,Journal of Advanced Mechanical Design, Systems, and Manufacturing, Vol.12, No.3 (2018)

packed at y-coordinate t, then y jt = 1 and otherwise y jt = 0. The RPP-X problem with a given set of x-coordinates x isdenoted as RPP-X(x) and can be formulated as an IP problem as follows:

minimize H

subject to∑

t∈[0,Hmax−h j]y jt = 1, ∀ j ∈ [1, n] (8)

∑t∈[0,Hmax−h j]

ty jt + h j ≤ H, ∀ j ∈ [1, n] (9)

no-overlap(Ri,R j), ∀i, j ∈ [1, n], i , j (10)

y jt ∈ {0, 1}, ∀ j ∈ [1, n],∀t ∈ [0,Hmax − h j] (11)

H ∈ {0, 1, 2, . . .}, (12)

where Hmax is a sufficiently large constant, and the way to describe the constraint (10) in linear inequalities is explainedlater. We can set Hmax to the value of the best upper bound because in case the optimal value of RPP-X is greater than orequal to the best upper bound, it is sufficient for our purpose to confirm this fact.

The objective is to minimize the height H of the container. The constraint (8) requires that each block be packed atexactly one y-coordinate. The constraint (9) requires that every block be packed inside the container. The constraint (10)requires that each block be packed without overlapping with other blocks. As in the case of P|cont|Cmax, even if we donot impose the constraint (12), variable H always takes an integer value in any optimal solution, and hence we solve it asa MIP problem in which (12) is not imposed.

Below we explain how we define the linear inequalities that describe the constraint (10). As in Section 3.2, we assumethat each rectilinear block is represented by a set of m j rectangles B j = {B j1, B j2, . . . , B jm j }. Note, however, that in thissection, the widths of these rectangles are not necessarily be one, because we would like to represent a rectilinear blockwith as small number of rectangles as possible. For example, the rectilinear block R j in Figure 3 can be represented bythree rectangles: one obtained by merging B j1, B j2 and B j3, another obtained by merging B j5 and B j6, and another definedby B j4. The width and the height of rectangle B jk are w jk and h jk, respectivery. The horizontal and vertical distances fromthe bottom-left corner of B jk to the reference point of R j are d jk and s jk, respectively. Any pair of two rectilinear blocksRi and R j do not overlap with each other if and only if every pair of rectangles Bil and B jk in Bi and B j, respectively, donot. Because the x-coordinates of all rectilinear blocks are fixed, the only situation when Bil possibly overlaps with B jk iswhen the following inequality is satisfied:

x(k)j − wil < x(l)

i < x(k)j + w jk, (13)

where x(l)i and x(k)

j are the x-coordinates of the bottom-left corner of Bil and B jk (e.g., x(l)i = xi+dil). If the above inequality

is satisfied, we need to consider the vertical relationship between Bil and B jk. When (13) is satisfied, rectangle Bil overlapswith B jk if and only if the following is satisfied:

y(k)j − hil < y

(l)i < y

(k)j + h jk, (14)

where y(l)i and y(k)

j are the y-coordinates of the bottom-left corner of Bil and B jk (e.g., y(l)i = ti + sil if rectilinear block Ri is

placed at (xi, ti)). Denoting the y-coordinates of Ri and R j as ti and t j, respectivery, the constraint (14) is equivalent to

t j + s jk − hil < ti + sil < t j + s jk + h jk. (15)

To forbid such placements, we prepare a constraint

yi, ti + y j, t j ≤ 1, (16)

for such a pair of ti and t j. To summarize, the constraint (10) is described by inequalities (16) for all pairs of ti and t j thatsatisfy (15) for every pair of rectangles Bil and B jk that satisfy (13).

We can obtain an upper bound that equals the objective value, and a solution of the rectilinear block packing problemwith the given x-coordinates of blocks by solving the RPP-X instance. The upper bound computed by this approach isdenoted as HUB and the solution of the rectilinear block packing problem as (x, y), where x is the set of x-coordinatesobtained by solving the P|cont|Cmax and y is the corresponding set of y-coordinates obtained by solving RPP-X(x).

In Sections 3.2 and 3.3, we described two problems, the P|cont|Cmax and the RPP-X to compute the lower and upperbounds for the rectilinear block packing problem.

6

Page 7: Exact algorithms for the rectilinear block packing problem

2© 2018 The Japan Society of Mechanical Engineers[DOI: 10.1299/jamdsm.2018jamdsm0074]

Matsushita, Hu, Hashimoto, Imahori and Yagiura,Journal of Advanced Mechanical Design, Systems, and Manufacturing, Vol.12, No.3 (2018)

3.4. Implementation of the exact algorithmIn this section, we explain our exact algorithm for the rectilinear block packing problem utilizing the methods of

solving the P|cont|Cmax and RPP-X. Our algorithm consists of two phases: Phase one is to compute an optimal solution tothe P|cont|Cmax with the search space S of all possible sets of x-coodinates of items. The objective value of the obtainedoptimal solution gives a lower bound on the optimal solution value of the original packing problem. Phase two is tocompute an upper bound and to reduce search space S . In this phase, we first check whether the set of x-coordinates xobtained in phase one has potential to generate a better solution value than the incumbent value before we exactly solvethe corresponding rectilinear block packing problem RPP-X(x) with x-coordinates fixed to those of x. If we find thatx will not generate a better solution, we add constraints to the model of P|cont|Cmax to exclude from the current searchspace S , those solutions x including the combinations of x-coordinates that prevent x from generating a better solution.Otherwise, we compute an optimal solution to RPP-X(x). The height of the strip of the obtained solution is an upperbound on the optimal solution value of the original problem. Whenever RPP-X(x) is solved, we add a constraint to themodel to exclude x from S because it is not necessary to check x again. We alternately call these two phases to strengthenlower and upper bounds until we obtain an optimal solution. We named this exact algorithm the successive search spacereduction (SSSR) algorithm.

In the beginning, when phase one is invoked for the first time, we solve the P|cont|Cmax problem explained inSection 3.2, obtaining a set of x-coordinates x for all the blocks in R and a lower bound LB on the optimal value of therectilinear block packing problem. We define X as a set of solutions of P|cont|Cmax and initialize X := ∅, which is usedto exclude from the search space S of P|cont|Cmax in the subsequent iterations, those solutions that will not improve theincumbent solution. This is realized by adding the following constraint

∑j∈[1,n]

∑p∈[0,W−w j]

x′jpx jp ≤ ∑

j∈[1,n]

∑p∈[0,W−w j]

x′jp

− 1 (17)

to the IP formulation of P|cont|Cmax in Section 3.2 for every x′ ∈ X (note that x′jp are constants and x jp are variables).Note that a solution x′ ∈ X may correspond to the x-coordinates of a subset R′ of items, and for items R j not in subsetR′, x′jp = 0 holds for all p ∈ [0,W − w j], implying that the right-hand side of constraint (17) becomes smaller and theconstraint is stronger. From the second call, phase one solves the P|cont|Cmax model with additional constraints (17) forall x′ ∈ X.

In phase two, for the solution x obtained by solving the P|cont|Cmax in phase one, we first check by applying the fol-lowing two tests (which are usually much quicker than solving RPP-X(x)), whether there exists a possibility of generatinga better solution value than the incumbent value.

In the first test TestA, we focus on the vertical strip C[p,p+1] = {(x, y) | p ≤ x ≤ p + 1, y ≥ 0} of width one insidethe container for each p = 0, 1, . . . ,W − 1 and consider the height of portions of items overlapping with C[p,p+1] in thelayout corresponding to x. To be more precise, let p-height of an item R j be the sum of the heights of the portions of R j

overlapping with C[p,p+1]. Let JA(p) be the set of indices of all items that have overlap with C[p,p+1], which can be definedas

JA(p) = { j | x j ≤ p, p + 1 ≤ x j + w j}.

We define hTestA(p) to be the sum of p-heights of R j for all j ∈ JA(p). If hTestA(p) is larger than or equal to the incumbentvalue, we say that TestA succeeded for p, which implies that the height of any feasible layout of the rectilinear blockpacking problem with fixed x-coordinates, RPP-X(x), must be larger than or equal to the incumbent value. In this case,we add the following x′ to X: x′jq = x jq (resp., x′jq = 0) for all j ∈ JA(p) (resp., j < JA(p)) and q ∈ [0,W − w j]. We repeatthis test from p = 0 to p = W − 1, adding x′ to X whenever TestA succeeded. If TestA succeeded for at least one p, weskip the second test and return to phase one without solving RPP-X(x).

In the second test TestB, we consider a subproblem in which we select a subset of items from R and solve a restrictedinstance of RPP-X(x). In this test, we focus on the vertical strip C[p−1,p+2] = {(x, y) | p − 1 ≤ x ≤ p + 2, y ≥ 0} of widththree inside the container for each p = 1, 2 . . . ,W − 2 and pick up all items overlapping with C[p−1,p+2]. Let JB(p) be theset of indices of all items that have overlap with C[p−1,p+2], which can be defined as

JB(p) = { j | x j ≤ p + 1, p ≤ x j + w j}.

We solve the problem RPP-X(x) restricted to items R j for all j ∈ JB(p), which is referred to as RPP-X(x, p). Let hTestB(p)be the optimal value of RPP-X(x, p). If hTestB(p) is larger than or equal to the incumbent value, we say that TestB

7

Page 8: Exact algorithms for the rectilinear block packing problem

2© 2018 The Japan Society of Mechanical Engineers[DOI: 10.1299/jamdsm.2018jamdsm0074]

Matsushita, Hu, Hashimoto, Imahori and Yagiura,Journal of Advanced Mechanical Design, Systems, and Manufacturing, Vol.12, No.3 (2018)

succeeded for p, which implies that the height of any feasible layout of the rectilinear block packing problem with fixedx-coordinates, RPP-X(x), must be larger than or equal to the incumbent value. In this case, we add the following x′ toX: x′jq = x jq (resp., x′jq = 0) for all j ∈ JB(p) (resp., j < JB(p)) and q ∈ [0,W − w j]. We repeat this test from p = 1to p = W − 2, adding x′ to X whenever TestB succeeded. If TestB succeeded for at least one p, we return to phase onewithout solving RPP-X(x).

It usually takes more time to solve RPP-X(x) than to apply TestA and TestB. Futhermore, the constraints obtained byTestA and TestB forbid solutions that have the same x-coordinates with those of x for all items in a (usually small) subsetof items, which means that they are stronger (in the sense that they exclude more solutions from search space S ) than theconstraint that forbids only x, the constraint added to X when RPP-X(x) is solved. For these reasons, it is advantageous toapply these two tests in reducing the time for phase two, and in reducing the total number of iterations by excluding moresolutions from the search space S of the restricted P|cont|Cmax in each iteration.

When the above two tests did not succeed, which implies that x potentially leads to a better solution than the incum-bent value, we solve RPP-X(x), obtaining a set of y-coordinates y for the rectilinear blocks and an upper bound HUB givenby the height of the obtained layout. After that we add x to X and return to phase one.

In each iteration of these two phases, we add at least one set of x-coodinates into X, which reduces the size of S byat least one. With this mechanism, we repeatedly reduce S and compute the corresponding lower bounds until a lowerbound on the objective values of solutions in S is larger than or equal to the best upper bound, which means that anoptimal solution is found.

The SSSR algorithm is formally described in Algorithm 1. In Algorithm 1, UB is the best upper bound (i.e., theincumbent value), (x∗, y∗) is the incumbent solution, and LB is a lower bound on the objective values of the solutions inS , where we initialize UB by UB := UBHEU with UBHEU the objective value of the solution (xHEU, yHEU) obtained by theheuristic algorithm by Hu et al. (2015).

Algorithm 1 SSSR algorithm1: Let UB := UBHEU, (x∗, y∗) := (xHEU, yHEU) and X := ∅.2: Solve the P|cont|Cmax problem with constraints (17) for all x′ in X, and obtain LB and x if the problem is feasible. Otherwise, output the

solution (x∗, y∗) and stop.3: Let succFlag := 0. Then apply TestA for each p = 0, 1, . . . ,W − 1:

If hTestA(p) ≥ UB holds, let succFlag := 1 and add the correspoonding x′ (defined by x and JA(p)) to X.4: If succFlag = 1, return to Step 2.5: Apply TestB for each p = 1, 2, . . . ,W − 2:

If hTestB(p) ≥ UB holds, let succFlag := 1 and add the correspoonding x′ (defined by x and JB(p)) to X.6: If succFlag = 1, return to Step 2.7: Solve RPP-X(x) and obtain HUB and y.8: If HUB < UB, update UB := HUB, x∗ := x and y∗ := y.9: If LB < UB, update X := X ∪ {x} and return to Step 2. Otherwise (i.e., LB ≥ UB), output the solution (x∗, y∗) and stop.

4. New Solution Representation

In Section 3.3, we proposed a method to compute an upper bound. However, this method takes much time to computean upper bound, especially for items that have complicated shapes. To alleviate this, in this section, we propose a newsolution representation scheme, which is based on an order of items, to decide a layout of rectilinear blocks whose x-coordinates are fixed. The basic idea of this approach is described in Section 4.1. In Section 4.2, we explain the definitionof x-monotone and connected rectilinear blocks. In Section 4.3, we explain how to compute a layout based on ourrepresentation. In Section 4.4, we show the guarantee of the optimality of our representation scheme in the sense that forany problem instance, there is always a solution representation that corresponds to an optimal solution.

4.1. Basic ideaThe basic idea is that given a set of x-coordinates of rectilinear blocks and an order of items to pack, we compute a

layout by placing items according to the given order one by one at the lowest available place on top of the items that havealready been placed. This idea may miss optimal layouts if directly applied to the case of general rectilinear shapes. Weprove that there exists an order of items that leads to an optimal layout for the case in which every rectilinear block is anx-monotone connected shape whose definitions are given in Section 4.2. We generalize this result to the case of generalshapes in Section 4.5; the idea is to divide each rectilinear block into a set of x-monotone connected pieces whose relativepositions are fixed and then consider an order of the resulting x-monotone connected pieces of all rectilinear blocks.

8

Page 9: Exact algorithms for the rectilinear block packing problem

2© 2018 The Japan Society of Mechanical Engineers[DOI: 10.1299/jamdsm.2018jamdsm0074]

Matsushita, Hu, Hashimoto, Imahori and Yagiura,Journal of Advanced Mechanical Design, Systems, and Manufacturing, Vol.12, No.3 (2018)

4.2. x-monotone and connected rectilinear blocksA rectilinear block is x-monotone if its intersection with any vertical line (i.e., a line parallel to the y-axis) forms

one line segment (or is empty). Similarly, a curved line is x-monotone if its intersection with any vertical line is a point(or is empty). Some examples of shapes that are x-monotone and not are shown in Figure 5. We can see that for arectilinear block that is not x-monotone, e.g., blocks E and F in Figure 5, there exist vertical lines whose intersection withthe rectilinear block forms two line segments.

Fig. 5: Examples of items that are x-monotone and not

A rectilinear block Ri is connected if its interior int(Ri) is path-connected, which means that any two points in the setcan be connected by a continuous curved line that does not touch its border. Examples of items that are connected andnot are shown in Figure 6. For an item that is not connected, there exist two points which cannot be connected by anycontinuous curved line that does not touch its border. Note that the right-most item in the figure, which consists of tworectangles that touch each other at a point, is not connected. For an x-monotone and connected rectilinear block, we havethe following property.

Fig. 6: Examples of items that are connected and not

Property 4.1 If a rectilinear block is x-monotone and connected, any two points in its interior can be connected by acontinuous x-monotone curved line and this line does not touch its border.

In Figure 5, only items A and B are x-monotone and connected. Items C and D are not connected, and E and F arenot x-monotone.

Definition 4.1 Two items Ri and R j are defined to have a common x-coordinate if both items have interior points at acommon x-coordinate (i.e., there exist two points (x, yi) ∈ int(Ri) and (x, y j) ∈ int(R j)).

Lemma 4.1 For any two connected x-monotone items Ri and R j that are placed without overlap, if for the vertical line ata common x-coordinate, the intersection of the vertical line with Ri is below that with R j, then this order is the same (i.e.,the intersection with Ri is below that with R j) for every common x-coordinate.

See Appendix A for the proof of Lemma 4.1.

4.3. Decoding of the solution representationAssuming that every rectilinear block is x-monotone and connected and their x-coordinates are fixed, we explain

how to decide from a given order σ, the y-coordinates of rectilinear blocks.

9

Page 10: Exact algorithms for the rectilinear block packing problem

2© 2018 The Japan Society of Mechanical Engineers[DOI: 10.1299/jamdsm.2018jamdsm0074]

Matsushita, Hu, Hashimoto, Imahori and Yagiura,Journal of Advanced Mechanical Design, Systems, and Manufacturing, Vol.12, No.3 (2018)

In our approach, all the items are packed one by one according to the order σ. In each step, when we pack item R j, itis placed at the lowest available position above every item Ri that has already been placed and has a common x-coordinatewith R j. As a result, for each vertical line, items having intersection with the line are placed in the same order as σ frombottom to top in the container.

To compute the y-coordinate for each item R j efficiently, the algorithm maintains a skyline of the upper edges of allplaced rectilinear blocks in the container. The skyline of a packing layout is the set of points that can be seen from aninfinitely high position. A skyline consists of a set of segments, where each segment touches the upper edge of a rectilinearblock in the container or the bottom edge of the container. Any two adjacent segments have different heights and exactlyone x-coordinate in common. Our approach packs items one by one in the order of σ, each at the lowest position above theskyline. We represent the skyline by an array h sky[1..W] of length W, where h sky[p] (p = 1, 2, . . . ,W) represents theheight of the skyline for x ∈ (p − 1, p). We also prepare, for each rectilinear block R j, an array that represents the heightsof the bottom boundary relative to the reference point for each x = 1, 2, . . . , w j, and another array for the top boundary.Then for each R j, we can compute the lowest y-coordinate of R j above the skyline in O(w j) time, and after packing R j,we can update the array for the skyline in O(w j) time. The total computation time of the decoding procedure is thereforeO(wsum), where wsum is the sum of the widths w j of bounding boxes for all items (i.e., wsum =

∑jw j).

We call the solution representation scheme based on this decoding algorithm the Permutation Solution Representation(PSR).

4.4. Proof of the optimalityIn this section, we prove that our approach explained in Section 4.3 guarantees that it will not miss an optimal

solution to the rectilinear block packing problem when the given blocks are x-monotone and connected. To prove this, wefirst show the following lemma (see Appendix A for the proof of Lemma 4.2).

Lemma 4.2 Suppose that functions f (x), g(x) : [l, r]→ R (l < r) satisfy the following conditions:

• Functions f (x) and g(x) are continuous in [l, r] except at a finite number of points.

• For every point x ∈ [l, r] at which f (x) or g(x) is discontinuous,

limε→+0

f (x − ε) ≤ f (x) ≤ limε→+0

f (x + ε) and

limε→+0g(x − ε) ≥ g(x) ≥ lim

ε→+0g(x + ε)

hold. (Note that when x = l (resp., x = r), the left-hand (resp., right-hand) sides of these conditions are notimposed.)

Then, if f (l) > g(l) and f (r) < g(r) hold, there is a point a ∈ (l, r) such that f (a) = g(a) holds.

Theorem 4.1 Suppose that the given items are connected and x-monotone, and their x-coordinates are given. Then thereexists an order of items σ such that an optimal layout is obtained by applying the procedure in Section 4.3 to σ.

Proof It is trivial to see that there is an optimal layout among bottom stable layouts, where a layout is bottom stable ifno items can move downward (without overlapping with others or protruding from the container). We prove that for anybottom stable optimal layout, there exists an order that generates the optimal layout.

We define a directed graph G1 whose vertices correspond to items and a directed edge is drawn from the vertexcorresponding to item Ri to that corresponding to R j if and only if they have a common x-coordinate and Ri is below R j.From Lemma 4.1, for any two items that have a common x-coordinate, the order of items on any vertical line is identical,and hence there is only one arc between any such pair of items. Below we show that the resulting directed graph G1 isacyclic. If we can show that, the proof of Theorem 4.1 will complete because then it is clear that there exists an order thatdoes not contradict the order implied by the graph (i.e., if there is an edge from a to b, then a is before b in the order), andby placing items in this order with the rule in the theorem, we will obtain the specified optimal layout.

Suppose that the graph G1 has a cycle. Two vertices (corresponding to items Ri and R j) connected by an arc inthe cycle have at least one common x-coodinate x, and we can draw a vertical arrow (i.e., a vertical line segment with

10

Page 11: Exact algorithms for the rectilinear block packing problem

2© 2018 The Japan Society of Mechanical Engineers[DOI: 10.1299/jamdsm.2018jamdsm0074]

Matsushita, Hu, Hashimoto, Imahori and Yagiura,Journal of Advanced Mechanical Design, Systems, and Manufacturing, Vol.12, No.3 (2018)

the upward direction) at x from an interior point in Ri to another in R j. Because for a sufficiently small ε > 0, theε-neighborhood of an inner point of an item is contained in the item, the end points of such a vertical arrow can alsobe taken from such neighborhoods; hence there is flexibility in deciding the x-coodinate to draw such arrows. Then, itis possible to draw all vertical arrows in the cycle in such a way that their x-coordinates are different from each other.Moreover, from Property 4.1, for each vertex in the cycle corresponding to item R j, assuming that the incoming (resp.,outgoing) arc is connected to the vertex corresponding to Ri (resp., Rk), the two inner points in R j, one at the head of thearrow from Ri to R j and another at the tail of the arrow from R j to Rk, can be connected by a continuous x-monotonecurved line. Figure 7 shows an example of the continuous x-monotone curved line between two interior points in item R j.

Fig. 7: An example of the continuous x-monotone curved line between two inner points in anitem

For the set of such vertical arrows, the leftmost arrow is defined as l0, and the rightmost arrow as r0. From the abovedefinitions, l0 and r0 can be determined uniquely. When the set of curved lines are traced following the direction of thecycle, the curved line traced from left to right is referred to as a line-to-right and that from right to left as a line-to-left.The path consisting of only lines-to-right from l0 and vertical arrows is referred to as S r

1, and the subsequent path fromthe first line-to-left immediately after the last vertical arrow of S r

1, named l1, to the line just before the next line-to-right isreferred to as S l

1, with the last vertical arrow of S l1 referred to as l2. The sequence of the subsequent lines-to-right is then

referred to as S r2 and so forth. An example of such lines-to-right and lines-to-left is shown in Figure 8.

Fig. 8: An example of lines-to-right and lines-to-left

Let the x-coordinates of l0, l1 and l2 be x0, x1 and x2. Each line-to-right or line-to-left can be defined as a continuousfunction that returns the y-coordinate of each point in the curved line for each x-coordinate. Then let f r

1 (x) be the functionrepresenting S r

1, where we define f r1 (x) = limε→+0 f r

1 (x+ε) at every discontinuous point x in the interval (x0, x1). From theabove definition, we have limε→+0 f r

1 (x− ε) < f r1 (x) for every such point x. Similary, let f l

1(x) be the function representingS l

1, where we define f l1(x) = limε→+0 f l

1(x+ε) at x = x2 and at every discontinuous point x in the interval (x2, x1). From theabove definition, limε→+0 f l

1(x − ε) > f l1(x) holds at every discontinuous point in (x2, x1). We also set the values of f r

1 (x1)and f l

1(x1) to f r1 (x1) = limε→+0 f r

1 (x1−ε) and f l1(x1) = limε→+0 f l

1(x1−ε). Then, from Lemma 4.2, we have f r1 (x2) < f l

1(x2)at x2, because otherwise we would have an x ∈ (x2, x1) that satisfies f r

1 (x) = f l1(x), which contradicts the assumption that

no two items overlap. From this fact, together with the fact that the leftmost point pr2 on the leftmost line-to-right in S r

2 isabove the leftmost point pl

1 on the leftmost line-to-left in S l1 by the definition, we can conclude that point pr

2 is above thepoint pr

1 on the line-to-right in S r1 at x2. Then, we delete S l

1 and the right part of S r1 from x2 to x1 to convert the sequence

of lines in S r1, S l

1 and S r2 to a new sequence consisting of only lines-to-right. Figure 9 is an example of this transformation.

By iterating the above transformation, a sequence S r0 consisting of only lines-to-right from l0 to r0 can be obtained.

11

Page 12: Exact algorithms for the rectilinear block packing problem

2© 2018 The Japan Society of Mechanical Engineers[DOI: 10.1299/jamdsm.2018jamdsm0074]

Matsushita, Hu, Hashimoto, Imahori and Yagiura,Journal of Advanced Mechanical Design, Systems, and Manufacturing, Vol.12, No.3 (2018)

Fig. 9: An example of converting the original set of lines to a sequence of only lines-to-right

By the symmetric argument, we can obtain a sequence S l0 consisting of only lines-to-left from r0 to l0. Besed on the above

definition, S r0 is located under S l

0 at r0 and S r0 is located over S l

0 at l0. By defining functions for S r0 and S l

0 in the sameway as f r

1 (x) and f l1(x) for S r

1 and S l1, we can apply Lemma 4.2 to show that there exists an intersection between S r

0 andS l

0. This contradicts the assumption that all continuous x-monotone items are packed without overlap. Hence, the graphG1 is acyclic, and this completes the proof of Theorem 4.1.

4.5. Generalization to arbitrarily shapesFor the case when the given rectilinear blocks have general shapes, we cannot directly apply the approach in Sec-

tion 4.3, because it may miss optimal solutions. Figure 10 shows an example of this situation. In this example, there arethree items, A, B and C, and the packing layout on the left is the unique optimal layout. However, for all orders, we cannotget this optimal solution by the decoding algorithm in Section 4.3. One may think that we should modify the placing ruleso that each item can be placed at the lowest possible place in the layout (instead of “the lowest place above the skyline”in our rule in Section 4.3); however, even with this modification, the optimal layout cannot be obtained by any order asshown in Figure 11.

We modify our approach in a different way and show that the resulting approach will not miss optimal solutions. Thebasic idea is to divide each rectilinear block into x-monotone connected pieces and consider orders of the resulting pieces.

Fig. 10: A counter example

Fig. 11: A counter example of another placing rule

We first divide each item R j by horizontal lines so that it is represented by a set of x-monotone and connected pieces.Examples of this procedure are shown in Figure 12.

We then consider orders of all x-monotone pieces generated by dividing all the items into x-monotone connectedpieces. We pack all x-monotone connected pieces in a given order by the rule in Section 4.3. The resulting layout may

12

Page 13: Exact algorithms for the rectilinear block packing problem

2© 2018 The Japan Society of Mechanical Engineers[DOI: 10.1299/jamdsm.2018jamdsm0074]

Matsushita, Hu, Hashimoto, Imahori and Yagiura,Journal of Advanced Mechanical Design, Systems, and Manufacturing, Vol.12, No.3 (2018)

Fig. 12: Examples of dividing items

not be feasible, because pieces divided from an item may be placed in a separated manner. We therefore need to modifythe y-coordinates of the pieces so that every rectilinear block is placed in its original shape. For example, in Figure 13, arectilinear block R j is divided into two pieces R1

j and R2j and R1

j is placed below R2j . Then we need to move R1

j upwarduntil it touches another piece, obtaining the original shape of R j.

Fig. 13: An example of modifying the y-coordinates of pieces

We now consider the problem of modifying the y-coordinates of pieces to make every item in its original shape andto minimize the height of the container H. For each piece P j, let y j be the variable representing the y-coordinate of pieceP j, where we assume that y j represents the bottom y-coordinate of the bounding box of P j. We define E1 to be the setof ordered pairs (i, j) such that (i, j) ∈ E1 if and only if pieces Pi and P j are from different rectilinear blocks and thereexists a common x-coordinate x′ at which Pi is below P j and no other piece is between them on the vertical line at x′. ByLemma 4.1, at most one of (i, j) and ( j, i) is in E1 for each pair of i and j. To ensure that no two pieces from differentrectilinear blocks overlap with each other, we impose a constraint

y j ≥ yi + di j

for each (i, j) ∈ E1, where di j is the minimum vertical distance between Pi and P j necessary to separate them. We thenconsider the constraint that requires every rectilinear block to become its original shape. Suppose that rectilinear block R j

is divided into pieces P j1 , P j2 , . . . , P jk ; then E2( j) is defined to be E2( j) = {( jl, jl+1) | l ∈ {1, 2, . . . , k − 1}}. From these, wedefine E2 =

∪nj=1 E2( j). The constraint is then represented as

y jl+1 = y jl + d jl jl+1

for each ( jl, jl+1) ∈ E2, where d jl jl+1 is the vertical distance between two pieces P jl and P jl+1 in the original shape of R j.From these, the problem is formulated as the following linear program (LP):

minimize H (18)

subject to y j ≥ yi + di j, ∀(i, j) ∈ E1 (19)

y j = yi + di j, ∀(i, j) ∈ E2 (20)

H ≥ y j + h(P j), ∀ j (21)

y j ≥ 0, ∀ j, (22)

where h(P j) is the height of the bounding box of piece P j.This problem can be reduced to the longest path problem (in which it is allowed to visit a vertex more than once) on

the graph G = (V, E) defined as follows. The vertex set V consists of vertices v j corresponding to pieces P j and source vsand sink vt. The edge set E consists of

13

Page 14: Exact algorithms for the rectilinear block packing problem

2© 2018 The Japan Society of Mechanical Engineers[DOI: 10.1299/jamdsm.2018jamdsm0074]

Matsushita, Hu, Hashimoto, Imahori and Yagiura,Journal of Advanced Mechanical Design, Systems, and Manufacturing, Vol.12, No.3 (2018)

• edge (vi, v j) with weight di j for every (i, j) ∈ E1,

• edges (vi, v j) and (v j, vi) with weights di j and −di j, respectively, for every (i, j) ∈ E2, and

• edges (vs, v j) and (v j, vt) with weights 0 and h(P j), respectively, for every piece P j.

Then it is not hard to see that the longest path length from vs to v j gives the value of y j, and that from vs to vt gives theheight H, of an optimal solution to the LP problem when it is feasible. When the LP problem is infeasible, there is apositive cycle in the graph and the longest path length becomes infinity.

The problem of finding longest paths from vs to the other vertices can be regarded as the shortest path problem onthe same graph G with weight for each edge multiplied by −1, which can be solved in polynomial time (O(|V ||E|) time byusing the Bellman–Ford algorithm (Bellman, 1958)). We define m as the number of pieces that represent all rectilinearblocks. Then |V | = O(m) and it is not hard to show that |E| = O(m) holds by a similar argument as in the analysis ofAlgorithm P2SP-1 in Appendix A of Imahori et al. (2003). Hence we can solve the above problem in O(m2) time.

If the LP problem is feasible, we obtain a feasible layout. Otherwise, we fail, which means that the order of piecesdoes not correspond to a feasible layout. This solution representation scheme, together with the above decoding procedure,is referred to as the permutation solution representation for general shapes (PSR-G). We show that there exists an order ofpieces such that the above decoding procedure leads to an optimal layout.

Theorem 4.2 For any instance of the rectilinear block packing problem, and for any way of cutting the given rectilinearblocks into connected x-monotone pieces, there exists a permutationσ of the pieces such that an optimal layout is obtainedby applying the decoding procedure of PSR-G to σ.

Proof We prove this theorem with the following two steps.

• From an optimal layout y∗, define an order σ of the connected x-monotone pieces.

• Prove that the y-coordinates obtained by applying the decoding procedure to the order σ leads to a layout havingthe same height as the specified optimal solution y∗.

Suppose that y∗ is an optimal solution. For convenience, we use y∗ to denote the set of y-coordinates of rectilinearblocks, as well as those of the corresponding connected x-monotone pieces, in the optimal layout. From the positionsspecified by y∗, we move each piece downward as low as possible. Then, a bottom-stable layout of the resulting x-monotone pieces is obtained. We name this layout Layout 1. For the derected acyclic graph G1 (defined in the proof ofTheorem 4.1) corresponding to Layout 1, we define the solution representation σ to be a linear extension of the partialorder specified by G1.

We first show by induction that Layout 1 is always obtained by applying the decoding procedure in Section 4.3 toσ. We denote by σ(k) the index of the kth piece in σ, and by v j the vertex in G1 corresponding to piece P j. When wepack the first piece Pσ(1), it is packed at the bottom of the container because no pieces have been packed. Then, we canshow that this y-coordinate of Pσ(1) is the same as that in Layout 1 for the following reason. The fact that it is at the firstplace in σ implies that there is no incoming arc to vσ(1) in G1, which means that in Layout 1, for any x-coordinate x′,there is no piece below Pσ(1) on the vertical line at x′. This fact, together with the fact that Layout 1 is bottom-stable,Pσ(1) must be at the bottom of the container in Layout 1. Suppose that just before Pσ(k) (k ≥ 2) is packed, all piecesPσ(1), Pσ(2), . . . , Pσ(k−1) have been packed at the same positions as those in Layout 1. When we pack the kth piece Pσ(k),all pieces that support Pσ(k) from below (i.e., those pieces that prevent Pσ(k) from moving downward) in Layout 1 havealready been packed (i.e., all such pieces are in {Pσ(1), Pσ(2), . . . , Pσ(k−1)}), because the order σ is a linear extention of thepartial order defined by G1 and hence all vertices from which arcs are connected to vσ(k) are in {vσ(1), vσ(2), . . . , vσ(k−1)}. Bythe inductive hypothesis, all such pieces are at the same positions as those in Layout 1. Because Layout 1 is bottom-stable,and the decoding procedure places Pσ(k) at the lowest possible place above such pieces, the decoding procedure placesPσ(k) at the same position as that in Layout 1. Therefore, the same layout as Layout 1 is obtained from the order σ by thedecoding procedure.

Next, we prove that by applying to Layout 1 the procedure of modifying the y-coordinates of pieces to make allrectilinear blocks in their original shapes, we obtain a solution (i.e., a layout of rectilinear blocks) with the same heightas the specified optimal solution y∗. In the process of modifying y∗ to Layout 1 to make all pieces bottom-stable, everypiece is continuously moved downward in such a way that it does not overlap with others during the process. This

14

Page 15: Exact algorithms for the rectilinear block packing problem

2© 2018 The Japan Society of Mechanical Engineers[DOI: 10.1299/jamdsm.2018jamdsm0074]

Matsushita, Hu, Hashimoto, Imahori and Yagiura,Journal of Advanced Mechanical Design, Systems, and Manufacturing, Vol.12, No.3 (2018)

implies that for every pair of pieces having a common x-coordinate, the vertical order between them in y∗ is the sameas that in Layout 1. From this fact, together with the fact that constrains (19) of the LP problem are imposed in such away that Layout 1 satisfies them, we can see that constraints (19) are also satisfied by y∗. It is obvious that y∗ satisfiesconstraints (20) because y∗ is a layout before dividing rectilinear blocks into connected x-monotone pieces. Therefore, y∗

is included in the feasible region of the LP problem, and hence the optimal solution value of the LP problem cannot beworse than the objective function value of y∗, implying that the layout obtained by solving the LP problem has the optimalheight. □

4.6. Branch-and-bound method to find an optimal orderIn this section, we explain the method to generate orders of pieces that are used for PSR. Note that the number of

all possible orders is m!/(m1!m2! · · ·mn!), where m j is the number of x-monotone connected pieces that represent therectilinear block R j and m =

∑nj=1m j. To decide the search order of branches in the search tree of the branch-and-bound

method, we consider priority among items. We set higher priority to a piece when the area of the rectilinear block thatgenerates that piece is larger, and among the pieces generated from the same rectilinear block, higher priority is givento a piece cut from a lower part of the item. We consider an enumeration tree whose leaves correspond to orders, andthe left-most leaf corresponds to the nonincreasing order of the priority among the pieces. Such an order tends to lead toa good layout, and hence we define the enumeration tree so that such an order is searched first. A branch from a nodecorresponds to a piece, and an inner node v of the tree corresponds to an order of the pieces on the branches from theroot of the tree to v. Such an order corresponds to a first part of orders of m pieces. Our algorithm is a branch-and-boundmethod on such an enumeration tree. For each inner node, we check for each x-coordinate if the remaining space abovethe skyline to the incumbent height is sufficient for the remaining pieces. This is checked by comparing the remainingspace above the skyline with the sum of the heights of the remaining pieces for each x-coordinate. If we conclude that theremaining space is not sufficient, we can terminate the node and backtracking follows. The check of remaining space canbe done in an incremental manner so that whenever a piece is placed, the time for the check is in the linear order of thewidth of the piece.

Note that if we pack pieces by applying the procedure in Section 4.5 to the optimal order computed by this method,we can obtain a packing layout that is optimal for the given set of x-coordinates. The height of the container of thisoptimal solution is also an upper bound of the original rectilinear block packing problem.

4.7. Exact algorithm based on the new solution representationIn this section, we propose an exact algorithm based on permutation solution representation (EAPSR) for the recti-

linear block packing problem. The basic idea of this algorithm is similar to the algorithm proposed in Section 3.4; thedifference is that instead of solving RPP-X as an IP problem, the EAPSR algorithm solves it with the branch-and-boundmethod in Section 4.6. In this exact algorithm, we first solve the relaxation problem explained in Section 3.2 and obtaina set of x-coordinates x of items and a lower bound LB. We then search for an optimal order σ corresponding to x bythe branch-and-bound method in Section 4.6. Then we pack the items according to σ and x by the method explained inSection 4.5, and we obtain an upper bound, updating the incumbent value UB if a better upper bound is obtained. Then,we add the constraint to the relaxation problem to forbid this x, thus narrowing the search space S for the P|cont|Cmax

problem, and solve the relaxation problem again. Our algorithm alternately computes a lower bound on the objectivevalues of solutions in S , and an upper bound on the objective value of the original packing problem. This process ofalternately updating both bounds is repeated until the value of LB becomes larger than or equal to UB, which means thatan optimal solution has already been found during the processing.

The EAPSR algorithm is formally described in Algorithm 2. In Algorithm 2, LB is the current lower bound on theobjective values of the solutions in S , UB is the incumbent value, and (x, y) is the current best solution.

Algorithm 2 EAPSR algorithm1: Set LB := 0 and UB := +∞.2: Solve the P|cont|Cmax problem and obtain a lower bound HLB and a set of x-coordinates xtmp.3: Update LB := HLB.4: Apply the branch-and-bound method in Section 4.6 to xtmp to obtain an optimal order σ corresponding to xtmp, and then apply the decoding

procedure in Section 4.5 to σ to obtain an optimal set of y-coordinates ytmp, with HUB the height of the obtained layout.5: If HUB < UB, update UB := HUB, x := xtmp and y := ytmp.6: If LB < UB, add the constraint to forbid xtmp to the model of P|cont|Cmax and return to Step 2.

Otherwise (i.e., LB ≥ UB), output the solution (x, y) and stop.

15

Page 16: Exact algorithms for the rectilinear block packing problem

2© 2018 The Japan Society of Mechanical Engineers[DOI: 10.1299/jamdsm.2018jamdsm0074]

Matsushita, Hu, Hashimoto, Imahori and Yagiura,Journal of Advanced Mechanical Design, Systems, and Manufacturing, Vol.12, No.3 (2018)

5. Computational Results

In this section, we report computational results obtained by our algorithms. All the algorithms tested in this paperwere implemented in the C++ programming language and run on a PC with a 2.5 GHz Intel Core i5 processor and 4GB memory. We used Gurobi Optimizer, version 6.0.5 for solving the IP problem when searching for x-coordinates forrectilinear blocks. We generated six instances consisting of x-monotone and connected items. To check the performanceof the algorithms on instances with different characteristics, instances rect3 and rect5 include rectilinear blocks that arecomposed of many rectangles, and rect4 and rect6 include rectilinear blocks whose widths are large. For each instance,

the width W of the container was set to W =⌈√∑n

j=1A(R j)⌉, where A(R j) denotes the area of item R j. For more details

of this width setting, readers could refer to Chen et al. (2010). We tested our exact algorithms SSSR in Section 3.4 andEAPSR in Section 4.7 on these six instances and compared their results. We set the time limit to 3600 seconds.

We report in Table 1 the results obtained by the algorithms. We define Hinc. as the height of the container of the bestsolution found when the algorithm terminated or the time limit was reached. The column “Occup.” shows the occupationrate in % of the solutions (i.e.,

∑nj=1A(R j)/(Hinc. ×W) × 100 (%)). The column “Hinc.” shows the incumbent value, and

an “∗” means that the solution is optimal. The column “time” shows the computation time of the algorithms SSSR andEAPSR. The column “loop” shows the total number of loops of the algorithms, and the column “time/loop” shows theavarage of the computation time of the phase for computing LB and UB, respectively, per each loop of the algorithms.We also report in Table 2 how the lower and upper bounds change as the number of loops increases. The row “#Loops”shows the number of loops, and the rows “LB” and “UB” show the values of each bound. For example, for the instancerect1, LB and UB in the first loop were 11 and 12, respectively, both of which stayed the same until the 10th loop, and inthe 11th loop, LB increased to 12.

Both algorithms succeeded in obtaining optimal solutions for all the instances except for rect4. For the instance rect4,the incumbent values obtained in the time limit happened to be the same for both algorithms. For five of the six instances,the EAPSR algorithm obtained optimal solutions faster than the SSSR algorithm, and the difference in computation timebecomes larger especially for instances containing items with complicated shapes and large widths. Figure 14 shows thelayout obtained by algorithm EAPSR for instance rect3, in which items have complicated shapes and large widths.

Table 1: Computational resultstime loop time/loop

Instance n W Occup. Hinc. SSSR EAPSR SSSR EAPSR SSSR EAPSRLB UB LB UB

rect1 9 9 87.04% ∗12 2.289 0.721 11 11 0.011 0.190 0.013 0.055rect2 7 5 93.33% ∗6 1.677 0.119 20 20 0.002 0.082 0.002 0.004rect3 9 10 86.15% ∗13 34.386 0.980 62 62 0.013 0.562 0.011 0.005rect4 6 52 74.23% 70 3600 3600 2898 3125 0.270 0.971 0.270 0.882rect5 9 7 88.89% ∗9 1.203 0.291 8 8 0.012 0.140 0.012 0.024rect6 5 22 67.40% ∗35 10.012 2.447 82 82 0.012 0.112 0.014 0.020

Table 2: Transition of lower and upper boundsInstance rect1 rect2 rect3 rect4 rect5 rect6#Loops 1 11 1 20 1 62 1 600 1 8 1 4 46 82LB 11 12 6 6 12 13 60 65 9 9 29 30 31 35UB 12 12 7 6 13 13 70 70 10 9 35 35 35 35

6. Conclusion

In this paper, we proposed exact algorithms for the rectilinear block packing problem. The basic idea of our algo-rithms is to iteratively compute lower and upper bounds on the optimal value of the remaining search space until the lowerbound is not smaller than the upper bound, which means that an optimal solution to the original problem is found. Tocompute a lower bound, we relaxed the problem to a parallel processor scheduling problem in which each rectilinear blockis cut into rectangles with width one and only the horizontal relationship of these rectangles are fixed. To compute anupper bound corresponding to the obtained x-coordinates, we proposed two methods, in both of which the x-coordinatesof the blocks are fixed to those obtained when we computed the latest lower bound. One method is to formulate the

16

Page 17: Exact algorithms for the rectilinear block packing problem

2© 2018 The Japan Society of Mechanical Engineers[DOI: 10.1299/jamdsm.2018jamdsm0074]

Matsushita, Hu, Hashimoto, Imahori and Yagiura,Journal of Advanced Mechanical Design, Systems, and Manufacturing, Vol.12, No.3 (2018)

Fig. 14: Layout obtained for rect3 by algorithm EAPSR

problem of computing an upper bound as another IP problem. By fixing the x-coordinates and solving the IP problemon y-coordinates, we obtained a feasible packing layout and the corresponding upper bound on the optimal value of therectilinear block packing problem. In the other method, we proposed a new solution representation, based on an order ofitems, to decide an optimal set of y-coordinates of rectilinear blocks corresponding to the specified x-coordinates. Thecomputational results showed that both algorithms obtained five optimal and one heuristic solutions for six instances. Thealgorithm based on the order representation improved the running time of the algorithm based on two IP problems.

In our algorithm, it takes long time to calculate lower and upper bounds for those instances with items havinglarge width or complicated shapes. Future directions of our research include alleviating this phenomenon by devisingpreprocessing methods and/or algorithms to calculate lower and upper bounds that are not sensitive to the size and thecomplexity of the items.

References

Baker, B.S., Coffman Jr., E.G. and Rivest, R.L., Orthogonal packings in two dimensions, SIAM Journal on Computing,Vol. 9, No. 4 (1980), pp. 846–855.

Bellman, R., On a routing problem, Quarterly of Applied Mathematics, Vol. 16, No. 1 (1958), pp. 87–90.Benders, J.F., Partitioning procedures for solving mixed-integer variables programming problems, Numerische Mathe-

matik, Vol. 4, No. 1 (1962), pp. 238–252.Burke, E.K., Kendall, G. and Whitwell, G., A new placement heuristic for the orthogonal stock-cutting problem, Opera-

tions Research, Vol. 52, No. 4 (2004), pp. 655–671.Chen, D., Liu, J., Fu, Y. and Shang, M., An efficient heuristic algorithm for arbitrary shaped rectilinear block packing

problem, Computers & Operations Research, Vol. 37, No. 6 (2010), pp. 1068–1074.Cote, J.-F., Dell’Amico, M. and Iori, M., Combinatorial Benders’ cuts for the strip packing problem, Operations Research,

Vol. 62, No. 3 (2014), pp. 643–661.Dowsland, K.A., Some experiments with simulated annealing techniques for packing problems, European Journal of

Operational Research, Vol. 68, No. 3 (1993), pp. 389–399.Fujiyoshi, K., Kodama, C. and Ikeda, A., A fast algorithm for rectilinear block packing based on selected sequence-pair,

Integration, the VLSI Journal, Vol. 40, No. 3 (2007), pp. 274–284.Fujiyoshi, K. and Murata, H., Arbitrary convex and concave rectilinear block packing using sequence-pair, IEEE Trans-

actions on Computer-Aided Design of Integrated Circuits and Systems, Vol. 19, No. 2 (2000), pp. 224–233.Furini, F., Iori, M., Martello, S. and Yagiura, M., Heuristic and exact algorithms for the interval min-max regret knapsack

problem, INFORMS Journal on Computing, Vol. 27, No. 2 (2015), pp. 392–405.Hu, Y., Hashimoto, H., Imahori, S. and Yagiura, M., Efficient implementions of construction heuristics for the rectilinear

block packing problem, Computers & Operations Research, Vol. 53 (2015), pp. 206–222.Imahori, S., Yagiura, M. and Ibaraki, T., Local search algorithms for the rectangle packing problem with general spatial

costs, Mathematical Programming, Vol. 97, No. 3 (2003), pp. 543–569.Kang, M.Z. and Dai, W.W.-M., General floorplanning with L-shaped, T-shaped and soft blocks based on bounded slicing

grid structure, Proceedings of the 1997 Asia and South Pacific Design Automation Conference (ASP-DAC) (1997),pp. 265–270.

Kang, M.Z. and Dai, W.W.-M., Arbitrary rectilinear block packing based on sequence pair, Proceedings of the 1998

17

Page 18: Exact algorithms for the rectilinear block packing problem

2© 2018 The Japan Society of Mechanical Engineers[DOI: 10.1299/jamdsm.2018jamdsm0074]

Matsushita, Hu, Hashimoto, Imahori and Yagiura,Journal of Advanced Mechanical Design, Systems, and Manufacturing, Vol.12, No.3 (2018)

IEEE/ACM International Conference on Computer-Aided Design (ICCAD) (1998), pp. 259–266.Kenmochi, M., Imamichi, T., Nonobe, K., Yagiura, M. and Nagamochi, H., Exact algorithms for the two-dimensional

strip packing problem with and without rotations, European Journal of Operational Research, Vol. 198, No. 1 (2009),pp. 73–83.

Lin, J.-M., Chen, H.-L. and Chang, Y.-W., Arbitrarily shaped rectilinear module placement using the transitive closuregraph representation, IEEE Transactions on Very Large Scale Integration (VLSI) Systems, Vol. 10, No. 6 (2002),pp. 886–901.

Ma, Y., Hong, X., Dong, S., Cai, Y., Chen, S., Cheng, C.-K. and Gu, J., Arbitrary convex and concave rectilinear blockpacking based on corner block list, Proceedings of the 2003 International Symposium on Circuits and Systems(ISCAS) (2003), pp. V-493–496.

Martello, S., Monaci, M. and Vigo, D., An exact approach to the strip-packing problem, INFORMS Journal on Computing,Vol. 15, No. 3 (2003), pp. 310–319.

Nakatake, S., Fujiyoshi, K., Murata, H. and Kajitani, Y., Module packing based on the BSG-structure and IC layoutapplications, IEEE Transactions on Computer-Aided Design of Integrated Circuits and Systems, Vol. 17, No. 6(1998), pp. 519–530.

Pang, Y., Cheng, C.-K., Lampaert, K. and Xie, W., Rectilinear block packing using O-tree representation, Proceedings ofthe 2001 International Symposium on Physical Design (ISPD) (2001), pp. 156–161.

Wascher, G., Haußner, H. and Schumann, H., An improved typology of cutting and packing problems, European Journalof Operational Research, Vol. 183, No. 3 (2007), pp. 1109–1130.

Wu, G.-M., Chang, Y.-C. and Chang, Y.-W., Rectilinear block placement using B*-trees, ACM Transactions on DesignAutomation of Electronic Systems (TODAES), Vol. 8, No. 2 (2003), pp. 188–202.

Wu, Y.-L., Huang, W., Lau, S.-C., Wong, C.K. and Young, G.H., An effective quasi-human based heuristic for solving therectangle packing problem, European Journal of Operational Research, Vol. 141, No. 2 (2002), pp. 341–358.

Xu, J., Guo, P.-N. and Cheng, C.-K., Rectilinear block placement using sequence-pair, Proceedings of the 1998 Interna-tional Symposium on Physical Design (ISPD) (1998), pp. 173–178.

Appendix A. Proof of Lemmas

In this section, we prove Lemmas 4.1 and 4.2.

Proof of Lemma 4.1 Assume that there are two items a and b, and the order of the items is a→ b (which signifies ais below b) on the vertical line at x1 and b→ a at x2. In Figure 15, the interior of item a is filled with a pattern of slantedlines from upper left to lower right, and that of b is filled with another pattern. We define qa

1 as an interior point of itema at x1, and qb

1, qa2, qb

2 are defined similarly. By Property 4.1, there are two continuous x-monotone curved lines, one linela from qa

1 to qa2 and another line lb from qb

1 to qb2. Then, by the intermediate value theorem, there exists an intersection P

of two lines la and lb between x1 and x2. Since la is in the interior of item a and lb is in that of b, for a sufficiently smallpositive ε, the ε-neighborhood of P is contained in the interior of both a and b. This means that there is overlap betweenitems a and b. This contradicts the assumption. □

Fig. 15: An example for the proof

18

Page 19: Exact algorithms for the rectilinear block packing problem

2© 2018 The Japan Society of Mechanical Engineers[DOI: 10.1299/jamdsm.2018jamdsm0074]

Matsushita, Hu, Hashimoto, Imahori and Yagiura,Journal of Advanced Mechanical Design, Systems, and Manufacturing, Vol.12, No.3 (2018)

Proof of Lemma 4.2 Let l′ := l and r′ := r. Then from the assumption, we have

f (l′) > g(l′) and f (r′) < g(r′). (23)

Suppose that there is a point x′ ∈ [l′, r′] such that f or g is discontinuous at x′.If f (x′) = g(x′) holds, we are done.If f (x′) > g(x′) holds, x′ must satisfy x′ , r′ (which implies x′ < r′) by condition (23), and for a sufficiently small

ε > 0, we have f (x′ + ε) > g(x′ + ε) and x′ + ε < r′. In this case, we set l′ := x′ + ε; then for the updated interval [l′, r′],condition (23) holds and the number of discontinuous points in [l′, r′] decreases by at least one.

Similarly, if f (x′) < g(x′) holds, x′ must satisfy x′ , l′ (which implies x′ > l′) by condition (23), and for a sufficientlysmall ε > 0, we have f (x′ − ε) < g(x′ − ε) and x′ − ε > l′. In this case, we set r′ := x′ − ε; then for the updated interval[l′, r′], condition (23) holds and the number of discontinuous points in [l′, r′] decreases by at least one.

By repeating the above operations finite times, we will reach either of the following two situations:

• A point a ∈ (l, r) satisfying f (a) = g(a) is found.

• Condition (23) holds and functions f and g are continuous in [l′, r′].

In the latter case, the intermediate value theorem ensures that there is a point a ∈ (l′, r′) that satisfies f (a) = g(a). □

19