0% found this document useful (0 votes)
22 views14 pages

Unit 4

Uploaded by

poornasrikalak
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views14 pages

Unit 4

Uploaded by

poornasrikalak
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

UNIT-4

Constraint satisfaction problem:


Defining Constraint Satisfaction Problems,
Constraint Propagation: Inference in CSPs,
Backtracking Search for CSPs,
The Structure of Problems.
Constraint satisfaction problem:
• A Constraint Satisfaction Problem(or CSP) is defined by a set of
variables,X1,X2,….Xn, and a set of constraints C1,C2,…,Cm.
• Each variable Xi has a nonempty domain D,of possible values. Each constraint
Ci involves some subset of variables and specifies the allowable combinations
of values for that subset.
• A State of the problem is defined by an assignment of values to some or all of
the variables,{Xi = vi,Xj = vj,…}.
• An assignment that does not violate any constraints is called a consistent or
legal assignment.
• A complete assignment is one in which every variable is mentioned, and a
solution to a CSP is a complete assignment that satisfies all the constraints.
• Some CSPs also require a solution that maximizes an objective function.
Example for Constraint Satisfaction Problem
• Figure shows the map of Australia showing each of its states and territories.
• We are given the task of coloring each region either red, green, or blue in such
a way that the neighboring regions have the same color.
• To formulate this as CSP, we define the variable to be the regions
:WA,NT,Q,NSW,V,SA, and T.
• The domain of each variable is the set {red,green,blue}.
• The constraints require neighboring regions to have distinct colors; for example,
the allowable combinations for WA and NT are the pairs
{(red,green),(red,blue),(green,red),(green,blue),(blue,red),(blue,green)}.

• { WA = red, NT = green, Q = red, NSW = green, V = red,SA = blue,T = red}.


The nodes of the graph corresponds to variables of
the problem and the arcs correspond to constraints.
Mapping Problem
CSP can be viewed as a standard search problem as follows:
• Initial state: the empty assignment {},in which all variables are unassigned.
• ➢ Successor function: a value can be assigned to any unassigned variable,
provided that it does not conflict with previously assigned variables.
• ➢ Goal test: the current assignment is complete.
• ➢ Path cost: a constant cost(E.g.,1) for every step.
• Every solution must be a complete assignment and therefore appears at
depth n if there are n variables.
• Depth first search algorithms are popular for CSPs
Varieties of CSPs
• (i) Discrete variables Finite domains :
• The simplest kind of CSP involves variables that are discrete and have finite
domains.
• Map coloring problems are of this kind. The 8-queens problem can also be
viewed as finite domain .
• CSP, where the variables Q1,Q2,…..Q8 are the positions each queen in columns
1,….8 and each variable has the domain {1,2,3,4,5,6,7,8}. If the maximum
domain size of any variable in a CSP is d, then the number of possible complete
assignments is O(dn ) – that is, exponential in the number of variables.
• Finite domain CSPs include Boolean CSPs, whose variables can be either true or
false. Infinite domains
• (ii) CSPs with continuous domains
• CSPs with continuous domains are very common in real world.
• For example in operation research field, the scheduling of experiments on the
Hubble Telescope requires very precise timing of observations; the start and finish
of each observation and manoeuvre are continuous-valued variables that must
obey a variety of astronomical, p
• Varieties of constraints:
• (i) unary constraints involve a single variable.
• Example : SA # green
• (ii) Binary constraints involve paris of variables.
• Example : SA # WA
• (iii) Higher order constraints involve 3 or more variables.
• Example :cryptarithmetic puzzles. recedence and power constraints.
Backtracking Search for CSPs:
The term backtracking search is used for depth-first search that chooses
values for one variable at a time and backtracks when a variable has no
legal values left to assign
Forward checking
• One way to make better use of constraints during search is called forward
checking.
• Whenever a variable X is assigned, the forward checking process looks at each
unassigned variable Y that is connected to X by a constraint and deletes from Y ’s
domain any value that is inconsistent with the value chosen for X.

You might also like