CSP
CSP
CSP
⚫ State is defined by variables Xi with values from domain Di
⚫ Goal test is a set of constraints specifying
Allowable combinations of values for subsets of values
Simple example of formal-representation language
Allows useful general-purpose algorithms with more power
than standard search algorithms.
CONSTRAINT SATISFACTION 4
PROBLEMS (CSPS)
A Constraint satisfaction problem consists of three components X, D, C:
*
D is a set of domains, {D1,D2,…..Dn}
C is a set of constraints that specify allowable combination of values.
Each constraint is represented as Ci=(Scope, Relation)
PROBLEMS (CSPS)
A solution to a CSP is a complete assignment that satisfies all the constraints.
An assignment that does not violate any constraints is called consistent or legal
*
Assignment.
*
have the same color.
7
EXAMPLE SOLUTION
*
8
*
9
*
With CSPs, once we find out that a partial assignment is
not a solution, we can immediately discard further
refinements of the partial assignment.
10
CONSTRAINT GRAPH
*
11
VARIETIES OF CSPS
*
12
VARIETIES OF CONSTRAINS
*
REAL WORLD CSPS 13
*
GENERAL FORM OF THE CSPS 14
*
CSPs can be solved by any search strategies.
CSP basic procedure:
1. Until a complete solution is found or until all the paths have led to lead ends, do select an unexpanded
node of the search graph
2.The constraints inference rules are applied to the selected node to generate all the possible new
constraints.
3. If the set of constraints contains a contradiction, then it is reported that this path is dead end.
4. If the set of constraints describes a complete solution has been found, then the rules are applied to
generate.
5. If neither a constraint nor a complete solution has been found, then the rules are applied to generate new
partial solutions. These partial solutions are inserted into the search graph.
STANDARD SEARCH FORMULATION
15
*
BACKTRACKING SEARCH 16
*
⚫ We can build up to a solution by searching through the space of
partial assignments though the single variable assignment.
⚫ Order in which we assign the variables does not matter
Eventually they all have to be assigned.
⚫ If during the process of building up a solution we falsify a constraint,
we can immediately reject all possible ways of extending the current
partial assignment and Backtrack.
BACKTRACKING SEARCH (CONTI..) 17
*
Idea 2: Check constraints to go
-- i.e. consider only values which do not conflict with
previous assignments.
-- Might have to do some computation to check the
constraints, then we get one step at a time towards the goal, i.e.
Incremental goal test.
*
BACKTRACKING SEARCH (CONTI..)
19
*
BACKTRACKING SEARCH (CONTI..)
20
*
BACKTRACKING SEARCH (CONTI..)
21
*
BACKTRACKING SEARCH
ISSUES….
*
BACKTRACKING SEARCH (CONTI..)
24
*
BACKTRACKING SEARCH (CONTI..)
25
*
BACKTRACKING SEARCH
(CONTI..) 26
*
27
*
domain-specific knowledge
VARIABLE ORDERING 28
*
in the order given by the variable list. However, the static ordering seldom results
in the most efficient search. Also, called as Fail-first heuristic, because it picks a
variable i.e. most likely to cause a failure soon, thereby pruning the tree.
VARIABLE ORDERING 29
*
The MRV heuristic does not help at all in choosing the first region to
color, because initially every region has three legal colors.
*
VALUE ORDERING 31
*
Once the variable has been selected the algorithm must decide on
the order in which to examine its value. It prefers the value that
eliminate the fewest choices for the neighboring in constraint
graph.
VALUE ORDERING 32
*
Thank You!!