Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 20

Presentation on Problem

Reduction and Constraint


Satisfaction
Group Member:

Ibrahim Khalil Shakik


ID:CE-14045
Md. Riazul Islam
ID:CE-14047
Content
• Problem Reduction and Decomposition (AND-ORGraphs)
• Constraint SatisfactionProblem
• Graph coloringproblem
• CryptArithmetic
Problem Reduction and Decomposition (AND-OR
Graphs)

Goal:
Acquire TV

Goal: Steal a TV Goal: Earn some Goal: Buy TV


set money set
Constraint Satisfaction Problem
 Each state contains:
Variables X1, X2, X3,…….Xn
Constraints C1,C2,…..Cn
Variables have to be assigned with values V1,V2,…..Vn
Such that none of the constraints are violated.

 Goal state- one in which all variables are assigned resp. values
and those values do not violate any constraint
Varieties of constraint
Unary constraints involve a single variable,
e.g., SA ≠ green

Binary constraints involve pairs of variables,


e.g., SA ≠ WA

Higher-order constraints involve 3 or more variables,


e.g., SA ≠ WA ≠ NT
Graph coloring problem
• Variables WA, NT, Q, NSW, V,
SA, T
• Domains Di = {red,green,blue}
• Constraints: adjacent regions
must have different colors
e.g., WA ≠ NT
Graph coloring problem
Binary CSP: each constraint relates two variables
Constraint graph: nodes are variables, arcs are constraints
Graph coloring problem
Solutions are complete and
consistent assignments, e.g.,
WA = red,
NT = green,
Q = red,
NSW = green,
V = red,
SA = blue,
T = green
Crypt Arithmetic
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.
Crypt Arithmetic
STEP-01: C3 = 1, since 2 single digit numbers plus a carry cannot be
more than 19.
Thus, C3 = 1, F = 1.

1 C2 C1
T W O
+ T W O
1 O U R
Crypt Arithmetic
STEP-02: T+T+C2 > 9 because only then it can generate carry. C2 can be 0
or 1 , depending on: if previous column is generating carry or not.
Assume, C2 = 1,
then, 2T+1>9
So, 2T>8
hence T>4
T can take value from 5,6,…9
Crypt Arithmetic
STEP-03: Assume, T = 5. But , if T=5 ,
1 C2 C1 T+T+C2 = 11
5 W O which means O = 1 , constraint
violated as F=1.
+ 5 W O
Now, assume different value for T
1 O U R
We know , T can take value from
5,6,…9
Crypt Arithmetic
STEP-04: Assume, T = 6. But , if T=6 ,
1 C2 C1 T+T+C2 = 13
6 W O which means O = 3 , accepted till
now.
+ 6 W O
1 O U R
Crypt Arithmetic
STEP-04: Assume, T = 6. But , if T=6 ,
1 C2 C1 T+T+C2 = 13
6 W 3 which means O = 3,
+ 6 W 3 O+O =R
1 3 U R Since O=3, R=6, constraint violated
as T=6.
Hence T=6 can’t generate solution.
Crypt Arithmetic
STEP-05: Assume, T = 7. 1 C2 1
1 C2 C1 7 W 5
7 W O + 7 W 5
+ 7 W O 1 5 U 0
1 O U R O+O =R
T+T+C2= O Since O=5, R=0, C1 = 1.
7+7+1=15
Thus O=5
Crypt Arithmetic
1 C2 1
STEP-06: We have middle column left
i.e. 7 W 5
W+W+C1=U + 7 W 5
Since C1 =1 1 5 U 0
W+W must be >9 [to generate carry]
W>=5 To generate carry C2
W can take values 5,6,7,…9
Crypt Arithmetic
STEP-07: Assume, W = 5. But , if W=5 ,
1 C2 1 W+W+C1 = U
7 5 5 5+5+1 = 11
+ 7 5 5 which means U = 1,
1 3 U 0 constraint violated as F=1.
Hence W=5 can’t generate solution.
Crypt Arithmetic
STEP-08: Assume, W = 6. But , if W=6,
1 C2 1 W+W+C1 = U
7 W 5 6+6+1 = 13
+ 7 W 5 which means U =3, C2 = 1, which is
accepted.
1 3 U 0
Crypt Arithmetic
Thus at this state since all the variables have been assigned value
which comply with constraints given, we have reached final
1 1 1
7 6 5
+ 7 6 5
1 5 3 0
Thanks

You might also like