Artificial Intelligence
Problem Formulation &
Solving Problems by Searching
ENG P KADEBU
Task environments
2
To design a rational agent we need to specify a task
environment
a problem specification for which the agent is a solution
PEAS: to specify a task environment
Performance measure
Environment
Actuators
Sensors
PEAS: Specifying an automated taxi driver
3
Performance measure:
safe, fast, legal, comfortable, maximize profits
Environment:
roads, other traffic, pedestrians, customers
Actuators:
steering, accelerator, brake, signal, horn
Sensors:
cameras, sonar, speedometer, GPS
PEAS: Medical diagnosis system
4
Performance measure:
Healthy patient, minimize costs, lawsuits
Environment:
Patient, hospital, staff
Actuators:
Screen display (form including: questions, tests, diagnoses,
treatments, referrals)
Sensors:
Keyboard (entry of symptoms, findings, patient's answers)
Environment Restrictions for Now
5
Static
Fully Observable
Deterministic
Discrete
The rational agent designer’s goal
6
Goal of AI practitioner who designs rational agents:
given a PEAS task environment,
1.Construct agent function f that maximizes (the expected value
of) the performance measure,
2.Design an agent program that implements f on a particular
architecture
Problem Solving Agents
7
Problem solving agent
A kind of “goal based” agent
Finds sequences of actions that lead to desirable states (goal).
The algorithms are uninformed
No extra information about the problem other than the
definition
No extra information
No heuristics (rules)
Goal Based Agent
8
What the world Sensors Percepts
State is like now
Environment
How the world evolves
What my actions do
What it will be like
if I do action A
What action I
Goals Actuators Actions
should do now
Goal Based Agents
9
Assumes the problem environment is:
Static
The plan remains the same
Observable
Agent knows the initial state
Discrete
Agent can enumerate the choices
Deterministic
Agent can plan a sequence of actions such that each will lead to an
intermediate state
The agent carries out its plans with its eyes closed
Certain of what’s going on
Open loop system
Well Defined Problems and Solutions
10
A problem
Initial state
Actions and Successor Function
Goal test
Path cost
Problem formulation
11
Choosing a relevant set of states to consider, and a
feasible set of operators for moving from one state to
another.
Search is the process of considering various possible
sequences of operators applied to the initial state,
and finding out a sequence which culminates in a
goal state.
Four general steps in problem solving
12
Goal formulation
Deciding on goal states based on current situation and agent’s
performance measure
Problem formulation
how can we get to the goal, without getting bogged down in the detail
of the world.
What actions and states to consider given the goal
Search
Determine the possible sequence of actions that lead to the states of
known values and then choose the best sequence.
Search algorithms –input is a problem, output is a solution (action
sequence)
Execute–Given the solution, perform the actions.
State Space Search Notations
13
An initial state is the description of the starting
configuration of the agent
An action or an operator takes the agent from one state to
another state which is called a successor state.
A state can have a number of successor states.
A plan is a sequence of actions.
The cost of a plan is referred to as the path cost. The path
cost is a positive number, and a common path cost may be
the sum of the costs of the steps in the path.
[S,s,O,G]
Search Problem
14
We are now ready to formally describe a search
problem.
A search problem consists of the following:
• S: the full set of states
• s : the initial state
• A:S→S is a set of operators
• G is the set of final states.
Note that G ⊆S
State Space Search
15
Representation of search problems
16
A search problem is represented using a directed
graph.
The states are represented as nodes.
The allowed actions are represented as arcs.
Searching process
17
The generic searching process can be very simply
described in terms of the following steps:
Do until a solution is found or the state space is
exhausted.
1. Check the current state
2. Execute allowable actions to find the successor states.
3. Pick one of the new states.
4. Check if the new state is a solution state If it is not, the new
state becomes the current state and the process is repeated
Illustration
18
Goal State found
19
8-Puzzle problem
20
State Space
21
The state space representation for this problem is
summarized below:
States: A state is a description of each of the
eight tiles in each location that it can occupy.
Operators/Action: The blank moves left, right, up
or down
Goal Test: The current state matches a certain
state (e.g. one of the ones shown on previous
slide)
Path Cost: Each move of the blank costs 1
A portion of the 8-puzzle
22
Example: Water Jug Problem
23
Given a 4 gallon bucket and a 3 gallon bucket, how
can we measure exactly 2 gallons into one bucket?
There are no markings on the bucket
You must fill each bucket completely
Example: Water Jug Problem
24
Initial state:
The buckets are empty
Represented by the tuple ( 0 0 )
Goal state:
One of the buckets has two gallons of water in it
Represented by either ( x 2 ) or ( 2 y )
Path cost:
1 per unit step
Example: Water Pouring
25
Actions and Successor Function
Fill a bucket
(x y) -> (3 y)
(x y) -> (x 4)
Empty a bucket
(x y) -> (0 y)
(x y) -> (x 0)
Pour contents of one bucket into another
(x y) -> (0 x+y) or (x+y-4, 4)
(x y) -> (x+y 0) or (3, x+y-3)
Example: Water Pouring
26
(0,0)
(4,0) (0,3)
(1,3) (4,3) (3,0)
(1,0) (0,1)
(3,3) (4,2)
(4,1)
(2,3)
(2,0) (0,2)
Example: Romania
27
On holiday in Romania; currently in Arad.
Flight leaves tomorrow from Bucharest
Formulate goal:–be in Bucharest
Formulate problem:–states: various cities–
actions: drive between cities
Find solution:–sequence of cities, e.g., Arad,
Sibiu, Fagaras, Bucharest
Semester 2 , 2018
Example: Map Planning
28
Well-defined problems and solutions
29
Searching For Solutions
30
Initial State
e.g. “At Arad”
Successor Function
A set of action state pairs
S(Arad) = {(Arad->Zerind, Zerind), …}
Goal Test
e.g. x = “at Bucharest”
Path Cost
sum of the distances traveled
Problem Formulation
31
Searching For Solutions
32
Having formulated some problems…how do we solve
them?
Search through a state space
Use a search tree that is generated with an initial
state and successor functions that define the state
space
Searching For Solutions
33
A state is (a representation of) a physical configuration
A node is a data structure constituting part of a search tree
Includes parent, children, depth, path cost
States do not have children, depth, or path cost
The EXPAND function creates new nodes, filling in the
various fields and using the SUCCESSOR function of the
problem to create the corresponding states
Searching For Solutions
34
Implementation: Components of a node
35
State: the state in the state space to which the node
corresponds
Parent-node: the node in the search tree that generated
this node
Action: the action that was applied to the parent to
generate the node
Path-cost: the cost, traditionally denoted by g(n), of the
path from the initial state to the node, as indicated by the
parent pointers
Depth: the number of steps along the path from the initial
state
Semester 2 , 2018
Searching For Solutions
36
Thank You!!
37