1. Introduction
The soft rectangle packing problem deals with soft rectangular objects whose areas are fixed, while their dimensions (width and height) can be adjusted in certain limits. Problems of optimized packing of soft rectangular objects arise, e.g., in land design/allocation [
1,
2,
3] and floorplanning of soft modules [
4,
5,
6], parallel computing [
7] and VLSI computer chip design [
8,
9,
10,
11], facility layout [
12], and designing a multi-channel conduit [
13,
14].
In the applications mentioned above, soft rectangles must be packed in a rectangular container subject to non-overlapping and containment conditions. That is, the objects must be arranged without mutual overlapping and completely inside the container. For a fixed number of rectangles, the objective is to optimize the size of the corresponding rectangular container, while for the fixed container, the objective is either to maximize the number of packed soft rectangles or to optimize an indicator associated with the perimeters of the objects. For the case of the fixed container, additional conditions, such as guillotine constraints, can be considered [
2,
3].
For packing soft rectangles in a fixed rectangular container there are plenty of theoretical estimations for the correspondence between parameters of the container, and soft rectangles to fit into the container [
15,
16,
17,
18,
19].
If soft rectangles are packed in a rectangular container, then there exists an optimal layout where the objects are aligned along the sides of the container. This observation is used in many numerical algorithms for the problem. A simulated annealing framework based on the sequence pair representation of the placement topology is proposed in [
1] for rectangular soft modules floorplanning. Here the sequence corresponds to a permutation of a given module set. Partitioning a given rectangular region into a fixed number of soft rectangles of known areas using guillotine cuts is considered in [
2,
3]. The objective is to minimize either the largest perimeter or the maximum aspect ratio of the rectangles. Corresponding mixed integer programming formulations are proposed. A binary search-based solution approach is used in [
2], while metaheuristics (Variable Neighborhood Search and Tabu Search) are implemented in [
3]. An alternative solution approach to the partitioning problem is proposed in [
5], where a heuristic based on iteratively merging two rectangles into a composite rectangle is used. Additional adjacency relations are considered in [
6] for the floorplanning problem, and a linear programming-based approach is used to construct a feasible floorplan. In [
7] the rectangular region partitioning problem motivated by matrix multiplication on heterogeneous platforms is approached by a column-based heuristic. Packing a collection of hard, soft, and fixed-position rectangles (prohibited zones) in a minimum square rectangular container is considered in [
8] and is approached by a heuristic based on a sequence pair placement topology. The sequence pair modeling approach is also used in [
9], combined with simulated annealing and Lagrangian relaxation. In [
10] a preliminary floorplan is constructed, and then the shapes of the flexible modules are adjusted in a best-fit way to fill up the unused area of a preliminary floorplan while keeping the relative positions between the modules unchanged. In this approach the adjusted modules are allowed to be rectilinear (L-shapes, T-shapes, etc.), and Lagrangian relaxation is used to solve the corresponding adjustment problem. A quick heuristic is proposed in [
11] to determine the aspect ratio of each soft module subject to keeping a given relative position between modules. The proposed method is implemented with Simulated Annealing and consists of two main steps: selection of a set of soft modules to adjust the aspect ratio and decision on the aspect ratio of elements in the set. In [
12] a specific two-dimensional rectangle packing area minimization problem with a central rectangle is considered. In this problem there exists at least one specific item (central rectangle) which must be placed near the center of the final layout. A heuristic solution approach is proposed based on three strategies: monitoring the aspect ratio, decreasing computational complexity, and filling the marginal inner space. The design of multi-channel conduit is considered in [
13] to find a topology that consists of several channels with a given cross-section area using a minimum amount of sheet metal and, at the same time, maximizing its stiffness. Using a regular quadratic grid, rectilinear channels are represented by combinations of squares, and a corresponding large-scale linear mixed-integer programming problem is solved by cut generation. Another problem motivated by multi-channel conduit design is considered in [
14] and consists in the arrangement of rectangles with given areas that minimizes the total length of all inner and outer border lines. A nonlinear mixed integer formulation is presented, and several approximation algorithms are provided along with an estimation of the proximity indicators.
In this paper, packing soft rectangles in an optimized convex (not necessarily rectangular) container is considered. For the rectangular container in the optimal arrangement, all soft rectangles are allocated such that their sides are parallel to the sides of the container. However, if the container is not rectangular, e.g., circular or triangular, rotation of the objects is essential to obtain the optimal arrangement. Moreover, in many applications, e.g., in land design or floor planning, the area for allocation of the soft rectangles (container) may have different zones prohibited for allocations. These can be, e.g., lakes or forests in the case of land design, columns or elevators in the case of floor planning. The presence of the prohibited zones is another reason for the arising rotated soft rectangles in the optimal arrangement. To the best of our knowledge, packing soft rectangles with free rotations allowed in convex containers has never been considered before.
The main contributions of this paper are:
- 1.
The problem of optimized packing of soft, rotated rectangles in a convex, optimized container with prohibited zones (OPSR) is formulated.
- 2.
Non-overlapping and containment conditions considering prohibited zones are presented using the phi-functions technique [
20,
21].
- 3.
A nonlinear mathematical model corresponding to the OPSR problem is formulated for optimized triangular, rectangular, circular, and scaled convex containers and prohibited zones.
- 4.
A model-based heuristic is proposed to obtain reasonable solutions for the corresponding large-scale nonconvex optimization problem.
- 5.
Numerical experiments are provided to demonstrate the efficiency of the proposed solution approach.
The rest of the paper is organized as follows.
Section 2 presents the problem formulation. A mathematical model is described in
Section 3.
Section 4 introduces a solution approach, while numerical experiments are reported in
Section 5. The last section,
Section 6, provides conclusions and directions for future research. The proof of the proposition from
Section 2 is given in
Appendix A, while the concept of phi-functions is defined in
Appendix B.
2. Problem Formulation
The following geometric objects are used in the problem formulation.
Containers. Let be a convex domain/container given in the fixed coordinate system , where L is a vector of unknown/variable parameters of .
Within this study the following shapes are considered for the containers:
rectangular container with variable dimensions
l and
h,
where
Circular container with variable radius
r,
:
Polygonal convex container given by its vertices
with variable scaling parameter
,
(
Figure 1):
where
Figure 1.
Regular polygonal container with scaling parameter , , and (from the left to the right).
Figure 1.
Regular polygonal container with scaling parameter , , and (from the left to the right).
Prohibited zones. There may be some fixed configurations designed inside the container where the placement of the objects is prohibited. We refer to these configurations as prohibited zones. Denote a set of prohibited zones by {, }.
Each prohibited zone can be presented as a union of basic objects (circle, ellipse, rectangle, convex polygon) (
Figure 2), i.e.,
subject to the shape sizes and the position
of the
inside the container remain unchanged.
Figure 2.
Examples of prohibited zones: (a) is a union of two rectangles; (b) is a union of three circles; (c) is a union of two triangles.
Figure 2.
Examples of prohibited zones: (a) is a union of two rectangles; (b) is a union of three circles; (c) is a union of two triangles.
Soft rectangles. Let a set of rectangles be given in .
Each rectangle
can be rotated by an angle
, stretched by elasticity parameters
and translated by a vector
:
where
is the original rectangle with
,
is a rotation matrix,
is an elasticity matrix,
,
,
.
The rectangle
defined by (
1) is referred to as a soft rectangle.
Proposition 1. The elasticity transformation preserves the area of the original rectangle under any translation and rotation iff . (See the proof in Appendix A). Further, we assume that , , , .
Figure 3 shows shapes of a soft rectangle for different values of elasticity coefficient
subject to area preservation
.
Placement conditions. The following types of placement conditions are considered in this study:
- (1)
Non-overlapping of each pair of soft rectangles:
- (2)
Containment of each soft rectangle into a convex container
:
- (3)
Containment of each prohibited zone
into a convex container
:
- (4)
Con-overlapping of each soft rectangle with prohibited zones:
- (5)
Metric constraints – , represent given limits of the elasticity parameter.
Objective functions. Different objective functions are considered depending on the shape of the container . That is, the height of a rectangular container, the radius of a circular container, and the scaling parameter of a polygonal container. Denote an objective function by .
Problem formulation. The Optimized Packing Soft Rectangles (OPSR). Find an arrangement of soft rectangles , minimizing subject to the placement conditions (1)–(5).
3. Mathematical Modeling
To describe the placement conditions of the OPSR problem, the phi-function technique [
20,
21] is used. For the reader’s convenience, basic definitions and properties of the phi-functions are provided in
Appendix B.
3.1. Analytical Description of the Placement Conditions
Non-overlapping conditions. To define a non-overlapping condition (
1) for soft rectangles
and
, we introduce a quasi phi-function:
Here,
is a phi-function for objects
and
,
is a phi-function for objects
and
, where
is a vector of variable parameters of
, and
are coordinates of vertices of soft rectangle
.
Thus, if for some , then soft rectangles do not overlap, i.e., .
We state non-overlapping condition (
3) for a soft rectangle
and a fixed prohibited zone
using the following quasi phi-function:
where
is a quasi phi-function for objects
and
,
.
Thus, if for some , then and do not overlap, i.e., .
Containment conditions. Let us consider the containment condition (
2) that describes the relation
, i.e.,
,
, using a phi-function, denoted by
, for objects
and
.
If
is a rectangular container, then
where
If
is a circular container, then
where
If
is a scaling convex polygonal container, then
where
,
,
Thus, the inequality provides containment of a soft rectangle into a container , i.e., for .
Containment condition (
3) for prohibited zones
, i.e.,
,
can be described using phi-functions/quasi phi-functions for objects
and
in the form
where
is a phi-function/quasi phi-function for a convex component
and the object
.
Ready-to-use phi-functions/quasi phi-functions for the complement of the container (rectangular, circular, or polygonal) and a convex component
can be found, e.g., in [
20,
22].
Thus, the inequality ensues the containment of a prohibited zone into a container , i.e., for .
3.2. Mathematical Model
The OPSR problem can be stated as the following nonlinear programming model:
subject to
where
is an objective function that depends on variable dimensions
L of a container;
, for , , ), .
Inequalities (
9) and (
10) describe the non-overlapping of a pair of soft rectangles/a soft rectangle and a prohibited zone; inequalities (
11) and (
12) state the containment of a soft rectangle/a prohibited zone into a container; inequality (
13) restricts a level of elasticity of soft rectangles.
is defined by (
2),
is defined by (
3),
is defined by (
4)–(
6),
is defined by (
7), and
is the total number of the problem variables.
4. A Heuristic Approach to Solve OPSR Problems
To apply state-of-the-art NLP local solvers for the large-scale nonconvex optimization problem (
8)–(
13) (subject to a balance between computational time and solution quality), we need to cope with two challenging issues: (1) how to construct feasible starting points (critical for most local NLP solvers); (2) how to reduce the problem dimension.
To find feasible starting points of the problem (
8)–(
13), we develop an algorithm based on homothetic transformations of spheres. To answer the second question, we propose a decomposition technique based on the results of [
23] that allows reducing the large-scale problem (
8)–(
13) to a sequence of nonlinear programming subproblems of much smaller dimensions (increasing linearly to the number of soft rectangles
), subject to
,
.
Our multistart heuristic approach consists of three main stages:
Stage 1. Generating feasible starting points of the problem (
8)–(
13) using Algorithm 1.
Stage 2. Searching for a local minimum of the problem (
8)–(
13) using Algorithm 2.
Stage 3. Selecting the best result from those found at Stage 2.
Let us consider the algorithm of generating feasible starting points of the problem (
8)–(
13) used at the first stage of the strategy.
Algorithm 1. Firstly, we circumscribe a sphere around each fixed original rectangle for . Assume that the center of the sphere is arranged at the center of rectangle (the midpoint of its diagonal end points). Secondly, we set starting dimensions of a container sufficiently large to host prohibited zones , , as well as all spheres , .
Step 1. Generate randomly n centers of spheres subject to for that can be considered as a set of n degenerated spheres placed inside the container .
Solve the problem of maximizing the homothety coefficient (scaling parameter) of the non-overlapping spheres , so that they do not overlap with prohibited zones , and fit the container , using the starting feasible point , , .
This optimization problem can be stated as the following nonlinear programming model:
subject to
where
is a vector of the decision variables, the inequality
describes the containment of a scaling sphere
into a container
, i.e.,
, the inequality
ensures the non-overlapping of two scaling spheres
and
, i.e.,
, while the inequality
holds the non-overlapping of a scaling sphere
and a prohibited zone
, i.e.,
. In the model, functions
,
, and
are ready-to-use phi-functions for the appropriate pair of objects that can be found, e.g., in [
20,
22].
Denote a point of local maximum of the problem by , .
The solution corresponds to the original sizes of the spheres.
Step 2. If , then Step 3; if , then take a larger value for and go to Step 1.
Step 3. Derive feasible values of auxiliary variables , and , subject to fixed centers of spheres , , and , , using simple geometric constructions of separating lines between each pair of spheres.
Step 4. Randomly generate rotation angles , for the corresponding rectangles. Substitute spheres by the corresponding rectangles for , .
The algorithm returns point
as a feasible starting point of the problem (
9)–(
14) for further local optimization, where
,
,
,
,
,
.
Figure 4a–c show some iterations of growing spheres
in the optimization procedure at Step 1 for a polygonal container
with increasing values of
. The configuration shown in
Figure 4d corresponds to a global solution of the problem considered at Step 1.
To search for local-optimal solutions of the OPSP problem (
8)–(
13), we propose a decomposition strategy that involves the following steps.
Algorithm 2. Let be a feasible starting point found by Algorithm 1, where ).
Step 1. Set .
Step 2. Set
and form
-neighborhood
Step 3. Define placement conditions on the vector
of
,
Step 4. Form a feasible region
for
-th subproblem:
where
,
,
,
,
,
.
Then, we eliminate from (
9) and (
10) the phi-function inequalities for each pair
of objects if
, while a system of linear inequalities
defined by (
14) is added to the system (
10)–(
14) for
.
This technique allows reducing the number of variables by
while the number of nonlinear inequalities in (
9) and (
10) is reduced by
.
Step 5. Search for a local-optimal solution of the
- subproblem
subject to
Denote a point of local minimum of the problem (
15)–(
22) by
.
Step 6. If , then go to Step 7; otherwise, stop the algorithm.
Step 7. Set and go to Step 2.
Figure 5 provides illustrations of the decomposition procedure in Algorithm 2 for optimized packing of soft rectangles in a scaling regular pentagon
with a polygonal prohibited area.
The configuration (
a) corresponds to the feasible starting point found by Algorithm 1,
. The configurations (
b)–(
d) corresponds to local optimal solutions of three subproblems (
15)–(
22),
. The configuration (
d) correspond to a local minimum of the problem (
15)–(
22) found at the last iteration
(
, Step 6) of the decomposition procedure.
Figure 6 presents a flow chart of the proposed heuristic approach for solving the OPSR problem.
5. Computational Results
In computational experiments, a computer was used having the processor 12th Gen Intel Core i5-12500 3.00 GHz. RAM 32 GB. Programming Language Python 3.11 was used for programming the algorithms. To solve nonlinear programming subproblems (
15)–(
22), a non-commercial local NLP solver, IPOPT (version 3.14.14) [
24], was applied.
Two groups of instances for packing soft rectangles with different limits of the elasticity parameter
in three types of containers (circular, rectangular, and polygonal) were considered: (1) without prohibited zones (Examples 1–7,
Figure 2 and
Figure 7,
Figure 8,
Figure 9,
Figure 10,
Figure 11,
Figure 12 and
Figure 13) with prohibited zones (Examples 8–15,
Figure 14,
Figure 15,
Figure 16,
Figure 17,
Figure 18,
Figure 19,
Figure 20 and
Figure 21). Specific values of the elasticity parameters for all problem instances considered in the paper can be found at ResearchGate
https://www.researchgate.net/publication/388143731_elasticity_parameters (accessed on 1 January 2025). Three feasible starting points are used for each instance. The CPU time limit in both cases was 300 s.
The following notations are used in presenting experimental results:
n: the number of soft rectangles;
m: the number of the polygonal container vertices;
: an optimized size of a container (the best value of the objective function found by our heuristic for ), i.e., : for circular container , : for rectangular container , : for polygonal container ;
denotes in %.
5.1. Instances Without Prohibited Zones
In this subsection different minimum scale regular containers are considered for packing soft rectangles.
Example 1. , total area of rectangles is 400, circular container.
Figure 7.
The best solutions in Example 1: (a) , ; (b) , , ; (c) , %.
Figure 7.
The best solutions in Example 1: (a) , ; (b) , , ; (c) , %.
Example 2. , , total area of rectangles is 400, square container.
Figure 8.
The best solutions in Example 2: (a) ; (b) , ; (c) .
Figure 8.
The best solutions in Example 2: (a) ; (b) , ; (c) .
Example 3. , , total area of rectangles is 400, triangular container.
Figure 9.
The best solutions in Example 3: (a) ; (b) , ; (c) .
Figure 9.
The best solutions in Example 3: (a) ; (b) , ; (c) .
Example 4. , , total area of rectangles is 400, pentagonal container.
Figure 10.
The best solutions in Example 4: (a) ; (b) , ; (c) .
Figure 10.
The best solutions in Example 4: (a) ; (b) , ; (c) .
Example 5. , , total area of rectangles is 400, hexagonal container.
Figure 11.
The best solutions in Example 5: (a) ; (b) ; (c) .
Figure 11.
The best solutions in Example 5: (a) ; (b) ; (c) .
Example 6. , , total area of rectangles is 400, heptagonal container.
Figure 12.
The best solutions in Example 6: (a) ; (b) , ; (c) .
Figure 12.
The best solutions in Example 6: (a) ; (b) , ; (c) .
Example 7. , , total area of rectangles is 400, octagonal container.
Figure 13.
The best solutions in Example 7: (a) ; (b) , ; (c) .
Figure 13.
The best solutions in Example 7: (a) ; (b) , ; (c) .
5.2. Instances with Prohibited Zones
Example 8. , total area of rectangles is 240. Each of the two prohibited zones is a union of two rectangles of area 24. Minimum height rectangular container, .
Figure 14.
The best solutions in Example 8: (a) ; (b) , ; (c) .
Figure 14.
The best solutions in Example 8: (a) ; (b) , ; (c) .
Example 9. , total area of rectangles is 392. Minimal square container, . The prohibited zone is a regular triangle of area 11.69.
Figure 15.
The best solutions in Example 9: (a) ; (b) ; (c) .
Figure 15.
The best solutions in Example 9: (a) ; (b) ; (c) .
Example 10. , total area of rectangles is 392. Minimal circular container. The prohibited zone is a regular triangle of area 11.69.
Figure 16.
The best solutions in Example 10: (a) ; (b) ; (c) .
Figure 16.
The best solutions in Example 10: (a) ; (b) ; (c) .
Example 11. , total area of rectangles is 392. Minimal circular container. The prohibited zone is a square of area 16.
Figure 17.
The best solutions in Example 11: (a) ; (b) , ; (c) .
Figure 17.
The best solutions in Example 11: (a) ; (b) , ; (c) .
Example 12. , total area of rectangles is 392. Minimal circular container. The prohibited zone is a regular octagon of area 101.82.
Figure 18.
The best solutions in Example 12: (a) ; (b) , ; (c) .
Figure 18.
The best solutions in Example 12: (a) ; (b) , ; (c) .
Example 13. , total area of rectangles is 392. Minimal circular container. The prohibited zone is a union of three circles of area 33.17.
Figure 19.
The best solutions in Example 13: (a) ; (b) , ; (c) .
Figure 19.
The best solutions in Example 13: (a) ; (b) , ; (c) .
Example 14. , total area of rectangles is 368. Minimum scale hexagonal container. The prohibited zone is a union of two rectangles of area 51.2.
Figure 20.
The best solutions in Example 14: (a) ; (b) , ; (c) .
Figure 20.
The best solutions in Example 14: (a) ; (b) , ; (c) .
Example 15. , total area of rectangles is 392. Minimum scale hexagonal container. The prohibited zone is a regular hexagon of area 45.25.
Figure 21.
The best solutions in Example 15: (a) ; (b) , ; (c) .
Figure 21.
The best solutions in Example 15: (a) ; (b) , ; (c) .
6. Conclusions
In this paper, packing soft rectangular objects in an optimized convex container is considered. Each soft rectangle conserves its area; however, dimensions (height, width) can vary in certain limits. Rectangular objects can be freely translated and rotated. The convex container may have (regular or irregular) prohibited zones. The phi-function technique is used to state non-overlapping and containment conditions. The corresponding large-scale nonlinear optimization problem is formulated, and a heuristic is proposed to find reasonable solutions. The principal difference of our model from the earlier research is that rotation of the soft rectangular objects is allowed. Numerical experiments demonstrate that rotation is essential to obtain high-quality arrangements. This is especially important for the case of non-rectangular containers and/or containers with prohibited zones.
A natural generalization of the proposed modeling and solution approach is considering soft irregular objects composed of rectangles, e.g., L- or II-shaped objects. Modeling and solution approaches presented in
Section 3 and
Section 4 can be used with minor modifications to treat the composed soft rectangular objects. Also, more sophisticated shapes can be considered [
25,
26,
27,
28].
In [
29], optimized packing of general soft convex polygons was considered. In contrast to the current work, where variables are translation vectors and rotation angles, the variables used in [
29] are coordinates of the polygons’ vertices. It would be interesting to specify the approach of [
29] for rectangles and compare both models numerically. Results in this direction are on the way.
In many cases a certain minimal distance between the objects must be assured. For example, in land design, land parcels must be accessible from all sides for maintenance and protection. Similarly, a certain distance between the land parcels must be guaranteed if they are used for contaminating activities. Correspondingly, the parcels must be sufficiently separated. This gives rise to the so-called sparse or sparsest packing problem [
30]. An interesting direction for future research is to consider sparse formulations for packing soft rectangles.
Considering 3D soft rectangles (cuboids) is also a promising area for future research. The main model (
8)–(
13) and the heuristic are dimension-independent and thus can be applied directly for the 3D case. Convex 3D containers of simple forms (cuboid, sphere, prism) also do not require significant changes in the main model. Reference [
31] is included in
Appendix A. Optimized packing of soft cuboids can also be applied to transportation problems [
32].
Solutions obtained by the proposed heuristic can be used as starting points either in other heuristics (see, e.g., ref. [
33] and the references therein) or in global optimization techniques [
34].
One of the interesting directions of future research is the application of our methodology to solving coverage [
35,
36,
37] and partition problems [
38].