Professional Documents
Culture Documents
MateriMinggu03 1920 AI ProblemSolving
MateriMinggu03 1920 AI ProblemSolving
2 IF3170/NUMand[1]and[2]and[3]/02-Sep-2019
Review
What is AI → 4 approaches
Intelligent Agent
Task Environment: Remember PEAS
6 Environment Types
Problem Solving Agent
4 components to be defined: initial state,
operator/successor function, goal test, path cost
Solving by Searching:
Informed Search
Uninformed Search
Beyond Classical Search → TODAY
3 IF3170/NUMand[1]and[2]and[3]/02-Sep-2019
Local Search
4 IF3170/NUMand[1]and[2]and[3]/02-Sep-2019
Local search algorithms
In many optimization problems, the path to the goal is
irrelevant; the goal state itself is the solution
5 IF3170/NUMand[1]and[2]and[3]/02-Sep-2019
Hill-climbing search
"Like climbing Everest in thick fog with amnesia"
6 IF3170/NUMand[1]and[2]and[3]/02-Sep-2019
Hill-climbing search
Problem: depending on initial state, can get stuck in local
maxima
7 IF3170/NUMand[1]and[2]and[3]/02-Sep-2019
Hill-climbing search: 8-queens
problem
h = number of pairs of queens that are attacking each other, either directly or
indirectly (h = 17 for the above state)
8 IF3170/NUMand[1]and[2]and[3]/02-Sep-2019
Hill-climbing search: 8-queens
problem
9 IF3170/NUMand[1]and[2]and[3]/02-Sep-2019
Gradient Descent
1. Compute the gradient : C ( x 1 , ..., x n ) i
x i
5. Repeat.
10 IF3170/NUMand[1]and[2]and[3]/02-Sep-2019
Simulated Annealing Search
11 IF3170/NUMand[1]and[2]and[3]/02-Sep-2019
Simulated Annealing
12 IF3170/NUMand[1]and[2]and[3]/02-Sep-2019
So.... Simulated annealing search
Idea: escape local maxima by allowing some "bad"
moves but gradually decrease their frequency
13 IF3170/NUMand[1]and[2]and[3]/02-Sep-2019
Properties of simulated annealing
search
One can prove: If T decreases slowly enough, then
simulated annealing search will find a global optimum
with probability approaching 1
14 IF3170/NUMand[1]and[2]and[3]/02-Sep-2019
Genetic algorithms
A successor state is generated by combining two parent states
15 IF3170/NUMand[1]and[2]and[3]/02-Sep-2019
Genetic algorithms
24/(24+23+20+11) = 31%
17 IF3170/NUMand[1]and[2]and[3]/02-Sep-2019
Adversarial Search (Games)
18 IF3170/NUMand[1]and[2]and[3]/02-Sep-2019
Outline
Optimal decisions
α-β pruning
Imperfect, real-time decisions
19 IF3170/NUMand[1]and[2]and[3]/02-Sep-2019
Games vs. search problems
"Unpredictable" opponent → specifying a move for every
possible opponent reply
Time limits → unlikely to find goal, must approximate
Task: Find the most optimal move → using certain
searching algorithm, with time limit can choose a good
move
In a normal search problem, the optimal solution would
be a sequence of actions leading to a goal state—a
terminal state that is a win
In adversarial search, opponent has something to say
about it.
20 IF3170/NUMand[1]and[2]and[3]/02-Sep-2019
Game tree (2-player, deterministic,
turns)
• MAX’s job to search for a good move
• the term search tree for a tree that is superimposed on the full game tree:
• examines enough nodes to allow a player to determine what move to make
21 IF3170/NUMand[1]and[2]and[3]/02-Sep-2019
Minimax
Perfect play for deterministic games
Idea: choose move to position with highest minimax value
= best achievable payoff against best play
22 IF3170/NUMand[1]and[2]and[3]/02-Sep-2019
Minimax algorithm
23 IF3170/NUMand[1]and[2]and[3]/02-Sep-2019
Properties of minimax
Complete? Yes (if tree is finite)
Optimal? Yes (against an optimal opponent)
Time complexity? O(bm)
Space complexity? O(bm) (depth-first exploration)
24 IF3170/NUMand[1]and[2]and[3]/02-Sep-2019
α-β pruning example
25 IF3170/NUMand[1]and[2]and[3]/02-Sep-2019
α-β pruning example
26 IF3170/NUMand[1]and[2]and[3]/02-Sep-2019
α-β pruning example
27 IF3170/NUMand[1]and[2]and[3]/02-Sep-2019
α-β pruning example
28 IF3170/NUMand[1]and[2]and[3]/02-Sep-2019
α-β pruning example
29 IF3170/NUMand[1]and[2]and[3]/02-Sep-2019
Properties of α-β
Pruning does not affect final result
30 IF3170/NUMand[1]and[2]and[3]/02-Sep-2019
Why is it called α-β?
α is the value of the best
(i.e., highest-value)
choice found so far at
any choice point along
the path for max
If v is worse than α, max
will avoid it
→ prune that branch
31 IF3170/NUMand[1]and[2]and[3]/02-Sep-2019
The α-β algorithm
32 IF3170/NUMand[1]and[2]and[3]/02-Sep-2019
The α-β algorithm
33 IF3170/NUMand[1]and[2]and[3]/02-Sep-2019
Algorithm illustration with α-β value
34 IF3170/NUMand[1]and[2]and[3]/02-Sep-2019
Resource limits
Suppose we have 100 secs, explore 104 nodes/sec
→ 106 nodes per move
Standard approach:
cutoff test:
e.g., depth limit (perhaps add quiescence search: the main
motive of quiescence search is usually to get a good value
out of an imperfect evaluation function)
evaluation function
= estimated desirability of position
35 IF3170/NUMand[1]and[2]and[3]/02-Sep-2019
Evaluation functions
For chess, typically linear weighted sum of features
Eval(s) = w1 f1(s) + w2 f2(s) + … + wn fn(s)
e.g., w1 = 9 with
f1(s) = (number of white queens) – (number of black queens),
etc.
36 IF3170/NUMand[1]and[2]and[3]/02-Sep-2019
Cutting off search
MinimaxCutoff is identical to MinimaxValue except
1. Terminal? is replaced by Cutoff?
2. Utility is replaced by Eval
37 IF3170/NUMand[1]and[2]and[3]/02-Sep-2019
Deterministic games in practice
Checkers: Chinook ended 40-year-reign of human world champion Marion
Tinsley in 1994. Used a precomputed endgame database defining perfect
play for all positions involving 8 or fewer pieces on the board, a total of 444
billion positions.
Go: human champions refuse to compete against computers, who are too
bad. In go, b > 300, so most programs use pattern knowledge bases to
suggest plausible moves.
38 IF3170/NUMand[1]and[2]and[3]/02-Sep-2019
Summary
Games are fun to work on!
They illustrate several important points about AI
perfection is unattainable → must approximate
good idea to think about what to think about
39 IF3170/NUMand[1]and[2]and[3]/02-Sep-2019
References
[1] Lathrop, R., Local Search Algorithm: Lecture Notes of
Introduction to Artificial Intelligence course in Computer Science
Department, University of California USA, can be accessed at:
http://www.ics.uci.edu/~rickl/courses/cs-271/2013-wq-cs271/2013-
wq-cs271-lecture-slides/2013wq271-05-LocalSearch.ppt
[2] Moore, A. W., Iterative Improvement Search: Statistical Data
Mining Tutorials, School of Computer Science, Carnegie Mellon
University USA, can be accessed at:
www.autonlab.org/tutorials/hillclimb02.pdf
[3] Hwee Tou Ng's (Singapore) course slides for AIMA, can be
accessed at: http://aima.eecs.berkeley.edu/slides-ppt/
[4] AISpace2 Tools for learning and understanding AI, can be accessed
at https://aispace2.github.io/AISpace2/index.html
40 IF3170/NUMand[1]and[2]and[3]/02-Sep-2019
THANK YOU