problem solving agentscse.iitrpr.ac.in/ckn/courses/s2014/us.pdfΒ Β· might be faster than bfs, when...
TRANSCRIPT
Problem Solving AgentsCSL 302 ARTIFICIAL INTELLIGENCE
SPRING 2014
Goal Based Agents
1/21/2014 CSL 302 ARTIFICIAL INTELLIGENCE, INDIAN INSTITUTE OF TECHNOLOGY ROPAR 2
Representation Mechanisms (propositional/first order/probabilistic logic)
Search (blind and informed)PlanningInference
Learning Models
Example
1/21/2014 CSL 302 ARTIFICIAL INTELLIGENCE, INDIAN INSTITUTE OF TECHNOLOGY ROPAR 3
Problem Solving AgentsGoal FormulationoOrganize behavior of the agent
oGoal β set of states in the world where the goal is satisfied
1/21/2014 CSL 302 ARTIFICIAL INTELLIGENCE, INDIAN INSTITUTE OF TECHNOLOGY ROPAR 4
Example
1/21/2014 CSL 302 ARTIFICIAL INTELLIGENCE, INDIAN INSTITUTE OF TECHNOLOGY ROPAR 5
Goal
Initial
Problem Solving AgentsGoal FormulationoOrganize behavior of the agent
oGoal β set of states in the world where the goal is satisfied
Problem FormulationoWhat are the actions?
oWhat are the states?
1/21/2014 CSL 302 ARTIFICIAL INTELLIGENCE, INDIAN INSTITUTE OF TECHNOLOGY ROPAR 6
Assumptions about the Task EnvironmentObservable or partially observable?
Discrete or Continuous?
Deterministic or Stochastic?
Static or Dynamic?
Episodic or Sequential?
Multiple or Single Agent?
1/21/2014 CSL 302 ARTIFICIAL INTELLIGENCE, INDIAN INSTITUTE OF TECHNOLOGY ROPAR 7
Assumptions about the Task EnvironmentObservable or partially observable?
Discrete or Continuous?
Deterministic or Stochastic?
Static or Dynamic?
Episodic or Sequential?
Multiple or Single Agent?
1/21/2014 CSL 302 ARTIFICIAL INTELLIGENCE, INDIAN INSTITUTE OF TECHNOLOGY ROPAR 8
Assumptions about the Task EnvironmentObservable or partially observable?
Discrete or Continuous?
Deterministic or Stochastic?
Static or Dynamic?
Episodic or Sequential?
Multiple or Single Agent?
1/21/2014 CSL 302 ARTIFICIAL INTELLIGENCE, INDIAN INSTITUTE OF TECHNOLOGY ROPAR 9
Finding a sequence of actions β Search!
Problem Solving AgentsGoal FormulationoOrganize behavior of the agent
oGoal β set of states in the world where the goal is satisfied
Problem FormulationoWhat are the actions?
oWhat are the states?
SearchoFinding the sequence of actions
1/21/2014 CSL 302 ARTIFICIAL INTELLIGENCE, INDIAN INSTITUTE OF TECHNOLOGY ROPAR 10
Example
1/21/2014 CSL 302 ARTIFICIAL INTELLIGENCE, INDIAN INSTITUTE OF TECHNOLOGY ROPAR 11
Goal
States
Operator/Action
Initial
What is the solution?
Problem TypesDeterministic and Fully Observable: Single state problemoSolution is sequence
Non-observable: Conformant problemoSolution (if any) is a sequence
Stochastic and/or Partially Observable: Contingency problemoSolution is a contingency plan or a policy
Unknown state space: Exploration problem
1/21/2014 CSL 302 ARTIFICIAL INTELLIGENCE, INDIAN INSTITUTE OF TECHNOLOGY ROPAR 12
Problem Solving β Atomic Agents
1/21/2014 CSL 302 ARTIFICIAL INTELLIGENCE, INDIAN INSTITUTE OF TECHNOLOGY ROPAR 13
Atomic AgentsoStates are indivisible
oSearching through the states to reach the goal.
Single State Problem Formulation
Problem can be defined by 5 components1. Initial State: the state the agent starts
2. Actions: the set of operators that can be executed at a state
3. Transition model: returns the state that results from doing an action in a state
4. Goal test: determines whether a given state is a goal state
5. Path Cost: function that assigns a numeric cost to a path
Step cost: cost of taking a single action
1/21/2014 CSL 302 ARTIFICIAL INTELLIGENCE, INDIAN INSTITUTE OF TECHNOLOGY ROPAR 14
β’ State Spaceβ’ Graphβ’ Path
Example
1/21/2014 CSL 302 ARTIFICIAL INTELLIGENCE, INDIAN INSTITUTE OF TECHNOLOGY ROPAR 15
Initial State: AradActions: Drive(Sibiu),Drive(Timisora)Goal Test: In(Bucharest)Path Cost: ?
Example: Toy Vacuum Problem
1/21/2014 CSL 302 ARTIFICIAL INTELLIGENCE, INDIAN INSTITUTE OF TECHNOLOGY ROPAR 16
State: Robot and Dirt Locations
Initial State: Any State
Actions: Left, Right Suck
Goal Test: No Dirt
Path Cost: cost 1 per action?
Example: Eight Puzzle Problem
1/21/2014 CSL 302 ARTIFICIAL INTELLIGENCE, INDIAN INSTITUTE OF TECHNOLOGY ROPAR 17
State: Tile Locations
Initial State: A specific tile configuration
Actions: move the blank tile left, right, up or down
Goal Test: tiles are in the required configuration
Path Cost: cost 1 per move?
Note: Optimal solution for an n-puzzle family is NP hard.
Example: 8 Queens Problem
1/21/2014 CSL 302 ARTIFICIAL INTELLIGENCE, INDIAN INSTITUTE OF TECHNOLOGY ROPAR 18
State: Configuration of the Queens
Initial State: Empty board
Actions: Add a queen to the board
Goal Test: configuration with 8 queens on the board with none attacking another
Path Cost: time taken to solve?
Example: Missionaries and Cannibals
1/21/2014 CSL 302 ARTIFICIAL INTELLIGENCE, INDIAN INSTITUTE OF TECHNOLOGY ROPAR 19
State: number of missionaries and cannibals on the boat and each bank
Initial State: all objects one bank
Actions: move boat with x missionaries and y cannibals, no more cannibals than missionaries on the boat or the shore, a boat with a maximum capacity.
Goal Test: All objects on the opposite bank
Path Cost: 1 per river crossing
Example: Rubikβs Cube
1/21/2014 CSL 302 ARTIFICIAL INTELLIGENCE, INDIAN INSTITUTE OF TECHNOLOGY ROPAR 20
State: List of colors on each face
Initial State: A specific color pattern
Actions: rotate a row or column or a face
Goal Test: configuration has the same color on all tiles on every face
Path Cost: cost 1 per move?
Example: Rubikβs Cube
1/21/2014 CSL 302 ARTIFICIAL INTELLIGENCE, INDIAN INSTITUTE OF TECHNOLOGY ROPAR 21
Example: Real WorldTravelling Salesman Problem (TSP)
Robot Navigation
Protein folding
Graph Coloring
1/21/2014 CSL 302 ARTIFICIAL INTELLIGENCE, INDIAN INSTITUTE OF TECHNOLOGY ROPAR 22
Uninformed Search21/1
1/21/2014 CSL 302 ARTIFICIAL INTELLIGENCE, INDIAN INSTITUTE OF TECHNOLOGY ROPAR 23
Search - TreesBasic Principle:oOffline simulated exploration of search space
oGenerate successors of already explored states
1/21/2014 CSL 302 ARTIFICIAL INTELLIGENCE, INDIAN INSTITUTE OF TECHNOLOGY ROPAR 24
Search Space as a Tree
1/21/2014 CSL 302 ARTIFICIAL INTELLIGENCE, INDIAN INSTITUTE OF TECHNOLOGY ROPAR 25
Parent Root
Node
Children Children
Node
Initial StateActions
Solution
Goal State
State
Example
1/21/2014 CSL 302 ARTIFICIAL INTELLIGENCE, INDIAN INSTITUTE OF TECHNOLOGY ROPAR 26
Search Strategies Strategies vary in the order in which nodes are picked for expansion
Evaluating search strategiesoCompleteness β Does it always find a solution if one exists?oOptimality β Does it always find a least cost solution?oSpace complexity β How much memory is needed to perform
search?oTime complexity β How long does it take to find a solution?
Time and Space complexities are measuredob β maximum branching factor of the search treeod β shallowest depth of the least cost solutionom- maximum depth of the search space
1/21/2014 CSL 302 ARTIFICIAL INTELLIGENCE, INDIAN INSTITUTE OF TECHNOLOGY ROPAR 27
Uninformed search strategiesUse only the information available in the problem definition
Breadth-first search
Uniform-cost search
Depth-first search
Depth-limited search
Iterative deepening search
1/21/2014 CSL 302 ARTIFICIAL INTELLIGENCE, INDIAN INSTITUTE OF TECHNOLOGY ROPAR 28
Breadth-first search (BFS)Expand shallowest unexpanded node
Implementation: FIFO Queue; successors at the end of the queue
1/21/2014 CSL 302 ARTIFICIAL INTELLIGENCE, INDIAN INSTITUTE OF TECHNOLOGY ROPAR 29
BFS β AnalysisCompleteness: Yes (if b is finite)
Optimality: Not optimal; Yes- Uniform cost edges
Time Complexity: exponential in d1 + π + π2 + π3 +β―+ ππ + π ππ β 1 = π(ππ+1)
Space Complexity: π(ππ+1)
1/21/2014 CSL 302 ARTIFICIAL INTELLIGENCE, INDIAN INSTITUTE OF TECHNOLOGY ROPAR 30
π = 10 106πππππ π ππ 103ππ¦π‘ππ ππππ
Uniform cost search (UCS)Expand least-cost (π(π))unexpanded node
Implementation: Priority queue β sort the nodes in the queue based on cost.
1/21/2014 CSL 302 ARTIFICIAL INTELLIGENCE, INDIAN INSTITUTE OF TECHNOLOGY ROPAR 31
UCS - AnalysisCompleteness: Yes; if step cost β₯ π
Optimality: Yes; nodes are expanded in increasing order of π(π)
Time Complexity: # of nodes with π β€ cost of optimal solution(πΆβ) - π(π πΆβ π )
Space Complexity: # of nodes with π β€ cost of optimal solution - π(π πΆβ π )
1/21/2014 CSL 302 ARTIFICIAL INTELLIGENCE, INDIAN INSTITUTE OF TECHNOLOGY ROPAR 32
Large subtrees with inexpensive steps may be explored before useful paths with costly steps
Depth-first search (DFS)Expand deepest unexpanded node
Implementation: LIFO queue; successors at the front of the queue
1/21/2014 CSL 302 ARTIFICIAL INTELLIGENCE, INDIAN INSTITUTE OF TECHNOLOGY ROPAR 33
DFS - AnalysisCompleteness: complete only in finite spaces; incomplete when there are loops and infinite spaces
Optimality: No
Time Complexity: π(ππ); terrible when π β« π;might be faster than BFS, when solutions are dense.
Space Complexity: 1 + π + π +β―+ (ππ‘βπππ£ππ)π =π(ππ); Linear space!!
1/21/2014 CSL 302 ARTIFICIAL INTELLIGENCE, INDIAN INSTITUTE OF TECHNOLOGY ROPAR 34
Depth # nodes MemoryBFS
Memory DFS
16 1016 10Eb 156Kb
Depth-limited search (DLS)Depth-first search with depth limit π
Implementation: nodes at depth π have no successors.
Only finite space to be explored.
Completeness: Yes/No???
Optimality: Yes/No???
1/21/2014 CSL 302 ARTIFICIAL INTELLIGENCE, INDIAN INSTITUTE OF TECHNOLOGY ROPAR 35
Iterative deepening search(IDS)
1/21/2014 CSL 302 ARTIFICIAL INTELLIGENCE, INDIAN INSTITUTE OF TECHNOLOGY ROPAR 36
ππππ‘β = 0
ππππ‘β = 1
ππππ‘β =2
ππππ‘β =3
ππππ‘β =4
IDS- AnalysisCompleteness: Yes!
Optimality: Yes for uniform cost edges; can be modified to explore uniform cost tree
Time Complexity: ππ + π β 1 π2 +β―+1 ππ = π(ππ)
Space Complexity: π(ππ)
1/21/2014 CSL 302 ARTIFICIAL INTELLIGENCE, INDIAN INSTITUTE OF TECHNOLOGY ROPAR 37
Asymptotic ratio of # nodes expanded by IDS vs DFS: (π + 1) π β 1 β 1for large values of π
Summary
1/21/2014 CSL 302 ARTIFICIAL INTELLIGENCE, INDIAN INSTITUTE OF TECHNOLOGY ROPAR 38
Graph SearchBFS-?
DFS-?
IDDFS-?
1/21/2014 CSL 302 ARTIFICIAL INTELLIGENCE, INDIAN INSTITUTE OF TECHNOLOGY ROPAR 39