Informed Search
Informed Search
• Breadth-first search
• Uniform-cost search
• Depth-first search
Uninformed • Depth-limited search
• Iterative deepening depth-first search
search
• Bidirectional search
2/12/2024 1
Informed Search strategies
What’s a proper heuristic that measures cheapest path from current node to goal node?
Romania Map with Costs
• Complete?
– From Iasi to Fagaras
– No – can get stuck in loops, e.g., Iasi 🡪 Neamt 🡪 Iasi 🡪Neamt 🡪 …
• Time?
– O(bm), but a good heuristic can give dramatic improvement
• Space?
– O(bm) -- keeps all nodes in memory
• Optimal?
– No
A*: Minimizing Total Est. Cost
• Name Reason
▪ h2 (n) = sum of the distances of the tiles from their goal positions,
called Manhattan distance
e.g., h2 (n) = 3 + 1 + 2 + 2 + 2 + 3 + 3 + 2 =
18
Memory bounded heuristic search
• Consistent or Legal Assignment: An assignment which does not violate any constraint or
rule is called Consistent or legal assignment.
• Complete Assignment: An assignment where every variable is assigned with a value, and the
solution to the CSP remains consistent. Such assignment is known as Complete assignment.
• Partial Assignment: An assignment which assigns values to some of the variables only. Such
type of assignments are called Partial assignments.
2/12/2024 30
DOMAINS & CONSTRAINTS IN CSP
There are following two types of domains which are used by the variables :
• Discrete Domain: It is an infinite domain which can have one state for multiple variables. For
example, a start state can be allocated infinite times for each variable.
• Finite Domain: It is a finite domain which can have continuous states describing one domain for
one specific variable. It is also called a continuous domain.
With respect to the variables, basically there are following types of constraints:
• Unary Constraints: It is the simplest type of constraints that restricts the value of a single variable.
e.g., SA ≠ green
• Binary Constraints: It is the constraint type which relates two variables. A value x2 will contain a
value which lies between x1 and x3. e.g., SA ≠ WA
• Global Constraints: It is the constraint type which involves an arbitrary number of variables.
2/12/2024 31
MAP COLORING USING CSP
2/12/2024
Constraints: Adjacent regions must have different colors 32
MAP COLORING USING CSP
2/12/2024 33
CONSTRAINT GRAPH - CSP
2/12/2024 34
CSP AS A SEARCH PROBLEM
• Initial state:
• {} – all variables are unassigned
• Successor function:
• a value is assigned to one of the unassigned variables with no conflict
• Goal test:
• a complete assignment
• Path cost:
• a constant cost for each step
• Solution:
• Appears at depth n if there are n variables
• Depth-first or local search methods work well
2/12/2024 35
CSP SOLVERS
2/12/2024 36
GLOBAL CONSTRAINTS- CRYPTARITHMETIC
2/12/2024 37
GLOBAL CONSTRAINTS- CRYPTARITHMETIC
• SOLVE:
S E N D
+ M O R E
----------------------------------
M O N E Y
B A S E
+ B A L L
-------------------------------------
G A M E S
2/12/2024 38
REAL WORLD CSP
2/12/2024 39
BACKTRACKING - CSP
2/12/2024 40
BACKTRACKING - CSP
2/12/2024 41
BACKTRACKING - CSP
2/12/2024 42
BACKTRACKING - CSP
2/12/2024 43
BACKTRACKING - CSP
2/12/2024 44
IMPROVING BACKTRACKING EFFICIENCY
2/12/2024 45
Forward checking
2/12/2024 46
Constraint propagation
2/12/2024 47
THANK YOU