0% found this document useful (0 votes)
11 views41 pages

CH 2

The document outlines the process of problem-solving, emphasizing the importance of defining problems, analyzing them, and selecting appropriate techniques. It discusses various problem types, including state space search, production systems, and heuristic search, while highlighting the advantages and challenges of different search strategies. Additionally, it categorizes problems based on characteristics such as predictability, recoverability, and the necessity for interaction.

Uploaded by

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

CH 2

The document outlines the process of problem-solving, emphasizing the importance of defining problems, analyzing them, and selecting appropriate techniques. It discusses various problem types, including state space search, production systems, and heuristic search, while highlighting the advantages and challenges of different search strategies. Additionally, it categorizes problems based on characteristics such as predictability, recoverability, and the necessity for interaction.

Uploaded by

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

Problems, Problem Spaces, and

Search
To Solve a problem….

1. Define the problem precisely.


2. Analyze the problem.
3. Isolate and represent the task knowledge
that is necessary to solve the problem.
4. Choose the best problem-solving technique
and apply it to the particular problem.
Defining the problem as State Space
Search
• Consider the problem “Play Chess”.
• For solving the problem, specify:
- The starting position of the chess board.
- Rules that define legal moves.
- Board position that represents a win for
either side.
• Goal: Any board position in which the opponent
does not have a legal move and king is under
attack.
A Legal Move
Legal Move…
• Provides a way of
getting from initial state
to final state.
• Consists of two parts:
left side contains a
pattern to be matched
against current board
position and right hand
side the changes to
board position to reflect
the move.
Problem of “Play Chess” is thus defined
as….

• Moving around in state space.


• Each state consists of a legal position of the
board.
• Consists of an initial state, a set of rules for
moving from one state to other and ending
up in one of the final states.
Water Jug Problem
• Given two jugs of 4 gallon and 3 gallons
without measuring markers.
• Pump to fill the jugs with water.
• How can you get exactly 2 gallons of water
into the 4 gallon jug?
• State space defined as set of ordered pairs (x,
y), where x=0,1,2,3 or 4 and y=0,1,2 or 3, x
represents the number of gallons of water in
the 4 gallon jug and y represents the number
of gallons of water in the 3 gallon jug.
• Start state is (0,0).
• Goal state is (2,n).
In order to provide a formal description of
the problem:
1. Define a state space that contains all the
possible configurations of the relevant
objects.
2. Specify the initial state.
3. Specify the goal states.
4. Specify a set of rules that describe the actions
(operators) available.
Production Systems
• Are structures in AI programs for facilitating
description and performing search process.
• A production system consists of
- A set of rules.
- One or more knowledge bases containing
information appropriate to a particular task.
- A control strategy specifying the order in
which rules are chosen.
- A rule applier.
Control Strategies

1. The first requirement of a good control is that


it causes motion.
Ex: Starting each time at the top of the list of
rules and choosing the first applicable one.
2. The second requirement of a good control
strategy is that it be systematic.
Ex: On each cycle, choose at random from
among the applicable rules.
Advantages of DFS

1. DFS requires less memory since only the


nodes on the current path are stored.
2. By chance or otherwise DFS may find a
solution without examining much of the
search space at all.
Advantages of BFS

1. BFS will not get trapped in a blind alley in


contrast to DFS.
2. If there is a solution BFS is guaranteed to find
it. Further if there are multiple solutions BFS
is guaranteed to find the optimal of them.
The Travelling Salesperson Problem
• A salesman has a list of cities which he must
visit exactly once.
• There are direct routes between each pair of
cities.
• Find the route that should be followed so that
the distance covered should be minimal.
• The number of possible paths are explored
between N cities is (N-1)!.
• This is called combinatorial explosion.
Heuristic Search
• Used for solving difficult problems.
• Compromise mobility and systematicity.
• Does not always find the best answer but
always finds a very good answer.
• Example: Nearest Neighbor Heuristic for
solving TSP.
• Time complexity: order of N2.
• Heuristics improves upon the solution to the
problem by removing combinatorial
explosion.
• Other advantages are:
- Rarely do we need optimal solution. A good
approximation usually serves very well.
Ex: Parking space.
- Heuristics may not produce best results in
worst cases but worst cases hardly arise in
real world.
-Leads to better understanding of the
problem.
Heuristic Function
• Is a function that maps from problem state
description to measures of desirability, usually
represented as real numbers.
• Plays an important role in guiding the search
process towards a solution.
• Example: For a TSP the sum of distances so
far.
Problem Characteristics

• Heuristic Search –a very general method


applicable to large class of problems.
• Consists of a wide variety of techniques which
are applicable based on problem domain.
• For this problems are to be analyzed along key
dimensions.
Is the Problem decomposable?
Blocks World
Can Solution Steps be ignored or Undone?

• Suppose we are trying to prove a mathematical


theorem. Every time we make a mistake we can
ignore and correct it.
• Suppose we are trying to solve the 8-puzzle problem.
If we make a mistake we can backtrack and solve it.
• Now consider the game of chess. If a bad move is
made it cannot be undone or backtracked.
• There are thus three class of problems:
- Ignorable, in which solution steps can be
ignored. It can be solved by a simple control
structure that never backtracks.
- Recoverable, in which solution steps can be
undone. Backtracking is necessary to recover
from errors.
- Irrecoverable, in which solution steps
cannot be undone. These system take a lot of
time for the planning process.
Is the Universe Predictable?
• For a 8-puzzle game it is possible to plan an
entire sequence of moves (certain outcome
problems).
• For a game of chess it is not possible with
certainty to plan the sequence of moves since
moves of other players are not known in
advance (uncertain outcome problems).
• Helping a lawyer decide how to protect his
client against murder charge is an example of
irrecoverable uncertain outcome problems.
Is a good solution absolute or relative?
• Consider the
simple facts
shown on the
right.
• Question is
asked “Is
Marcus alive?”
• Several ways of
deciding that
Marcus is dead.
Two ways are…
• But in case of TSP the shortest route is the
only solution to the problem.
• Thus reasoning problem is an example of any
path problem whereas TSP is an example of
best path problem.
What is the role of knowledge?

• For playing chess a limited amount of


knowledge is required for determining the
legal moves and implementing simple control
mechanisms.
• But for determining which newspapers
support which candidates in the elections a
lot of knowledge is required even for
recognizing the solution.
Does the task require interaction with a
person?
• Consider the problem of proving mathematical
theorems. If
1. All we want to know that there is a proof.
2. The program is capable of finding a proof by
itself.
then it does not matter what strategy the program
takes to find the proof.
• Alternatively finding the proof may be sufficiently
difficult so that the program does not know where
to start from.
There are thus two classes of problems:

• Solitary, in which the computer is given a


problem description and produces an answer
with no intermediate communication.
• Conversational, in which there is an
intermediate communication between a
person and a computer for providing
additional assistance.
Issues in the design of search program

• Direction of search: forward vs. backward


reasoning (Initial to goal state or vice versa).
• How to select appropriate matching rules
(Importance of search procedure).
• How to represent each node in the search
process (Knowledge representation problem
and the frame problem).

You might also like