search
play

Search Marco Chiarandini Department of Mathematics & Computer - PowerPoint PPT Presentation

DM841 D ISCRETE O PTIMIZATION Part I Search Marco Chiarandini Department of Mathematics & Computer Science University of Southern Denmark Complete Search Incomplete Search Random Restart Resume and Outlook Implementation Issues


  1. DM841 D ISCRETE O PTIMIZATION Part I Search Marco Chiarandini Department of Mathematics & Computer Science University of Southern Denmark

  2. Complete Search Incomplete Search Random Restart Resume and Outlook Implementation Issues ◮ Modeling in CP ◮ Global constraints (declaration) ◮ Notions of local consistency ◮ Global constraints (operational: filtering algorithms) ◮ Search ◮ Set variables ◮ Symmetry breaking 2

  3. Complete Search Incomplete Search Random Restart Search Implementation Issues ◮ Complete ◮ backtracking ◮ Incomplete ◮ local search 3

  4. Complete Search Incomplete Search Random Restart Outline Implementation Issues 1. Complete Search 2. Incomplete Search 3. Random Restart 4. Implementation Issues 4

  5. Complete Search Incomplete Search Random Restart Backtracking: Terminology Implementation Issues ◮ backtracking: depth first search of a search tree ◮ branching strategy: method to extend a node in the tree ◮ node visited if generated by the algorithm ◮ constraint propagation prunes subtrees ◮ deadend: if the node does not lead to a solution ◮ thrashing repeated exploration of failing subtree differing only in assignments to variables irrelevant to the failure of the subtree. 5

  6. Complete Search Incomplete Search Random Restart Simple Backtracking Implementation Issues ◮ at level j : instantiation I = { x 1 = a 1 , . . . , x j = a j } ◮ branches: different choices for an unassigned variable: I ∪ { x = a } ◮ branching constraints C = { b 1 , . . . , b j } , b i , 1 ≤ i ≤ j ◮ C ∪ { b 1 j + 1 } , . . . , C ∪ { b k j + 1 } extension of a node by mutually exclusive branching constraints (In this view, easy implementation of propagation: the branching constraints are simply scheduled for propagation) 6

  7. Complete Search Incomplete Search Random Restart Branching strategies Implementation Issues Assume a variable order and a value order (e.g., lexicographic): A. Generic branching with unary constraints: 1. Enumeration, d -way x = 1 | x = 2 | . . . 2. Binary choice points, 2-way x = 1 | x � = 1 3. Domain splitting x ≤ 3 | x > 3 � d -way can be simulated by 2-way with no loss of efficiency. While, theoretical studies (eg, [Hwang and Mitchell, 2005]) show that the viceversa is less efficient. � in practice 2-way seems more efficient than d -way on the same models 7

  8. Complete Search Incomplete Search Random Restart Branching strategies Implementation Issues B. Problem specific: ◮ Disjunctive scheduling (job-shop scheduling) s i , s j starting times of activities, d i their duration on a shared resource: s i + d i ≤ s j | s j + d j ≤ s i equivalent to: x ij = 1 | x ij � = 1 with x ij = 1 ⇐ ⇒ s i + d i ≤ s j and x ij = 0 ⇐ ⇒ s j + d j ≤ s i introducing binary variables for order. ◮ Zykov’s branching rule for graph coloring 8

  9. Complete Search Incomplete Search Random Restart Constraint propagation Implementation Issues ◮ Constraint propagation performed at each node: mechanism to avoid thrashing ◮ typically best to enforce domain consistency but with some exceptions (e.g., forward checking is best in SAT) ◮ nogood constraints added after deadend is encountered similar to caching or memoization techniques: record solution to subproblems and reuse them instead of recomputing them. Corresponds to values ruled out by higher order consistency which would be too costly to check again 9

  10. Complete Search Incomplete Search Nogood constraints Random Restart Implementation Issues Recollection ◮ An instantiation I on P is globally consistent if it can be extended to a solution of P , globally inconsistent otherwise. ◮ A globally inconsistent instantiation is also called a (standard) nogood. (a partial instantiation that does not lead to a solution.) ◮ Remark: A locally inconsistent instantiation is a nogood. The reverse is not necessarily true 10

  11. Complete Search Incomplete Search Random Restart Example Implementation Issues 11

  12. Complete Search Incomplete Search Random Restart Example Implementation Issues 11

  13. Complete Search Incomplete Search Random Restart Nogood constraints Implementation Issues Definition (Nogood) A nogood constraint is a set of assignments and branching constraints that is not consistent with any solution. Implicit constraints, their addition does not remove solutions. Goal: reduce thrashing. ◮ Rule out inconsistencies before they are encountered during search: ◮ Add implied constraints by hand during modeling ◮ Automatically add them by applying constraint propagation algorithms � Rule out inconsistencies after they have been encountered late for this node, since it has been already refuted, but it may contribute to pruning in the future. 12

  14. E.g.: On 6-queens problem: Tree on the left: No constraint propagation white nodes: all constraints with some instantiated variables are satisfied black nodes: one or more constraint checks fail shaded area explained later With arc consistency (left) and forward checking (right): – { x 1 = 2 , x 2 = 5 , x 3 = 3 } is a nogood: post ¬{ x 1 = 2 ∧ x 2 = 5 ∧ x 3 = 3 } – { x 1 = 5 , x 2 = 2 , x 3 = 4 } is also a nogood by mirroring over x-axis – ( x 2 = 5 ) = ⇒ ( x 6 � = 1 ) this is also a nogood.

  15. Complete Search Incomplete Search Random Restart Discovering nogoods Implementation Issues Case without propagation: ◮ Let P = � X , D , C ∪ { b 1 . . . , b j }� be a deadended node ( b i , 1 ≤ i ≤ j , is the branching constraint posted at level i in the search tree). ◮ J ( P ) jumpback nogood for P is defined recursively: ◮ P is a leaf node. Let C be a constraint that is not consistent with P : J ( P ) = { b i | X ( b i ) ∩ X ( C ) � = ∅ , 1 ≤ i ≤ j } ◮ P is not a leaf node. Let { b 1 j + 1 . . . , b k j + 1 } be all possible extensions of P attempted by the branching strategy, each of which has failed: k � � � J ( P ∪ { b i j + 1 } ) − { b i J ( P ) = j + 1 } i = 1 14

  16. Example Assume no constraint propagation Eg: C ′ = C ∪ { x 1 = 2 , x 2 = 5 , x 3 = 3 , x 4 = 1 , x 5 = 4 } , all extensions of x 6 to P fail: J ( P ) = ( J ( P ∪ { x 6 = 1 } ) − { x 6 = 1 } ) ∪ . . . ∪ ( J ( P ∪ { x 6 = 6 } ) − { x 6 = 6 } ) = { x 2 = 5 } ∪ { x 1 = 2 } ∪ { x 3 = 3 } ∪ { x 5 = 4 } ∪ { x 2 = 5 } ∪ { x 3 = 3 } = { x 1 = 2 , x 2 = 5 , x 3 = 3 , x 5 = 4 } (for P ∪ { x 6 = 1 } both C ( x 2 , x 6 ) and C ( x 4 , x 6 ) fail but we take one)

  17. Complete Search Incomplete Search Random Restart Discovering nogoods Implementation Issues Case with propagation: ◮ Let P = � X , D , C ∪ { b 1 . . . , b j }� be a deadended node ( b i , 1 ≤ i ≤ j , is the branching constraint posted at level i in the search tree). ◮ J ( P ) jumpback nogood for P is defined recursively: ◮ P is a leaf node. Let x be a variable whose domain has become empty (one must exist), where dom ( x ) is the original domain of x : � J ( P ) = expl ( x � = a ) a ∈ dom ( x ) expl is eliminating explanation for a , ie, a subset of C such that expl ( x � = a ) ∪ { x = a } is a nogood ◮ P is not a leaf node. Let { b 1 j + 1 . . . , b k j + 1 } be all possible extensions of P attempted by the branching strategy, each of which has failed: k � ( J ( P ∪ { b i j + 1 } ) − { b i J ( P ) = j + 1 } ) i = 1 16

  18. Example Assume constraint propagation At node P = { x 1 = 2 , x 2 = 5 } 1 is removed from D ( x 6 ) . Eliminating explanation: expl ( x 6 � = 1 ) = { x 2 = 5 } ( ≡ { x 2 = 5 , x 6 = 1 } is a nogood) Implied constraint ¬ ( x 2 = 5 ∧ x 6 = 1 ) � ( x 2 = 5 ) = ⇒ ( x 6 � = 1 ) expl ( x 6 � = 3 ) = { x 1 = 2 , x 2 = 5 } � ( x 1 = 2 ∧ x 2 = 5 ) = ⇒ ( x 6 � = 3 )

  19. Complete Search Incomplete Search Random Restart Nogood Databases Implementation Issues ◮ Memory problems ◮ Attempt to restrict to only those that are useful: ◮ restrict the nogood that are discovered ◮ restrict the nogoods kept over time 18

  20. Complete Search Incomplete Search Random Restart Backjumping Implementation Issues ◮ Standard backtracking: chronological backtracking: backjump to the most recently instantiated variable ◮ Non-chronological backtracking ≡ backjumping or intelligent backtracking: backtracks to and retracts the closest branching constraint that bears responsibility. Eg: jump back to the most recent variable that shares a constraint with deadend variable. Eg: P = � X , D , C ∪ { b 1 . . . , b j }� non-leaf deadend J ( P ) ⊆ { b 1 . . . , b j } jumpback nogood for P jump back to largest i , 1 ≤ i ≤ j : b i ∈ J ( P ) and retract b i , all branching constraints posted after b i and nogoods recorded after b i 19

  21. Complete Search Incomplete Search Random Restart Conflict-directed backjumping Implementation Issues Example ◮ deadend after failing to extend 25314. Nogood associated is { x 1 = 2 , x 2 = 5 , x 3 = 3 , x 5 = 4 } ◮ Backjump to and retract x 5 = 4 (here like chronological backtr.) ◮ deadend discovered for 2531. Nogood associated is { x 1 = 2 , x 2 = 5 , x 3 = 3 } ◮ backjump to and retract x 3 = 3 (dashed arrow) � skip all the shaded tree ◮ (nogood used only to backjump not for propagation, less memory usage) 20

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend