cs347 – introduction to artificial intelligence dr. daniel tauritz (dr. t) department of computer...
TRANSCRIPT
![Page 1: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/1.jpg)
CS347 – Introduction toArtificial Intelligence
Dr. Daniel Tauritz (Dr. T)Department of Computer Science
[email protected]://web.mst.edu/~tauritzd/
CS347 course website: http://web.mst.edu/~tauritzd/courses/cs347/
![Page 2: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/2.jpg)
What is AI?
Systems that…–act like humans (Turing Test)–think like humans–think rationally–act rationally
Play Ultimatum Game
![Page 3: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/3.jpg)
How difficult is it to achieve AI?
• Three Sisters Puzzle
![Page 4: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/4.jpg)
Rational Agents
• Environment• Sensors (percepts)• Actuators (actions)• Agent Function• Agent Program• Performance Measures
![Page 5: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/5.jpg)
Rational Behavior
Depends on:
• Agent’s performance measure
• Agent’s prior knowledge
• Possible percepts and actions
• Agent’s percept sequence
![Page 6: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/6.jpg)
Rational Agent Definition
“For each possible percept sequence, a rational agent selects an action that is expected to maximize its performance measure, given the evidence provided by the percept sequence and any prior knowledge the agent has.”
![Page 7: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/7.jpg)
PEAS description & properties:–Fully/Partially Observable–Deterministic, Stochastic, Strategic–Episodic, Sequential–Static, Dynamic, Semi-dynamic–Discrete, Continuous–Single agent, Multiagent–Competitive, Cooperative–Known, Unknown
![Page 8: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/8.jpg)
Problem-solving agents
A definition:
Problem-solving agents are goal based agents that decide what to do based on an action sequence leading to a goal state.
![Page 9: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/9.jpg)
Environment Assumptions
• Fully Observable
• Single Agent
• Discrete
• Sequential
• Known & Deterministic
![Page 10: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/10.jpg)
Open-loop problem-solving steps
• Problem-formulation (actions & states)
• Goal-formulation (states)
• Search (action sequences)
• Execute solution
![Page 11: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/11.jpg)
Well-defined problems• Initial state• Action set: ACTIONS(s)• Transition model: RESULT(s,a)• Goal test• Step cost: c(s,a,s’)• Path cost• Solution / optimal solution
![Page 12: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/12.jpg)
Example problems
• Vacuum world
• Tic-tac-toe
• 8-puzzle
• 8-queens problem
![Page 13: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/13.jpg)
Search trees• Root corresponds with initial state
• Vacuum state space vs. search tree
• Search algorithms iterate through goal testing and expanding a state until goal found
• Order of state expansion is critical!
![Page 14: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/14.jpg)
function TREE-SEARCH(problem) returns solution/failinitialize frontier using initial problem state
loop doif empty(frontier) then return fail
choose leaf node and remove it from frontier
if chosen node contains goal state then return corresponding solution
expand chosen node and add resulting nodes to frontier
![Page 15: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/15.jpg)
Redundant paths
• Loopy paths
• Repeated states
• Redundant paths
![Page 16: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/16.jpg)
function GRAPH-SEARCH(problem) returns solution/failinitialize frontier using initial problem state
initialize explored set to be empty
loop doif empty(frontier) then return fail
choose leaf node and remove it from frontier
if chosen node contains goal state then return corresponding solution
add chosen node to explored set
expand chosen node and add resulting nodes to frontier only if not yet in frontier or explored set
![Page 17: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/17.jpg)
Search node datastructure
• n.STATE
• n.PARENT-NODE
• n.ACTION
• n.PATH-COST
States are NOT search nodes!
![Page 18: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/18.jpg)
Frontier
• Frontier = Set of leaf nodes
• Implemented as a queue with ops:– EMPTY?(queue)– POP(queue)– INSERT(element,queue)
• Queue types: FIFO, LIFO (stack), and priority queue
![Page 19: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/19.jpg)
Problem-solving performance
• Completeness
• Optimality
• Time complexity
• Space complexity
![Page 20: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/20.jpg)
Complexity in AI• b – branching factor• d – depth of shallowest goal node• m – max path length in state space• Time complexity: # generated nodes• Space complexity: max # nodes stored• Search cost: time + space complexity• Total cost: search + path cost
![Page 21: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/21.jpg)
Tree Search• Breadth First Tree Search (BFTS)
• Uniform Cost Tree Search (UCTS)
• Depth-First Tree Search (DFTS)
• Depth-Limited Tree Search (DLTS)
• Iterative-Deepening Depth-First Tree Search (ID-DFTS)
![Page 22: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/22.jpg)
Example state space #1
![Page 23: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/23.jpg)
Breadth First Tree Search (BFTS)
• Frontier: FIFO queue
• Complete: if b and d are finite
• Optimal: if path-cost is non-decreasing function of depth
• Time complexity: O(b^d)
• Space complexity: O(b^d)
![Page 24: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/24.jpg)
Uniform Cost Search (UCS)
• g(n) = lowest path-cost from start node to node n
• Frontier: priority queue ordered by g(n)
![Page 25: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/25.jpg)
Depth First Tree Search (DFTS)
• Frontier: LIFO queue (a.k.a. stack)
• Complete: no
• Optimal: no
• Time complexity: O(bm)
• Space complexity: O(bm)
• Backtracking version of DFTS has a space complexity of: O(m)
![Page 26: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/26.jpg)
Depth-Limited Tree Search (DLTS)
• Frontier: LIFO queue (a.k.a. stack)
• Complete: not when l < d
• Optimal: no
• Time complexity: O(b^l)
• Space complexity: O(bl)
• Diameter: min # steps to get from any state to any other state
![Page 27: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/27.jpg)
Diameter example 1
![Page 28: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/28.jpg)
Diameter example 2
![Page 29: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/29.jpg)
Iterative-Deepening Depth-First Tree Search (ID-DFTS)
function ID-DFS(problem) returns solution/failfor depth = 0 to ∞ do
result ← DLS(problem,depth)
if result ≠ cutoff then return result
•Complete: Yes, if b is finite•Optimal: Yes, if path-cost is nondecreasing function of depth•Time complexity: O(b^d)•Space complexity: O(bd)
![Page 30: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/30.jpg)
Bidirectional Search
BiBFTS
•Complete: Yes, if b is finite
•Optimal: Not “out of the box”
•Time & Space complexity: O(bd/2)
![Page 31: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/31.jpg)
Example state space #2
![Page 32: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/32.jpg)
Best First Search (BeFS)• Select node to expand based on
evaluation function f(n)
• Typically node with lowest f(n) selected because f(n) correlated with path-cost
• Represent frontier with priority queue sorted in ascending order of f-values
![Page 33: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/33.jpg)
Path-cost functions
• g(n) = lowest path-cost from start node to node n
• h(n) = estimated non-negative path-cost of cheapest path from node n to a goal node [with h(goal)=0]
![Page 34: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/34.jpg)
Heuristics
• h(n) is a heuristic function
• Heuristics incorporate problem-specific knowledge
• Heuristics need to be relatively efficient to compute
![Page 35: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/35.jpg)
Important BeFS algorithms
• UCS: f(n) = g(n)
• GBeFS: f(n) = h(n)
• A*S: f(n) = g(n)+h(n)
![Page 36: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/36.jpg)
GBeFTS
• Incomplete (so also not optimal)
• Worst-case time and space complexity: O(bm)
• Actual complexity depends on accuracy of h(n)
![Page 37: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/37.jpg)
A*S
• f(n) = g(n) + h(n)
• f(n): estimated cost of optimal solution through node n
• if h(n) satisfies certain conditions, A*S is complete & optimal
![Page 38: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/38.jpg)
Example state space # 3
![Page 39: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/39.jpg)
Admissible heuristics• h(n) admissible if:
Example: straight line distance
A*TS optimal if h(n) admissible
![Page 40: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/40.jpg)
Consistent heuristics• h(n) consistent if:
Consistency implies admissibility
A*GS optimal if h(n) consistent
![Page 41: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/41.jpg)
![Page 42: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/42.jpg)
A* search notes
• Optimally efficient for consistent heuristics
• Run-time is a function of the heuristic error
• Suboptimal variants
• Not strictly admissible heuristics
• A* Graph Search not scalable due to memory requirements
![Page 43: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/43.jpg)
Memory-bounded heuristic search
• Iterative Deepening A* (IDA*)
• Recursive Best-First Search (RBFS)
• IDA* and RBFS don’t use all avail. memory
• Memory-bounded A* (MA*)
• Simplified MA* (SMA*)
• Meta-level learning aims to minimize total problem solving cost
![Page 44: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/44.jpg)
Heuristic Functions
• Effective branching factor
• Domination
• Composite heuristics
• Generating admissible heuristics from relaxed problems
![Page 45: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/45.jpg)
Sample relaxed problem
• n-puzzle legal actions:
Move from A to B if horizontally or vertically adjacent and B is blank
Relaxed problems:
(a)Move from A to B if adjacent
(b)Move from A to B if B is blank
(c)Move from A to B
![Page 46: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/46.jpg)
Generating admissible heuristics
The cost of an optimal solution to a relaxed problem is an admissible heuristic for the original problem.
![Page 47: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/47.jpg)
Adversarial SearchEnvironments characterized by:• Competitive multi-agent• Turn-taking
Simplest type: Discrete, deterministic, two-player, zero-sum games of perfect information
![Page 48: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/48.jpg)
Search problem formulation• S0: Initial state (initial board setup)
• Player(s): which player has the move• Actions(s): set of legal moves• Result(s,a): defines transitional model• Terminal test: game over!• Utility function: associates player-
dependent values with terminal states
![Page 49: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/49.jpg)
Minimax
![Page 50: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/50.jpg)
Example game tree 1
![Page 51: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/51.jpg)
Depth-Limited Minimax• State Evaluation Heuristic
estimates Minimax value of a node
• Note that the Minimax value of a node is always calculated for the Max player, even when the Min player is at move in that node!
![Page 52: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/52.jpg)
Heuristic Depth-Limited Minimax
![Page 53: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/53.jpg)
State Eval Heuristic Qualities
A good State Eval Heuristic should:
(1)order the terminal states in the same way as the utility function
(2)be relatively quick to compute
(3)strongly correlate nonterminal states with chance of winning
![Page 54: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/54.jpg)
Weighted Linear State Eval Heuristic
1( ) ( )
ni i
iEVAL s w f s
![Page 55: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/55.jpg)
Heuristic Iterative-Deepening Minimax
• IDM(s,d) calls DLM(s,1), DLM(s,2), …, DLM(s,d)
• Advantages:–Solution availability when time is
critical–Guiding information for deeper
searches
![Page 56: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/56.jpg)
Redundant info example
![Page 57: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/57.jpg)
Alpha-Beta Pruning• α: worst value that Max will accept at this
point of the search tree
• β: worst value that Min will accept at this point of the search tree
• Fail-low: encountered value <= α
• Fail-high: encountered value >= β
• Prune if fail-low for Min-player
• Prune if fail-high for Max-player
![Page 58: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/58.jpg)
DLM w/ Alpha-Beta Pruning Time Complexity
• Worst-case: O(bd)• Best-case: O(bd/2) [Knuth & Moore, 1975]
• Average-case: O(b3d/4)
![Page 59: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/59.jpg)
Example game tree 2
![Page 60: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/60.jpg)
![Page 61: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/61.jpg)
Move Ordering Heuristics• Knowledge based (e.g., try captures first in
chess)• Principal Variant (PV) based• Killer Move: the last move at a given depth
that caused αβ-pruning or had best minimax value
• History Table: track how often a particular move at any depth caused αβ-pruning or had best minimax value
![Page 62: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/62.jpg)
History Table (HT)
• Option 1: generate set of legal moves and use HT value as f-value
• Option 2: keep moves with HT values in a sorted array and for a given state traverse the array to find the legal move with the highest HT value
![Page 63: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/63.jpg)
Example game tree 3
![Page 64: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/64.jpg)
Search Depth Heuristics• Time based / State based
• Horizon Effect: the phenomenon of deciding on a non-optimal principal variant because an ultimately unavoidable damaging move seems to be avoided by blocking it till passed the search depth
• Singular Extensions / Quiescence Search
![Page 65: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/65.jpg)
Time Per Move
• Constant
• Percentage of remaining time
• State dependent
• Hybrid
![Page 66: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/66.jpg)
Quiescence Search• When search depth reached, compute
quiescence state evaluation heuristic
• If state quiescent, then proceed as usual; otherwise increase search depth if quiescence search depth not yet reached
• Call format: QSDLM(root,depth,QSdepth), QSABDLM(root,depth,QSdepth,α,β), etc.
![Page 67: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/67.jpg)
QS game tree Ex. 1
![Page 68: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/68.jpg)
QS game tree Ex. 2
![Page 69: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/69.jpg)
Transposition Tables (1)
• Hash table of previously calculated state evaluation heuristic values
• Speedup is particularly huge for iterative deepening search algorithms!
• Good for chess because often repeated states in same search
![Page 70: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/70.jpg)
Transposition Tables (2)• Datastructure: Hash table indexed by
position
• Element:
–State evaluation heuristic value
–Search depth of stored value
–Hash key of position (to eliminate collisions)
–(optional) Best move from position
![Page 71: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/71.jpg)
Transposition Tables (3)• Zobrist hash key
– Generate 3d-array of random 64-bit numbers (piece type, location and color)
– Start with a 64-bit hash key initialized to 0– Loop through current position, XOR’ing hash
key with Zobrist value of each piece found (note: once a key has been found, use an incremental approach that XOR’s the “from” location and the “to” location to move a piece)
![Page 72: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/72.jpg)
Search versus lookup
• Balancing time versus memory
• Opening table– Human expert knowledge– Monte Carlo analysis
• End game database
![Page 73: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/73.jpg)
Forward pruning
• Beam Search (n best moves)
• ProbCut (forward pruning version of alpha-beta pruning)
![Page 74: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/74.jpg)
Null Move Forward Pruning
• Before regular search, perform shallower depth search (typically two ply less) with the opponent at move; if beta exceeded, then prune without performing regular search
• Sacrifices optimality for great speed increase
![Page 75: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/75.jpg)
Futility Pruning• If the current side to move is not in check,
the current move about to be searched is not a capture and not a checking move, and the current positional score plus a certain margin (generally the score of a minor piece) would not improve alpha, then the current node is poor, and the last ply of searching can be aborted.
• Extended Futility Pruning
• Razoring
![Page 76: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/76.jpg)
![Page 77: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/77.jpg)
Adversarial Search in Stochastic Environments
Worst Case Time Complexity: O(bmnm) with b the average branching factor, m the deepest search depth, and n the average chance branching factor
![Page 78: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/78.jpg)
Example “chance” game tree
![Page 79: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/79.jpg)
Expectiminimax & Pruning
• Interval arithmetic
• Monte Carlo simulations (for dice called a rollout)
![Page 80: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/80.jpg)
State-Space Search
• Complete-state formulation
• Objective function
• Global optima
• Local optima (don’t use textbook’s definition!)
• Ridges, plateaus, and shoulders
• Random search and local search
![Page 81: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/81.jpg)
Steepest-Ascent Hill-Climbing
• Greedy Algorithm - makes locally optimal choices
Example
8 queens problem has 88≈17M states
SAHC finds global optimum for 14% of instances in on average 4 steps (3 steps when stuck)
SAHC w/ up to 100 consecutive sideways moves, finds global optimum for 94% of instances in on average 21 steps (64 steps when stuck)
![Page 82: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/82.jpg)
Stochastic Hill-Climbing
• Chooses at random from among uphill moves
• Probability of selection can vary with the steepness of the uphill move
• On average slower convergence, but also less chance of premature convergence
![Page 83: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/83.jpg)
More Local Search Algorithms
• First-choice hill-climbing• Random-restart hill-climbing• Simulated Annealing
![Page 84: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/84.jpg)
Population Based Local Search
• Deterministic local beam search• Stochastic local beam search• Evolutionary Algorithms• Particle Swarm Optimization• Ant Colony Optimization
![Page 85: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/85.jpg)
Particle Swarm Optimization• PSO is a stochastic population-based
optimization technique which assigns velocities to population members encoding trial solutions
• PSO update rules:
PSO demo: http://www.borgelt.net//psopt.html
![Page 86: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/86.jpg)
Ant Colony Optimization
• Population based
• Pheromone trail and stigmergetic communication
• Shortest path searching
• Stochastic moves
![Page 87: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/87.jpg)
Online Search
• Offline search vs. online search
• Interleaving computation & action
• Dynamic, nondeterministic, unknown domains
• Exploration problems, safely explorable
• Agents have access to:– ACTIONS(s)– c(s,a,s’) cannot be used until RESULT(s,a)– GOAL-TEST(s)
![Page 88: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/88.jpg)
Online Search Optimality
• CR – Competitive Ratio
• TAPC – Total Actual Path Cost
• C* - Optimal Path Cost
• Best case: CR = 1
• Worst case: CR = ∞
*
TAPCCR
C
![Page 89: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/89.jpg)
Online Search Algorithms
• Online-DFS-Agent
• Random Walk
• Learning Real-Time A* (LRTA*)
![Page 90: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/90.jpg)
Online Search Example Graph 1
![Page 91: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/91.jpg)
Online Search Example Graph 2
![Page 92: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/92.jpg)
Online Search Example Graph 3
![Page 93: CS347 – Introduction to Artificial Intelligence Dr. Daniel Tauritz (Dr. T) Department of Computer Science tauritzd@mst.edu tauritzd](https://reader035.vdocuments.site/reader035/viewer/2022062516/56649de95503460f94ae3b76/html5/thumbnails/93.jpg)
AI courses at S&T• CS345 Computational Robotic Manipulation (SP2012)• CS347 Introduction to Artificial Intelligence (SP2012)• CS348 Evolutionary Computing (FS2011)• CS434 Data Mining & Knowledge Discovery (FS2011)• CS447 Advanced Topics in AI (SP2013)• CS448 Advanced Evolutionary Computing (SP2012)• CpE358 Computational Intelligence (FS2011)• SysEng378 Intro to Neural Networks & Applications