FAI - Unit-2 - State Space Search & Heuristic Search Techniques
FAI - Unit-2 - State Space Search & Heuristic Search Techniques
The steps that are required to build a system to solve a particular problem are:
1. Problem Definition that must include precise specifications of what the initial situation will be, as well as
what final situations constitute acceptable solutions to the problem.
2. Problem Analysis, this can have immense impact on the appropriateness of various possible techniques for
solving the problem.
3. Isolate and Represent the task knowledge required to solve the problem.
4. Selection of the best technique(s) for solving the particular problem.
1. Initial Position of the chess board : The starting position can be described by an 8 X 8 array
square in which each element square (x, y) describes the board position of an appropriate
piece in the official chess opening position.
State Space Representation - Play Chess
2. The rules that define legal moves
The legal moves provide the way of getting from initial state of final state.
It can be described as a set of rules consisting of two parts: A left side that gives the current position and
the right side that describes the change to be made to the board position.
1. Initial State
We will represent a state of the problem as a tuple (x, y), where x represents the amount of water in the 4-
gallon jug and y represents the amount of water in the 3-gallon jug.
Note that 0 ≤ x ≤ 4, and 0 ≤ y ≤ 3.
Here the initial state is (0, 0). The goal state is (2, n) for any value of n.
State Space Representation – Water Jug
2. Production Rules
3 (x, y) If x>0 (x-d, y) pour some water out of the 4- gallon jug
4 (x, y) If y>0 (x, y-d) pour some water out of the 3- gallon jug
7 (x, y) If x + y >= 4 & y>0 (4,y-(4-x)) pour water from the 3- gallon jug
into the 4-gallon jug until the 4-
gallon jug is full
8 (x, y) If x + y >= 3 & x>0 (x-(3-y),3)) pour water from the 4- gallon jug
into the 3-gallon jug until the 3-
gallon jug is full
9 (x, y) If x + y <= 4 & y>0 (x+y,0) pour all the water from the 3-
gallon jug into the 4-gallon jug
State Space Representation – Water Jug
2. Production Rules
10 (x, y) If x + y <= 3 & x>0 (0,x+y) pour all the water from the 4 -
gallon jug into the 3-gallon jug
0 0
0 3 2
3 0 9
3 3 2
4 2 7
0 2 5 or 12
2 0 9 or 11
State Space Representation – 8 Puzzle
Problem Definition: The 8 puzzle consists of eight numbered, movable tiles set in a 3x3 frame.
One cell of the frame is always empty thus making it possible to move an adjacent numbered
tile into the empty cell. Such a puzzle is illustrated in following diagram.
2 8 3 1 2 3
1 6 4 8 4
7 5 7 6 5
2 8 3 2 8 3
1 6 4 1 4
7 5 7 6 5
2 8 3 2 2 8 3 2 8 3
8 Puzzle - Game Tree
1 6 4 1 4 1 6 4
7 5 7 6 5 7 5
3 2 8 3 4 2 3 2 8 3
1 4 1 8 4 1 4
7 6 5 7 6 5 7 6 5
8 3 2 8 3 5 2 3 2 3
2 1 4 7 1 4 1 8 4 1 8 4
7 6 5 6 5 7 6 5 7 6 5
6 1 2 3
8 4
7 6 5
7 1 2 3 1 2 3
8 4 7 8 4
7 6 5 6 5
Problem Characteristics
1. Is the problem decomposable into a set of independent smaller or easier sub-problems?
2. Can solution steps be ignored or at least undone if they prove unwise?
3. Is the problem’s universe predictable?
4. Is a good solution to the problem obvious without comparison to all other possible solutions?
5. Is the desired solution a state of the world or a path to a state?
6. Is a large amount of knowledge absolutely required to solve the problem or is knowledge
important only to constrain the search?
7. Can a computer that is simply given the problem return the solution or will the solution of the
problem require interaction between the computer and a person?
Production System
Production systems provide appropriate structures for performing and describing search
processes.
A production system has four basic components:
1. A set of rules each consisting of a left side that determines the applicability of the rule and a right side that
describes the operation to be performed if the rule is applied.
2. A database of current facts established during the process of inference.
3. A control strategy that specifies the order in which the rules will be compared with facts in the database
and also specifies how to resolve conflicts in selection of several rules or selection of more facts.
4. A rule applier.
Production systems provide us with good ways of describing the operations that can be
performed in a search for a solution to a problem.
Production System Characteristics
1. A monotonic production system is a production system in which the application of a rule
never prevents the later application of another rule that could also have been applied at the
time the first rule was selected.
2. A non-monotonic production system is one in which this is not true. This production system
increases the problem-solving efficiency of the machine by not keeping a record of the
changes made in the previous search process.
3. A partially communicative production system is a production system with the property that if
the application of a particular sequence of rules transforms state P into state Q, then any
combination of those rules that is allowable also transforms state P into state Q.
4. A commutative production system is a production system that is both monotonic and partially
commutative. These type of production systems is used when the order of operation is not
important, and the changes are reversible.
Issues in the Design of Search Programs
1. The direction in which to conduct the search (forward versus backward reasoning). If the
search proceeds from start state towards a goal state, it is a forward search or we can also
search from the goal, i.e., backward search.
2. How to select applicable rules (Matching). Production systems typically spend most of their
time looking for rules to apply. So, it is critical to have efficient procedures for matching rules
against states.
3. How to represent each node of the search process (knowledge representation problem).