exploiting reductions
play

Exploiting Reductions Given an efficient algorithm for a problem A - PowerPoint PPT Presentation

T79.4201 Search Problems and Algorithms T79.4201 Search Problems and Algorithms Exploiting Reductions Given an efficient algorithm for a problem A we can solve a Lecture 5: Constraint satisfaction: formalisms problem B by developing a


  1. T–79.4201 Search Problems and Algorithms T–79.4201 Search Problems and Algorithms Exploiting Reductions ◮ Given an efficient algorithm for a problem A we can solve a Lecture 5: Constraint satisfaction: formalisms problem B by developing a reduction from B to A . and modelling Algorithm for B: ◮ When solving a search problem the most efficient solution R ( x ) Reduction Algorithm input x = ⇒ = ⇒ = ⇒ Answer R methods are typically based on special purpose algorithms. for A ◮ In Lectures 3 and 4 important approaches to developing such algorithms have been discussed. ◮ Constraint satisfaction problems (CSPs) offer attractive target ◮ However, developing a special purpose algorithm for a given problems to be used in this way: ◮ CSPs provide a flexible framework to develop reductions, i.e., problem requires typically a substantial amount of expertise and encodings of problems as CSPs such that a solution to the original considerable resources. problem can be easily extracted from a solution of the CSP ◮ Another approach is to exploit an efficient algorithm already encoding the problem. developed for some problem through reductions. ◮ Constraint programming offers tools to build efficient algorithms for solving CSPs for a wide range of constraints. ◮ There are efficient software packages that can be directly used for solving interesting classes of constraints. I.N. & P .O. Spring 2006 I.N. & P .O. Spring 2006 T–79.4201 Search Problems and Algorithms T–79.4201 Search Problems and Algorithms Constraint Satisfaction Problems (CSPs) CSPs II ◮ Given variables Y := y 1 ,..., y k and domains D 1 ,... D k , a constraint C on Y is a subset of D 1 ×···× D k . ◮ For a constraint C on x i 1 ,..., x i m , an n-tuple ( d 1 ,..., d n ) ∈ D 1 ×···× D n satisfies C if ( d i 1 ,..., d i m ) ∈ C ◮ If k = 1, the constraint is called unary and if k = 2, binary. ◮ Example. An n-tuple ( 1 , 2 ,..., n ) satisfies the constraint NotEq ◮ Example. Consider variables y 1 , y 2 both having the domain on x 1 , x 2 because ( 1 , 2 ) ∈ NotEq but the n-tuple ( 1 , 1 ,..., n ) does D i = { 0 , 1 , 2 } and a binary constraint NotEq on y 1 , y 2 such that not as ( 1 , 1 ) �∈ NotEq . NotEq = { ( 0 , 1 ) , ( 0 , 2 ) , ( 1 , 0 ) , ( 1 , 2 ) , ( 2 , 0 ) , ( 2 , 1 ) } . ◮ A solution to a CSP � C , x 1 ∈ D 1 ,..., x n ∈ D n � is an n-tuple ◮ For variables x , y , we denote this constraint modelling ( d 1 ,..., d n ) ∈ D 1 ×···× D n that satisfies each constraint C ∈ C . non-equality by x � = y . ◮ Given variables x 1 ,..., x n and domains D 1 ,... D n , Example. Consider a CSP a constraint satisfaction problem (CSP): �{ x 1 � = x 2 , x 1 � = x 3 , x 2 � = x 3 } , x 1 ∈ { 0 , 1 , 2 } , x 2 ∈ { 0 , 1 , 2 } , x 3 ∈ { 0 , 1 , 2 }� � C ; x 1 ∈ D 1 ,..., x n ∈ D n � The 3-tuple ( 0 , 1 , 2 ) is a solution to the CSP as it satisfies all the constraints but ( 0 , 1 , 1 ) is not because it does not satisfy the constraint x 2 � = x 3 . where C is a set of constraints each on a subsequence of x 1 ,..., x n . I.N. & P .O. Spring 2006 I.N. & P .O. Spring 2006

  2. T–79.4201 Search Problems and Algorithms T–79.4201 Search Problems and Algorithms Example: SEND + MORE = MONEY ◮ Replace each letter by a different digit so that Example. Coloring problem SEND 9567 Given a graph G , the coloring problem can be encoded as a CSP as + MORE + 1085 follows. MONEY 10652 is a correct sum. The unique solution. ◮ For each node v i in the graph introduce a variable V i with the ◮ Variables: S, E, N, D, M, O, R, Y domain { 1 ,..., n } where n is the number of available colors. ◮ Domains: [1..9] for S, M and [0..9] for E, N, D, O, R, Y ◮ For each edge ( v i , v j ) in the graph introduce a constraint V i � = V j . ◮ Constraints: ◮ This is a reduction of the coloring problem to a CSP because the solutions to the CSP correspond exactly to the solutions of the 1000 · S + 100 · E + 10 · N + D coloring problem: + 1000 · M + 100 · O + 10 · R + E a tuple ( t 1 ,..., t n ) satisfying all the constraints gives a valid = 10000 · M + 1000 · O + 100 · N + 10 · E + Y coloring of the graph where node v i is colored with color t i . x � = y for every pair of variables x , y in {S, E, N, D, M, O, R, Y}. ◮ It is easy to check that the tuple ( 9 , 5 , 6 , 7 , 1 , 0 , 8 , 2 ) satisfies the constraints, i.e., is a solution to the problem. I.N. & P .O. Spring 2006 I.N. & P .O. Spring 2006 T–79.4201 Search Problems and Algorithms T–79.4201 Search Problems and Algorithms Constrained Optimization Problems ◮ Given: a CSP P := � C ; x 1 ∈ D 1 ,..., x n ∈ D n � and a function N Queens obj : Sol �→ R Problem: Place n queens on a n × n chess board so that they do not ◮ ( P , obj ) is a constrained optimization problem (COP) where the attack each other. task is to find a solution d to P for which the value obj ( d ) is ◮ Variables: x 1 ,..., x n ( x i gives the position of the queen on ith optimal. column) ◮ Example. KNAPSACK: a knapsack of a fixed volume and n ◮ Domains: [1..n] objects, each with a volume and a value. Find a collection of ◮ Constraints: for i ∈ [ 1 .. n − 1 ] and j ∈ [ i + 1 .. n ] : these objects with maximal total value that fits in the knapsack. (i) x i � = x j (rows) ◮ Representation as a COP: (ii) x i − x j � = i − j (SW-NE diagonals) Given: knapsack volume v and n objects with volumes a 1 ,..., a n (iii) x i − x j � = j − i (NW-SE diagonals) and values b 1 ,..., b n . ◮ When n = 10, the tuple ( 3 , 10 , 7 , 4 , 1 , 5 , 2 , 9 , 6 , 8 ) gives a solution Variables: x 1 ,..., x n to the problem. Domains: { 0 , 1 } Constraint: ∑ n i = 1 a i · x i ≤ v , Objective function: ∑ n i = 1 b i · x i . I.N. & P .O. Spring 2006 I.N. & P .O. Spring 2006

  3. T–79.4201 Search Problems and Algorithms T–79.4201 Search Problems and Algorithms Solving CSPs Constraints ◮ Constraints have varying computational properties. ◮ For some classes of constraints there are efficient special ◮ In the course we consider more carefully two classes of purpose algorithms (domain specific methods/constraint solvers). constraints: linear constraints and Boolean constraints. Examples ◮ Linear constraints (Lectures 7–9) are an example of a class of ◮ Linear equations constraints which has efficient special purpose algorithms. ◮ Linear programming ◮ Now we consider Boolean constraints as an example of a class ◮ Unification for which we need to use general methods based on propagation ◮ For others general methods consisting of ◮ constraint propagation algorithms and and search. ◮ search methods ◮ However, boolean constraints are interesting because ◮ highly efficient general purpose methods are available for solving must be used. Boolean constraints; ◮ Different encodings of a problem as a CSP utilizing different sets ◮ they provide a flexible framework for encoding (modelling) where it of constraints can have substantial different computational is possible to use combinations of constraints (with efficient properties. support by solution techniques). ◮ However, it is not obvious which encodings lead to the best computational performance. I.N. & P .O. Spring 2006 I.N. & P .O. Spring 2006 T–79.4201 Search Problems and Algorithms T–79.4201 Search Problems and Algorithms Propositional formulas ◮ Syntax (what are well-formed propositional formulas): Boolean Constraints Boolean variables (atoms) X = { x 1 , x 2 ,... } Boolean connectives ∨ , ∧ , ¬ ◮ A Boolean constraint C on variables x 1 ,..., x n with the domain ◮ The set of (propositional) formulas is the smallest set such that all { true , false } can be seen as a Boolean function Boolean variables are formulas and if φ 1 and φ 2 are formulas, so f C : { true , false } n − → { true , false } such that a tuple ( t 1 ,..., t n ) are ¬ φ 1 , ( φ 1 ∧ φ 2 ) , and ( φ 1 ∨ φ 2 ) . satisfies the constraint C iff f C ( t 1 ,..., t n ) = true . For example, (( x 1 ∨ x 2 ) ∧¬ x 3 ) is a formula but (( x 1 ∨ x 2 ) ¬ x 3 ) is ◮ Typically such functions are represented as propositional not. formulas . ◮ A formula of the form x i or ¬ x i is called a literal where x i is a ◮ Solution methods for Boolean constraints exploit the structure of Boolean variable. the representation of the constraints as formulas. ◮ We employ usual shorthands: φ 1 → φ 2 : ¬ φ 1 ∨ φ 2 φ 1 ↔ φ 2 : ( ¬ φ 1 ∨ φ 2 ) ∧ ( ¬ φ 2 ∨ φ 1 ) φ 1 ⊕ φ 2 : ( ¬ φ 1 ∧ φ 2 ) ∨ ( φ 1 ∧¬ φ 2 ) I.N. & P .O. Spring 2006 I.N. & P .O. Spring 2006

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