Abstract
We consider the problem of packing the maximal number of unit squares in a hypograph of a function. A polynomial time algorithm is described to solve this problem for a piecewise linear function.
1 Introduction
The problems of rectangular packing and cutting are difficult problems of discrete optimization (for references see [1]). For example, the computational complexity of the problem of packing in a rectangular sheet (A, B) the maximum number of equal small rectangles (c, d) (pallet loading problem (PLP)) is unknown. This problem has number 55 in the list of open problems “The Open Problems Project”. It is closely connected with another known problem, 56 in the list of open problems, about the complexity of deciding whether a given number of axis-parallel unit squares can be packed into a simple polygon (without holes). Appearance [2] conjecture the problem to be polynomially solvable. The problem is known to be NP-hard for polygons with holes [3], even if the polygon is an orthogonal polygon with all coordinates being multiples of 1/2. Recently, this version of the problem was shown to be in NP [6], making it NP-complete. This problem arises in wood industry (cutting a log into quadratic plates), in glass industry (cutting defecting pane glass into small equal squares) etc. Applications of analogous problems can be seen in [4, 5]. In this article we consider the problem of packing of unit squares in a hypograph of a function. The article is organized as follows. The second section contains the proof of a theorem about the structure of the optimal packing unit squares in a hypograph of a function. In the third section we propose a polynomial algorithm for the problem with piecewise linear function.
2 A theorem about optimal packing
It appears, that a two-dimensional problem about optimum packing unit squares in a hypograph of a function can be reduced to a one-dimensional problem of packing unit intervals in a one-dimensional set which have a trivial solution. If a compact set is represented as a separable union of intervals
then the maximum number of single intervals which are possible to pack in this set is given by the obvious formula
Definition 1
A hypograph of a function f on the interval [a, b] is the set
Note that this definition is different from the classical definition of hypograph in [7]. Cleave this set by lines parallel to the x-axis with integer y-coordinates. We designate these lines by Li:
The intersection of the set Li and the hypograph H(f, a, b) is a compact set, which we designate by Hi(f, a, b). Let us suppose that this set consists of finite number of intervals. Let us suppose also without loss of generality that the function f is a bounded continuous function on the interval [a, b]. Then, if Hi(f, a, b) = ⋃j∈JAi,j, where Ai,j is an interval, the maximum number Ni of unit intervals in Hi(f, a, b) is given by
The following theorem reduces the packing of unit squares to the packing of unit intervals.
Theorem 1
The maximum number N of unit squares in a hypograph H(f, a, b) of a function f on the interval [a, b] is given by
Proof
This theorem is almost obvious. We prove this claim by induction on the area of a hypograph. If the area of a hypograph is less than 1, then any unit square cannot be packed in such a hypograph. In the same way, any interval Ai,j = [ai,j, bi,j] has length less than 1, otherwise, a rectangle
lying inside a hypograph H(f, a, b), contains unit square. Let for all hypographs of area less then S, theorem is valid. Let us show its justice for hypographs of area greater then or equal to S. Let us consider a set H1(f, a, b) = ⋃j∈JA1,j. It can cross no more than
unit squares. All remaining unit squares are above the line y = 1. Then these squares with decreased by 1 y-coordinate are in the hypograph of a function, f (x) – 1. By the inductive hypothesis, in the hypograph of a function f (x) – 1, it can be packed ∑i∈N\{1}Ni unit squares. Together with squares intersecting a line y = 1 it can be proved easily that it is impossible to locate in the hypograph H(f, a, b) more than N = ∑i∈NNi unit squares. But such a number of unit squares can be locate, if the first N1 squares we locate in a hypograph between lines y = 0 and y =1. The theorem is proved.
Let’s illustrate this theorem by a problem of optimal packing of unit squares in a semicircle of radius 5 (hypograph of a function

Packing unit squares in a semicircle
As another application of this theorem, we consider a problem of packing unit squares in a hypograph H(f, a, b) of a function
If this problem can be solved in a polynomial time, then a known unsolved problem of factoring integers in a polynomial time has a positive answer. Let’s designate N(f, a, b) as the maximum number of unit squares, which can be packed into a hypograph of a function H(f, a, b), then
3 Polynomial algorithm for a piecewise-linear function
In this section we consider a problem of optimum packing of unit squares in a hypograph of a piecewise-linear function and show the existence of a polynomial algorithm for its solution.
Let us consider in the beginning, the case of trapezioidal function:
Coefficients of this function satisfy the equalities
The graph of this function is presented in Figure 2.

Trapezoidal function
Then, by Theorem 1, a solution to the problem of packing of unit squares in a hypograph of a function H(f, a, b) is given by the formula
where
This expression is equal to the number of points of a twodimensional integral lattice without the points on axes of the abscissas in a trapezoid with vertices in points (0, 0), (0, c), (a2 – a1, c), (b – a, 0). The formula for the number of integral points in a trapezoid in the vertices (0, 0), (0, a), (b, a), (c, 0) is given by
Thus, the problem of optimum packing of unit squares in a hypograph of a trapezoidal function is reduced to the problem of counting the number of integral points in a trapezoid. This last problem in the general case of polygons is widely investigated and the existence of polynomial time algorithms is well known (see e.g. [8, 9]). So, for a solution of this reduced problem there exist effective polynomial algorithms. Thus, the problem of optimum packing of unit squares in the hypograph of trapezoidal function has effective, polynomial algorithms.
Let’s consider the case of a piecewise linear function
Such a function can be represented as an ordered sequence of vertices of a hypograph considered as a polygon with vertices
It is easy to see that O(n) arithmetical operations are sufficient for transforming from one form of presentation to another. Moreover, a problem of optimum packing unit squares in a hypograph of a piecewise linear function can be considered by virtue of the theorem 1, as a problem of counting their numbers with the help of formulas (1), i.e. as counting the sum of integer part of lengths of intervals cutting from a hypograph of a piecewise linear function by the set of lines y = i, i ∈ N. Then a problem of counting the sum of integer part of lengths of intervals cutting from a hypograph of a piecewise linear function, considered as a sequence of vertices of a polygon
by the set of lines y = i, i ∈ N is easily decomposed into problems with smaller numbers of vertices, and the sum of such numbers of vertices will be no more than n. The main idea consists in cutting a trapezoidal part of a hypograph of a non-unimodal piecewise linear function. Before formulating an algorithm for general case, we shall consider the case of a unimodal piecewise linear function, for which a sequence bi is of the form:
Such a polygon can be easily presented in a way in which
Then, counting the sum of the integer part of lengths of intervals cutting from a hypograph of such a function can be reduced to the formula
where Ni is equal to the sum of the integer part of lengths of intervals cutting from a hypograph of trapezoidal function as an appropriate trapezoid with vertices
As we already have stated, for calculating Ni there is a polynomial algorithm based on counting the points of integral lattice in an appropriate trapezoid. Therefore, there is a polynomial algorithm for counting the sum of the integer part of lengths of intervals cutting from a hypograph of a unimodal piecewise linear function by lines y = i, i ∈ N.
Let’s consider the general case of a piecewise linear function, presented by the sorted list of vertices:
If this function is not unimodal on the interval [a1, an], there is a local minimum of this function bk:

Piecewise linear function
Select the least among such local minima. Let this minimum has an index k. Then by a line y = bk, we cut a hypograph into two parts. The bottom part corresponds to a unimodal function. The upper part corresponds to a function on a smaller interval, and this smaller interval can be divided into two intervals, on each of which it is possible to solve a problem of counting the sum of integer part of lengths of intervals cutting by lines y = i. Thus, the following decomposition has been derived (see figure 2):
where N1 corresponds to a solution of a problem for unimodal function, N2 is a solution of a problem for function on an interval [a′, ak], N3 is a solution of a problem for function on an interval [ak, b′], a′, b′ are the left and right intersection of a line Y = bk with the graph of considered function.
Then the time of solution T(n) of considered problem satisfies the recurrent ratio
where P(n) is the time of the solution of a problem for trapezoidal component of a function plus elementary operations on calculation of k, a′, b′. It is easy to show that a solution of the last recurrent ratio requires an easily proved polynomial evaluation T(n). Thus, taking into account that a problem of calculating the sum of integer parts of intervals cutting by lines y = i in a hypograph of function is equivalent to a problem of optimum packing of unit squares in a hypograph of this function, the following theorem is proved.
Theorem 2
For a problem of optimum packing of unit squares in a hypograph H(f, a, b) of a piecewise linear function f on the interval [a, b] there exists a polynomial algorithm.
Let’s remark, that the crude estimates allow to evaluate a computing time of the given algorithm as quadratic number of arithmetical operations. That is for a hypograph of function, consisting n vertices, the number of arithmetical operations required for calculating the maximum number of unit squares, which can be packed into the hypograph, is evaluated by O(n2).
4 Conclusions
The proved theorems make probable a hypothesis about an existence of polynomial algorithm for a general problem of optimum packing the unit squares in a polygon without holes. It is natural to consider at first the following weaker problems.
Problem 1
To prove the existence of a polynomial algorithm for problems of packing of unit squares in a convex polygon.
Problem 2
To prove the existence of a polynomial algorithm for the problem about packing of squares 2 × 2 in a rectilinear polygon without holes, whose all vertices have integer coordinates.
References
[1] H. Dyckhoff, A typology of cutting and packing problems, European Journal of Operational Research 44(1990) 145–159.10.1016/0377-2217(90)90350-KSuche in Google Scholar
[2] C. Baur and S. P. Fekete, Approximation of geometric dispersion problems, Algorithmica, 30:450-470, 2001.10.1007/BFb0053964Suche in Google Scholar
[3] R. J. Fowler, M. S. Paterson, and S. L. Tanimoto. Optimal packing and covering in the plane are NP-complete. Inform. Process. Lett., 12(3):133-137, 1981.10.1016/0020-0190(81)90111-3Suche in Google Scholar
[4] C. Turan and E.N. Amirgaliev. A robust leaky-LMS algorithm for sparse system identification, Proceeding of the 9th international Conference on Discrete Optimization and Operations Research, Vladivostok, Russia, 2016. PP 538-546.10.1007/978-3-319-44914-2_42Suche in Google Scholar
[5] Rysbaiyly B., Yunicheva N. An iterative method to calculate the thermal characteristics of the rock mass with inaccurate initial data. Open Engineering. 2016. PP 627-636.10.1515/eng-2016-0089Suche in Google Scholar
[6] Muriel Dulieu, Dania El-Khechen, John Iacono, and Nikolaj van Omme. Packing 2 × 2 unit squares into grid polygons is NP-complete. In Proceedings of the 21st Canadian Conference on Computational Geometry, Vancouver, Canada, August 2009.Suche in Google Scholar
[7] Rockafellar, Ralph Tyrell (1996), Convex Analysis, Princeton University Press, Princeton, NJ.Suche in Google Scholar
[8] Alexander I. Barvinok. A polynomial time algorithm for counting integral points in polyhedra when the dimension is fixed. Mathematics of Operations Research, 19(4):769-779, 1994.10.1287/moor.19.4.769Suche in Google Scholar
[9] M. Beck and S. Robins. Explicit and efficient formulas for the lattice point count in rational polygons using Dedekind-Rademacher sums. Discrete and Computational Geometry, 27(4):443-459, 2002.10.1007/s00454-001-0082-3Suche in Google Scholar
© 2017 M. Z. Arslanov et al.
This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 License.
Artikel in diesem Heft
- Regular Articles
- The Differential Pressure Signal De-noised by Domain Transform Combined with Wavelet Threshold
- Regular Articles
- Robot-operated quality control station based on the UTT method
- Regular Articles
- Regression Models and Fuzzy Logic Prediction of TBM Penetration Rate
- Regular Articles
- Numerical study of chemically reacting unsteady Casson fluid flow past a stretching surface with cross diffusion and thermal radiation
- Regular Articles
- Experimental comparison between R409A and R437A performance in a heat pump unit
- Regular Articles
- Rapid prediction of damage on a struck ship accounting for side impact scenario models
- Regular Articles
- Implementation of Non-Destructive Evaluation and Process Monitoring in DLP-based Additive Manufacturing
- Regular Articles
- Air purification in industrial plants producing automotive rubber components in terms of energy efficiency
- Regular Articles
- On cyclic yield strength in definition of limits for characterisation of fatigue and creep behaviour
- Regular Articles
- Development of an operation strategy for hydrogen production using solar PV energy based on fluid dynamic aspects
- Regular Articles
- An exponential-related function for decision-making in engineering and management
- Regular Articles
- Usability Prediction & Ranking of SDLC Models Using Fuzzy Hierarchical Usability Model
- Regular Articles
- Exact Soliton and Kink Solutions for New (3+1)-Dimensional Nonlinear Modified Equations of Wave Propagation
- Regular Articles
- Entropy generation analysis and effects of slip conditions on micropolar fluid flow due to a rotating disk
- Regular Articles
- Application of the mode-shape expansion based on model order reduction methods to a composite structure
- Regular Articles
- A Combinatory Index based Optimal Reallocation of Generators in the presence of SVC using Krill Herd Algorithm
- Regular Articles
- Quality assessment of compost prepared with municipal solid waste
- Regular Articles
- Influence of polymer fibers on rheological properties of cement mortars
- Regular Articles
- Degradation of flood embankments – Results of observation of the destruction mechanism and comparison with a numerical model
- Regular Articles
- Mechanical Design of Innovative Electromagnetic Linear Actuators for Marine Applications
- Regular Articles
- Influence of addition of calcium sulfate dihydrate on drying of autoclaved aerated concrete
- Regular Articles
- Analysis of Microstrip Line Fed Patch Antenna for Wireless Communications
- Regular Articles
- PEMFC for aeronautic applications: A review on the durability aspects
- Regular Articles
- Laser marking as environment technology
- Regular Articles
- Influence of grain size distribution on dynamic shear modulus of sands
- Regular Articles
- Field evaluation of reflective insulation in south east Asia
- Regular Articles
- Effects of different production technologies on mechanical and metallurgical properties of precious metal denture alloys
- Regular Articles
- Mathematical description of tooth flank surface of globoidal worm gear with straight axial tooth profile
- Regular Articles
- Earth-based construction material field tests characterization in the Alto Douro Wine Region
- Regular Articles
- Experimental and Mathematical Modeling for Prediction of Tool Wear on the Machining of Aluminium 6061 Alloy by High Speed Steel Tools
- Special Issue on Current Topics, Trends and Applications in Logistics
- 10.1515/eng-2017-0001
- Special Issue on Current Topics, Trends and Applications in Logistics
- The Methodology of Selecting the Transport Mode for Companies on the Slovak Transport Market
- Special Issue on Current Topics, Trends and Applications in Logistics
- Determinants of Distribution Logistics in the Construction Industry
- Special Issue on Current Topics, Trends and Applications in Logistics
- Management of Customer Service in Terms of Logistics Information Systems
- Special Issue on Current Topics, Trends and Applications in Logistics
- The Use of Simulation Models in Solving the Problems of Merging two Plants of the Company
- Special Issue on Current Topics, Trends and Applications in Logistics
- Applying the Heuristic to the Risk Assessment within the Automotive Industry Supply Chain
- Special Issue on Current Topics, Trends and Applications in Logistics
- Modeling the Supply Process Using the Application of Selected Methods of Operational Analysis
- Special Issue on Current Topics, Trends and Applications in Logistics
- Possibilities of Using Transport Terminals in South Bohemian Region
- Special Issue on Current Topics, Trends and Applications in Logistics
- Comparison of the Temperature Conditions in the Transport of Perishable Foodstuff
- Special Issue on Current Topics, Trends and Applications in Logistics
- E-commerce and its Impact on Logistics Requirements
- Topical Issue Modern Manufacturing Technologies
- Wear-dependent specific coefficients in a mechanistic model for turning of nickel-based superalloy with ceramic tools
- Topical Issue Modern Manufacturing Technologies
- Effects of cutting parameters on machinability characteristics of Ni-based superalloys: a review
- Topical Issue Desktop Grids for High Performance Computing
- Task Scheduling in Desktop Grids: Open Problems
- Topical Issue Desktop Grids for High Performance Computing
- A Volunteer Computing Project for Solving Geoacoustic Inversion Problems
- Topical Issue Desktop Grids for High Performance Computing
- Improving “tail” computations in a BOINC-based Desktop Grid
- Topical Issue Desktop Grids for High Performance Computing
- LHC@Home: a BOINC-based volunteer computing infrastructure for physics studies at CERN
- Topical Issue Desktop Grids for High Performance Computing
- Comparison of Decisions Quality of Heuristic Methods with Limited Depth-First Search Techniques in the Graph Shortest Path Problem
- Topical Issue Desktop Grids for High Performance Computing
- Using Volunteer Computing to Study Some Features of Diagonal Latin Squares
- Topical Issue on Mathematical Modelling in Applied Sciences, II
- A polynomial algorithm for packing unit squares in a hypograph of a piecewise linear function
- Topical Issue on Mathematical Modelling in Applied Sciences, II
- Numerical Validation of Chemical Compositional Model for Wettability Alteration Processes
- Topical Issue on Mathematical Modelling in Applied Sciences, II
- Innovative intelligent technology of distance learning for visually impaired people
- Topical Issue on Mathematical Modelling in Applied Sciences, II
- Implementation and verification of global optimization benchmark problems
- Topical Issue on Mathematical Modelling in Applied Sciences, II
- On a program manifold’s stability of one contour automatic control systems
- Topical Issue on Mathematical Modelling in Applied Sciences, II
- Multi-agent grid system Agent-GRID with dynamic load balancing of cluster nodes
Artikel in diesem Heft
- Regular Articles
- The Differential Pressure Signal De-noised by Domain Transform Combined with Wavelet Threshold
- Regular Articles
- Robot-operated quality control station based on the UTT method
- Regular Articles
- Regression Models and Fuzzy Logic Prediction of TBM Penetration Rate
- Regular Articles
- Numerical study of chemically reacting unsteady Casson fluid flow past a stretching surface with cross diffusion and thermal radiation
- Regular Articles
- Experimental comparison between R409A and R437A performance in a heat pump unit
- Regular Articles
- Rapid prediction of damage on a struck ship accounting for side impact scenario models
- Regular Articles
- Implementation of Non-Destructive Evaluation and Process Monitoring in DLP-based Additive Manufacturing
- Regular Articles
- Air purification in industrial plants producing automotive rubber components in terms of energy efficiency
- Regular Articles
- On cyclic yield strength in definition of limits for characterisation of fatigue and creep behaviour
- Regular Articles
- Development of an operation strategy for hydrogen production using solar PV energy based on fluid dynamic aspects
- Regular Articles
- An exponential-related function for decision-making in engineering and management
- Regular Articles
- Usability Prediction & Ranking of SDLC Models Using Fuzzy Hierarchical Usability Model
- Regular Articles
- Exact Soliton and Kink Solutions for New (3+1)-Dimensional Nonlinear Modified Equations of Wave Propagation
- Regular Articles
- Entropy generation analysis and effects of slip conditions on micropolar fluid flow due to a rotating disk
- Regular Articles
- Application of the mode-shape expansion based on model order reduction methods to a composite structure
- Regular Articles
- A Combinatory Index based Optimal Reallocation of Generators in the presence of SVC using Krill Herd Algorithm
- Regular Articles
- Quality assessment of compost prepared with municipal solid waste
- Regular Articles
- Influence of polymer fibers on rheological properties of cement mortars
- Regular Articles
- Degradation of flood embankments – Results of observation of the destruction mechanism and comparison with a numerical model
- Regular Articles
- Mechanical Design of Innovative Electromagnetic Linear Actuators for Marine Applications
- Regular Articles
- Influence of addition of calcium sulfate dihydrate on drying of autoclaved aerated concrete
- Regular Articles
- Analysis of Microstrip Line Fed Patch Antenna for Wireless Communications
- Regular Articles
- PEMFC for aeronautic applications: A review on the durability aspects
- Regular Articles
- Laser marking as environment technology
- Regular Articles
- Influence of grain size distribution on dynamic shear modulus of sands
- Regular Articles
- Field evaluation of reflective insulation in south east Asia
- Regular Articles
- Effects of different production technologies on mechanical and metallurgical properties of precious metal denture alloys
- Regular Articles
- Mathematical description of tooth flank surface of globoidal worm gear with straight axial tooth profile
- Regular Articles
- Earth-based construction material field tests characterization in the Alto Douro Wine Region
- Regular Articles
- Experimental and Mathematical Modeling for Prediction of Tool Wear on the Machining of Aluminium 6061 Alloy by High Speed Steel Tools
- Special Issue on Current Topics, Trends and Applications in Logistics
- 10.1515/eng-2017-0001
- Special Issue on Current Topics, Trends and Applications in Logistics
- The Methodology of Selecting the Transport Mode for Companies on the Slovak Transport Market
- Special Issue on Current Topics, Trends and Applications in Logistics
- Determinants of Distribution Logistics in the Construction Industry
- Special Issue on Current Topics, Trends and Applications in Logistics
- Management of Customer Service in Terms of Logistics Information Systems
- Special Issue on Current Topics, Trends and Applications in Logistics
- The Use of Simulation Models in Solving the Problems of Merging two Plants of the Company
- Special Issue on Current Topics, Trends and Applications in Logistics
- Applying the Heuristic to the Risk Assessment within the Automotive Industry Supply Chain
- Special Issue on Current Topics, Trends and Applications in Logistics
- Modeling the Supply Process Using the Application of Selected Methods of Operational Analysis
- Special Issue on Current Topics, Trends and Applications in Logistics
- Possibilities of Using Transport Terminals in South Bohemian Region
- Special Issue on Current Topics, Trends and Applications in Logistics
- Comparison of the Temperature Conditions in the Transport of Perishable Foodstuff
- Special Issue on Current Topics, Trends and Applications in Logistics
- E-commerce and its Impact on Logistics Requirements
- Topical Issue Modern Manufacturing Technologies
- Wear-dependent specific coefficients in a mechanistic model for turning of nickel-based superalloy with ceramic tools
- Topical Issue Modern Manufacturing Technologies
- Effects of cutting parameters on machinability characteristics of Ni-based superalloys: a review
- Topical Issue Desktop Grids for High Performance Computing
- Task Scheduling in Desktop Grids: Open Problems
- Topical Issue Desktop Grids for High Performance Computing
- A Volunteer Computing Project for Solving Geoacoustic Inversion Problems
- Topical Issue Desktop Grids for High Performance Computing
- Improving “tail” computations in a BOINC-based Desktop Grid
- Topical Issue Desktop Grids for High Performance Computing
- LHC@Home: a BOINC-based volunteer computing infrastructure for physics studies at CERN
- Topical Issue Desktop Grids for High Performance Computing
- Comparison of Decisions Quality of Heuristic Methods with Limited Depth-First Search Techniques in the Graph Shortest Path Problem
- Topical Issue Desktop Grids for High Performance Computing
- Using Volunteer Computing to Study Some Features of Diagonal Latin Squares
- Topical Issue on Mathematical Modelling in Applied Sciences, II
- A polynomial algorithm for packing unit squares in a hypograph of a piecewise linear function
- Topical Issue on Mathematical Modelling in Applied Sciences, II
- Numerical Validation of Chemical Compositional Model for Wettability Alteration Processes
- Topical Issue on Mathematical Modelling in Applied Sciences, II
- Innovative intelligent technology of distance learning for visually impaired people
- Topical Issue on Mathematical Modelling in Applied Sciences, II
- Implementation and verification of global optimization benchmark problems
- Topical Issue on Mathematical Modelling in Applied Sciences, II
- On a program manifold’s stability of one contour automatic control systems
- Topical Issue on Mathematical Modelling in Applied Sciences, II
- Multi-agent grid system Agent-GRID with dynamic load balancing of cluster nodes