Unit 2 Searching methods (1)
Unit 2 Searching methods (1)
Completeness: Exhaustiveness
If a solution exists, state space
search will find it
01 02 Explores all possible states of a
problem to find a solution
Each rule is written in such a way that each has left hand side which
shows the condition to be matched and the right-hand side which
describes the operation to be performed if the condition matches
02 Control Strategy
It provides the way and the order in which rules will be compared to the
Knowledge database and it also describes the way of resolving the conflicts
that may arise in case left-hand side of many rules match.
11
Production System
03 Rule Applier
Once the left side of the rule gets match at a particular state and the
control strategy resolves the conflicts if there are, the rule is fired using
rule applier.
04 Knowledge Database
This is a collection of facts and information that the production system can
use to make decisions.
12 Example
Let us consider that the Initial state of a problem to be BADCCB and Goal State is
ABBCCD.
The set of rules are as follows (notice they are written as Left-Hand side (IF) and
Right Hand Side (Then Condition).
1) BA AB
2) DC CD
3) CB BC
4) DB BD
13 Working of Prodution Rules
14 Water Jug Problem
You are given two jugs, a 4-gallon one and a 3-gallon one, a pump which has
unlimited water which you can use to fill the jug, and the ground on which
water may be poured. Neither jug has any measuring markings on it. How can
you get exactly 2 gallons of water in the 4-gallon jug?
Here the initial state is (0, 0). The goal state is (2, n) for any value of n.
15 Water Jug Problem
States
Initial State 01 02 Transition Model
Goal State
Standardised Problem
Grid Problem
Vacuum Cleaner System
8-Puzzle
Real World Problem
Route Finding
Touring Problem
Robot Navigation
VLSI Design
States (Set of states and actions between states) and Search Tree (Path
between states to reach goal)
20 Uninformed Search
Used to find the solutions to the problem which does not have any
domain knowledge associated with it.
02 Heuristic Function
Example
38
Example
39
A* Search Algorithm
It combines the strength of both a greedy search and a uniform cost
search.
The heuristic of A* search is calculated as the summation of heuristic cost
in greedy search and uniform cost search.
f(x) = h(x) + g(x)
h(x) is the forward cost of a node from current state to goal state.
g(x) is the backward cost of a node from the initial state.
f(x) is fitness number
The node with smallest f(x) is selected.
The time and space complexity of A* search algorithm is O(b^d)
Example
40
Example
41
Example
42
Example - Cost Effective
43
Example - Cost Effective
44
Example - Cost Effective
45
46
Example
Example - Cost Effective
47
48
AO* Search Algorithm
AO* algorithm is a best first search algorithm.
Uses the concept of AND-OR graphs to decompose any complex problem
given into smaller set of problems which are further solved.
AND side of the graph represent a set of task that need to be done to
achieve the main goal , whereas the OR side of the graph represent the
different ways of performing task to achieve the same main goal.
f(n) = g(n) + h(n)
Example
49
Example
50
Example
51
52
Hill Climbing Algorithm
Continuously moves in the direction of increasing elevation/value to find
the peak of the mountain or best solution to the problem.
It terminates when it reaches a peak value where no neighbor has a higher
value.
This technique is used for optimizing the mathematical problems
A node of hill climbing algorithm has two components which are state and
value.
Local search, Greedy approach and No backtracking are features of it
Best when insufficient allotted time and the problem may or may not have
absolute results
53
Hill Climbing Algorithm
Graph between various
states of algorithm and
Objective function/Cost.
Y-axis=objective
function or cost function
X-axis = state-space
54 Types of Hill Climbing Algorithm
A plateau is the flat area of the search space in which all the neighbor
states of the current state contains the same value, because of this
algorithm does not find any best direction to move.
The solution for the plateau is to take big steps or very little steps
while searching, to solve the problem
57 Problems in Hill Climbing