This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def fill_in_transition(self): | |
""" | |
Compute the transition matrix of the grid | |
input: / | |
output: T {np.array} -- the transition matrix of the grid | |
""" | |
T = np.zeros((self.state_size, self.state_size, self.action_size)) # Empty matrix of dimension S*S*A | |
#### | |
# Add your code here |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def policy_iteration(self, threshold = 0.0001, gamma = 0.8): | |
""" | |
Policy iteration on GridWorld | |
input: | |
- threshold {float} -- threshold value used to stop the policy iteration algorithm | |
- gamma {float} -- discount factor | |
output: | |
- policy {np.array} -- policy found using the policy iteration algorithm | |
- V {np.array} -- value function corresponding to the policy | |
- epochs {int} -- number of epochs to find this policy |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.