Agents

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 37

Problem solving

CHAPTER
Outline
2

Agents and environments


Rationality
PEAS (Performance measure, Environment,
Actuators, Sensors)
Environment types
Agent types

Artificial Intelligence a modern approach


Problem solving
3

• A problem is defined by its elements and their


relations.
• Problem formulation is the process of deciding what
actions and states to consider, given a goal

Artificial Intelligence a modern approach


Problem formulation
4

A problem can be defined formally by four


components:
1. Initial state
2. Successor function (Actions and Transition
model)
3. Goal test
4. Path cost

Artificial Intelligence a modern approach


5

Initial State The starting state which agent knows


itself.
 Successor Function
 A description of the possible actions available to
the agent.
 State x, successor – FN (x) returns a set of
< action, successor> ordered pairs, where each
action is a legal action in a state x and each successor
is a state that can be reached from x by applying that
action.
Artificial Intelligence a modern approach
State Space
6

The set of all possible states reachable from the


initial state by any sequence of actions.
The initial state and successor function
defines the state space.
The state space forms a graph in which nodes are
state and axis between the nodes are action.
Path A path in the state space is a sequence of state
connected by a sequence of actions.

Artificial Intelligence a modern approach


• State Space

A State space is the set of all states reachable from the

initial state. Definitions of terms :


◊ A state space forms a graph (or map) in which the nodes

are states and the arcs between nodes are actions.

◊ In state space, a path is a sequence of states connected by


a sequence of actions.

◊ The solution of a problem is part of the map formed by the


state space.
Goal Test
8

Test to determine whether the given state is the goal


state.
If there is an explicit set of possible goal states, then
we can whether any one of the goal state is reached
or not.
Example : In chess, the goal is to reach a state called
―checkmateǁ where the opponent‘s king is under
attack and can‘t escape.

Artificial Intelligence a modern approach


Path cost
9

 A function that assigns a numeric cost to each path.


 The cost of a path can be described as the sum of the costs
of the individual actions along that path.
 Step cost of taking an action ‗a‘ to go from one state ‗x‘ to
state ‗y‘ is denoted by C(x,a,y)
 C-Cost , x,y- states , Action , Step costs are non-negative
 These 4 elements are gathered into a data structure
that is given as input to problem solving algorithm.
 A solution quality is measured by path cost function. An
optimal solution has lowest path cost among all
solutions.

Artificial Intelligence a modern approach


Problem types
10

 1. Single –state problem


 2. Multiple –state problem
 3. Contingency problem.
 Single –state problem
  observable (at least initial state)
  deterministic
  static
  discrete
 Multiple –state problem
  partially observable (initial state not observable)
  deterministic
 Static
  discrete Contingency problem  partially observable (initial state not
observable)  non-deterministic

Artificial Intelligence a modern approach


11

 Search is fundamental to the problem-solving process.


  Search is a general mechanism that can be used when
more direct method is not known.
  Search provides the framework into which more direct
methods for solving subparts of a problem can be
embedded.
 A very large number of AI problems are formulated as
search problems.

Artificial Intelligence a modern approach


Toy Problems
The vacuum world
12

 The vacuum world 1 2


 The world has only two
locations
 Each location may or may 3 4
not contain dirt
 The agent may be in one
location or the other 5 6
 8 possible world states
 Three possible actions:
Left, Right, Suck 7 8
 Goal: clean up all the dirt
Toy Problems
The vacuum world
13

 States: one of the 8 states given earlier


 Operators: move left, move right, suck
 Goal test: no dirt left in any square
 Path cost: each action costs one

R
S S
L
R R
SS
L L

R
L
8 puzzle problem
1. Examples of Problem
Definitions
8-puzzle problem
15

Artificial Intelligence a modern approach


Artificial Intelligence a modern approach 16
Artificial Intelligence a modern approach 17
Artificial Intelligence a modern approach 18
Problem Solving, Search

and Control Strategies
Exampl
e2:
Search strategies
21

Searching is a process to find the solution for


a given set of problems.
 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

Artificial Intelligence a modern approach


Search strategies
22

 Strategies are evaluated along the following dimensions:


 completeness: does it always find a solution if one exists?
 time complexity: number of nodes generated
 space complexity: maximum number of nodes in memory
 optimality: does it always find a least-cost solution?

 Time and space complexity are measured in terms


of
 b: maximum branching factor of the search tree
 d: depth of the least-cost solution
 m: maximum depth of the state space (may be ∞)

Artificial Intelligence a modern approach


Searching Strategies
24

Uninformed/Blind Informed

 The uninformed search  Informed search algorithms


does not contain any use domain knowledge.
domain knowledge such as  In an informed search,
closeness, the location of problem information is
the goal available which can guide
 It operates in a brute-force the search.
way as it only includes  Informed search strategies
information about how to can find a solution more
traverse the tree and how to efficiently than an
identify leaf and goal nodes uninformed search strategy
Artificial Intelligence a modern approach
Search Strategies
25

Uninformed/Blind Informed

 Uninformed search applies a  Informed search is also


way in which search tree is called a Heuristic search.
searched without any
information about the search  A heuristic is a way which
space like initial state operators might not always be
and test for the goal, so it is also guaranteed for best
called blind search. solutions but guaranteed
 It examines each node of the
to find a good solution in
tree until it achieves the goal
node. reasonable time.

Artificial Intelligence a modern approach


Searching Strategies
26

Uninformed/Blind Informed

 Breadth-first search  Greedy Search


 Uniform cost search
 A* Search
 Depth-first search
 Iterative deepening depth-first
search
 Bidirectional Search

Artificial Intelligence a modern approach


Uninformed/Blind Search
27

Breadth-First Search(BFS)
In breadth-first search, the tree or the graph is
traversed breadthwise, i.e. it starts from a node
called search key and then explores all the
neighbouring nodes of the search key at that depth-
first and then moves to the next level nodes. It is
implemented using the queue data structure that
works on the concept of first in first out (FIFO). It is
a complete algorithm as it returns a solution if a
solution exists

Artificial Intelligence a modern approach


28

The time complexity for breadth-first search is bd where


b (branching factor) is the average number of child
nodes for any given node and d is depth.
The disadvantage of this algorithm is that it requires a
lot of memory space because it has to store each level of
nodes for the next one. It may also check duplicate
nodes.
Example: If the search starts from root node A to
reach goal node G, then it will traverse A-B-C-D-G. It
traverses level wise, i.e. explores the shallowest node
first.
Artificial Intelligence a modern approach
29

Advantages:
BFS will provide a solution if any solution exists.
If there are more than one solutions for a given
problem, then BFS will provide the minimal solution
which requires the least number of steps.
Disadvantages:
It requires lots of memory since each level of the tree
must be saved into memory to expand the next level.
BFS needs lots of time if the solution is far away from
the root node.
Artificial Intelligence a modern approach
Artificial Intelligence a modern approach 30
Artificial Intelligence a modern approach 31
Properties of breadth-first search
Complete? Yes (if b is finite)

Time? 1+b+b2+b3+… +bd + b(bd-1) = O(bd+1)

Space? O(bd+1) (keeps every node in memory)

Optimal? Yes (if cost = 1 per step)

Space is the bigger problem (more than


time)
Artificial Intelligence a modern approach 33
Artificial Intelligence a modern approach 34
Artificial Intelligence a modern approach 35
Artificial Intelligence a modern approach 36
Artificial Intelligence a modern approach 37

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy