0% found this document useful (0 votes)
58 views19 pages

Lec3-Problem Solving Agents

Uploaded by

ÀbdUŁ ßaŠiŤ
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)
58 views19 pages

Lec3-Problem Solving Agents

Uploaded by

ÀbdUŁ ßaŠiŤ
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/ 19

Artificial Intelligence

Problem Solving Agent


Introduction
 In which we see how an agent can find a sequence of actions that achieves its goals
when no single action will do.
 The method of solving problem through AI involves the process of defining the search
space, deciding on start and goal states and then finding the path from the start state to
goal state through search space.
Problem Solving
 A problem-solving refers to a state where we wish to reach to a definite goal from a
present state or condition.”
 According to computer science, a problem-solving is a part of artificial intelligence
which encompasses a number of techniques such as algorithms, heuristics to solve a
problem.

 Let’s use a map as an example, if you take fast look you can deduce that each node
represents a city, and the cost to travel from a city to another is denoted by the number
over the edge connecting the nodes of those 2 cities.
Informed and Uninformed Algorithm
 Informed algorithms, in which the agent can estimate how far it is from the goal, and
uninformed algorithms, where no such estimate is available.
Problem Solving Agents
 The reflex agents are known as the simplest agents as they directly map states into actions.
 However, this mapping could not be applicable in large and complex environments in which
storing the mapping and learning consume too much such as “Automated taxi driver”
environment.
 Such environments may be a better place for Goal-based agents to arise, because such agents
consider future actions and their expected outcome.
 Problem-solving agents in AI mostly used 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.
 What is Atomic Representation?
Problem Solving Agents
 When the correct action to take is not immediately obvious, an agent may need to to
plan ahead: to consider a sequence of actions that form a path to a goal state. Such
an agent is called a problem-solving agent, and the computational process it
undertakes is called search.
 Problem-solving agents use atomic representations, —that is, states of the world are
considered as wholes, with no internal structure visible to the problem-solving
algorithms.
 Agents that use factored or structured representations of states are called planning
agents.
 A factored representation is one in which the states are defined by set of features.
 A structured representation is one in which the states are expressed in form of
objects and relations between them.
Problem Solving Agents

To solve a problem an Agent pass by 2 phases of formulation:


Goal Formulation
Problem Formulation
Goal Formulation
 It is the first and simplest step in problem-solving having a goal want to reach.
 It organizes the steps/sequence required to formulate one goal out of multiple goals as well as
actions to achieve that goal.
 Goal formulation is based on the current situation and the agent’s performance measure.
Problem Solving Agent-Problem
Formulation
 Problem formation is the step in problem definition that is used to understand and decide
a course of action that needs to be considered to achieve a goal.
 A problem formulation is deciding what actions and states to consider.
 “in(CITYNAME)” where CITYNAME is the name of the current city we are In.
 Suppose agent is updated with map in its memory, will start to study the map and
consider a hypothetical journey through the map until it reaches E from A.
 Once Agent has found the sequence of cities it should pass by to reach its goal in
the following sequence.
 The process of finding such sequence is called search
 A search algorithm is like a black box which takes problem as input returns
a solution
 Once the solution is found the sequence of actions it recommends is carried out is
called the execution phase.
Problem Formulation
A problem can be defined formally by 5 components:
Initial State:It is state from which agents start solving the problem {e.g. in(A)}.
The first component that describes the problem is the initial state that the agent starts in. For example, if a taxi
agent needs to get to location(B) but the taxi is currently at location(A) then the initial state of the problem
would be location(A).
Action : is a description of the possible actions available to the agent. Given a state s, Actions(s) returns the set
of actions that can be executed in s. We say that each of these actions is applicable in s.
Successor function Or transition Model It is specified by a function Result(s , a) that returns the state that
results from doing action a in state s.
The initial state, actions and transition model together define the state space of a problem which is a set of all
states reachable from the initial state by any sequence of actions. The state space forms a graph in which the
nodes are states and the links between the nodes are actions.
Problem Formulation

Goal Test:
Able to decide whether the current state is a goal state {e.i: is the current state is in(E)?}.
Path cost:
 Function that assigns a numeric value to each path, each step we take in solving the problem should
be somehow weighted, so travel from A to E agent will pass by many cities, the cost to travel
between two consecutive cities should have some cost measure, {e.i: Traveling from ‘A’ to ‘B’ costs
20 km or it can be typed as c(A, 20, B)}.
 A solution to a problem is path from the initial state to a goal state, and solution quality is measured by
the path cost, and the optimal solution has the lowest path cost among all possible solutions.
Vacuum Cleaner Problem
Vacuum Cleaner Problem
 States: The state is determined by both the agent location and the dirt location. The
agent is in one of two locations, each of which might or might not contain dirt.
Therefore, there are 2 x 2² = 8 possible world states.
 A larger environment would have n x 2 to the power of n states.
 Initial State: Any state can be assigned as the initial state in this case.
 Action: In this environment there are three actions, Move Left , Move Right , Suck up
the dirt.
Vacuum Cleaner Problem
 Transition Model: All the actions have expected effects, except for when the agent is
in leftmost square and the action is Left, when the agent is in rightmost square and the
action is Right and the square is clean when the action is to Suck.
 Goal Test: Goal test 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.
8 Puzzle Problem
The 8-puzzle is a sliding puzzle that is played on a 3-by-3 grid with 8 square tiles labeled 1 through 8,
plus a blank square. The goal is to rearrange the tiles so that they are in row-major order, using as few
moves as possible. You are permitted to slide tiles either horizontally or vertically into the blank
square. The following diagram shows a sequence of moves from an initial board (left) to the goal
board (right).
8 Puzzle Problem
 Initial state:
 Our board can be in any state resulting from making it in any configuration.
 Actions : move blank Up, Down, Left, or Right
 State description:
 Successor function generates legal states resulting from applying the four
actions {move blank Up, Down, Left, or Right}.
 State description specifies the location of each of the eight titles and the
blank.
 Goal test:
 Checks whether the states matches the goal configured in the goal state.
 Path cost:
 Each step costs 1, so the path cost is the sum of steps in the path.
8 Puzzle Problem & Formulation
Practice Question

 Give a complete problem formulation for each of the following.


Choose a formulation that is precise enough to be implemented.
 Using only four colors, you have to color a planar map in such a way
that no two adjacent regions have the same color.
 You have three jugs, measuring 12 gallons, 8 gallons, and 3 gallons,
and a water faucet. You can fill the jugs up or empty them out from
one to another or onto the ground. You need to measure out exactly
one gallon.
Practice Question

 Using only four colors, you have to color a planar map in such a way
that no two adjacent regions have the same color.
 States: Any color on any region is a state.
Initial State: No regions colored. Any region can be the initial state
Actions: Color a region one of the four colors
Transition model: Returns the region with its color and any two adjacent
regions cannot be that color.
Goal test: All regions colored, no two adjacent regions have the same color
Path cost: N/A
Practice Question

 You have three jugs, measuring 12 gallons, 8 gallons, and 3 gallons,


and a water faucet. You can fill the jugs up or empty them out from
one to another or onto the ground. You need to measure out exactly
one gallon.
 States: Any combination of filled/non-filled jugs.
Initial State: Assume all jugs are empty.
Actions: Fill jug; empty jug; transfer water from one jug to another; pour water
onto ground
Transition model: The actions have their expected effects.
Goal test: Any jug with 1 gallon of water.
Path cost: N/A

You might also like