

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


(a) Give the V ∗^ value for every state in this grid world.
(b) Give the Q(s, a) value for every transition in this grid world.
(c) Show an optimal policy π∗—i.e., the optimal action from each state.
(d) Now consider applying the Q-learning algorithm to this grid world, assuming the table of Qˆ values is initialized to zeros. Assume the agent begins in the bottom left grid square and then travels clockwise around the perimeter of the grid until it reaches the absorbing goal state, completing the first training episode. Describe which Qˆ values are modified as a result of this episode, and give their revised values. Answer the question again assuming the agent now performs a second identical episode. Answer it for a third episode.
For example, the picture below illustrates a starting position with four heaps, with one, three, five, and seven pieces respectively. Players alternate in removing a number of pieces from a chosen heap. The number of pieces chosen to remove must be greater than zero, and less than or equal to the number of pieces in the heap.
Suppose you wanted to write a Q-learning program that learned to play Nim with four piles, each of which could initially contain between one and seven pieces.
Let a state of the world be represented by the four-tuple (n 1 , n 2 , n 3 , n 4 ), where ni is the number of pieces in the ith heap.
(a) Define a possible reward function r(s, a) for this game.
(b) Suppose you represent the Qˆ function as a table. How many entries would it have, and why? (Recall that you have four heaps, with at most seven pieces in each heap. Allow the Qˆ function table to have enough entries to cover all the possible states and actions.)
(c). Suppose you have initialized Qˆ function table to all zeros. Suppose the initial state of the game is (1, 3 , 5 , 7), and your program is going to go first. Using your reward function above and γ = 0.8, simulate a learning session of one game, as follows:
Give the final non-zero entries in your Qˆ table.