10/13/11 Solution: Minimax with Alpha-Beta Pruning and
Progressive Deepening
When answering the question in Parts C.1 and C.2 below, assume you have already applied
minimax with alpha-beta pruning and progressive deepening on the corresponding game
tree up to depth 2. The value shown next to each node of the tree at depth 2 is the
respective node’s static-evaluation value. Assume the procedure uses the information it has
acquired up to a given depth to try to improve the order of evaluations later. In particular,
the procedure reorders the nodes based on the evaluations found up to depth 2 in an attempt
to improve the effectiveness of alpha-beta pruning when running up to depth 3.
We want to know in which order the nodes/states A, B, C, and D in the game tree are
evaluated when the procedure runs up to depth 3, after running up to depth 2 and
reordering.
Part C.1: Game Tree I (5 points)
1 3
Choose the order in which the nodes/states A, B, C and D in game tree I above are
evaluated when running minimax with alpha-beta pruning and progressive deepening after
running up to depth 2 and reordering. (Circle your answer)
a. ABCD
b. DABC
c. BADC
d. CDAB
e. DCBA
4
Part C.2: Game Tree II (5 points)
2 1
Choose the order in which the nodes/states A, B, C and D in game tree II above are
evaluated when running minimax with alpha-beta pruning and progressive deepening after
running up to depth 2 and reordering (Circle your answer)
f. ABCD
g. DABC
h. BADC
i. CDAB
j. DCBA
5
10/13/11 Problem 2: Games
In the game tree below, the value below each node is the static evaluation at that node.
MAX next to a horizontal line of nodes means that the maximizer is choosing on that turn,
and MIN means that the minimizer is choosing on that turn.
2 6 1
3 7 20
Part A (10 points)
Using minimax without Alpha-Beta pruning, which of the three possible moves should the
maximizer take at node A?
C
What will be the final minimax value of node A?
2
Part B (10 points)
Mark suggests that Alpha-Beta pruning might help speed things up. Perform a minimax
search with alpha-beta pruning, traversing the tree, and list the order in which you
statically evaluate the nodes (that is, you would start with E). Write your answer below.
Note that there is, at the end of this quiz, a tear-off sheet with copies of the tree.
Not done in this
example
Part C (10 points)
Tom thinks that he might save some trouble by calculating static values at depth 2 and then
using those static values to reorder the tree for the alpha-beta search that goes all the way to
the leaf nodes. Thus, Tom is attempting to deploy alpha-beta search in a way that will
improve pruning.
Suppose the static evaluator Tom uses at depth 2 produces exactly the minimax values you
found in Part A. Tom uses those numbers to reorder BC&D, EF, GH, and IJ. Note that
Tom knows nothing about how the tree branches below depth 2 at this point. Draw the
reordered tree down to depth 2, the EFGHIJ level.
Best moves on LEFT A MAX
MIN 6 C 2 B 1 D
6 7 2 3 1 20
Explain the reasoning behind your choices:
3
Progressive Deepening Games Problem 3
3 0 3
3 9
Min 0 c b d 3
3
9 f 4 e 7 4 3
Max 2 0 3
8 9 2 3
Min
2. Converting problems into constraint propagation form
“Paul, John, and Ringo are musicians. One of them plays bass, another plays guitar, and the third plays drums. As it
happens, one of them is afraid of things associated with the number 13, another is afraid of Apple Computers, and the
third is afraid of heights. Paul and the guitar player skydive; John and the bass player enjoy Apple Computers; and the
drummer lives in an open penthouse apartment 13 on the thirteenth floor. What instrument does Paul play?”
How can we solve this problem? Try it yourself first, by any means you care, then we’ll see how to do it by – ta-da! –
the magic of constraint propagation! (You might want to think about constraints when you solve it, and what the
constraints are.)
What are the constraints? How might they be represented? We want to use the facts in the story to determine whether
certain identity relations hold ore are eXcluded. Here is our notation: assume X(Peter, Guitar Player) means “the
person who is John is not the person who plays the guitar.” Further, this relation is symmetrical, so that if we have
X(Peter, Guitar Player) then we also have, X(Guitar Player, Peter). In this notation, the facts become the following (of
course all the symmetrical facts hold as well):
1. X(Paul, Guitar Player)
2. X(Paul, Fears Heights)
3. X(Guitar Player, Fears Heights)
4. X(John, Fears Apple Computers)
5. X(John, Bass Player)
6. X(Bass Player, Fears Apple Computers)
7. X(Drummer, Fears 13)
8. X(Drummer, Fears Heights)
Now we can represent the possible relations implicitly by means of entries in tables, and use constraint propagation. An
X entry in a table denotes that the identity relation is excluded, and an I denotes that the identity relation actually holds.
We can then use three tables, one to represent the possible identities between people and instrument players; one to
represent the possible identities between people and fears; and a third to represent the possible relationships between
instrument players and fears.
3
1. X(Paul, Guitar Player)
2. X(Paul, Fears Heights)
3. X(Guitar Player, Fears Heights)
4. X(John, Fears Apple Computers)
5. X(John, Bass Player)
6. X(Bass Player, Fears Apple Computers)
7. X(Drummer, Fears 13)
8. X(Drummer, Fears Heights)
Instrument Player
Bass Player Guitar Player Drum Player
Paul X X I
John X I X
Ringo I X X
Fears
13 Apple Computers Heights
Paul X I X
John I X X
Ringo X X I
`
Fears
13 Apple Computers Heights
Bass player X X I
Guitar player I X X
Drum Player X I X
How do we do constraint propagation in this system? Note that we can deduce rules like the following to fill in the
three tables:
1. If all but one entry in a row are X, then the remaining entry is I.
2. If you know I(x,y) and X(y,z) then you may conclude X(x,z).
If two names pick out the same thing (are identical), then they must share all the same properties.
What other rules do we need?
3. If you know X(x,y) & X(z,y) then you may conclude X(x,z)
4. If you know X(x,y) & X(x,z) then you may conclude X(y,z)
4
)*+ * #9:#
.+ !
*.!,++ ((+
.!+
7+1
?
+
+
1 +
'
;.
1( (
1( (
7+
( )
+ (1*'
(,2
+
(
13
( (6+ 4:
;)
(.3
#, ((
/ /..
(
#
&,
@...
34:3
8,
-@...36+ )
(
3
5, "
"13;
)
(
$, +(/
136+ :
9,
;13(6+ 3
>, '
(:
)
(*2+
((+,
A
)%-. /
7 11
( 1
< (
* ""
B
)4-. /
2( *+
#&85,
(!"
$
1
(+
+(1(
+ *(1
,
. (
1#
C#
(
* ,(
.
(++
#
6 # & 8 5
T L
4 1 2 3 4
B
: 1 2 C3 4
B L
; 1 2 3 4
S
) 1 2 3 4
S L C P
3 1 2 3 4
T L C P
#%
):- /
2711(D11(
7
+
+!"
$ "$
'
-
*
/
1
( +
#
6 2 3 4
4 1 2 3 4
: 3 4
; 2 3 4
)
1
3 4
##
/
.!0
#3 T, P, B
&3
S, L
83 C
53 N
)5- /
11(
7111
((2
(( E
( .!
% 9
$"' &"
" *
(
1
( .
(
0
Newton - has the most
constraints
#&
10/13/11 Constraint Propagation
You just bought a 6-sided table (because it looks like a benzene ring) and want to hold a dinner
party. You invite your 4 best friends: McCain, Obama, Biden and Palin. Luckily a moose wanders
by and also accepts your invitation. Counting yourself, you have 6 guests for seats labeled 1-6.
2 6
3 5
Your guests have seven seating demands:
● Palin wants to sit next to McCain
● Biden wants to sit next to Obama
● Neither McCain nor Palin will sit next to Obama or Biden
● Neither Obama nor Biden will sit next to McCain or Palin
● The moose is afraid to sit next to Palin
● No two people can sit in the same seat, and no one can sit in 2 seats.
● McCain insists on sitting in seat 1
10
Part A (10 points)
You realize there are 2 ways to represent this problem as a constraint problem. For each below, run
the domain reduction algorithm and continue to propagate through domains reduced to one value.
That is, cross out all the impossible values in each domain without using any search.
Variables: You, Moose, McCain, Palin, Obama, Biden
Domains: Seats 1-6
Constraints: I-VII
You: ✕
1 2 3 4 5 6
Moose: ✕
1 2 3 4 5 6
McCain: 1 ✕
2 ✕3 ✕4 ✕
5 ✕6
Palin: ✕1 2 ✕
3 ✕4 ✕
5 6
Obama: ✕1 ✕
2 3 4 5 ✕
6
Biden: ✕
1 ✕
2 3 4 5 ✕
6
Variables: Seats 1-6
Domains: You, Moose, McCain, Palin, Obama, Biden
Constraints: I-VII
1: ✕
You ✕
Moose McCain ✕
Palin ✕
Obama ✕
Biden
2: You Moose ✕
McCain Palin ✕
Obama ✕
Biden
3: You Moose ✕
McCain ✕
Palin Obama Biden
4: You Moose ✕
McCain ✕
Palin Obama Biden
5: You Moose ✕
McCain ✕
Palin Obama Biden
6: You Moose ✕
McCain Palin ✕
Obama ✕
Biden
Part B (15 points)
For now, you decide to continue using seats as variables and guests as domains (the 2nd
representation). You decide to see how a depth-first search with no constraint propagation works ,
but as you run the search you see you are doing a lot of backtracking.
9
You break ties by choosing the left-most in this order:
You (Y), Moose (M), McCain(Mc), Palin (P), Obama (O), Biden (B)
Show the partial search tree only up to the first time you try to assign seat 6.
Begin with the reduced domains from the previous
page. Use only the constraints supplied; use no commensense beyond what you see in the
constraints. You might want to work this out on the tear off sheet at the end of the quiz first.
1
Mc
2
Y M P
11
Depth-first thru already reduced
1 Mc domains - no other constraint
propagation {Mc}
Seat 1
2 Y M P { Y, M, P} {Y, M, P}
2 6
3Y M O B
4Y M O B {Y, M, O, B} 3 5 {Y, M, O, B}
4
5Y M O B {Y, M, O, B}
6 Y M P
FAIL! {Mc}
Seat 1
{Y, M, P} {Y, M, P}
2 6
{Y, M, O, B} 3 5 {Y, M, O, B}
4
{Y, M, O, B}
{Mc}
Seat 1
{Y, M, P} {Y, M, P}
2 6
{Y, M, O, B} 3 5 {Y, M, O, B}
4
{Y, M, O, B}
Part C (15 points)
Now you try to use depth-first search and constraint propagation through
domains reduced to size 1. You break ties by choosing the left-most in this order:
You (Y), Moose (M), McCain(Mc), Palin (P), Obama (O), Biden (B)
Show the the full search tree (up until you find a solution), starting with the same pre-
reduced domains. You might want to work this out on a copy at the end of the quiz..
1
Mc
2
Y M P
12
Depth-first through already reduced
domains PLUS constraint propagation
incl. through domains reduced to 1
1 Mc {Mc}
Seat 1
2 Y M P { Y, M, P}
2
✕ M, P}
{Y,
6
✕ M, O, B} 3
{Y, 5 {Y, M, O, B}
✕
4
✕ M, O, B}
{Y,
1 Mc {Mc}
Seat 1
reduced to 1 !
2 Y M P {Y, M, P} ✕ P}
2
✕ M,
{Y,
6
Fail !
3 M O B
✕ M, O, B} 3
{Y, 5 {Y, M, O, B}
✕
4
✕✕
{Y, M, O, B}
1 Mc {Mc}
Seat 1
2 Y M P {Y, M, P} {Y,
2
✕ M, P}
6
3 M O B
✕ M, O, B} 3
{Y, 5 {Y, M, O, B}
✕ ✕
4
✕ M, ✕
{Y, O, B}
1 Mc
{Mc} reduced to 1 !
Seat 1
2 Y M P { Y, M, P}
2
✕✕
{Y, M, P}
6
Fail !
3 M O B
✕ M, O, B} 3
{Y, 5 {Y, M, O, B}
✕ ✕✕
4
4 M B ✕ M, ✕
{Y, O, B}
1 Mc {Mc}
Seat 1
{Y, M, P}
2 Y M P 2
✕✕
{Y, M, P}
6 Fail !
3 M O B
reduced to 1 !
✕ M, O, B} 3
{Y, 5 {Y, M, O, B}
✕ ✕✕
4 M B 4
✕ M, ✕
{Y, O, B}
1 Mc {Mc}
Seat 1
{Y, M, P} reduced to 1 !
2 Y M P 2
✕✕
{Y, M, P}
6
Fail !
3 M O B ✕ M, O, B} 3
{Y, 5 {Y, M, O, B} reduced to 1 !
✕✕ ✕
4
4 M O
✕ M, O, ✕
{Y, B}
Note: if we enforce constraint that Biden must be
next to Obama, then M is ruled out immediately
at this point.
1 Mc
{Mc}
Seat 1
2 Y M P { Y, M, P} ✕✕
{Y, M, P}
2 6
Fail !
3 M O B reduced to 1 !
✕M, O, B} 3
{Y, 5 {Y, M, O, B}
✕ ✕✕
4
4 M O
✕ M, O,✕
{Y, B}
1 Mc {Mc}
Seat 1 reduced to 1 !
2 Y M P {Y, M, P}
✕✕
{Y, M, P} Fail !
2 6
3 Y O B
✕ O, B} 3
{Y, M, 5 {Y,
✕✕ M, O, B}
✕✕
{Y, M, O, B}
1 Mc
{Mc} reduced to 1 !
Seat 1
2 Y M P {Y, M, P} ✕✕
{Y, M, P}
Fail !
2 6
3 Y O B
M, O, B} 3
{Y, ✕ 5 {Y, M, O, B}
✕✕
4
4 Y B
{Y, ✕
M,✕
O, B}
Note: if we enforce constraint that Biden must be
next to Obama, then Y is ruled out immediately at
this point.
1 Mc
{Mc}
2 Y M P Seat 1
{ Y, M, P}
2
✕ P}
{Y, M,
6
3 Y O B reduced to 1 !
M, O, B} 3
{Y, ✕ 5 {Y, M, O, B}
✕ ✕✕
4
4 Y B
M,✕
{Y, ✕ O, B} Success!
5 Y {Mc}
Seat 1
{Y, M, P} {Y, M, P}
6 P 2 6
{Y, M, O, B} 3 5 {Y, M, O, B}
4
{Y, M, O, B}
{Mc}
Seat 1
{Y, M, P} {Y, M, P}
2 6
{Y, M, O, B} 3 5 {Y, M, O, B}
4
{Y, M, O, B}