48
Topics in Transportation 11th of October - Packing Irregular Shapes Topics in Transportation – October 11th, 2005. Jens Egeblad

Topics in Transportation 11th of October Packing Irregular ...danha/courses/SADNA08/IrregularPackings.pdf · October 7th 2005 Jens Egeblad History of the Nesting Problem 1966 First

  • Upload
    others

  • View
    4

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Topics in Transportation 11th of October Packing Irregular ...danha/courses/SADNA08/IrregularPackings.pdf · October 7th 2005 Jens Egeblad History of the Nesting Problem 1966 First

Topics in Transportation 11th of October- Packing Irregular Shapes

Topics in Transportation – October 11th, 2005.Jens Egeblad

Page 2: Topics in Transportation 11th of October Packing Irregular ...danha/courses/SADNA08/IrregularPackings.pdf · October 7th 2005 Jens Egeblad History of the Nesting Problem 1966 First

October 7th 2005 Jens Egeblad

Overview

Background, geometry and history of the Nesting Problem

The No-Fit-Polygon

A 2-exchange heuristic

Guided Local Search applied to Nesting

SofaPacker – Story (little theory)

Page 3: Topics in Transportation 11th of October Packing Irregular ...danha/courses/SADNA08/IrregularPackings.pdf · October 7th 2005 Jens Egeblad History of the Nesting Problem 1966 First

October 7th 2005 Jens Egeblad

The Nesting Problem

Packing problems of irregular shapes are often refered to as Nesting Problems

Applications: Garment industry – Minimize fabric waste Metal industry – Minimize metal waste

Containers can be complex:(But are usually simple)

Page 4: Topics in Transportation 11th of October Packing Irregular ...danha/courses/SADNA08/IrregularPackings.pdf · October 7th 2005 Jens Egeblad History of the Nesting Problem 1966 First

October 7th 2005 Jens Egeblad

Strip-Packing of Irregular Shapes

Most common nesting problem is Strip Packing

Place a set S of shapes within rectangle WxH s.t. no two shapes overlap and W is minimized.

H

W

NP-Hard

Here we assume that shapes are polygons

H

W

Page 5: Topics in Transportation 11th of October Packing Irregular ...danha/courses/SADNA08/IrregularPackings.pdf · October 7th 2005 Jens Egeblad History of the Nesting Problem 1966 First

October 7th 2005 Jens Egeblad

Solution Methods

Solution methods for the Nesting Problem falls in two categories:

Legal Placement Methods Placement of a shape always on empty part of the material Limited solution space Produce legal placement quickly

Relaxed Placement Methods Overlap is allowed and minimized during optimization

– Legal placement when Overlap = 0 Larger solution space

Page 6: Topics in Transportation 11th of October Packing Irregular ...danha/courses/SADNA08/IrregularPackings.pdf · October 7th 2005 Jens Egeblad History of the Nesting Problem 1966 First

October 7th 2005 Jens Egeblad

Geometric Concepts

Overlap:

Intersection Depth:

No-Fit-Polygon:

Page 7: Topics in Transportation 11th of October Packing Irregular ...danha/courses/SADNA08/IrregularPackings.pdf · October 7th 2005 Jens Egeblad History of the Nesting Problem 1966 First

October 7th 2005 Jens Egeblad

Geometric Concepts (2)

Raster model:

Envelope (contour):

Placed shapes

Page 8: Topics in Transportation 11th of October Packing Irregular ...danha/courses/SADNA08/IrregularPackings.pdf · October 7th 2005 Jens Egeblad History of the Nesting Problem 1966 First

October 7th 2005 Jens Egeblad

History of the Nesting Problem

1966 First article from by R.C. Art. Uses envelope structure (L)

1976 Adamowicz and Albone Cluster shapes to get reduce problem to rectangular packing (L)

1992 Heistermann and Lengauer Irregular material for the leather industry (animal hides) (L)

1992 Lutfiyya et al. Overlap removal, raster model, simulated Annealing (R)

1993 Blazewicz et al. (First local search) Improve solution by moving, swapping and rotating each shape (L)

1993 Oliveira et al. Raster model and simulated annealing (R)

1995 Heckman and Lengauer Raster model and 4-stage simulated annealing (R)

1998 Dowsland et al. Jostling for position (L)

2002 Gomes and Oliveira 2-Exchange (L)

2005 (2001) Egeblad et al. Guided Local Search (R)

Page 9: Topics in Transportation 11th of October Packing Irregular ...danha/courses/SADNA08/IrregularPackings.pdf · October 7th 2005 Jens Egeblad History of the Nesting Problem 1966 First

October 7th 2005 Jens Egeblad

The No-Fit-Polygon

No-fit-polygons (NFPs) are the core of many legal placement methods

Here the NFPs of all pairs of polygons are calculated in a preprocessing step (few seconds)

Resembles Minkowski sums

Page 10: Topics in Transportation 11th of October Packing Irregular ...danha/courses/SADNA08/IrregularPackings.pdf · October 7th 2005 Jens Egeblad History of the Nesting Problem 1966 First

October 7th 2005 Jens Egeblad

Calculating the NFP is complex See Bennel and Song 2005, ”A Comprehensive and robust

procedure for obtaining the no-fit-polygon using Minkowski sums”

However, when both A and B are convex Sort edges from A and –B by slope and combine them

Calculating the NFP

AB

-B

12

3

456

7

89

1

2

34 5

6

7

89

Page 11: Topics in Transportation 11th of October Packing Irregular ...danha/courses/SADNA08/IrregularPackings.pdf · October 7th 2005 Jens Egeblad History of the Nesting Problem 1966 First

October 7th 2005 Jens Egeblad

2-Exchange (Gomes and Oliveira)

Legal placement method

Uses NFP

The current placement is represented by a sequence of shapes

Exchanging elements of the sequence improves the solution quality

Page 12: Topics in Transportation 11th of October Packing Irregular ...danha/courses/SADNA08/IrregularPackings.pdf · October 7th 2005 Jens Egeblad History of the Nesting Problem 1966 First

October 7th 2005 Jens Egeblad

Converting a Sequence to a Layout

A sequence of shapes S = <s1, s2, …, sn> is converted to a placement by a bottom-left heuristic Given a set of placed shapes <s1, s2, …, sm> the next piece

sm+1 is placed at the point (xm+1, ym+1) s.t. xm+1 is minimized if multiple xm+1 solutions ym+1 is minimized sm does not overlap with the pieces {s1, s2, …, sm} sm is within the area of the plate

Page 13: Topics in Transportation 11th of October Packing Irregular ...danha/courses/SADNA08/IrregularPackings.pdf · October 7th 2005 Jens Egeblad History of the Nesting Problem 1966 First

October 7th 2005 Jens Egeblad

Bottom-Left Placement Example

Sequence:

Page 14: Topics in Transportation 11th of October Packing Irregular ...danha/courses/SADNA08/IrregularPackings.pdf · October 7th 2005 Jens Egeblad History of the Nesting Problem 1966 First

October 7th 2005 Jens Egeblad

Bottom-Left Position

Use NFPs to determine the position of shape sm+1

Define:

Where: Pm+1 is the set of of points s.t. sm+1 is inside the plate, NFPi,m+1 is the no-fit-polygon of shapes i and m+1, and int(S) is the interior of the set S

Now, select the point with minimum y from B

Page 15: Topics in Transportation 11th of October Packing Irregular ...danha/courses/SADNA08/IrregularPackings.pdf · October 7th 2005 Jens Egeblad History of the Nesting Problem 1966 First

October 7th 2005 Jens Egeblad

Finding the Bottom-Left Position

The point is: A vertex of a NFPi,m+1 for some i, a vertex of Pm+1 , a intersection of edges from NFPi,m+1 and NFPj,m+1 for i,j or an intersection of edges from NFPi,m+1 and Pm+1

Look in the article for the figures

Page 16: Topics in Transportation 11th of October Packing Irregular ...danha/courses/SADNA08/IrregularPackings.pdf · October 7th 2005 Jens Egeblad History of the Nesting Problem 1966 First

October 7th 2005 Jens Egeblad

2-Exchange Neighborhood Example

Exchange a pair of pieces in the current sequence

Page 17: Topics in Transportation 11th of October Packing Irregular ...danha/courses/SADNA08/IrregularPackings.pdf · October 7th 2005 Jens Egeblad History of the Nesting Problem 1966 First

October 7th 2005 Jens Egeblad

Neighborhood Parameter

Neighborhood parameter ∆

∆=3

∆=2∆=1

Defines how far we can exchange shapes

Exchange Criteria (Try all exchanges among all shapes): First better Best Random improving

Page 18: Topics in Transportation 11th of October Packing Irregular ...danha/courses/SADNA08/IrregularPackings.pdf · October 7th 2005 Jens Egeblad History of the Nesting Problem 1966 First

October 7th 2005 Jens Egeblad

Initial Solution

Gomes and Oliveira tries different initial solutions

Sort all shapes according to rankings: Decreasing area Decreasing length Decreasing width Decreasing irregularity (from convex hull) Increasing rectangularity (difference from bounding rect.) Random

Page 19: Topics in Transportation 11th of October Packing Irregular ...danha/courses/SADNA08/IrregularPackings.pdf · October 7th 2005 Jens Egeblad History of the Nesting Problem 1966 First

October 7th 2005 Jens Egeblad

2-Exchange Overview

Generate initial solution according to some ranking Use bottom-left strategy to place the shapes

Repeatedly do 2-exchange: Investigate all exchanges within the neighborhood using

bottom-left heuristic to generate placements from each sequence

If an improving move found -> Accept it! Otherwise -> STOP! And output solution.

Page 20: Topics in Transportation 11th of October Packing Irregular ...danha/courses/SADNA08/IrregularPackings.pdf · October 7th 2005 Jens Egeblad History of the Nesting Problem 1966 First

October 7th 2005 Jens Egeblad

GLS for Nesting (Egeblad et al.)

Relaxed placement method inspired by Færø et al.

Start with long strip-length Minimize pairwise overlap:

Total overlap is zero => Valid solution for this length. Reduce the strip-length and continue.

Use Guided Local Search (local search with augmented objective function)

Solve decision problem Reduce W

∑∑∈ ∈

∩Si Sj

jiarea )(min

Page 21: Topics in Transportation 11th of October Packing Irregular ...danha/courses/SADNA08/IrregularPackings.pdf · October 7th 2005 Jens Egeblad History of the Nesting Problem 1966 First

October 7th 2005 Jens Egeblad

Local Search

For some shape s minimize its overlap by translating s horizontally translating s vertically, or rotating s around its center (if allowed)

Page 22: Topics in Transportation 11th of October Packing Irregular ...danha/courses/SADNA08/IrregularPackings.pdf · October 7th 2005 Jens Egeblad History of the Nesting Problem 1966 First

October 7th 2005 Jens Egeblad

Horizontal Translation

Page 23: Topics in Transportation 11th of October Packing Irregular ...danha/courses/SADNA08/IrregularPackings.pdf · October 7th 2005 Jens Egeblad History of the Nesting Problem 1966 First

October 7th 2005 Jens Egeblad

Vertical Translation

Page 24: Topics in Transportation 11th of October Packing Irregular ...danha/courses/SADNA08/IrregularPackings.pdf · October 7th 2005 Jens Egeblad History of the Nesting Problem 1966 First

October 7th 2005 Jens Egeblad

Local Minima

Starting with:

And repeating local search we may get this:

No move of a single shape reduces overlap.

Page 25: Topics in Transportation 11th of October Packing Irregular ...danha/courses/SADNA08/IrregularPackings.pdf · October 7th 2005 Jens Egeblad History of the Nesting Problem 1966 First

October 7th 2005 Jens Egeblad

Guided Local Search – The Metaheuristic

Introduced by Voudoris and Tsang 1996 Applied to Constraint Satisfaction and Traveling Salesman

Modify the objective by punishing bad characteristics of a solution in local minima

Solution

Obj. Obj.

Solution

Penalize

Characteristics are called features E.g. overlap is a bad characteristic

Page 26: Topics in Transportation 11th of October Packing Irregular ...danha/courses/SADNA08/IrregularPackings.pdf · October 7th 2005 Jens Egeblad History of the Nesting Problem 1966 First

October 7th 2005 Jens Egeblad

Guided Local Search (for Nesting)

Introduce penalty pij for each pair of polygons i and j

Augmented objective function:

Page 27: Topics in Transportation 11th of October Packing Irregular ...danha/courses/SADNA08/IrregularPackings.pdf · October 7th 2005 Jens Egeblad History of the Nesting Problem 1966 First

October 7th 2005 Jens Egeblad

GLS – Penalties

Initially all penalty counts pij are 0 At local minimum increase one or more penalty counts

We must decide which to penalize At local minimum calculate the utility of each feature

Increase penalty count of the feature(s) with highest utility.

Page 28: Topics in Transportation 11th of October Packing Irregular ...danha/courses/SADNA08/IrregularPackings.pdf · October 7th 2005 Jens Egeblad History of the Nesting Problem 1966 First

October 7th 2005 Jens Egeblad

Fast neighborhood search (rectangles)

How does the overlap evolve as one box is translated across another:

Area of overlapping region is a piecewise linear function of the x-position of one of the rectangles.

Page 29: Topics in Transportation 11th of October Packing Irregular ...danha/courses/SADNA08/IrregularPackings.pdf · October 7th 2005 Jens Egeblad History of the Nesting Problem 1966 First

October 7th 2005 Jens Egeblad

Fast neighborhood search (Polygons)

Nothing

A triangle with increasing baseline and height

A constant triangle + a skewed rectangle with increasing baseline

Page 30: Topics in Transportation 11th of October Packing Irregular ...danha/courses/SADNA08/IrregularPackings.pdf · October 7th 2005 Jens Egeblad History of the Nesting Problem 1966 First

October 7th 2005 Jens Egeblad

Fast neighborhood search (edges)

Area between edges is a piecewise quadratic function:

h(t) and (t-t0) are linear functions indicating height and width of the triangle

Breakpoints: ”Intersect-begin” and ”Intersect-end”

Page 31: Topics in Transportation 11th of October Packing Irregular ...danha/courses/SADNA08/IrregularPackings.pdf · October 7th 2005 Jens Egeblad History of the Nesting Problem 1966 First

October 7th 2005 Jens Egeblad

Fast neighborhood search (edge types)

For horizontal translation: We divide non-horizontal edges into two groups:

Positive are ”left” edges Negative are ”right” edges

Page 32: Topics in Transportation 11th of October Packing Irregular ...danha/courses/SADNA08/IrregularPackings.pdf · October 7th 2005 Jens Egeblad History of the Nesting Problem 1966 First

October 7th 2005 Jens Egeblad

Fast neighborhood search (area)

Area of overlap can be calculated as a sum of areas of ”regions” between edges from polygons:

=

+ +

- -

Page 33: Topics in Transportation 11th of October Packing Irregular ...danha/courses/SADNA08/IrregularPackings.pdf · October 7th 2005 Jens Egeblad History of the Nesting Problem 1966 First

October 7th 2005 Jens Egeblad

Fast neighborhood search (algorithm)

Note: Find the minimum on each piece of f(x) by solving a 2nd order equation

Page 34: Topics in Transportation 11th of October Packing Irregular ...danha/courses/SADNA08/IrregularPackings.pdf · October 7th 2005 Jens Egeblad History of the Nesting Problem 1966 First

October 7th 2005 Jens Egeblad

Summary of solution method

Page 35: Topics in Transportation 11th of October Packing Irregular ...danha/courses/SADNA08/IrregularPackings.pdf · October 7th 2005 Jens Egeblad History of the Nesting Problem 1966 First

October 7th 2005 Jens Egeblad

GLS – Nesting (Live demo)

Demo of the original implementation from 2001

Page 36: Topics in Transportation 11th of October Packing Irregular ...danha/courses/SADNA08/IrregularPackings.pdf · October 7th 2005 Jens Egeblad History of the Nesting Problem 1966 First

October 7th 2005 Jens Egeblad

Additional constraints 2D

Fixed positions of some shapes Irregular material Quality areas/requirement

Page 37: Topics in Transportation 11th of October Packing Irregular ...danha/courses/SADNA08/IrregularPackings.pdf · October 7th 2005 Jens Egeblad History of the Nesting Problem 1966 First

October 7th 2005 Jens Egeblad

2D Results

SAHA (Oliveira, Gomes - autumn 2004), 2D-Nest (autumn 2002)

20 different runs on each instance (both SAHA and GLS)

GLS running times are 600 sec.

GLS wins most ”average”-instances and 1 more ”maximum” than SAHA.

Page 38: Topics in Transportation 11th of October Packing Irregular ...danha/courses/SADNA08/IrregularPackings.pdf · October 7th 2005 Jens Egeblad History of the Nesting Problem 1966 First

October 7th 2005 Jens Egeblad

2D Packing examples

Page 39: Topics in Transportation 11th of October Packing Irregular ...danha/courses/SADNA08/IrregularPackings.pdf · October 7th 2005 Jens Egeblad History of the Nesting Problem 1966 First

October 7th 2005 Jens Egeblad

3D Nesting

Packing of 3D shapes (meshes) Here a fixed sized container NP-Hard, of course!

Page 40: Topics in Transportation 11th of October Packing Irregular ...danha/courses/SADNA08/IrregularPackings.pdf · October 7th 2005 Jens Egeblad History of the Nesting Problem 1966 First

October 7th 2005 Jens Egeblad

3D Nesting (history)

1997 Ikonen et al. Genetic algorithms (and bounding boxes)

1998 Cagan et al. Simulated annealing (octree decomposition like 2D raster)

(R)

1998 Dickinson and Knopf Legal Placement, but no backtracking or improvement (L)

2005 Egeblad et al. (Really Nielsen and Odgaard) Guided Local Search

Page 41: Topics in Transportation 11th of October Packing Irregular ...danha/courses/SADNA08/IrregularPackings.pdf · October 7th 2005 Jens Egeblad History of the Nesting Problem 1966 First

October 7th 2005 Jens Egeblad

Generalization to 3D

Objective function: minimize overlapping volume 1 more translation (z) Edges => Faces Areas => Volumes

Page 42: Topics in Transportation 11th of October Packing Irregular ...danha/courses/SADNA08/IrregularPackings.pdf · October 7th 2005 Jens Egeblad History of the Nesting Problem 1966 First

October 7th 2005 Jens Egeblad

Volume between faces

Volume between faces (VBF) of 3D-Meshes:

Triangulate faces of VBF; 3 Breakpoints:

Page 43: Topics in Transportation 11th of October Packing Irregular ...danha/courses/SADNA08/IrregularPackings.pdf · October 7th 2005 Jens Egeblad History of the Nesting Problem 1966 First

October 7th 2005 Jens Egeblad

Calculating the volume of a tetrahedron

Given that a is (x-t, 0, 0)t:

- Cubic function!

VBFs can be calculated as sum of volumes of different tetrahedrons:

Page 44: Topics in Transportation 11th of October Packing Irregular ...danha/courses/SADNA08/IrregularPackings.pdf · October 7th 2005 Jens Egeblad History of the Nesting Problem 1966 First

October 7th 2005 Jens Egeblad

3D Nesting with GLS

3D is like 2D Objective is volume

Same neighborhood + 1 more translation

The end-faces of the VBFs are triangulated

Like edges in 2D, every pair of triangles from the VBF-faces give rise to a set of breakpoints

Same asymptotic number of breakpoints

Cubic functions instead of quadratic

Same asymptotic running time

Page 45: Topics in Transportation 11th of October Packing Irregular ...danha/courses/SADNA08/IrregularPackings.pdf · October 7th 2005 Jens Egeblad History of the Nesting Problem 1966 First

October 7th 2005 Jens Egeblad

3D Benchmarks

Case 1 Pack 10 objects into a cylinder filling 11.3 % of the total volume. Total

number of faces = 260. Case 2

Pack 15 objects into a cylinder filling 12.6 % of the total volume. Total number of faces = 380.

This was too easy for 3D-Nest (so we doubled the numbers)

30

20

25.2

22.6

520

760

8.1 sec81.65 sec.26.00 minCase 2

3.2 sec45.55 sec.22.13 minCase 1

3D NestDickinson/knopfIkonen et al.Instance

Page 46: Topics in Transportation 11th of October Packing Irregular ...danha/courses/SADNA08/IrregularPackings.pdf · October 7th 2005 Jens Egeblad History of the Nesting Problem 1966 First

October 7th 2005 Jens Egeblad

3D Examples

Case 1 Case 2

Page 47: Topics in Transportation 11th of October Packing Irregular ...danha/courses/SADNA08/IrregularPackings.pdf · October 7th 2005 Jens Egeblad History of the Nesting Problem 1966 First

October 7th 2005 Jens Egeblad

Recap

Lots of methods for 2D Legal – Often uses the No-fit-polygon Relaxed – Requires efficient overlap calculation

Current state of the art 2-Exchange method by Gomes and Oliveira (L) Guided Local Search by Egeblad et al. is (R)

Few methods for 3D Current state of the art is by Egeblad et al. (R) Few datasets, so we do not know its limits

SofaPacker – Reallife (Clusters 3D meshes)

Page 48: Topics in Transportation 11th of October Packing Irregular ...danha/courses/SADNA08/IrregularPackings.pdf · October 7th 2005 Jens Egeblad History of the Nesting Problem 1966 First

October 7th 2005 Jens Egeblad

The End