+ All Categories
Home > Documents > 2D Rectangular Packing with LFF and LFF/T Presented by Y. T. Wu.

2D Rectangular Packing with LFF and LFF/T Presented by Y. T. Wu.

Date post: 22-Dec-2015
Category:
View: 219 times
Download: 0 times
Share this document with a friend
Popular Tags:
27
2D Rectangular 2D Rectangular Packing with LFF and Packing with LFF and LFF/T LFF/T Presented by Y. T. Wu Presented by Y. T. Wu
Transcript

2D Rectangular 2D Rectangular Packing with LFF and Packing with LFF and LFF/TLFF/T

Presented by Y. T. WuPresented by Y. T. Wu

OverviewOverview

IntroductionIntroduction The ProblemThe Problem LFF AlgorithmLFF Algorithm LFF/T Algorithm – An ImprovementLFF/T Algorithm – An Improvement Experimental ResultsExperimental Results ConclusionConclusion Future DirectionFuture Direction

IntroductionIntroduction

2D rectangular packing is to pack a set of 2D rectangular packing is to pack a set of rectangles into a bounding rectanglerectangles into a bounding rectangle

There are many practical applications:There are many practical applications: VLSI floor-planningVLSI floor-planning VLSI placementVLSI placement Job-schedulingJob-scheduling

IntroductionIntroduction

It is a NP-complete problemIt is a NP-complete problem

Heuristics are proposed for solving these Heuristics are proposed for solving these kind of problemskind of problems

Existing algorithms:Existing algorithms: Simulated AnnealingSimulated Annealing Genetic algorithmsGenetic algorithms

The ProblemThe Problem

To determine whether a set of rectangles(rTo determine whether a set of rectangles(r11, r, r22, , rr33,…, r,…, rnn) with given length ) with given length l l and width and width ww can be can be packed into a bounded rectangular container Rpacked into a bounded rectangular container R

Goal: Goal: Minimize total area for packing these rectangles Minimize total area for packing these rectangles Maximize packing densityMaximize packing density

LFF AlgorithmLFF Algorithm

What is LFF?What is LFF?

A A quasi-humanquasi-human (cognitive) based heuristic (cognitive) based heuristic

A deterministic algorithm inspired by ChinesA deterministic algorithm inspired by Chinese ancient professionals for polygon-shape ste ancient professionals for polygon-shape stone platesone plates

Based on the concept of flexibilityBased on the concept of flexibility

LFF AlgorithmLFF Algorithm

Two types of flexibility:Two types of flexibility:

Flexibility of empty space follows this order:Flexibility of empty space follows this order:

a corner < a side < a central void areaa corner < a side < a central void area

Flexibility of objects to be packed cannot be cFlexibility of objects to be packed cannot be calculated, but follow this order in general:alculated, but follow this order in general:

larger objects < smaller objectslarger objects < smaller objects

LFF AlgorithmLFF Algorithm

What is a corner?What is a corner? It is a point which is bounded in two It is a point which is bounded in two

directionsdirections

Corner bounded on top and left

Corner bounded on bottom

and left

Corner bounded on top and right

As the packed object are all rectangles, As the packed object are all rectangles, all corners are 90ºall corners are 90º

Corner bounded on bottom and right

LFF AlgorithmLFF Algorithm

Basic rules of LFF:Basic rules of LFF:

Objects must be packed to at least one cornerObjects must be packed to at least one corner

There must not be any overlapping of objectsThere must not be any overlapping of objects

Due to flexibilities, larger objects should be packed to corners Due to flexibilities, larger objects should be packed to corners firstfirst

If more than one available corner If more than one available corner (i.e. a corner to which the (i.e. a corner to which the packing does not overlap with other objects)packing does not overlap with other objects),, use fitness cost use fitness cost function to choose the best onefunction to choose the best one Fitness cost function = total area of rectangle packedFitness cost function = total area of rectangle packed

LFF AlgorithmLFF Algorithm

As mentioned in previous slide, overlapping of As mentioned in previous slide, overlapping of objects is not allowedobjects is not allowed

““Region query” is the process for detecting Region query” is the process for detecting whether the region for insertion of new object is whether the region for insertion of new object is already occupiedalready occupied

In LFF, region query is operated by In LFF, region query is operated by K-D tree, with K-D tree, with KK = 4 = 4

LFF AlgorithmLFF Algorithm

What is K-D tree?What is K-D tree?

A “Multi-dimensional Binary Tree”A “Multi-dimensional Binary Tree”

struct kdtree{struct kdtree{kdkey_t kd_keys[4];kdkey_t kd_keys[4];kdkey_t kd_lo_min_bound,kdkey_t kd_lo_min_bound,kd_hi_max_bound,kd_hi_max_bound,kd_other_bound;kd_other_bound;struct kdtree *kd_father;struct kdtree *kd_father;struct kdtree * kd_sons[2];struct kdtree * kd_sons[2];

};};

The packing is considered to be performed on a coordinate-plaThe packing is considered to be performed on a coordinate-plane on which all keys are representing points on that coordinatne on which all keys are representing points on that coordinate-planee-plane

LFF AlgorithmLFF Algorithm

The 4 kd_keys are:The 4 kd_keys are:

KK00((pp) = x) = x11

KK11((pp) = y) = y11

KK22((pp) = x) = x22

KK33((pp) = y) = y22(x1, y1)

(x2, y2)

LFF AlgorithmLFF Algorithm

The two sons are LOSON and HISONThe two sons are LOSON and HISON

To determine whether a child To determine whether a child qq is LOSON or HISON of is LOSON or HISON of its parent its parent pp, compare their corresponding , compare their corresponding kdkeykdkey

Discriminator Discriminator j j is introduced to control the use kdkey fois introduced to control the use kdkey for comparison. Compare Kr comparison. Compare Kjj((pp) and K) and Kjj((qq))

For example, when For example, when jj=0, if K=0, if K00((pp)>K)>K00((qq), ), qq is LOSON; is LOSON; if Kif K00((pp)<K)<K00((qq), ), qq is HISON is HISON

j increments as it goes down the tree, and reset to 0 whj increments as it goes down the tree, and reset to 0 when it reaches maximum, then repeat to increment againen it reaches maximum, then repeat to increment again

LFF AlgorithmLFF Algorithm

An exampleAn example

Fig. 1a) 16 labelled rectangles on a grid 0 x 13 in size Fig. 1b) Placement of these 16 labelled rectangles in a 4-d binary tree

a (6, 1, 7, 3)

a (6, 1, 7, 3)

b (2, 6, 4, 9)

b (2, 6, 4, 9)

c (9, 7, 12, 8)

c (9, 7, 12, 8)

d (1, 4, 3, 7)

d (1, 4, 3, 7) e (1, 10, 3, 13)

e (1, 10, 3, 13)

LFF AlgorithmLFF Algorithm

Procedures for manipulating K-D Tree in LFF 2Procedures for manipulating K-D Tree in LFF 2D rectangular packing:D rectangular packing:

KD-INSERTKD-INSERT

KD-REGION-SEARCHKD-REGION-SEARCH

KD-SUCCESSORKD-SUCCESSOR

KD-INTERSECT-REGIONKD-INTERSECT-REGION

LFF AlgorithmLFF Algorithm

KD-INSERTKD-INSERT It takes in a kd-node as parameterIt takes in a kd-node as parameter Insert this node into the existing KD-TREE bInsert this node into the existing KD-TREE b

y calling the KD-SUCCESSOR to find out why calling the KD-SUCCESSOR to find out where should the node be insertedere should the node be inserted

KD-SUCCESSORKD-SUCCESSOR It compares the jth It compares the jth kdkey kdkey of of qq and and pp to determine to determine

whether LOSON or HISON should be the next nowhether LOSON or HISON should be the next node de

LFF AlgorithmLFF Algorithm

KD-REGION-SEARCHKD-REGION-SEARCH For each For each kd_node in the KD-TREEkd_node in the KD-TREE, call KD-INTERSECT-REGIO, call KD-INTERSECT-REGIO

N to check whether that N to check whether that kd-nodekd-node intersects with intersects with oo if if oo is packed at is packed at the corner being evaluated, report overlapping, if any and quit chethe corner being evaluated, report overlapping, if any and quit checkingcking

KD-INTERSECT-REGIONKD-INTERSECT-REGION Test, based on a set of conditions, whetherTest, based on a set of conditions, whether p p intersects or touche intersects or touche

s with s with oo if if oo is packed at the corner being examined is packed at the corner being examined

If yes, check whether they are touchingIf yes, check whether they are touching

If yes, add p to the touches list to indicate that If yes, add p to the touches list to indicate that pp touches with touches with o o

If no, return TRUE to indicate intersectionIf no, return TRUE to indicate intersection

LFF AlgorithmLFF Algorithm

The relationship between the KD-TREE The relationship between the KD-TREE operations and LFFoperations and LFF

Before packing any objects, call KD-REGION-Before packing any objects, call KD-REGION-SEARCH to detect overlappingSEARCH to detect overlapping

If no overlapping is reported, call KD-INSERT to If no overlapping is reported, call KD-INSERT to update the KD-TREE, indicating that the object is update the KD-TREE, indicating that the object is packed at the specific position and occupy therepacked at the specific position and occupy there

LFF AlgorithmLFF Algorithm

The algorithm:The algorithm:

Starting with an empty work space (bounding rectangle)Starting with an empty work space (bounding rectangle)

1.1. Based on the current packing configuration, find all possible COPMs for each unpBased on the current packing configuration, find all possible COPMs for each unpacked rectangle, represent each COPM b a quinary-tuple <longer side, shorter siacked rectangle, represent each COPM b a quinary-tuple <longer side, shorter side, orientation, xde, orientation, x11, y, y11>>

2.2. Sort all these quinary-tuples in lexicographical orderSort all these quinary-tuples in lexicographical order

3.3. For each candidate COPM, do a) to c) to find its fitness function value (FFV).For each candidate COPM, do a) to c) to find its fitness function value (FFV).

a)a) Pseudo-pack this COPMPseudo-pack this COPM

b)b) Pseudo-pack all the remaining rectangles based on the current COPM list anPseudo-pack all the remaining rectangles based on the current COPM list and with a greedy approach, until no more COPM can be packedd with a greedy approach, until no more COPM can be packed

c)c) Calculate FFV of this candidate COPM as the occupied area.Calculate FFV of this candidate COPM as the occupied area.

Note: Before the pseudo-packing for the next candidate COPM is tried, one needNote: Before the pseudo-packing for the next candidate COPM is tried, one needs to remove the previous pseudo-packed COPMs to remove the previous pseudo-packed COPM

4.4. Pick the candidate COPM with the highest FFB and really pack the corresponding Pick the candidate COPM with the highest FFB and really pack the corresponding rectangle according to the COPMrectangle according to the COPM

5.5. Mark the rectangle as packedMark the rectangle as packed

6.6. Return to step 1 until no more packing can be doneReturn to step 1 until no more packing can be done

LFF AlgorithmLFF Algorithm

A sample case:A sample case:

Suppose rectangles A(2x5), B(4x4) and C(6x4) are to be Suppose rectangles A(2x5), B(4x4) and C(6x4) are to be packed in a work space (8x8) and a rectangle P(6x3) at (0, 8) packed in a work space (8x8) and a rectangle P(6x3) at (0, 8) is already packed in previous iterationis already packed in previous iteration

COPM is represented as <longer side, shorter side, COPM is represented as <longer side, shorter side, orientation, xorientation, x11, y, y11>>

As P is packed, one of the container’s corner is occupied, the As P is packed, one of the container’s corner is occupied, the available corners are: (0, 0), (0, 2), (3, 8), (8, 0), (8, 8)available corners are: (0, 0), (0, 2), (3, 8), (8, 0), (8, 8)

LFF algorithmLFF algorithm

The COPM list generated stores all feasible packing (no The COPM list generated stores all feasible packing (no overlapping and within the bounding rectangle)overlapping and within the bounding rectangle)

(6, 4, 1, 4, 2) – rectangle C vertically packed at (8, 8)(6, 4, 1, 4, 2) – rectangle C vertically packed at (8, 8) (6, 4, 1, 3, 2) – rectangle C vertically packed at (8, 0)(6, 4, 1, 3, 2) – rectangle C vertically packed at (8, 0) (6, 4, 1, 4, 0) – rectangle C vertically packed at (3, 8)(6, 4, 1, 4, 0) – rectangle C vertically packed at (3, 8) (5, 2, 0, 3, 6) – rectangle A horizontally packed at (8, 8) or (3, 8)(5, 2, 0, 3, 6) – rectangle A horizontally packed at (8, 8) or (3, 8) (5, 2, 1, 6, 3) – rectangle A vertically packed at (8, 8)(5, 2, 1, 6, 3) – rectangle A vertically packed at (8, 8) (5, 2, 0, 3, 0) – rectangle A vertically packed at (8, 0)(5, 2, 0, 3, 0) – rectangle A vertically packed at (8, 0) (5, 2, 1, 6, 0) – rectangle A vertically packed at (8, 0)(5, 2, 1, 6, 0) – rectangle A vertically packed at (8, 0) (5, 2, 1, 3, 3) – rectangle A vertically packed at (3, 8)(5, 2, 1, 3, 3) – rectangle A vertically packed at (3, 8) (5, 2, 0, 0, 0) – rectangle A vertically packed at (0, 2) or (0, 0)(5, 2, 0, 0, 0) – rectangle A vertically packed at (0, 2) or (0, 0)

For rectangle B, the generation is by checking all orientation against For rectangle B, the generation is by checking all orientation against all corners, if feasible in location, it will shorten itself by deleting not all corners, if feasible in location, it will shorten itself by deleting not feasible solutions feasible solutions

LFF AlgorithmLFF Algorithm

Consider rectangle C is pseudo-packed to (8, 8) vertically, i.e., COPM (6, Consider rectangle C is pseudo-packed to (8, 8) vertically, i.e., COPM (6, 4, 1, 4, 2)4, 1, 4, 2)

The COPM list for next pseudo-packing step is shortened by removing all The COPM list for next pseudo-packing step is shortened by removing all entries related to rectangle C as well as all entries packing rectangles to entries related to rectangle C as well as all entries packing rectangles to corner (8, 8) since it is already occupiedcorner (8, 8) since it is already occupied

The list becomes:The list becomes: (5, 2, 0, 3, 0) – rectangle A vertically packed at (8, 0)(5, 2, 0, 3, 0) – rectangle A vertically packed at (8, 0) (5, 2, 1, 6, 0) – rectangle A vertically packed at (8, 0)(5, 2, 1, 6, 0) – rectangle A vertically packed at (8, 0) (5, 2, 1, 3, 3) – rectangle A vertically packed at (3, 8)(5, 2, 1, 3, 3) – rectangle A vertically packed at (3, 8) (5, 2, 0, 0, 0) – rectangle A vertically packed at (0, 2) or (0, 0)(5, 2, 0, 0, 0) – rectangle A vertically packed at (0, 2) or (0, 0) (4, 4, 0, 4, 0) – rectangle B horizontally or vertically packed at (8, 0)(4, 4, 0, 4, 0) – rectangle B horizontally or vertically packed at (8, 0) (4, 4, 0, 3, 4) – rectangle B horizontally or vertically packed at (3, 8)(4, 4, 0, 3, 4) – rectangle B horizontally or vertically packed at (3, 8)

Packing continues until all rectangles are packed or no more available Packing continues until all rectangles are packed or no more available space for packing. Remove all rectangles and pseudo-pack C to another space for packing. Remove all rectangles and pseudo-pack C to another corner.corner.

LFF/T – An Improvement of LFFLFF/T – An Improvement of LFF

Introduce two new concepts:Introduce two new concepts: TightnessTightness

For each candidate rectangle placement location, we look at thFor each candidate rectangle placement location, we look at the points that are immediate adjacent to each corner of the cane points that are immediate adjacent to each corner of the candidate rectangle (There are 8 points for measurement)didate rectangle (There are 8 points for measurement)

The 8 corner-adjacent ptsThe 8 corner-adjacent pts B has a larger tightness value (4) than A(3)B has a larger tightness value (4) than A(3)

A parameter A parameter qq Greedy Search done for the COPMs of the Greedy Search done for the COPMs of the qq longest rectangles o longest rectangles o

nlynly

A B

LFF/T – An Improvement of LFFLFF/T – An Improvement of LFF

The LFF/T algorithm:The LFF/T algorithm:

Starting with an empty work space (bounding rectangle)Starting with an empty work space (bounding rectangle)1.1. Based on the current packing configuration, find all possible COPMs for each unpacked rectanBased on the current packing configuration, find all possible COPMs for each unpacked rectan

gle, represent each COPM b a quinary-tuple <longer side, shorter side, orientation, x1, y1)gle, represent each COPM b a quinary-tuple <longer side, shorter side, orientation, x1, y1)2.2. Sort all these quinary-tuples in lexicographical orderSort all these quinary-tuples in lexicographical order3.3. For each candidate COPM, do a) to c) to find its fitness function value (FFV).For each candidate COPM, do a) to c) to find its fitness function value (FFV).

a)a) Pseudo-pack this COPMPseudo-pack this COPMb)b) While there are rectangles remaining and there are spaces in the box,While there are rectangles remaining and there are spaces in the box,

If there is a location that the next rectangle in the sorted list can fit, then,If there is a location that the next rectangle in the sorted list can fit, then, For each legal corner moves of the rectangle, calculate the tightness values as desFor each legal corner moves of the rectangle, calculate the tightness values as des

cribed abovecribed above Choose the corner move with the highest tightness values and pseudo-pack this reChoose the corner move with the highest tightness values and pseudo-pack this re

ctangle therectangle there Update the corner lists and move to the next rectangle in the listUpdate the corner lists and move to the next rectangle in the listElse Else

Skip this rectangleSkip this rectangleCalculate FFV of this candidate COPM as the occupied area.Calculate FFV of this candidate COPM as the occupied area.

Note: Before the pseudo-packing for the next candidate COPM is tried, one needs to remove thNote: Before the pseudo-packing for the next candidate COPM is tried, one needs to remove the previous pseudo-packed COPMe previous pseudo-packed COPM

4.4. Pick the candidate COPM with the highest FFB and really pack the corresponding rectangle acPick the candidate COPM with the highest FFB and really pack the corresponding rectangle according to the COPMcording to the COPM

5.5. Mark the rectangle as packedMark the rectangle as packed6.6. Return to step 1 until no more packing can be doneReturn to step 1 until no more packing can be done

Experimental ResultsExperimental Results

ProblemProblem No. of RectsNo. of Rects Box SizeBox Size Original LFFOriginal LFF LFF/T (q=n)LFF/T (q=n)

Packing Packing

DensityDensity

Packing Packing DensityDensity

ami33ami33 3333 1076*10761076*1076 94.09%94.09% 95.84%95.84%

ami49ami49 4949 5954*59545954*5954 96.31%96.31% 97.12%97.12%

playoutplayout 6262 9397*93979397*9397 98.83%98.83% 99.26%99.26%

ConclusionConclusion

LFF/T can really improve the packing density of LFFLFF/T can really improve the packing density of LFF

Reasons:Reasons: In LFF, there may be several corners result in the same FFV In LFF, there may be several corners result in the same FFV

(fitness value). The algorithm will just arbitrary take one(fitness value). The algorithm will just arbitrary take one Tightness value ensures that less gaps or spaces exist Tightness value ensures that less gaps or spaces exist

between any pair of rectangles, which in turn gives smaller between any pair of rectangles, which in turn gives smaller dead space dead space

LFF/T takes longer processing timeLFF/T takes longer processing time

Both algorithms have their own advantagesBoth algorithms have their own advantages

Future DirectionFuture Direction

Extension of LFF or LFF/T to 3D Extension of LFF or LFF/T to 3D applicationsapplications

Experiments will be carried out to see Experiments will be carried out to see which one is more suitablewhich one is more suitable


Recommended