Helmut Simonis and Barry O’Sullivan- Almost Square Packing

  • Upload
    mnaom

  • View
    228

  • Download
    0

Embed Size (px)

Citation preview

  • 8/3/2019 Helmut Simonis and Barry OSullivan- Almost Square Packing

    1/38

    Square Packing

    Almost Square Packing

    Almost Square Packing

    Helmut Simonis and Barry OSullivan

    Cork Constraint Computation CentreComputer Science Department

    University College CorkIreland

    CSCLP 2010

    Helmut Simonis and Barry OSullivan Almost Square Packing 1

    http://find/http://goback/
  • 8/3/2019 Helmut Simonis and Barry OSullivan- Almost Square Packing

    2/38

    Square Packing

    Almost Square Packing

    Points to Remember

    Almost Square Packing: Generalization of Square Packing

    (Simonis and OSullivan, CP 2008)

    Allows rotation of items, extra degree of freedom

    Interleave orientation of item with interval choice for X

    Redundant constraints similar to square packing

    Further decomposition possible, treat X variables on their

    own

    Does not need disjoint2 and second cumulative

    constraint

    Problems up to N=26 solved optimally (very similar to

    square packing)

    Helmut Simonis and Barry OSullivan Almost Square Packing 2

    http://find/http://goback/
  • 8/3/2019 Helmut Simonis and Barry OSullivan- Almost Square Packing

    3/38

    Square Packing

    Almost Square Packing

    Almost Square Packing

    Consider almost squares, rectangles n (n+ 1)

    Pack all items 1 2, 2 3, ..., n (n+ 1)

    Into smallest possible rectangle

    Items are non-overlapping

    Helmut Simonis and Barry OSullivan Almost Square Packing 3

    http://find/http://goback/
  • 8/3/2019 Helmut Simonis and Barry OSullivan- Almost Square Packing

    4/38

    Square Packing

    Almost Square Packing

    Background

    Suggested by Prof. Des MacHale, Math, UCC

    Solved packing up to 13 14 by hand

    Starting point for Barrys and my interest in packing

    My objection: This is too complicated

    Look at square packingKnown results, benchmark comparison

    Helmut Simonis and Barry OSullivan Almost Square Packing 4

    http://find/http://goback/
  • 8/3/2019 Helmut Simonis and Barry OSullivan- Almost Square Packing

    5/38

    Square Packing

    Almost Square Packing

    Simpler Problem: Square Packing

    Consider squares, rectangles n n

    Pack all items 1 1, 2 2, ..., n n

    Into smallest possible rectangle

    Items are non-overlapping

    Helmut Simonis and Barry OSullivan Almost Square Packing 5

    S P ki

    http://find/http://goback/
  • 8/3/2019 Helmut Simonis and Barry OSullivan- Almost Square Packing

    6/38

    Square Packing

    Almost Square Packing

    Outline

    1 Square Packing

    2 Almost Square Packing

    Helmut Simonis and Barry OSullivan Almost Square Packing 6

    S P ki

    http://find/http://goback/
  • 8/3/2019 Helmut Simonis and Barry OSullivan- Almost Square Packing

    7/38

    Square Packing

    Almost Square Packing

    Problem (N=26)

    26

    25

    24

    23

    22

    21

    20

    1918 1716

    15

    14

    1312

    11

    10

    9

    8

    76

    5

    4 3

    2

    Helmut Simonis and Barry OSullivan Almost Square Packing 7

    Square Packing

    http://find/http://goback/
  • 8/3/2019 Helmut Simonis and Barry OSullivan- Almost Square Packing

    8/38

    Square Packing

    Almost Square Packing

    Problem Decomposition

    Search for candidate enclosing rectangle

    Area must be larger than sum of items to be placed

    Search in order of increasing areaand increasing squareness

    Check each candidate for (in)feasibility until first solution is

    found

    Observation: Only limited number of candidates explored

    Helmut Simonis and Barry OSullivan Almost Square Packing 8

    Square Packing

    http://find/http://goback/
  • 8/3/2019 Helmut Simonis and Barry OSullivan- Almost Square Packing

    9/38

    Square Packing

    Almost Square Packing

    Basic Model

    disjoint2

    cumulative

    cumulative

    X,Y

    W

    H

    Width

    Height

    Helmut Simonis and Barry OSullivan Almost Square Packing 9

    Square Packing

    http://find/http://goback/
  • 8/3/2019 Helmut Simonis and Barry OSullivan- Almost Square Packing

    10/38

    Square Packing

    Almost Square Packing

    Interval Based Strategies

    Key Idea: Fixing intervals, not values

    Fixing variables to values is too restrictive

    Select area in which item is placed

    Allows items to shift slightly

    Restrict domain to intervals

    Only at end fix actual values

    Helmut Simonis and Barry OSullivan Almost Square Packing 10

    Square Packing

    http://find/http://goback/
  • 8/3/2019 Helmut Simonis and Barry OSullivan- Almost Square Packing

    11/38

    Square Packing

    Almost Square Packing

    Forcing Compulsory Parts

    Xl Xr

    Xl Xr

    Number of intervals: large

    Number of intervals: small

    Compulsory parts

    Large Interval

    Small Interval

    Helmut Simonis and Barry OSullivan Almost Square Packing 11

    Square Packing

    http://find/http://goback/
  • 8/3/2019 Helmut Simonis and Barry OSullivan- Almost Square Packing

    12/38

    Square Packing

    Almost Square Packing

    Model Improvement: Dominance Criterion

    X1, Y1

    W1

    H1

    X2, Y2

    W2

    H2A

    X2, Y2

    W2

    H2B

    Y2 Y1

    Y2 + H2 Y1 + H1

    D

    X2 X1

    X2 +W2 X1 +W1

    D

    Helmut Simonis and Barry OSullivan Almost Square Packing 12

    Square Packing

    http://find/http://goback/
  • 8/3/2019 Helmut Simonis and Barry OSullivan- Almost Square Packing

    13/38

    q g

    Almost Square Packing

    Strategies Comparison

    0.01

    0.1

    1

    10

    100

    1000

    10000

    100000

    1e+06

    16 18 20 22 24 26 28

    Time[s]

    Problem Size

    KorfBlueBlocker

    naivenaive gaps

    xthenydisj

    semantic4

    semanticdual

    intervalsplit

    xy

    Helmut Simonis and Barry OSullivan Almost Square Packing 13

    Square Packing

    http://find/http://goback/
  • 8/3/2019 Helmut Simonis and Barry OSullivan- Almost Square Packing

    14/38

    q g

    Almost Square Packing

    Optimal Solution (N=27, CP 2008)

    27

    26

    25

    24

    23

    22

    21

    20

    19

    18

    17

    16

    15

    14

    13

    12

    11

    1

    09

    8

    7

    6 5

    4

    3

    2

    Even better results by R. Korf in IJCAI 2009

    Helmut Simonis and Barry OSullivan Almost Square Packing 14

    Square Packing

    http://find/http://goback/
  • 8/3/2019 Helmut Simonis and Barry OSullivan- Almost Square Packing

    15/38

    Almost Square Packing

    Outline

    1 Square Packing

    2 Almost Square Packing

    Helmut Simonis and Barry OSullivan Almost Square Packing 15

    Square Packing

    http://find/http://goback/
  • 8/3/2019 Helmut Simonis and Barry OSullivan- Almost Square Packing

    16/38

    Almost Square Packing

    Back to the Future

    Apply lessons learned to almost square packing

    Added degree of freedom, rotation of itemsWeak impact, length only changes by one

    But 2n additional choices

    Helmut Simonis and Barry OSullivan Almost Square Packing 16

    Square Packing

    Al S P ki

    http://find/http://goback/
  • 8/3/2019 Helmut Simonis and Barry OSullivan- Almost Square Packing

    17/38

    Almost Square Packing

    Almost Square, Optimal Solution (N=26)

    27x26

    25x26

    24x25

    23x24

    23x22

    22x21

    20x21

    19x20

    19x18

    18x17

    17x16

    15x16

    15x14

    14x13

    12x13

    11x12

    10x11

    10x9

    9x8

    7x8 6

    x7

    5

    x6

    4x

    5

    3x4 2x

    3

    2x

    1

    Helmut Simonis and Barry OSullivan Almost Square Packing 17

    http://find/http://goback/
  • 8/3/2019 Helmut Simonis and Barry OSullivan- Almost Square Packing

    18/38

    Square Packing

    Almost Square Packing

    http://find/
  • 8/3/2019 Helmut Simonis and Barry OSullivan- Almost Square Packing

    19/38

    Almost Square Packing

    Problem with Tree View

    Showing complete tree is clearly infeasible

    We only show path to solution

    But most time is spent in non-solution parts of tree

    Helmut Simonis and Barry OSullivan Almost Square Packing 19

    Square Packing

    Almost Square Packing

    http://find/http://goback/
  • 8/3/2019 Helmut Simonis and Barry OSullivan- Almost Square Packing

    20/38

    Almost Square Packing

    Search Choices

    Based on best method for square packing

    Assign X intervals, fix X values, assign Y intervals, fix Y

    valuesWhen to fix orientation?

    Eager Before assigning X intervals

    Lazy After assigning X intervals

    Interleaved Mixed with X interval assignment

    Helmut Simonis and Barry OSullivan Almost Square Packing 20

    Square PackingAlmost Square Packing

    http://find/http://goback/
  • 8/3/2019 Helmut Simonis and Barry OSullivan- Almost Square Packing

    21/38

    Almost Square Packing

    Eager Orientation (N=17)

    1

    10

    100

    1000

    10000

    100000

    1e+06

    1e+07

    0 10 20 30 40 50 60 70 80

    Nodes

    Depth

    FAILTRY

    Helmut Simonis and Barry OSullivan Almost Square Packing 21

    Square PackingAlmost Square Packing

    http://find/http://goback/
  • 8/3/2019 Helmut Simonis and Barry OSullivan- Almost Square Packing

    22/38

    Almost Square Packing

    Lazy Orientation (N=17)

    1

    10

    100

    1000

    10000

    100000

    1e+06

    1e+07

    0 10 20 30 40 50 60 70 80

    Nodes

    Depth

    FAILTRY

    Helmut Simonis and Barry OSullivan Almost Square Packing 22

    Square PackingAlmost Square Packing

    http://find/http://goback/
  • 8/3/2019 Helmut Simonis and Barry OSullivan- Almost Square Packing

    23/38

    Almost Square Packing

    Interleaved Orientation (N=17)

    1

    10

    100

    1000

    10000

    100000

    0 10 20 30 40 50 60 70 80

    Nodes

    Depth

    FAILTRY

    Helmut Simonis and Barry OSullivan Almost Square Packing 23

    Square PackingAlmost Square Packing

    http://find/http://goback/
  • 8/3/2019 Helmut Simonis and Barry OSullivan- Almost Square Packing

    24/38

    q g

    Comparison (N=17)

    1

    10

    100

    1000

    10000

    100000

    1e+06

    1e+07

    0 10 20 30 40 50 60 70 80

    Nodes

    Depth

    EagerLazy

    Interleaved

    Helmut Simonis and Barry OSullivan Almost Square Packing 24

    Square PackingAlmost Square Packing

    http://find/http://goback/
  • 8/3/2019 Helmut Simonis and Barry OSullivan- Almost Square Packing

    25/38

    q g

    Node Distribution (N=20)

    1

    10

    100

    1000

    10000

    100000

    0 10 20 30 40 50 60 70 80 90 100

    Nodes

    Depth

    20_35_88

    W and X Interval X Assignment Y Interval Y AssignmentFAILTRY

    Helmut Simonis and Barry OSullivan Almost Square Packing 25

    Square PackingAlmost Square Packing

    http://find/http://goback/
  • 8/3/2019 Helmut Simonis and Barry OSullivan- Almost Square Packing

    26/38

    Problem with Slack (N=21)

    1

    10

    100

    1000

    10000

    100000

    1e+06

    0 10 20 30 40 50 60 70

    Nodes

    Depth

    21_46_77

    "flat_21_46_77.dat"

    Helmut Simonis and Barry OSullivan Almost Square Packing 26

    Square PackingAlmost Square Packing

    http://find/http://goback/
  • 8/3/2019 Helmut Simonis and Barry OSullivan- Almost Square Packing

    27/38

    Impact of Interval Size (N=26)

    1

    10

    100

    1000

    10000

    100000

    1e+06

    1e+07

    0 20 40 60 80 100 120 140

    Nodes

    Depth

    26_42_156

    0.250.300.350.400.45

    Helmut Simonis and Barry OSullivan Almost Square Packing 27

    Square PackingAlmost Square Packing

    http://find/http://goback/
  • 8/3/2019 Helmut Simonis and Barry OSullivan- Almost Square Packing

    28/38

    Basic Model Results (SICStus Prolog 4.04), 2008

    Desktop

    First Solution All SolutionsN Loss Back Time Sols Back Time

    4 0.00 2 00:00 8 6 00:00

    5 0.00 4 00:00 16 14 00:00

    6 1.79 16 00:00 216 24 00:00

    7 0.00 19 00:00 65 76 00:00

    8 0.00 6 00:00 12 83 00:00

    9 1.82 54 00:00 9170 3137 00:00

    10 0.45 323 00:00 1854 1379 00:00

    11 0.00 99 00:00 4 268 00:00

    12 0.96 546 00:00 25180 13795 00:02

    13 0.00 1900 00:00 42 6197 00:00

    14 0.00 2937 00:00 4 9604 00:00

    15 0.00 14440 00:00 4 50592 00:03

    16 0.00 15967 00:01 544 48711 00:03

    17 0.00 210878 00:14 16 398759 00:27

    18 0.00 9734 00:00 110288 152032 00:24

    19 0.00 102235 00:08 526 3240741 04:2620 0.00 351659 00:34 1988 3612859 05:52

    21 0.20 14036353 21:38 3250117 720146935 25:13:20

    22 0.00 58206362 01:37:30 688 122563947 03:23:19

    23 0.00 14490682 30:12 6784 136039535 04:38:40

    24 0.00 27475258 55:05 96 99731414 03:20:37

    25 0.00 35282646 01:23:12 1007780

    26 0.00 92228265 03:28:20 1056

    Helmut Simonis and Barry OSullivan Almost Square Packing 28

    Square PackingAlmost Square Packing

    http://find/http://goback/
  • 8/3/2019 Helmut Simonis and Barry OSullivan- Almost Square Packing

    29/38

    Redundant Constraints

    Forbidden gaps

    Ignore small blocks

    Symmetries of aligned blocks(?)

    Helmut Simonis and Barry OSullivan Almost Square Packing 29

    Square PackingAlmost Square Packing

    http://find/http://goback/
  • 8/3/2019 Helmut Simonis and Barry OSullivan- Almost Square Packing

    30/38

    Forbidden Gaps

    Large items can be placed either directly on border or

    away from border

    Otherwise gap must be filled with small items and slack

    For each gap size, pre-compute length of item that can notbe covered

    Slight complication due to rotation of items, useconstructive disjunction

    Remove most forbidden gaps at setup by reducing domains

    Further reduction when item is orientedDoes not handle interaction of multiple gaps

    Helmut Simonis and Barry OSullivan Almost Square Packing 30

    Square PackingAlmost Square Packing

    http://find/http://goback/
  • 8/3/2019 Helmut Simonis and Barry OSullivan- Almost Square Packing

    31/38

    Pseudo Solution Removing 1 2 Block

    16x17 16x15

    15x14

    14x13

    13x1212x11

    10x11

    10x9 8x9

    7x8

    7x6

    6x5

    4x5

    4x32x3

    Helmut Simonis and Barry OSullivan Almost Square Packing 31

    Square PackingAlmost Square Packing

    http://find/http://goback/
  • 8/3/2019 Helmut Simonis and Barry OSullivan- Almost Square Packing

    32/38

    Redundant Constraint Result

    Basic Model Not One Gap Both

    N Back Time Back Time Back Time Back Time4 2 00:00 2 00:00 2 00:00 2 00:00

    5 4 00:00 3 00:00 2 00:00 1 00:00

    6 16 00:00 16 00:00 6 00:00 6 00:00

    7 19 00:00 18 00:00 10 00:00 9 00:00

    8 6 00:00 5 00:00 17 00:00 10 00:00

    9 54 00:00 54 00:00 27 00:00 27 00:00

    10 323 00:00 323 00:00 159 00:00 159 00:00

    11 99 00:00 99 00:00 54 00:00 54 00:00

    12 546 00:00 546 00:00 274 00:00 274 00:0013 1900 00:00 1900 00:00 1040 00:00 1040 00:00

    14 2937 00:00 2936 00:00 1505 00:00 1501 00:00

    15 14440 00:00 14425 00:00 7632 00:00 7617 00:00

    16 15967 00:01 9338 00:00 7264 00:00 3989 00:00

    17 210878 00:14 210850 00:13 107639 00:07 107611 00:07

    18 9734 00:00 9734 00:00 5550 00:00 5550 00:00

    19 102235 00:08 102235 00:08 13694 00:01 13690 00:01

    20 351659 00:34 355964 00:33 157312 00:14 161410 00:14

    21 14036353 21:38 10859861 16:01 9499957 14:14 6524396 09:1322 58206362 01:37:30 58214183 01:33:03 17312971 24:37 17319946 23:54

    23 14490682 30:12 14490682 29:16 6400629 11:01 6400629 10:33

    24 27475258 55:05 27475258 53:11 9801577 16:39 9801577 16:10

    25 35282646 01:23:12 35502799 01:21:25 13030167 25:16 13232221 25:15

    26 92228265 03:28:20 92228259 03:22:33 29432477 55:38 29432467 54:08

    Helmut Simonis and Barry OSullivan Almost Square Packing 32

    Square PackingAlmost Square Packing

    http://find/http://goback/
  • 8/3/2019 Helmut Simonis and Barry OSullivan- Almost Square Packing

    33/38

    Impact of Interval Size

    Helmut Simonis and Barry OSullivan Almost Square Packing 33

    Square PackingAlmost Square Packing

    http://find/http://goback/
  • 8/3/2019 Helmut Simonis and Barry OSullivan- Almost Square Packing

    34/38

    Further Problem Decomposition

    Do we really need the full basic model?

    Most search in X variable search phase

    Postpone setting up Y variables, disjoint2 and 2nd

    cumulative

    Only create them when complete solution for X variables

    found

    Uses just single cumulative constraint

    We can even replace disjoint2 by reifiedinequalities

    Helmut Simonis and Barry OSullivan Almost Square Packing 34

    Square PackingAlmost Square Packing

    D i i R l

    http://find/http://goback/
  • 8/3/2019 Helmut Simonis and Barry OSullivan- Almost Square Packing

    35/38

    Decomposition Results

    With Redundant ConstraintsBasic Model Decomposed Model Decomposed Reified

    N Back Time Back Time Back Time4 2 00:00 2 00:00 2 00:00

    5 1 00:00 1 00:00 1 00:00

    6 6 00:00 6 00:00 6 00:00

    7 9 00:00 9 00:00 9 00:00

    8 10 00:00 10 00:00 10 00:00

    9 27 00:00 27 00:00 27 00:00

    10 159 00:00 176 00:00 176 00:00

    11 54 00:00 54 00:00 54 00:00

    12 274 00:00 301 00:00 301 00:00

    13 1040 00:00 1040 00:00 1040 00:00

    14 1501 00:00 1501 00:00 1501 00:00

    15 7617 00:00 7617 00:00 7617 00:00

    16 3989 00:00 3989 00:00 3989 00:00

    17 107611 00:07 107611 00:05 107611 00:06

    18 5550 00:00 5550 00:00 5550 00:00

    19 13690 00:01 13690 00:00 13690 00:00

    20 161410 00:14 161410 00:11 161410 00:1621 6524396 09:13 6524396 07:10 6524396 08:05

    22 17319946 23:54 17319946 19:13 17319946 21:50

    23 6400629 10:33 6400629 08:04 6400629 08:58

    24 9801577 16:10 9801577 12:11 9801577 13:07

    25 13232221 25:15 13232221 20:07 13232773 23:34

    26 29432467 54:08 29432467 40:26 29432467 43:51

    Helmut Simonis and Barry OSullivan Almost Square Packing 35

    Square PackingAlmost Square Packing

    C i ith (K f t l 2010)

    http://find/http://goback/
  • 8/3/2019 Helmut Simonis and Barry OSullivan- Almost Square Packing

    36/38

    Comparison with (Korf et al., 2010)

    Korf, Moffitt and Pollack Redundant DecompositionSize Area Nodes Times Back Times Back Times

    17 3457 6,889,973 :07 107611 00:07 107611 00:05

    18 3076 22,393,428 :26 5550 00:00 5550 00:00

    19 3576 11,918,834 :11 13690 00:01 13690 00:00

    20 3588 608,635,198 12:50 161410 00:14 161410 00:1121 3991 792,197,287 23:21 6524396 09:13 6524396 07:10

    22 4492 4,544,585,807 1:49:32 17319946 23:54 17319946 19:13

    23 40115 32,222,677,089 15:06:56 6400629 10:33 6400629 08:04

    24 40130 41,976,042,836 18:39:34 9801577 16:10 9801577 12:11

    25 45130 557,540,262,189 12:11:30:32 13232221 25:15 13232221 20:07

    26 42156 - - 29432467 54:08 29432467 40:26

    Helmut Simonis and Barry OSullivan Almost Square Packing 36

    Square PackingAlmost Square Packing

    F t W k

    http://find/http://goback/
  • 8/3/2019 Helmut Simonis and Barry OSullivan- Almost Square Packing

    37/38

    Future Work

    SICStus Prolog cumulative does not know about volume of

    items

    Domain variables [n,

    n+ 1] for duration and resource useDoes not know that w h is n (n+ 1)

    Underestimates volume as n n

    Improved energetic reasoning possible (CHIP)

    Helmut Simonis and Barry OSullivan Almost Square Packing 37

    Square PackingAlmost Square Packing

    P i t t R b

    http://find/http://goback/
  • 8/3/2019 Helmut Simonis and Barry OSullivan- Almost Square Packing

    38/38

    Points to Remember

    Almost Square Packing: Generalization of Square Packing

    (CP 2008)

    Interleave orientation of item with interval choice for X

    Further decomposition possible, treat X variables on their

    own

    Does not need disjoint2 and second cumulative

    constraint

    Problems up to N=26 solved optimally (very similar to

    square packing)

    Outperforms best published results by 103

    Helmut Simonis and Barry OSullivan Almost Square Packing 38

    http://find/http://goback/