cpsc 322 introduction to artificial intelligence
DESCRIPTION
CPSC 322 Introduction to Artificial Intelligence. October 25, 2004. Things. Assignment 3 was posted Friday night Midterm exam 2 is one week from today Bring me your first midterms before the second midterm if you want to be retested on problem 3 Jessica Hodgins talk, Thursday, - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: CPSC 322 Introduction to Artificial Intelligence](https://reader030.vdocument.in/reader030/viewer/2022033020/5681437c550346895daffad3/html5/thumbnails/1.jpg)
CPSC 322Introduction to Artificial Intelligence
October 25, 2004
![Page 2: CPSC 322 Introduction to Artificial Intelligence](https://reader030.vdocument.in/reader030/viewer/2022033020/5681437c550346895daffad3/html5/thumbnails/2.jpg)
Things...
Assignment 3 was posted Friday night
Midterm exam 2 is one week fromtoday
Bring me your first midterms beforethe second midterm if you want to beretested on problem 3
Jessica Hodgins talk, Thursday,October 28, 1-2pm, MacLeod 214
![Page 3: CPSC 322 Introduction to Artificial Intelligence](https://reader030.vdocument.in/reader030/viewer/2022033020/5681437c550346895daffad3/html5/thumbnails/3.jpg)
Game search
(also known as adversarial search) hasthese components:
move (or board) generator
static board evaluation function (this is the heuristic part - it doesn’t generate moves or look ahead - it’s static)
minimax algorithm to alternately propagate minima and maxima upward from “bottom”
![Page 4: CPSC 322 Introduction to Artificial Intelligence](https://reader030.vdocument.in/reader030/viewer/2022033020/5681437c550346895daffad3/html5/thumbnails/4.jpg)
Minimax algorithmStart with the following:
a) there are two players, MAX and MINb) it’s MAX’s turn to movec) MAX has a static board evaluation function that returns
bigger values if a board is favorable to MAXd) the evaluation function gets better as the game gets
closer to a goal state (else why bother to generatethe game space?)
e) MAX believes that MIN’s evaluation function is nobetter than MAX’s (if that’s not true, then MAXshould at least avoid betting money on this game)
![Page 5: CPSC 322 Introduction to Artificial Intelligence](https://reader030.vdocument.in/reader030/viewer/2022033020/5681437c550346895daffad3/html5/thumbnails/5.jpg)
Minimax algorithm1. Generate the game tree to as many levels (plies) that time and space
constraints allow. The top level is called MAX (as in it’s now MAX’s turn to move), the next level is called MIN, the next level is MAX, and so on.
2. Apply the evaluation function to all the terminal (leaf) states/boards to get “goodness” values
3. Use those terminal board values to determine the values to be assigned to the immediate parents:
a) if the parent is at a MIN level, then the value is the minimum of the values of its childrenb) if the parent is at a MAX level, then the value is the maximum of the values of its children
4. Keep propagating values upward as in step 3
5. When the values reach the top of the game tree, MAX chooses the move indicated by the highest value
![Page 6: CPSC 322 Introduction to Artificial Intelligence](https://reader030.vdocument.in/reader030/viewer/2022033020/5681437c550346895daffad3/html5/thumbnails/6.jpg)
Deep Blue Garry Kasparovvital statistics: vital statistics:• 200,000,000 moves per second • 3 moves per second• 480 custom chess-playing chips • meat
1997
![Page 7: CPSC 322 Introduction to Artificial Intelligence](https://reader030.vdocument.in/reader030/viewer/2022033020/5681437c550346895daffad3/html5/thumbnails/7.jpg)
Puzzles, games, and AIPuzzles and two-player board games have longserved as a laboratory for experiments with heuristic search
Solving puzzles and playing games suggestsintelligence on the part of a human player, buthumans don’t do this stuff the same way that search procedures do
Electronic Arts probably won’t be hiring yousolely on your mastery of minimax search(but it couldn’t hurt)
![Page 8: CPSC 322 Introduction to Artificial Intelligence](https://reader030.vdocument.in/reader030/viewer/2022033020/5681437c550346895daffad3/html5/thumbnails/8.jpg)
Puzzles, games, and AIStill, heuristic search is a simple but useful tool, and the minimax game playing approachis clearly very powerful
You probably don’t fully understand thesesearch techniques until you’ve had to implement them...especially game search
Let’s look at just one more game...
![Page 9: CPSC 322 Introduction to Artificial Intelligence](https://reader030.vdocument.in/reader030/viewer/2022033020/5681437c550346895daffad3/html5/thumbnails/9.jpg)
Oska• two players• four pieces each
![Page 10: CPSC 322 Introduction to Artificial Intelligence](https://reader030.vdocument.in/reader030/viewer/2022033020/5681437c550346895daffad3/html5/thumbnails/10.jpg)
Oska• two players• four pieces each
![Page 11: CPSC 322 Introduction to Artificial Intelligence](https://reader030.vdocument.in/reader030/viewer/2022033020/5681437c550346895daffad3/html5/thumbnails/11.jpg)
Oska• two players• four pieces each• piece movement:
![Page 12: CPSC 322 Introduction to Artificial Intelligence](https://reader030.vdocument.in/reader030/viewer/2022033020/5681437c550346895daffad3/html5/thumbnails/12.jpg)
Oska• two players• four pieces each• piece movement: • piece may be moved one space forward on the diagonal
![Page 13: CPSC 322 Introduction to Artificial Intelligence](https://reader030.vdocument.in/reader030/viewer/2022033020/5681437c550346895daffad3/html5/thumbnails/13.jpg)
Oska• two players• four pieces each• piece movement: • piece may be moved one space forward on the diagonal
![Page 14: CPSC 322 Introduction to Artificial Intelligence](https://reader030.vdocument.in/reader030/viewer/2022033020/5681437c550346895daffad3/html5/thumbnails/14.jpg)
Oska• two players• four pieces each• piece movement: • piece may be moved one space forward on the diagonal
![Page 15: CPSC 322 Introduction to Artificial Intelligence](https://reader030.vdocument.in/reader030/viewer/2022033020/5681437c550346895daffad3/html5/thumbnails/15.jpg)
Oska• two players• four pieces each• piece movement: • piece may be moved one space forward on the diagonal
![Page 16: CPSC 322 Introduction to Artificial Intelligence](https://reader030.vdocument.in/reader030/viewer/2022033020/5681437c550346895daffad3/html5/thumbnails/16.jpg)
Oska• two players• four pieces each• piece movement: • piece may be moved one space forward on the diagonal • piece may jump forward on the diagonal over an opponent’s piece to an empty space, thus capturing the opponent’s piece
![Page 17: CPSC 322 Introduction to Artificial Intelligence](https://reader030.vdocument.in/reader030/viewer/2022033020/5681437c550346895daffad3/html5/thumbnails/17.jpg)
Oska• two players• four pieces each• piece movement: • piece may be moved one space forward on the diagonal • piece may jump forward on the diagonal over an opponent’s piece to an empty space, thus capturing the opponent’s piece
![Page 18: CPSC 322 Introduction to Artificial Intelligence](https://reader030.vdocument.in/reader030/viewer/2022033020/5681437c550346895daffad3/html5/thumbnails/18.jpg)
Oska• two players• four pieces each• piece movement: • piece may be moved one space forward on the diagonal • piece may jump forward on the diagonal over an opponent’s piece to an empty space, thus capturing the opponent’s piece
![Page 19: CPSC 322 Introduction to Artificial Intelligence](https://reader030.vdocument.in/reader030/viewer/2022033020/5681437c550346895daffad3/html5/thumbnails/19.jpg)
Oska• two players• four pieces each• piece movement: • piece may be moved one space forward on the diagonal • piece may jump forward on the diagonal over an opponent’s piece to an empty space, thus capturing the opponent’s piece
![Page 20: CPSC 322 Introduction to Artificial Intelligence](https://reader030.vdocument.in/reader030/viewer/2022033020/5681437c550346895daffad3/html5/thumbnails/20.jpg)
Oska• two players• four pieces each• piece movement: • piece may be moved one space forward on the diagonal • piece may jump forward on the diagonal over an opponent’s piece to an empty space, thus capturing the opponent’s piece
![Page 21: CPSC 322 Introduction to Artificial Intelligence](https://reader030.vdocument.in/reader030/viewer/2022033020/5681437c550346895daffad3/html5/thumbnails/21.jpg)
Oska• two players• four pieces each• piece movement: • piece may be moved one space forward on the diagonal • piece may jump forward on the diagonal over an opponent’s piece to an empty space, thus capturing the opponent’s piece • you don’t have to capture if you don’t want to
![Page 22: CPSC 322 Introduction to Artificial Intelligence](https://reader030.vdocument.in/reader030/viewer/2022033020/5681437c550346895daffad3/html5/thumbnails/22.jpg)
Oska• two players• four pieces each• piece movement: • piece may be moved one space forward on the diagonal • piece may jump forward on the diagonal over an opponent’s piece to an empty space, thus capturing the opponent’s piece • you don’t have to capture if you don’t want to
![Page 23: CPSC 322 Introduction to Artificial Intelligence](https://reader030.vdocument.in/reader030/viewer/2022033020/5681437c550346895daffad3/html5/thumbnails/23.jpg)
Oska• two players• four pieces each• piece movement: • piece may be moved one space forward on the diagonal • piece may jump forward on the diagonal over an opponent’s piece to an empty space, thus capturing the opponent’s piece • you don’t have to capture if you don’t want to
![Page 24: CPSC 322 Introduction to Artificial Intelligence](https://reader030.vdocument.in/reader030/viewer/2022033020/5681437c550346895daffad3/html5/thumbnails/24.jpg)
Oska• two players• four pieces each• piece movement: • piece may be moved one space forward on the diagonal • piece may jump forward on the diagonal over an opponent’s piece to an empty space, thus capturing the opponent’s piece • you don’t have to capture if you don’t want to • multiple jumps not permitted
![Page 25: CPSC 322 Introduction to Artificial Intelligence](https://reader030.vdocument.in/reader030/viewer/2022033020/5681437c550346895daffad3/html5/thumbnails/25.jpg)
Oska• two players• four pieces each• piece movement: • piece may be moved one space forward on the diagonal • piece may jump forward on the diagonal over an opponent’s piece to an empty space, thus capturing the opponent’s piece • you don’t have to capture if you don’t want to • multiple jumps not permitted
![Page 26: CPSC 322 Introduction to Artificial Intelligence](https://reader030.vdocument.in/reader030/viewer/2022033020/5681437c550346895daffad3/html5/thumbnails/26.jpg)
Oska• two players• four pieces each• piece movement: • piece may be moved one space forward on the diagonal • piece may jump forward on the diagonal over an opponent’s piece to an empty space, thus capturing the opponent’s piece • you don’t have to capture if you don’t want to • multiple jumps not permitted
![Page 27: CPSC 322 Introduction to Artificial Intelligence](https://reader030.vdocument.in/reader030/viewer/2022033020/5681437c550346895daffad3/html5/thumbnails/27.jpg)
Oska• two players• four pieces each• piece movement: • piece may be moved one space forward on the diagonal • piece may jump forward on the diagonal over an opponent’s piece to an empty space, thus capturing the opponent’s piece • you don’t have to capture if you don’t want to • multiple jumps not permitted
![Page 28: CPSC 322 Introduction to Artificial Intelligence](https://reader030.vdocument.in/reader030/viewer/2022033020/5681437c550346895daffad3/html5/thumbnails/28.jpg)
Oska• two players• four pieces each• piece movement: • piece may be moved one space forward on the diagonal • piece may jump forward on the diagonal over an opponent’s piece to an empty space, thus capturing the opponent’s piece • you don’t have to capture if you don’t want to • multiple jumps not permitted
![Page 29: CPSC 322 Introduction to Artificial Intelligence](https://reader030.vdocument.in/reader030/viewer/2022033020/5681437c550346895daffad3/html5/thumbnails/29.jpg)
Oska• two players• four pieces each• piece movement: • piece may be moved one space forward on the diagonal • piece may jump forward on the diagonal over an opponent’s piece to an empty space, thus capturing the opponent’s piece • you don’t have to capture if you don’t want to • multiple jumps not permitted
![Page 30: CPSC 322 Introduction to Artificial Intelligence](https://reader030.vdocument.in/reader030/viewer/2022033020/5681437c550346895daffad3/html5/thumbnails/30.jpg)
Oska• two players• four pieces each• piece movement: • piece may be moved one space forward on the diagonal • piece may jump forward on the diagonal over an opponent’s piece to an empty space, thus capturing the opponent’s piece • you don’t have to capture if you don’t want to • multiple jumps not permitted • if a player can’t make a legal move on a turn, the player loses turn and opponent moves again
![Page 31: CPSC 322 Introduction to Artificial Intelligence](https://reader030.vdocument.in/reader030/viewer/2022033020/5681437c550346895daffad3/html5/thumbnails/31.jpg)
Oska• how to win
![Page 32: CPSC 322 Introduction to Artificial Intelligence](https://reader030.vdocument.in/reader030/viewer/2022033020/5681437c550346895daffad3/html5/thumbnails/32.jpg)
Oska• how to win • capture all your opponent’s pieces
![Page 33: CPSC 322 Introduction to Artificial Intelligence](https://reader030.vdocument.in/reader030/viewer/2022033020/5681437c550346895daffad3/html5/thumbnails/33.jpg)
Oska• how to win • capture all your opponent’s pieces
![Page 34: CPSC 322 Introduction to Artificial Intelligence](https://reader030.vdocument.in/reader030/viewer/2022033020/5681437c550346895daffad3/html5/thumbnails/34.jpg)
Oska• how to win • capture all your opponent’s pieces
![Page 35: CPSC 322 Introduction to Artificial Intelligence](https://reader030.vdocument.in/reader030/viewer/2022033020/5681437c550346895daffad3/html5/thumbnails/35.jpg)
Oska• how to win • capture all your opponent’s pieces
![Page 36: CPSC 322 Introduction to Artificial Intelligence](https://reader030.vdocument.in/reader030/viewer/2022033020/5681437c550346895daffad3/html5/thumbnails/36.jpg)
Oska• how to win black wins • capture all your opponent’s pieces
![Page 37: CPSC 322 Introduction to Artificial Intelligence](https://reader030.vdocument.in/reader030/viewer/2022033020/5681437c550346895daffad3/html5/thumbnails/37.jpg)
Oska• how to win • capture all your opponent’s pieces
![Page 38: CPSC 322 Introduction to Artificial Intelligence](https://reader030.vdocument.in/reader030/viewer/2022033020/5681437c550346895daffad3/html5/thumbnails/38.jpg)
Oska• how to win • capture all your opponent’s pieces • move all your remaining pieces to your opponent’s starting row
![Page 39: CPSC 322 Introduction to Artificial Intelligence](https://reader030.vdocument.in/reader030/viewer/2022033020/5681437c550346895daffad3/html5/thumbnails/39.jpg)
Oska• how to win • capture all your opponent’s pieces • move all your remaining pieces to your opponent’s starting row
![Page 40: CPSC 322 Introduction to Artificial Intelligence](https://reader030.vdocument.in/reader030/viewer/2022033020/5681437c550346895daffad3/html5/thumbnails/40.jpg)
Oska• how to win • capture all your opponent’s pieces • move all your remaining pieces to your opponent’s starting row
![Page 41: CPSC 322 Introduction to Artificial Intelligence](https://reader030.vdocument.in/reader030/viewer/2022033020/5681437c550346895daffad3/html5/thumbnails/41.jpg)
Oska• how to win • capture all your opponent’s pieces • move all your remaining pieces to your opponent’s starting row
![Page 42: CPSC 322 Introduction to Artificial Intelligence](https://reader030.vdocument.in/reader030/viewer/2022033020/5681437c550346895daffad3/html5/thumbnails/42.jpg)
Oska• how to win • capture all your opponent’s pieces • move all your remaining pieces to your opponent’s starting row
![Page 43: CPSC 322 Introduction to Artificial Intelligence](https://reader030.vdocument.in/reader030/viewer/2022033020/5681437c550346895daffad3/html5/thumbnails/43.jpg)
Oska• how to win white wins • capture all your opponent’s pieces • move all your remaining pieces to your opponent’s starting row
![Page 44: CPSC 322 Introduction to Artificial Intelligence](https://reader030.vdocument.in/reader030/viewer/2022033020/5681437c550346895daffad3/html5/thumbnails/44.jpg)
What does this have to do with you?Consider this predicate:
oska([[w w w w][0 0 0][0 0][0 0 0][b b b b]], w, 3, [[w w w 0][0 0 w][0 0][0 0 0][b b b b]]).
This predicate is true if • the first argument is a legal board in an Oska game • the second argument indicates the colour of the pieces being “moved” by the oska predicate • the third argument indicates how deep (number of moves/plies/levels) the game search goes • the fourth argument is the best move that the oska predicate can find using its move generator, board evaluation function, and minimax algorithm
![Page 45: CPSC 322 Introduction to Artificial Intelligence](https://reader030.vdocument.in/reader030/viewer/2022033020/5681437c550346895daffad3/html5/thumbnails/45.jpg)
Welcome to your term project
oska([[w w w w][0 0 0][0 0][0 0 0][b b b b]], w, 3, [[w w w 0][0 0 w][0 0][0 0 0][b b b b]]).
• due 6:00am Monday, November 29, 2004• you can work individually or in pairs but I need to know who the pairs no later than this Sunday, October 31• more details will be posted this week, including documentation requirements
![Page 46: CPSC 322 Introduction to Artificial Intelligence](https://reader030.vdocument.in/reader030/viewer/2022033020/5681437c550346895daffad3/html5/thumbnails/46.jpg)
One other thing....
oska([[w w w w][0 0 0][0 0][0 0 0][b b b b]], w, 3, [[w w w 0][0 0 w][0 0][0 0 0][b b b b]]).
oska([[w w w w w][0 0 0 0][0 0 0][0 0] [0 0 0][0 0 0 0][b b b b b]], w, 3, [[w w w w 0][0 0 0 w][0 0 0][0 0] [0 0 0][0 0 0 0][b b b b b]]).
could look like this instead:
![Page 47: CPSC 322 Introduction to Artificial Intelligence](https://reader030.vdocument.in/reader030/viewer/2022033020/5681437c550346895daffad3/html5/thumbnails/47.jpg)
Your program vs. Deep Blue
game search game search move generator move generator static board evaluator static board evaluator minimax algorithm minimax algorithm pruning (maybe) pruningone processor 480 custom-fabricated
chess-playing chipsCILOG algorithms and representations
hardwired on chipsgrit and determination selective deepening by
reallocating chips on the flygiant libraries of openings, endgames, and championship matches
![Page 48: CPSC 322 Introduction to Artificial Intelligence](https://reader030.vdocument.in/reader030/viewer/2022033020/5681437c550346895daffad3/html5/thumbnails/48.jpg)
Back to heuristic search techniques
![Page 49: CPSC 322 Introduction to Artificial Intelligence](https://reader030.vdocument.in/reader030/viewer/2022033020/5681437c550346895daffad3/html5/thumbnails/49.jpg)
Heuristic depth-first search algorithm
Given a set of start nodes, a set of goal nodes, and a graph (i.e., the nodes and arcs):
apply heuristic h(n) to start nodesmake a “list” of the start nodes - let’s call it the “frontier”sort the frontier by h(n) values
repeat if no nodes on the frontier then terminate with failure choose one node from the front of the frontier and remove it if the chosen node matches the goal node then terminate with success else get next nodes (neighbors) and h(n) values and sort those nodes by h(n) values and put those sorted nodes on the front of the frontier
end repeat
![Page 50: CPSC 322 Introduction to Artificial Intelligence](https://reader030.vdocument.in/reader030/viewer/2022033020/5681437c550346895daffad3/html5/thumbnails/50.jpg)
Heuristic depth-first search - tiles out of place
2 8 3 1 2 3
1 _ 4 goal: 8 _ 4
7 6 5 7 6 5
2 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 _ 4 7 1 4 8 _ 4 7 8 4 1 _ 8 1 8 5 1 4 3 1 _ 3 1 4 5 1 _ 5
7 6 5 7 6 5 6 1 5 6 5 _ 7 6 5 _ 6 5 7 6 5 7 6 _ 7 6 5 7 6 5 _ 7 6 7 4 6
![Page 52: CPSC 322 Introduction to Artificial Intelligence](https://reader030.vdocument.in/reader030/viewer/2022033020/5681437c550346895daffad3/html5/thumbnails/52.jpg)
Heuristic depth-first search - tiles out of place
2 8 3 1 2 3
1 _ 4 3 goal: 8 _ 4
7 6 5 7 6 5
2 8 3 2 _ 3 2 8 3
_ 1 4 4 1 8 4 4 1 4 _ 5
7 6 5 7 6 5 7 6 5
_ 8 3 2 8 3 _ 2 3 2 3 _ 2 8 _ 2 8 3
2 1 4 7 1 4 1 8 4 1 8 4 1 4 3 1 4 5
7 6 5 _ 6 5 7 6 5 7 6 5 7 6 5 7 6 _
8 _ 3 2 8 3 1 2 3 2 3 4 2 _ 8 2 8 3
2 1 4 7 1 4 _ 8 4 1 8 _ 1 4 3 1 4 5
7 6 5 6 _ 5 7 6 5 7 6 5 7 6 5 7 _ 6
8 3 _ 8 1 3 2 8 3 2 8 3 1 2 3 1 2 3 2 3 4 2 3 4 _ 2 8 2 4 8 2 8 3 2 8 3
2 1 4 2 _ 4 7 _ 4 7 1 4 8 _ 4 7 8 4 1 _ 8 1 8 5 1 4 3 1 _ 3 1 4 5 1 _ 5
7 6 5 7 6 5 6 1 5 6 5 _ 7 6 5 _ 6 5 7 6 5 7 6 _ 7 6 5 7 6 5 _ 7 6 7 4 6
![Page 53: CPSC 322 Introduction to Artificial Intelligence](https://reader030.vdocument.in/reader030/viewer/2022033020/5681437c550346895daffad3/html5/thumbnails/53.jpg)
Heuristic depth-first search - tiles out of place
2 8 3 1 2 3
1 _ 4 3 goal: 8 _ 4
7 6 5 7 6 5
2 8 3 2 _ 3 2 8 3
_ 1 4 4 1 8 4 4 1 4 _ 5
7 6 5 7 6 5 7 6 5
_ 8 3 2 8 3 _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 4 5 1 _ 5
7 6 5 7 6 5 6 1 5 6 5 _ 7 6 5 _ 6 5 7 6 5 7 6 _ 7 6 5 7 6 5 _ 7 6 7 4 6
![Page 55: CPSC 322 Introduction to Artificial Intelligence](https://reader030.vdocument.in/reader030/viewer/2022033020/5681437c550346895daffad3/html5/thumbnails/55.jpg)
Heuristic depth-first search - tiles out of place
2 8 3 1 2 3
1 _ 4 3 goal: 8 _ 4
7 6 5 7 6 5
2 8 3 2 _ 3 2 8 3
_ 1 4 4 1 8 4 4 1 4 _ 5
7 6 5 7 6 5 7 6 5
_ 8 3 2 8 3 _ 2 3 2 3 _ 2 8 _ 2 8 3
2 1 4 4 7 1 4 5 1 8 4 1 8 4 1 4 3 1 4 5
7 6 5 _ 6 5 7 6 5 7 6 5 7 6 5 7 6 _
8 _ 3 2 8 3 1 2 3 2 3 4 2 _ 8 2 8 3
2 1 4 4 7 1 4 _ 8 4 1 8 _ 1 4 3 1 4 5
7 6 5 6 _ 5 7 6 5 7 6 5 7 6 5 7 _ 6
8 3 _ 8 1 3 2 8 3 2 8 3 1 2 3 1 2 3 2 3 4 2 3 4 _ 2 8 2 4 8 2 8 3 2 8 3
2 1 4 5 2 _ 4 3 7 _ 4 7 1 4 8 _ 4 7 8 4 1 _ 8 1 8 5 1 4 3 1 _ 3 1 4 5 1 _ 5
7 6 5 7 6 5 6 1 5 6 5 _ 7 6 5 _ 6 5 7 6 5 7 6 _ 7 6 5 7 6 5 _ 7 6 7 4 6
![Page 56: CPSC 322 Introduction to Artificial Intelligence](https://reader030.vdocument.in/reader030/viewer/2022033020/5681437c550346895daffad3/html5/thumbnails/56.jpg)
Heuristic depth-first search - tiles out of place
2 8 3 1 2 3
1 _ 4 3 goal: 8 _ 4
7 6 5 7 6 5
2 8 3 2 _ 3 2 8 3
_ 1 4 4 1 8 4 4 1 4 _ 5
7 6 5 7 6 5 7 6 5
_ 8 3 2 8 3 _ 2 3 2 3 _ 2 8 _ 2 8 3
2 1 4 4 7 1 4 5 1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5 _ 7 6 5 _ 6 5 7 6 5 7 6 _ 7 6 5 7 6 5 _ 7 6 7 4 6
![Page 58: CPSC 322 Introduction to Artificial Intelligence](https://reader030.vdocument.in/reader030/viewer/2022033020/5681437c550346895daffad3/html5/thumbnails/58.jpg)
Heuristic depth-first search - tiles out of place
2 8 3 1 2 3
1 _ 4 3 goal: 8 _ 4
7 6 5 7 6 5
2 8 3 2 _ 3 2 8 3
_ 1 4 4 1 8 4 4 1 4 _ 5
7 6 5 7 6 5 7 6 5
_ 8 3 2 8 3 _ 2 3 2 3 _ 2 8 _ 2 8 3
2 1 4 4 7 1 4 5 1 8 4 1 8 4 1 4 3 1 4 5
7 6 5 _ 6 5 7 6 5 7 6 5 7 6 5 7 6 _
8 _ 3 2 8 3 1 2 3 2 3 4 2 _ 8 2 8 3
2 1 4 4 7 1 4 6 _ 8 4 1 8 _ 1 4 3 1 4 5
7 6 5 6 _ 5 7 6 5 7 6 5 7 6 5 7 _ 6
8 3 _ 8 1 3 2 8 3 2 8 3 1 2 3 1 2 3 2 3 4 2 3 4 _ 2 8 2 4 8 2 8 3 2 8 3
2 1 4 5 2 _ 4 3 7 _ 4 7 1 4 8 _ 4 7 8 4 1 _ 8 1 8 5 1 4 3 1 _ 3 1 4 5 1 _ 5
7 6 5 7 6 5 6 1 5 6 5 _ 7 6 5 _ 6 5 7 6 5 7 6 _ 7 6 5 7 6 5 _ 7 6 7 4 6
![Page 59: CPSC 322 Introduction to Artificial Intelligence](https://reader030.vdocument.in/reader030/viewer/2022033020/5681437c550346895daffad3/html5/thumbnails/59.jpg)
Heuristic depth-first search - tiles out of place
2 8 3 1 2 3
1 _ 4 3 goal: 8 _ 4
7 6 5 7 6 5
2 8 3 2 _ 3 2 8 3
_ 1 4 4 1 8 4 4 1 4 _ 5
7 6 5 7 6 5 7 6 5
_ 8 3 2 8 3 _ 2 3 2 3 _ 2 8 _ 2 8 3
2 1 4 4 7 1 4 5 1 8 4 1 8 4 1 4 3 1 4 5
7 6 5 _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7 6 5 7 6 _ 7 6 5 7 6 5 _ 7 6 7 4 6
![Page 61: CPSC 322 Introduction to Artificial Intelligence](https://reader030.vdocument.in/reader030/viewer/2022033020/5681437c550346895daffad3/html5/thumbnails/61.jpg)
Heuristic depth-first search - tiles out of place
2 8 3 1 2 3
1 _ 4 3 goal: 8 _ 4
7 6 5 7 6 5
2 8 3 2 _ 3 2 8 3
_ 1 4 4 1 8 4 4 1 4 _ 5
7 6 5 7 6 5 7 6 5
_ 8 3 2 8 3 _ 2 3 2 3 _ 2 8 _ 2 8 3
2 1 4 4 7 1 4 5 1 8 4 1 8 4 1 4 3 1 4 5
7 6 5 _ 6 5 7 6 5 7 6 5 7 6 5 7 6 _
8 _ 3 2 8 3 1 2 3 2 3 4 2 _ 8 2 8 3
2 1 4 4 7 1 4 6 _ 8 4 1 8 _ 1 4 3 1 4 5
7 6 5 6 _ 5 7 6 5 7 6 5 7 6 5 7 _ 6
8 3 _ 8 1 3 2 8 3 2 8 3 1 2 3 1 2 3 2 3 4 2 3 4 _ 2 8 2 4 8 2 8 3 2 8 3
2 1 4 5 2 _ 4 3 7 _ 4 5 7 1 4 7 8 _ 4 7 8 4 1 _ 8 1 8 5 1 4 3 1 _ 3 1 4 5 1 _ 5
7 6 5 7 6 5 6 1 5 6 5 _ 7 6 5 _ 6 5 7 6 5 7 6 _ 7 6 5 7 6 5 _ 7 6 7 4 6
![Page 62: CPSC 322 Introduction to Artificial Intelligence](https://reader030.vdocument.in/reader030/viewer/2022033020/5681437c550346895daffad3/html5/thumbnails/62.jpg)
Heuristic depth-first search - tiles out of place
2 8 3 1 2 3
1 _ 4 3 goal: 8 _ 4
7 6 5 7 6 5
2 8 3 2 _ 3 2 8 3
_ 1 4 4 1 8 4 4 1 4 _ 5
7 6 5 7 6 5 7 6 5
_ 8 3 2 8 3 _ 2 3 2 3 _ 2 8 _ 2 8 3
2 1 4 4 7 1 4 5 1 8 4 4 1 8 4 5 1 4 3 1 4 5
7 6 5 _ 6 5 7 6 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5 7 6 _ 7 6 5 7 6 5 _ 7 6 7 4 6
![Page 64: CPSC 322 Introduction to Artificial Intelligence](https://reader030.vdocument.in/reader030/viewer/2022033020/5681437c550346895daffad3/html5/thumbnails/64.jpg)
Heuristic depth-first search - tiles out of place
2 8 3 1 2 3
1 _ 4 3 goal: 8 _ 4
7 6 5 7 6 5
2 8 3 2 _ 3 2 8 3
_ 1 4 4 1 8 4 4 1 4 _ 5
7 6 5 7 6 5 7 6 5
_ 8 3 2 8 3 _ 2 3 2 3 _ 2 8 _ 2 8 3
2 1 4 4 7 1 4 5 1 8 4 4 1 8 4 5 1 4 3 1 4 5
7 6 5 _ 6 5 7 6 5 7 6 5 7 6 5 7 6 _
8 _ 3 2 8 3 1 2 3 2 3 4 2 _ 8 2 8 3
2 1 4 4 7 1 4 6 _ 8 4 2 1 8 _ 1 4 3 1 4 5
7 6 5 6 _ 5 7 6 5 7 6 5 7 6 5 7 _ 6
8 3 _ 8 1 3 2 8 3 2 8 3 1 2 3 1 2 3 2 3 4 2 3 4 _ 2 8 2 4 8 2 8 3 2 8 3
2 1 4 5 2 _ 4 3 7 _ 4 5 7 1 4 7 8 _ 4 0 7 8 4 3 1 _ 8 1 8 5 1 4 3 1 _ 3 1 4 5 1 _ 5
7 6 5 7 6 5 6 1 5 6 5 _ 7 6 5 _ 6 5 7 6 5 7 6 _ 7 6 5 7 6 5 _ 7 6 7 4 6
![Page 65: CPSC 322 Introduction to Artificial Intelligence](https://reader030.vdocument.in/reader030/viewer/2022033020/5681437c550346895daffad3/html5/thumbnails/65.jpg)
Heuristic depth-first search - tiles out of place
2 8 3 1 2 3
1 _ 4 3 goal: 8 _ 4
7 6 5 7 6 5
2 8 3 2 _ 3 2 8 3
_ 1 4 4 1 8 4 4 1 4 _ 5
7 6 5 7 6 5 7 6 5
_ 8 3 2 8 3 _ 2 3 2 3 _ 2 8 _ 2 8 3
2 1 4 4 7 1 4 5 1 8 4 4 1 8 4 5 1 4 3 1 4 5
7 6 5 _ 6 5 7 6 5 7 6 5 7 6 5 7 6 _
8 _ 3 2 8 3 1 2 3 2 3 4 2 _ 8 2 8 3
2 1 4 4 7 1 4 6 _ 8 4 2 1 8 _ 1 4 3 1 4 5
7 6 5 6 _ 5 7 6 5 7 6 5 7 6 5 7 _ 6
8 3 _ 8 1 3 2 8 3 2 8 3 1 2 3 1 2 3 2 3 4 2 3 4 _ 2 8 2 4 8 2 8 3 2 8 3
2 1 4 5 2 _ 4 3 7 _ 4 5 7 1 4 7 8 _ 4 0 7 8 4 3 1 _ 8 1 8 5 1 4 3 1 _ 3 1 4 5 1 _ 5
7 6 5 7 6 5 6 1 5 6 5 _ 7 6 5 _ 6 5 7 6 5 7 6 _ 7 6 5 7 6 5 _ 7 6 7 4 6
![Page 66: CPSC 322 Introduction to Artificial Intelligence](https://reader030.vdocument.in/reader030/viewer/2022033020/5681437c550346895daffad3/html5/thumbnails/66.jpg)
Why heuristic depth-first search?
![Page 67: CPSC 322 Introduction to Artificial Intelligence](https://reader030.vdocument.in/reader030/viewer/2022033020/5681437c550346895daffad3/html5/thumbnails/67.jpg)
Comparing search strategiesstrategy selection halts? space optimal path
depth-first last node added no linear nobreadth-first first node added yes exponential yes*lowest-cost minimal g(n) yes exponential yes firstbest-first globally minimal no exponential no h(n)heuristic locally minimal no linear no depth-first h(n)
* assuming all arcs have the same cost
![Page 68: CPSC 322 Introduction to Artificial Intelligence](https://reader030.vdocument.in/reader030/viewer/2022033020/5681437c550346895daffad3/html5/thumbnails/68.jpg)
What’s missing?
A heuristic search strategy that is guaranteed tofind the optimal (lowest-cost) path from start nodeto goal node
What do the strategies that find optimal pathshave in common?
![Page 69: CPSC 322 Introduction to Artificial Intelligence](https://reader030.vdocument.in/reader030/viewer/2022033020/5681437c550346895daffad3/html5/thumbnails/69.jpg)
Questions?