Introduction to Artificial Intelligence CS 438 Spring 2008

Download Report

Transcript Introduction to Artificial Intelligence CS 438 Spring 2008

Introduction to Artificial Intelligence
CS 438 Spring 2008
• Today
– AIMA, Ch. 3
– Problem Solving Agents
• State space search
– Programming Assignment
• Thursday
– AIMA, Ch. 3
– Uniformed Search
Can your IA make you money as
a gold farmer?
Goal-based Problem Solving
• To develop an IA there two major concerns
– KR
– Search Method
• Assume for right now that knowledge is
encoded in some form that it can be easily
retrieved and applied
Goal Formulation
• Goal
– A state of the environment that meets some desirable
property or properties
– Examples
•
•
•
•
Chess: checkmate (opponents king cannot avoid capture)
Path finding: being in a specific geographic location
Robot Vacuum: Clear floor
Goals may include factors that determine which solutions are
more desirable than others
– Speed, shortest path, safety
Goal Formulation
• Before you can decide what to do you must
determine what it is you are trying to do
– Take an “intentional stance” D. Dennett
– “Goals help organize the behavior by limiting
the objectives that the agent is trying to
achieve” p. 60
– Given all possible actions to take, some can be
rejected outright because they are not relevant
of the agent reaching its goals.
State-space Search
• Search
– The activity of looking for a sequence of
actions that solves (achieves) the goal (goal
state)
• State-space
– Defined by the initial state, the actions the
agent can take to go from one state to the
other, and goal state
State-space search
• Path
– Any sequence of action that leads from one state to
another
• Solution
– A path starting at the initial state and leading to the
goal state
• Path cost
– Sum of the cost of each action
– g(n) cost of path from initial state to state n
– Note that path cost differs from “search cost”, which
refers to the computational complexity of the search
algorithm
Problem Formation
• Initial State
– State the agent starts in
• Actions available to the agent
– Defines actions that allow IA to transform one state
into another
– Successor function: S(x) given state x returns set of
new states given each applicable action (action-state
pairs)
• Goal test
– Determines if a state meets the specific properties of
the goal
• Path cost
– Function assigns a cost to a solution path
Example: Romania
Single-state problem formulation
1. initial state: "at Arad"
2. actions or successor function S(x) = set of
action–state pairs
– S(Arad) = {<Arad  Zerind, Zerind>, … }
–
3. goal test
– x = "at Bucharest"
–
4. path cost (additive)
– sum of distances, number of actions executed, etc.
–
Example: The 8-puzzle
•
•
•
•
states?
actions?
goal test?
path cost?
Example: The 8-puzzle
•
•
•
•
states? locations of tiles
actions? move blank left, right, up, down
goal test? = goal state (given)
path cost? 1 per move
Example: robotic assembly
• states?: real-valued coordinates of robot joint
angles parts of the object to be assembled
• actions?: continuous motions of robot joints
• goal test?: complete assembly
• path cost?: time to execute
Example: Water Jug Problem
• Goal formulation: measure
precisely 2 gallons of water
• Problem formulation
– Two jugs
• 4 gallon jug with x amount of water
• 3 gallon jug with y amount of water
– Initial state
• (0,0) : both jugs empty
– Goal
• (2, y) or (x, 2)
– Path cost: 1 unit for each pouring
action
Water Jug
Problem
• Actions:
Search
• Expanding a state
– Generating new states by applying possible (valid)
actions to current state using the successor function
S(x)
• Search Tree
– Root is the initial state
– Each expanded state is a search node
• Search Node
– Encodes the state, parent node, action applied,
depth, and path cost
Example: Water Jug Problem