Rectangular Partitioning

Similar documents
Partitioning Spatially Located Load with Rectangles: Algorithms and Simulations

Aspects of a Multivariate Complexity Analysis for Rectangle Tiling

Basic Idea. The routing problem is typically solved using a twostep

Computational Geometry

Approximation Algorithms for Geometric Intersection Graphs

ICS 161 Algorithms Winter 1998 Final Exam. 1: out of 15. 2: out of 15. 3: out of 20. 4: out of 15. 5: out of 20. 6: out of 15.

On the Complexity of Graph Cuboidal Dual Problems for 3-D Floorplanning of Integrated Circuit Design

Lecture 3: Art Gallery Problems and Polygon Triangulation

3 No-Wait Job Shops with Variable Processing Times

W[1]-hardness. Dániel Marx. Recent Advances in Parameterized Complexity Tel Aviv, Israel, December 3, 2017

Combinatorial Optimization

Computational Geometry

On ɛ-unit distance graphs

Graphs and Network Flows IE411. Lecture 21. Dr. Ted Ralphs

Optimizing Parallel Sparse Matrix-Vector Multiplication by Corner Partitioning

On the Rectangle Escape Problem

Approximation Algorithms

Estimation of Wirelength

Clustering and Visualisation of Data

Lecture 21: Other Reductions Steven Skiena

15-854: Approximations Algorithms Lecturer: Anupam Gupta Topic: Direct Rounding of LP Relaxations Date: 10/31/2005 Scribe: Varun Gupta

CS6100: Topics in Design and Analysis of Algorithms

Exercises Computational Complexity

Introduction. A very important step in physical design cycle. It is the process of arranging a set of modules on the layout surface.

Treewidth and graph minors

Problem A. Interactive Smiley Face

Isometric Diamond Subgraphs

9 About Intersection Graphs

Computational Biology Lecture 12: Physical mapping by restriction mapping Saad Mneimneh

CMPSCI611: The SUBSET-SUM Problem Lecture 18

Computational Geometry

1/60. Geometric Algorithms. Lecture 1: Introduction. Convex Hulls

Exemples of LCP. (b,3) (c,3) (d,4) 38 d

Graph theory. Po-Shen Loh. June We begin by collecting some basic facts which can be proved via bare-hands techniques.

CS 410/584, Algorithm Design & Analysis, Lecture Notes 8!

Eulerian disjoint paths problem in grid graphs is NP-complete

Some Open Problems in Graph Theory and Computational Geometry

CS 140: Sparse Matrix-Vector Multiplication and Graph Partitioning

Range Searching and Windowing

ON WEIGHTED RECTANGLE PACKING WITH LARGE RESOURCES*

Notes for Lecture 24

Hardness for Maximum Weight Rectangles ARTURS BACKURS, MIT NISHANTH DIKKALA, MIT CHRISTOS TZAMOS, MIT

Interactive Math Glossary Terms and Definitions

Train schedule diagram drawing algorithm considering interrelationship between labels

Parameterized Complexity of Independence and Domination on Geometric Graphs

Approximation Algorithms

Geometric Red-Blue Set Cover for Unit Squares and Related Problems

Sparse Hypercube 3-Spanners

Matching and Planarity

Separators in High-Genus Near-Planar Graphs

CSC 505, Fall 2000: Week 12

CS 410/584, Algorithm Design & Analysis, Lecture Notes 8

On Coloring and Colorability Analysis of Integrated Circuits with Triple and Quadruple Patterning Techniques. Alexey Lvov Gus Tellez Gi-Joon Nam

Algorithms for Integer Programming

Lecture 21: Other Reductions Steven Skiena. Department of Computer Science State University of New York Stony Brook, NY

11.1 Facility Location

Solutions to Problem Set 1

On Multi-Stack Boundary Labeling Problems

(Refer Slide Time: 00:02:00)

Tutorial for Algorithm s Theory Problem Set 5. January 17, 2013

Minimum congestion spanning trees of grids and discrete toruses

T. Biedl and B. Genc. 1 Introduction

Motion Planning. O Rourke, Chapter 8

Placement Algorithm for FPGA Circuits

Computational Geometry

UNIVERSITY OF TORONTO Department of Computer Science April 2014 Final Exam CSC373H1S Robert Robere Duration - 3 hours No Aids Allowed.

Big Data Analytics. Special Topics for Computer Science CSE CSE April 14

AMS /672: Graph Theory Homework Problems - Week V. Problems to be handed in on Wednesday, March 2: 6, 8, 9, 11, 12.

Scanning Real World Objects without Worries 3D Reconstruction

Reductions. Linear Time Reductions. Desiderata. Reduction. Desiderata. Classify problems according to their computational requirements.

Minimizing Clock Domain Crossing in Network on Chip Interconnect

Mapping pipeline skeletons onto heterogeneous platforms

Fast Hierarchical Clustering via Dynamic Closest Pairs

Solutions to problem set 1

Derrick Stolee. April 12,

TELCOM2125: Network Science and Analysis

Chapter 10. Exploring Conic Sections

W[1]-hardness. Dániel Marx 1. Hungarian Academy of Sciences (MTA SZTAKI) Budapest, Hungary

On the Rectangle Escape Problem

3 Competitive Dynamic BSTs (January 31 and February 2)

CMSC 754 Computational Geometry 1

Nearest Neighbor Predictors

The Complexity of Camping

CS S Lecture February 13, 2017

Algorithms for Euclidean TSP

Part II. Graph Theory. Year

SPERNER S LEMMA MOOR XU

1 Unweighted Set Cover

Figure : Example Precedence Graph

Solutions for the Exam 6 January 2014

5th Grade Units (as articulated through Diocese of Tucson ACE Collaborative Curriculum Design 2012) Unit 1: Mathematical Operations with Whole Numbers

Computing NodeTrix Representations of Clustered Graphs

Multi-Stack Boundary Labeling Problems

arxiv: v5 [cs.dm] 9 May 2016

Fixed Parameter Algorithms

A SIMPLE APPROXIMATION ALGORITHM FOR NONOVERLAPPING LOCAL ALIGNMENTS (WEIGHTED INDEPENDENT SETS OF AXIS PARALLEL RECTANGLES)

Parameterized graph separation problems

A Simple, but NP-Hard, Motion Planning Problem

The Bounded Edge Coloring Problem and Offline Crossbar Scheduling

1 Introduction. Counting with Cubes. Barringer Winter MathCamp, 2016

Transcription:

Rectangular Partitioning Joe Forsmann and Rock Hymas Introduction/Abstract We will look at a problem that I (Rock) had to solve in the course of my work. Given a set of non-overlapping rectangles each having top, left, bottom, and right coordinates, divide the x-y plane over which these rectangles exist into the minimum number of rows plus columns, such that each resulting cell intersects at most one rectangle. We will refer to this problem as Rectangular Partitioning and show that it is NP-complete, but that approximation algorithms exist. We also explore the non-optimal solution used in my work, as well as discussing open problems and future challenges. Motivation The motivation for Rectangular Partitioning comes from my work. The application I help create has forms that can be designed by third parties, and it also has a layout engine that makes it easy to change the layout of a form based on the size of the form and its contents. The layout engine takes as it s input a table of cells and their contents, along with attributes specifying how a given cell, row, or column should behave (i.e. expand when the form expands, alignment of controls, etc.). The table of cells may have controls that overlap multiple cells, but each cell may contain at most one control. Third party form designers don t have direct access to this layout engine, and so we created a conversion from the form they designed to the layout engine input by subdividing the form space into rows and columns based on the placement of individual controls, which are all rectangular. Minimizing the number of rows plus columns is important to the running time of the layout engine, so that is our goal. Additionally, in researching Rectangular Partitioning, we have found that it is related to problems in parallel computation where a computational task is partitioned into subtasks that can be assigned to parallel processors in such a way that minimized communication among the processors in reassembling the solution. Understanding Rectangular Partitioning further may provide insight into the problem of subdividing a computational task for parallel processors. Formal Problem Definition Given a set of non-overlapping rectangles R 1, R 2, R n each having top coordinates t(r i ), left coordinates l(r i ), bottom coordinates b(r i ), and right coordinates denoted as r(r i ), partition the x-y plane over which these rectangles exist into the minimum number of rows plus columns, such that each resulting cell intersects at most one rectangle. Formally, a partitioning is determined by a set H of horizontal dividers (rows) h 0 = 0 h 1 h p = max i r(r i ) and a set V of vertical dividers v 0 = 0 v 1 v q = max j b(r j ). The partitioning creates p q cells c i,j, 0 i < p and 0 j < q, where the cell c i,j is also a rectangle with t c i,j = v j, b c i,j = v j +1, l c i,j = h i, r c i,j = h i+1. We

say that a cell c i,j intersects a rectangle R k if max t c i,j, t R k > min b c i,j, b R k and max l c i,j, l R k > min r c i,j, r R k. Then we try to find a partitioning P = H, V such that p + q is as small as possible, subject to the constraint that c i,j, c i,j intersects at most one R k. Our approach In my application, the existing algorithm for solving this problem is non-optimal. We give the algorithm here for completeness. In this description, increases along the y axis move downward. Sort the rectangles first by increasing t(r i ), then by increasing l(r i ) Create a partition with one row and one column h 0 = 0, h 1 = max i r R i v 0 = 0, v 1 = max i b(r i ) For each rectangle R i For each cell c i,j which intersects both R i and some other R j if R i and R j can be separated by creating a new row Create a new row, with new h i = max t R i, t(r j ) Insert h i into the correct place in H else Create a new column, with new v i = max l R i, l(r j ) Insert v i into the correct place in V endif end for end for The following sequence shows the progression of dividing rows and columns that the above algorithm goes through. The rectangles are numbered according to their order in this sorting.

The following is an example where the algorithm above does not find the optimal solution. The algorithm will divide it into 6 rows, but an optimal solution requires only rows and 2 columns Rectangular Partitioning is NP-Complete Rectangular Partitioning has an equivalent decision problem that is defined as follows: Given the values p, q, is there a partitioning (H, V) of the x-y plane such that H = p and V = q and such that each cell c i,j intersects at most one of the rectangles R i. We show this by reducing the Balanced Bipartite Cover (BBC) problem to Rectangular Partitioning. BBC is defined as follows: Given a bipartite graph G = (V 1, V 2, E) with V 1 = V 2, E V 1 V 2 and a positive integer k, are there subsets U 1 V 1 and U 2 V 2 such that U 1 = U 2 = k each edge (u, v) E has either u U 1 or v U 2. BBC is shown to be NP-Complete in [2]. The following proof is analogous to the proof in [same reference] that BBC can be reduced to the Generalized Block Distribution. First we create an instance of Rectangular Partitioning from a given instance of BBC in the following way. Let n = V 1 = V 2 in the instance of BBC. Let R i,j be defined such that l R i,j = 2i + 1, t R i,j = 2j + 1, r R i,j = 2i + 2, b R i,j = 2j + 2. Then the instance of RP has q = p = n + k + 2 and includes the following rectangles: 1. R 0,0 2. R 0,4k+1 and R 0,4k+2 for 0 k < n/2. R 1,4k and R 1,4k+ for 0 k < n/2 4. R 4k+1,0 and R 4k+2,0 for 0 k < n/2 5. R 4k,1 and R 4k+,1 for 0 k < n/2 6. R 2i,2j and R 2i+1,2j+1 for all (i, j) E If we find a solution to this RP then the rectangles from the first five rules force is to create at least n + 2 rows and n + 2 columns no matter what the rectangles in rule 6 do. This is demonstrated by the hollow rectangles in the first two rows and first two columns in Figure 1. Forcing columns and rows, with the minimum set of rows and columns indicated by dotted lines. This leaves us with k rows and k

columns to add in hopes of satisfying the requirements of the rectangles in rule 6. For each edge in G, rule 6 constructs two rectangles (green) not divided by the the rows/columns forced into existence by rules 1 through 5. Each of these sets of rectangles can and must be divided either by adding a new row or a new column, or both, if we are to meet the requirement that each cell intersect at most one rectangle. Splitting them with a new row corresponds to choosing a vertex from V 1 in BBC and splitting them with a new column corresponds to a choosing a vertex from V 2. It is clear from the construction of this RP instance that there exists a solution to it if and only if the corresponding BBC problem has a solution. Thus, RP is NP-hard. A certificate of a solution to the decision version of RP that is verifiable in polynomial time is simple a partitioning H of the x-y plane with p rows and q columns that satisfies the requirement of RP. Thus, RP is in NP and is NP-Complete. Figure 1. Forcing columns and rows Paper Discussion Problem Overview In their paper [1] Muthukrishnan and Suel discuss partitioning an array of cells containing integers into rectangular tiles. Consider, for example, that integers in each cell represent amount of work, and the job is to partition the work among processors. The goal of the algorithm is to balance the work between the processors. The paper also describes applications of this algorithm in the database and image processing paradigm. Metrics for Optimal Partitioning Two metrics are used to quantify the optimality of the algorithm MAX-SUM and SUM-VAR. The MAX- SUM metric is simply the maximum of all tile weights, where the tile weight is the sum of all cells within that tile. The SUM-VAR metric is the sum of all variance, where variance is defined as the square of the difference between the tile weight and the average of all tile weights. The goal of the algorithm is to find a partitioning that minimizes these metrics. NP-Completeness Via references, the paper stated that variation of this problem was proven to be NP-Complete. The MAX-SUM in three dimensions was found to be NP Complete using a reduction to Monotonic -SAT. Further, the two dimensional problem was shown to be NP Complete using a reduction to the Balanced Complete bipartite subgraph. For optimizing the slightly different problem of minimizing the number of tiles, a reduction to Set Cover is referenced that provides a O(log n ) approximation of the number of dividers. Other Heuristic Algorithms

Having shown that this problem and many variants are NP-Complete, the paper turns toward finding algorithms that approximate solutions. Many other authors have shown that there exist heuristic algorithms that provide good approximations to the MAX-SUM problem. The best of which provides a solution with an approximation factor of about 120. Most of these other algorithms are based on the following principle: Do alternate scans of each axis, and for each scan find the best possible cuts taking into account all the cuts that have been made before. The algorithm terminates when there are no more cuts made over a full scan. The Algorithm The formal algorithm can be found in section 5.2 of the paper. The core algorithm described in this paper is inspired by a greedy algorithm used for solving Set Cover. Essentially, the author makes optimizations on another referenced solution to provide a better running time and closer approximation to an optimal solution than any other known solution. Mapping Rectangular Partitioning to Array Partitioning The concept of returning a list of x and y values that define the partitioning boundaries are the same between the problem discussed in the paper, and the project problem of partitioning controls into cells. Given this, we considered ways in which to map the rectangular partitioning into the array partitioning. In the Rectangular Partitioning problem, if we place a vertical line on the right side of each control, and we place a horizontal line on the top of each control, then this creates an n m array with at most one control per cell. If a cell in this array contains a control, then set the value of that cell to be a large value. Finally, set the value of all other cells that do not contain a control to 0. Then, we run the version of the algorithm described in this paper with the metric to minimize the number of partitions to obtain the solution to the Rectangular Partitioning problem. To ensure that each cell in the end will contain at most one control, we set the value of a controlcontaining cell to be a large value. Therefore, the extreme cost of having two controls in one cell, and one cell in another would force all cells to have a single control. Open Problems and Challenges There are many potential variations on this problem, even within the framework of our motivation section. For example, the layout engine might have O pq time complexity, and so the optimization would change to optimizing for minimum pq, rather than minimum p + q. One could easily imagine removing the initial constraint that all rectangles are non-overlapping. We could then rephrase the question in terms of minimizing the number of cells that intersect multiple rectangles. If the layout engine could handle multiple controls in a given cell, but doing so was expensive, we could modify what we re optimizing for by making it p + q + ci, where c is a constant penalty factor and I is the number of cells with multiple intersecting controls.

Bibliography [1] S. Muthukrishnan and Torsten Suel. Approximation Algorithms for Array Partitioning Problems. citeseer.ist.psu.edu/58259.html [2] M. Grigni, and F. Manne, "On the Complexity of the Generalized Block Distribution," Proc. rd Int. Workshop on Parallel Algorithms for Irregularly Structured Problems (IRREGULAR'96),1996, pp. 19-- 26. [] S. Muthukrishnan, Viswanath Poosala, and Torsten Suel. On rectangular partitionings in two dimensions: Algorithms, complexity, and applications. 7th International Conference on Database Theory, January, 1999. [4] S. Khanna, S. Muthukrishnan and S. Skiena. Efficient array partitioning. Proc. 24th ICALP, 616626, 1997. http://citeseer.ist.psu.edu/article/khanna97efficient.html