1 / 27

A Tree Search Algorithm for Solving the Two-Dimensional Knapsack Problem

A Tree Search Algorithm for Solving the Two-Dimensional Knapsack Problem. T. Fanslau and A. Bortfeldt University in Hagen, Germany. Contents: 1 Introduction 2 The Tree Search Algorithm 3 Numerical Test 4 Conclusions. 1 Introduction. 2D-Knapsack Problem (2D-KP)

kreeli
Download Presentation

A Tree Search Algorithm for Solving the Two-Dimensional Knapsack Problem

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. A Tree Search Algorithm for Solving the Two-Dimensional Knapsack Problem T. Fanslau and A. Bortfeldt University in Hagen, Germany Contents: 1 Introduction 2 The Tree Search Algorithm 3 Numerical Test 4 Conclusions

  2. 1 Introduction 2D-Knapsack Problem (2D-KP) Given: - a large rectangle (container) - a set of small rectangles (pieces); each piece has a value (area, …) Determine: feasible arrangement of subset of pieces in the container so that total value of the packed pieces is maximized and relevant constraints are met Special case: value = area  total covered area to maximize Feasibility conditions: • any two packed pieces do not overlap • each packed piece lies entirely inside the container • each packed piece is placed parallel to the container sides

  3. Usual constraints: (C1) Orientation constraint: orientation of all pieces fixed; 90° rotating not allowed (C2) Guillotine constraint: all pieces of a pattern can be cut by guillotine cuts (edge-to-edge-cuts, parallel to container edges)Subtypes of 2D-KP (Lodi et al. 1999):

  4. Literature overview Common approaches (2D-KP - NP-hard ):tree search (TRS), dynamic optimization (DO), metaheuristics (GA, TS, …)

  5. The Tree Search Algorithm 2.1 TRS Algorithm for non-guillotine case A) Overall algorithm initialize: search_effort := 1; repeat generate complete solution s; // using search_effort! update best solution if necessary: sbest := s; update parameter: search_effort := 2 * search_effort; until time_limit exceeded; • multiple solutions generated one by one • internal parameter search_effort . range of tree search . doubled per solution • current best solution - upper bound • stop after time limit exceeded

  6. B) Generating one solution Residual space (RS): - rectangular free space within container- data: 2 dimensions, reference corner RS_set:- generated, yet unprocessed RS - first RS to be filled: empty container - not disjoint in general Procedure:- RS filled one after another- each RS filled by best rectangle placement, one rectangle placed in reference corner- if no rectangle fits – RS only removed - RS_set updated after placement- new solution complete if RS_set empty- chosen placement – no more changed!

  7. // initialize set of residual rectangles Rres := {all rectangles}; solution s := ; set of residual spaces RS_set := {container}; // fill residual spaces successively while RS_set   do rs := RS nearest to origin; // Manhattan dist.: x+y ->min!remove rs from RS_set;determine best rect. placement rpl* = (r,o,x,y) for rs; // R!if placement foundthen extend solution s := s  {rpl*}; Rres := Rres \ {r}; endif;update RS_set; // R! endwhile; // “R!” – parts to be refined Generating one solution – pseudocode

  8. C) Updating the set of residual spaces • always to be done after RS processed (also if no placement) - updating includes: .processed RS removed .new RS created .existing RS reduced wC, y legend: - RS - rectangle - ref. corner of RS RS0 IC, x

  9. C) Updating the set of residual spaces • always to be done after RS processed (also if no placement) - updating includes: .processed RS removed .new RS created .existing RS reduced wC, y RS1 2 new overlapping RS RS2 rect1 IC, x

  10. C) Updating the set of residual spaces • always to be done after RS processed (also if no placement) - updating includes: .processed RS removed .new RS created .existing RS reduced wC, y new RS RS3 rect2 reduced RS RS2 rect1 IC, x

  11. D) Evaluating of placements • multiple possible placements per RS in general- evaluation criteria: 1) specific value := value / area 2) smoothness index (0, 1 or 2) 3) area- all poss. placements ordered by evaluation criteria 1) – 3); first ns placements tried in this order (ns = curr. no. of succ.) wC, y current RS rect2 rect1 IC, x

  12. D) Evaluating of placements • multiple possible placements per RS in general- evaluation criteria: 1) specific value := value / area 2) smoothness index (0, 1 or 2) 3) area- all poss. placements ordered by evaluation criteria 1) – 3); first ns placements tried in this order (ns = curr. no. of succ.) wC, y xN – nearby edge on the right of xC yN – nearby edge above yC no coincidence: x‘ < xN y‘ > yN smoothness index = 0 y‘ yN rect2 yC rect1 xC x‘ xN IC, x

  13. D) Evaluating of placements • multiple possible placements per RS in general- evaluation criteria: 1) specific value := value / area 2) smoothness index (0, 1 or 2) 3) area- all poss. placements ordered by evaluation criteria 1) – 3); first ns placements tried in this order (ns = curr. no. of succ.) wC, y xN – nearby edge on the right of xC yN – nearby edge above yC one coincidence case: x‘ < xN y‘ = yN smoothness index = 1 y‘, yN rect2 yC rect1 xC x‘ xN IC, x

  14. D) Evaluating of placements • multiple possible placements per RS in general- evaluation criteria: 1) specific value := value / area 2) smoothness index (0, 1 or 2) 3) area- all poss. placements ordered by evaluation criteria 1) – 3); first ns placements tried in this order (ns = curr. no. of succ.) wC, y xN – nearby edge on the right of xC yN – nearby edge above yC two coincidence cases: x‘ = xN y‘ = yN smoothness index = 2 y‘, yN rect2 yC rect1 xC x‘, xN IC, x

  15. E) Determining the best placement for a RS Task:- given:partial solution s with n - 1 rectangles (n ≥ 1), set Rres - request: best nth placement rpl* for current residual space rs Approach: Partition Controlled Tree Search (PCTRS)1) multiple complete solutions sc generated – all extending s; best placement rpl* = nth placement of best solution sc2) additional search depth sd specified - RS of levels n,…,n+sd–1: multiple placements per RS tried RS of levels n+sd,…: only first placement tried (evaluation!) ith search level ↔ ith placement - sd increases with parameter search_effort3) complete solutions generated by different extension strategies - each strategy calculates its own best solution - best solution sc over all strategies determines best placement rpl* - each extension strategy defined by a partition of sd4) advantages of PCTRS - only small fraction of complete solutions tried compared to const. no. of succ. - mix of strategies cares for suitable balance between 2 factors: . width of seach – no of succ. per extension . degree of foresight – no. of simultaneous considered search levels.

  16. Expl.: extension strategy for partition “2+1” (two stages) fixed partial plan, level n-1 0 • stage 1: tree with two levels n and n+1 and ns = 2 constructed - complete all sol. s, - select best complete sol. sb, - reduce sb to n+1 placements, - pass sb to next stage • stage 2: tree with one level n+2 and ns = 8 constructed; best complete solution of 2nd stage returned at last stage 1, level n 1 add. search depth stage 1, level n + 1 2 ... stage 2, level n + 2 3 partial plan completed plan

  17. 2.2 TRS-Algorithm for guillotine case Packing units: - blocks with n  1 rectangles - simple blocks (one item type), general blocks (small inner gaps) - 2 super phases: 1: simple blocks only, 2: general blocks Residual spaces (RS): - container – first RS - each RS filled by 1 block; remaining empty space then cut into three daughter spaces - unprocessed RS always disjoint - heuristic rules for cutting RS and processing order of RS Tree search: - PCTRS - largest blocks tried per RS Guillotine constraint: - observed by (single) blocks - observed by complete plans (sequences of blocks) since residual spaces generated by guillotine cuts

  18. 3 Numerical Test Implementation, names: algorithm implemented in C, called: CLTRS variant for subtypes OG/RG: CLTRS–G variant for subtypes OF/RF: CLTRS–F PC/OS: AMD Athlon, 2.6 GHz, Windows XP Configuration: parameters uniformly set per CLTRS variant exception: time limitsReporting of results: - gap := relative deviation from upper bound (or known optimum) (bound – objective value) / bound (in %) - only best values per method and instance considered - only one run per instance with CLTRS (G or F)

  19. A) 630 instances from Beasley (2004) Optimization criterion: packed valueInstance size: m: 40 …1000 CLTRS–F: mean computing time 22.1 Secs.

  20. B) 21 instances from Hopper and Turton (2004) Optimization criterion: packed area; filling rate 100% poss. Instance size: m: 16 …197 CLTRS–F: mean computing time – OF: 129.5 Secs, – RF: 1.8 Secs.

  21. C) 44 instances from Fayard et al. (1998) Piece set: constrained (C), unconstrained (U) Optimization criterion: packed area (U), packed value (W) Resulting subsets: CU, CW, UU, UW - 11 instances each Instance size: m: 25 …60 CLTRS–G: mean computing time 252 Secs.

  22. 4 Conclusions Heuristic CLTRS: - excellent solution quality - time consumption: OF/RF – excellent; OG/RG – moderate - few parameters, no tuning New concepts: - problem specific: . CLTRS–F: smoothness index – heart of approach . CLTRS–G: generalized block concept - generic: Partition Controlled Tree Search (PCTRS) . new type of incomplete tree search / beam search . economical generation of solutions . balance of:search width – degree of foresight Topics of further research: - 3D-CLTRS, non-guillotine case - 2D-CLTRS, extension to strip packing - application of PCTRS to other problems.

  23. Appendix: Detailed description of PCTRS

  24. Search stage:- input: solution sin with m filled RS (m ≥ n-1) - procedure: subtree of partial solutions of depth d constructed (d ≤ sd), all constructed solutions of level m + d are completed - ns – no. successors per node = no. tried blocks per RS; ns = f(d, search_effort); d small ↔ ns big ! - output: best complete solution sout Extension strategy (ES):- results by chaining of search stages, i.e. input sin of stage x+1 = output sout of stage x - for given search depth sd all possible ES given by all partitions of sd example: search depth sd = 3, ordered partition p: 3; 2+1; 1+2; 1+1+1; no. of summands t: 1 2 2 3- no of summands t = no. of stages; ith summand = depth d of ith stage Partition Controlled Tree Search (PCTRS):- all possible ES used concurrently - search stages / ES differ in terms of a) search width, i.e. no. of tested placements per RS (ns) b) degree of foresight, i.e. no. of simultaneous considered RS (d)- PCTRS cares for suitable balance of both factors!

  25. 1) extension strategy for partition “3” (one stage) fixed partial plan, level n-1 0 • for each RS of levels n, n+1, n+2 the first ns = 2 admissible placements are tried • each partial plan with n+2 blocks is completed; best complete solution returned stage 1, level n 1 add. search depth stage 1, level n + 1 2 stage 1, level n + 2 3 partial plan completed plan, standard completion from next level (here: n + 3)

  26. 2) extension strategy for partition “1+1+1” (three stages) fixed partial plan, level n-1 0 • stage 1: for RS of level n first ns = 8 admissible placements are tried; each resulting plan is completed; s1 – best solution of stage 1 • stages 2, 3: same procedure repeated on levels n+1, n+2, yielding best solutions s2 and s3, s3 is returned • chaining: s1 is input for 2nd stage, s2 is input for 3rd stage ... stage 1, level n 1 add. search depth ... stage 2, level n + 1 2 ... stage 3, level n + 2 3 partial plan completed plan

  27. 3) extension strategy for partition “2+1” (two stages) fixed partial plan, level n-1 0 • stage 1: tree with two levels n and n+1 and ns = 2 constructed • stage 2: tree with one level n+2 and ns = 8 constructed; best solution of 2nd stage returned at last • chaining: best solution of stage 1 is input for stage 2 stage 1, level n 1 add. search depth stage 1, level n + 1 2 ... stage 2, level n + 2 3 partial plan completed plan

More Related