0% found this document useful (0 votes)
8 views18 pages

Problem Solving in AI

The document discusses problem-solving approaches in Artificial Intelligence, focusing on search techniques used by rational agents to find optimal solutions to various problems. It outlines the steps involved in solving a problem, including defining, analyzing, identifying, choosing, and implementing solutions, as well as measuring the performance of algorithms. Additionally, it provides examples of typical AI problems such as the Water-Jug Problem and the N-Queen Problem, along with their respective state representations and solution strategies.

Uploaded by

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

Problem Solving in AI

The document discusses problem-solving approaches in Artificial Intelligence, focusing on search techniques used by rational agents to find optimal solutions to various problems. It outlines the steps involved in solving a problem, including defining, analyzing, identifying, choosing, and implementing solutions, as well as measuring the performance of algorithms. Additionally, it provides examples of typical AI problems such as the Water-Jug Problem and the N-Queen Problem, along with their respective state representations and solution strategies.

Uploaded by

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

PROBLEM SOLVING APPROACH TO

TYPICAL AI PROBLEMS
Problem-solving agents
In Artificial Intelligence, Search techniques are universal
problem-solving methods. Rational agents or Problem-
solving agents in AI mostly used these search strategies or
algorithms to solve a specific problem and provide the best
result. Problem- solving agents are the goal-based agents and
use atomic representation. In this topic, wewill learn various
problem-solving search algorithms.
• Some of the most popularly used problem solving with
the help of artificial intelligence are:
1. Chess.
2. Travelling Salesman Problem.
3. Tower of Hanoi Problem.
4. Water-Jug Problem.
5. N-Queen Problem. 1
PROBLEM SOLVING APPROACH TO
TYPICAL AI PROBLEMS
Problem Searching

• In general, searching refers to as finding information one


needs.

• Searching is the most commonly used technique of problem


solving in artificial intelligence.

• The searching algorithm helps us to search for solution of


particular problem.

• Problem: Problems are the issues which comes across any


system. A solution is needed to solve that particular problem.

2
PROBLEM SOLVING APPROACH TO
TYPICAL AI PROBLEMS
Steps : Solve Problem Using Artificial Intelligence
• The process of solving a problem consists of five steps.
These are:

Problem Solving in Artificial Intelligence 3


PROBLEM SOLVING APPROACH TO
TYPICAL AI PROBLEMS
Defining The Problem: The definition of the problem must be
included precisely. It should contain the possible initial as well
as final situations which should result in acceptable solution.
1. Analyzing The Problem: Analyzing the problem and its
requirement must be done as few features can have
immense impact on the resulting solution.
2. Identification of Solutions: This phase generates
reasonable amount of solutions to the given problem in a
particular range.
3. Choosing a Solution: From all the identified solutions, the
best solution is chosen basis on the results produced by
respective solutions.
4. Implementation: After choosing the best solution, its
implementation is done.
4
PROBLEM SOLVING APPROACH TO
TYPICAL AI PROBLEMS
Measuring problem-solving performance

We can evaluate an algorithm’s performance in four ways:

Completeness: Is the algorithm guaranteed to find a solution


when there is one?
Optimality: Does the strategy find the optimal solution?
Time complexity: How long does it take to find a solution?
Space complexity: How much memory is needed to perform
the search?

5
PROBLEM SOLVING APPROACH TO
TYPICAL AI PROBLEMS
Search Algorithm Terminologies
• Search: Searching is a step by step procedure to solve a
search-problem in a given search space. A search problem
can have three main factors:
1. Search Space: Search space represents a set of
possible solutions, which a system may have.
2. Start State: It is a state from where agent begins the
search.
3. Goal test: It is a function which observe the current state
and returns whether the goal state is achieved or not.
• Search tree: A tree representation of search problem is called
Search tree. The root of the search tree is the root node which
is corresponding to the initial state.
• Actions: It gives the description of all the available actions to
the agent. 6
Example Problems
• A Toy Problem is intended to illustrate or exercise various
problem-solving methods.
• A real- world problem is one whose solutions people actually
care about.
Toy Problems
• Vacuum World
• States: The state is determined by both the agent location
and the dirt locations. The agent is in one of the 2 locations,
each of which might or might not contain dirt. Thus there are
2*2^2=8 possible world states.
• Initial state: Any state can be designated as the initial state.
• Actions: In this simple environment, each state has just three
actions: Left, Right, and
• Suck. Larger environments might also include Up and Down. 7
Example Problems
• Transition model: The actions have their expected effects,
except that moving Left in the leftmost squ are, moving Right
in the rightmost square, and Sucking in a clean square have
no effect. The complete state space is shown in Figure.
• Goal test: This checks whether all the squares are clean.
• Path cost: Each step costs 1, so the path cost is the number
of steps in the path.

Vacuum World State Space Graph 8


1) 8- Puzzle Problem

8- Puzzle Problem

• States: A state description specifies the location of each of the


eight tiles and the blank in one of the nine squares.
• Initial state: Any state can be designated as the initial state.
Note that any given goal can be reached from exactly half of
the possible initial states.
• The simplest formulation defines the actions as movements of
the blank space Left, Right, Up, or Down. Different subsets of
these are possible depending on where the blank is.
9
1) 8- Puzzle Problem

• Transition model: Given a state and action, this returns the


resulting state; for example, if we apply Left to the start state
in Figure 3.4, the resulting state has the 5 and the blank
switched.
• Goal test: This checks whether the state matches the goal
configuration shown in Figure. Path cost: Each step costs 1,
so the path cost is the number of steps in the path.

10
Queens Problem

Queens Problem
• States: Any arrangement of 0 to 8 queens on the board is a
state.
• Initial state: No queens on the board.
• Actions: Add a queen to any empty square.
• Transition model: Returns the board with a queen added to
the specified square.
• Goal test: 8 queens are on the board, none attacked. 11
Problem
• Consider the given problem. Describe the operator
involved in it. Consider the water jug problem: You are
given two jugs, a 4-gallon one and 3-gallon one. Neither
has any measuring marker on it. There is a pump that can
be used to fill the jugs with water. How can you get
exactly 2 gallon of water from the 4-gallon jug ?
• Explicit Assumptions: A jug can be filled from the pump,
water can be poured out of a jug on to the ground, water
can be poured from one jug to another and that there are
no other measuring devices available.
• Here the initial state is (0, 0). The goal state is (2, n) for
any value of n.

12
• State Space Representation: 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.
• To solve this we have to make some assumptions not
mentioned in the problem. They are:
• We can fill a jug from the pump.
• We can pour water out of a jug to the ground.
• We can pour water from one jug to another.
• There is no measuring device available.

• Operators - we must define a set of operators that will take us


from one state to another.
13
Sr Current State Next State Descriptions
.
1 (x,y) if x < 4 (4,y) Fill the 4 gallon jug
2 (x,y) if x < 3 (x,3) Fill the 3 gallon jug
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
5 (x,y) if y > 0 (0, y) Empty the 4 gallon jug
6 (x,y) if y > 0 (x 0) Empty the 3 gallon jug on the ground
7 (x,y) if x + y > = 4 (4, y – (4 – x)) Pour water from the 3 gallon jug into the
and y > 0 4 gallon jug until the 4 gallon jug is full
8 (x,y) if x + y > = 3 (x – (3 – x), 3) Pour water from the 4 gallon jug into the
and x > 0 3 gallon jug until the 3 gallon jug is full
9 (x,y) if x + y < = 4 (x + y, 0) Pour all the water from the 3 gallon jug
and y > 0 into the 4 gallon jug
10 (x,y) if x + y < = 3 (0, x + y) Pour all the water from the 4 gallon jug
and x > 0 into the 3 gallon jug
11 (0, 2) (2, 0) Pour the 2 gallons from 3 gallon jug into
the 4 gallon jug
12 (2, y) (0, y) Empty the 2 gallons in the 4 gallon jug
on the ground
14
Solution

15
S.No Gallons in
S 4- Gallons in 3- Rule Applied
. gel jug(x) gel jug (y)
o
1. 0 0 Initial state
l
2.. 4 0 1. Fill 4
3 1 u 3 6. Poor 4 into 3 to fill
4. 1 t 0 4. Empty 3
5. 0 i 1 8. Poor all of 4 into
3
6. 4 o 1 1. Fill 4
7. 2 3 6. Poor 4 into 3
n
16
S
• 4-gallon one and a 3-gallon Jug
o

l
•No measuringumark on the jug.
•There is a pump to fill the jugs with water.
•How can you get
t exactly 2 gallon of water into the 4-
gallon jug?
i

n
17
END

18

You might also like