constraint satisfaction algorithms
play

Constraint satisfaction: algorithms For some classes of constraints - PowerPoint PPT Presentation

T79.4201 Search Problems and Algorithms T79.4201 Search Problems and Algorithms Constraint satisfaction: algorithms For some classes of constraints there are efficient special purpose algorithms (domain specific methods/constraint


  1. T–79.4201 Search Problems and Algorithms T–79.4201 Search Problems and Algorithms Constraint satisfaction: algorithms ◮ For some classes of constraints there are efficient special purpose algorithms (domain specific methods/constraint solvers). Lecture 6: Constraint satisfaction: algorithms ◮ But now we consider general methods consisting of ◮ constraint propagation techniques and ◮ Basic algorithmic framework for solving CSPs ◮ search methods. ◮ DPLL algorithm for Boolean constraints in CNF ◮ We discuss the basic structure of such a general method (procedure Solve below), the components used, and their interaction. ◮ The DPLL algorithm for solving Boolean constraint satisfaction problems given in CNF is presented as an example of such a general method. I.N. & P .O. Autumn 2007 1 I.N. & P .O. Autumn 2007 2 T–79.4201 Search Problems and Algorithms T–79.4201 Search Problems and Algorithms Constraint Programming: Basic Framework Solve procedure Solve: ◮ The procedure Solve takes as input a constraint satisfaction var continue: Boolean ; problem (CSP) and transforms it until it is solved. continue:= TRUE; ◮ It employs a number of subprocedures (Happy, Preprocess, while continue and not Happy do Constraint Propagation, Atomic, Split, Proceed by Cases). Preprocess; ◮ The subprocedures Happy and Atomic test the given CSP to Constraint Propagation; check the termination condition for Solve. if not Happy then ◮ The subprocedures Preprocess and Constraint Propagation if Atomic then transforms the given CSP to another one that is equivalent to it. continue:= FALSE else ◮ Split divides the given CSP into two or more CSPs whose union Split; is equivalent to the CSP . Proceed by Cases ◮ Proceed by Cases specifies what search techniques are used to end process the CSPs generated by Split. end ◮ The subprocedures will be explained in more detail below. end I.N. & P .O. Autumn 2007 3 I.N. & P .O. Autumn 2007 4

  2. T–79.4201 Search Problems and Algorithms T–79.4201 Search Problems and Algorithms Equivalence of CSPs Example. ◮ To understand Solve we need the notion of equivalence. ◮ Consider the following CSPs: P 1 = �{ x 1 < x 2 } ; x 1 ∈ { 1 , 3 } , x 2 ∈ { 1 , 3 }� ◮ Basically, CSPs P 1 and P 2 are equivalent if they have the same P 2 = �{ x 1 < x 3 , x 3 ≤ x 2 } ; x 1 ∈ { 1 , 3 } , x 2 ∈ { 1 , 3 } , x 3 ∈ { 1 , 2 , 3 }� set of solutions. ◮ However, transformations can add new variables to a CSP and ◮ P 1 and P 2 are not equivalent (because they have different sets for then equivalence is understood w.r.t. the original variables. variables). ◮ We say that two value assignments T and T ′ agree on a set of ◮ However, they are equivalent on variables X = { x 1 , x 2 } as variables X if T ( x ) = T ′ ( x ) for all x ∈ X . ◮ for the unique solution T 1 = { x 1 �→ 1 , x 2 �→ 3 } of P 1 there is a ◮ CSPs P 1 and P 2 are equivalent w.r.t. a set of variables X iff corresponding solution T 21 = { x 1 �→ 1 , x 2 �→ 3 , x 3 �→ 3 } of P 2 ◮ for every solution T 1 of P 1 there is a solution T 2 of P 2 such that T 1 such that T 1 and T 21 agree on variables X and and T 2 agree on variables X and ◮ for the solutions T 21 and T 22 = { x 1 �→ 1 , x 2 �→ 3 , x 3 �→ 2 } of P 2 T 1 ◮ for every solution T 2 of P 2 there is a solution T 1 of P 1 such that T 2 is a corresponding solution of P 1 agree on X . and T 1 agree on variables X . ◮ For instance, CSP ◮ Union of CSPs P 1 ,..., P m is equivalent w.r.t. X to a CSP P 0 iff P 0 = �{ x 1 < x 2 ; x 1 ∈ { 1 ,..., 10 } , x 2 ∈ { 1 ,..., 10 }� ◮ for every solution T 0 of P 0 there is a solution T i of P i for some is equivalent w.r.t. { x 1 , x 2 } to the union of 1 ≤ i ≤ m such that T 0 and T i agree on variables X and P 01 = �{ x 1 < x 2 } ; x 1 ∈ { 1 ,..., 5 } , x 2 ∈ { 1 ,..., 10 }� ◮ for each 1 ≤ i ≤ m for every solution T i of P i there is a solution T 0 P 02 = �{ x 1 < x 2 } ; x 1 ∈ { 6 ,..., 10 } , x 2 ∈ { 1 ,..., 10 }� of P 0 such that T i and T 0 agree on variables X . I.N. & P .O. Autumn 2007 5 I.N. & P .O. Autumn 2007 6 T–79.4201 Search Problems and Algorithms T–79.4201 Search Problems and Algorithms Solved and Failed CSPs Transformations ◮ For termination we need to defined when a CSP has been solved ◮ In the following we represent transformations of CSPs by means and when it is failed, i.e., has no solution. of proof rules. ◮ Let C be a constraint on variables y 1 ,..., y k with domains ◮ A rule D 1 ,..., D k ( C ⊆ D 1 ×···× D k ). P 0 ◮ C is solved if C = D 1 ×···× D k and C � = / 0 . P 1 ◮ A CSP is solved if transforms the CSP P 0 to the CSP P 1 . — all its constraints are solved ◮ A rule — no domain of it is empty. P 0 ◮ A CSP is failed if P 1 | ··· | P 1 — it contains the false constraint ⊥ , or transforms the CSP P 0 to the set of CSPs P 1 ,..., P n . — one of its domains or constraints is empty. I.N. & P .O. Autumn 2007 7 I.N. & P .O. Autumn 2007 8

  3. T–79.4201 Search Problems and Algorithms T–79.4201 Search Problems and Algorithms Happy Preprocess This is a test applied to the current CSP to see whether the goal ◮ Bring constraints to desired syntactic form. conditions set for the original CSP have been achieved. Typical ◮ Example: Constraints on reals. conditions include: Desired syntactic form: no repeated occurrences of a variable. ax 7 + bx 5 y + cy 10 = 0 ◮ a solution has been found, ax 7 + z + cy 10 = 0 , bx 5 y = z ◮ all solutions have been found, ◮ a solved form has been reached from which one can generate all (Notice a new variable is introduced.) solutions, Atomic ◮ it is determined that no solution exists (the CSP is failed), ◮ This is a test applied to the current CSP to see whether the CSP ◮ an optimal solution w.r.t. some objective function has been found, is amenable for splitting. ◮ Typically a CSP is considered atomic if the domains of the ◮ all optimal solutions have been found. variables are either singletons or empty. Example. For a CSP ◮ But a CSP can be viewed atomic also if it is clear that search � x 1 + x 2 = x 3 , x 1 − x 2 = 0 ; x i ∈ D i � ‘under’ this CSP is not needed. the solved form could be, for example, For example, this could be the case when the CSP is “solved” or � x 1 = x 2 , x 3 = 2 x 2 ; x i ∈ D i � an optimal solution can be computed directly from the CSP . I.N. & P .O. Autumn 2007 9 I.N. & P .O. Autumn 2007 10 T–79.4201 Search Problems and Algorithms T–79.4201 Search Problems and Algorithms Split — a domain Split x ∈ D ◮ D finite (Enumeration) : x ∈ { a } | x ∈ D −{ a } ◮ After Constraint Propagation, Split is called when the test Happy x ∈ { a 1 ,..., a k } ◮ D finite (Labeling) : fails but the CSP is not yet Atomic. x ∈ { a 1 } | ... | x ∈ { a k } ◮ A call to Split replaces the current CSP P 0 by CSPs P 1 ,..., P n x ∈ [ a .. b ] ◮ D interval of reals (Bisection) : such that the union of P 1 ,..., P n is equivalent to P 0 , i.e., the rule x ∈ [ a .. a + b 2 ] | x ∈ [ a + b 2 .. b ] P 0 Split — a constraint P 1 | ··· | P n ◮ Disjunctive constraints like is applied Start[task1] + Duration[task1] ≤ Start[task2] ∨ Start[task2] + Duration[task2] ≤ Start[task1] ◮ A split can be implemented by splitting domains or constraints. can be split using the rule: C 1 ∨ C 2 ◮ For efficiency an important issue is the splitting heuristics, i.e. C 1 | C 2 which split to apply and in which order to consider the resulting ◮ Constraints in "compound" form: CSPs. | p (¯ x ) | = a p (¯ x ) = a | p (¯ x ) = − a I.N. & P .O. Autumn 2007 11 I.N. & P .O. Autumn 2007 12

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