Constraint Satisfaction Problem Constraint Satisfaction Problem CSP contains
Constraint Satisfaction Problem
Constraint Satisfaction Problem • CSP contains finite set of variables, each of which is related to a finite domain, and a set of constraints that restricts the values which variables can take. • Main task of CSP is to assign a value to each variable satisfying all the constraints.
• A set of variables X={x 1, …, xn} • Finite set S 1 of possible domains • a set of constraints that restricts the values of variables.
Satisfiability • A satisfiability problem has logical proposition formula in n variables and required to find a value for each variable that makes the formula correct.
Search strategies for solving CSP • 1. CSP determines whethere exists any model. • 2. Then find out that model. • 3. After that count the number of models. • 4. And tries to find out the best model.
CSP standard search problem • Initial state – variables unassigned • Successor function - value assigned to any unassigned variable, provided that it does not conflict with previously assigned variables. • Goal Test – check whether the assignment is completed. • Path cost – a constant cost of every step
Generate and Test • One by one all possible complete variable assignments are created and then for each variable we test if it satisfies all the constraints. • Not efficient algorithm because it generates many incorrect assignments of values.
Backtracking • Current variable is assigned a value. • Value is taken from domain. • This assignment is then checked with the current partial solution , if any of the constraint between this variable and past variables is violated, the assignment is discarded and a new value will be chosen. • If complete solution is found, the algorithm finishes.
Limitations of Backtracking • 1. Thrashing – repeated failure due to identical errors. • 2. Does not identify the actual reason for conflict. • 3. Redundant work.
Consistence driven techniques • Two Types – Node consistency, Arc Consistency • The node representing a variable v in constraint graph is node consistent if for every value x in the current domain of v, each unary constraint of v is satisfied.
Forward checking • Limitation of backtracking can be avoided by applying consistency techniques to forward check the possible conflicts. • Forward check can detect inconsistency. • It prunes branches of search tree that may lead to failure.
Representation of CSP • Represented using an undirected graph, which is known as constraint graph where the nodes represent the variables and edges represents the binary constraints. • Higher order constraints are represented by hyper arcs.
Examples of CSP • • 1. Scheduling Problem 2. N-Queens Problem 3. Map Coloring Problem 4. Satisfiability Problem
Local search for CSP • The initial state assigns a value to every variable , and the successor function usually works by changing the value of one variable at a time. • In choosing a new variable the most obvious heuristic is to select the value of Min conflicts that results in minimum number of conflicts with other variables.
- Slides: 14