0% found this document useful (0 votes)
3 views

6.1 Constraint Satisfaction Problem

Constraint satisfaction problems (CSPs) are mathematical problems defined by a set of variables, their domains, and constraints that must be satisfied. CSPs can be solved through variable assignments that meet all constraints, utilizing search algorithms to efficiently navigate the solution space. Examples include Sudoku and cryptarithmetic puzzles, which illustrate the application of CSPs in real-world scenarios.

Uploaded by

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

6.1 Constraint Satisfaction Problem

Constraint satisfaction problems (CSPs) are mathematical problems defined by a set of variables, their domains, and constraints that must be satisfied. CSPs can be solved through variable assignments that meet all constraints, utilizing search algorithms to efficiently navigate the solution space. Examples include Sudoku and cryptarithmetic puzzles, which illustrate the application of CSPs in real-world scenarios.

Uploaded by

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

Constraint satisfaction problems (CSPs)

 Constraint satisfaction problems (CSPs) are mathematical


questions defined as a set of objects whose state must satisfy
a number of constraints or limitations.
 CSPs represent the entities in a problem as a homogeneous
collection of finite constraints over variables, which is solved
by constraint satisfaction methods
 It is a search procedure that operates in a space of constraints
 Any problem in the world can mathematically be represented
as CSP.
 The solution is typically a state that can satisfy all the
constraints.
 A constraint satisfaction problem (CSP) consists of
 a set of variables, {X1, X2, . . . , Xn}
 a domain for each variable {D1, D2, ..., Dk}, and
 a set of constraints, {C1, C2, . . . , Cp}
 A CSP is solved by a variable assignment that satisfies all
given constraints. In CSPs, states are explicitly
represented as variable assignments. CSP search
algorithms take advantage of this structure.
 The main idea is to exploit the constraints to eliminate
large portions of search space.
 The aim is to choose a value for each variable so that the
resulting possible world satisfies the constraints.
 n variables of domain size d → O(dn) distinct complete
assignments.
Example-1
Sudoku Playing: The gameplay where the constraint is that
no number from 0-9 can be repeated in the same row or
column.
Crypt Arithmetic Puzzles

Constraints:

1. Variables: can take values from 0-9

2. No two variables should take same value

3. The values should be selected such a way that it should

comply with arithmetic properties


Example: SEND + MORE =
MONEY

5 4 3 2 1 SOLUTION:
S E N D
+ M O R E 9 5 6 7
c3 c2 c1 + 1 0 8 5
---------------------- -----------------
M O N E Y 1 0 6 5 2

VALUES:
S=9
E=5
N=6
D=7
M=1
O=0
R=8
Y=2
1. From Column 5, M=1, since it is only carry-over possible from
sum of 2 single digit number in column 4.
2. To produce a carry from column 4 to column 5 'S + M' is at least
9 so 'S=8or9' so 'S+M=9or10' & so 'O = 0 or 1'. But 'M=1', so 'O
= 0'.
3. If there is carry from Column 3 to 4 then 'E=9' & so 'N=0'. But 'O
= 0' so there is no carry & 'S=9' & 'c3=0'.
4. If there is no carry from column 2 to 3 then 'E=N' which is
impossible, therefore there is carry & 'N=E+1' & 'c2=1'.
5. If there is carry from column 1 to 2 then 'N+R=E mod 10' &
'N=E+1‘ so 'E+1+R=E mod 10', so 'R=9' but 'S=9', so there must
be carry from column 1 to 2. Therefore 'c1=1' & 'R=8'.
6. To produce carry 'c1=1' from column 1 to 2, we must have
'D+E=10+Y‘ as Y cannot be 0/1 so D+E is atleast 12. As D is atmost
7 & E is atleast 5 (D cannot be 8 or 9 as it is already assigned). N is
atmost 7 & 'N=E+1' so 'E=5or6'.
7. If E were 6 & D+E atleast 12 then D would be 7, but 'N=E+1' &
N would also be 7 which is impossible. Therefore 'E=5' & 'N=6'.
8. D+E is atleast 12 for that we get 'D=7' & 'Y=2'.

You might also like