Loading

IIT-M RL-ASSIGNMENT-2-GRIDWORLD

Solution for submission 132119

A detailed solution for submission 132119 submitted for challenge IIT-M RL-ASSIGNMENT-2-GRIDWORLD

sundar_raman_p_ee17b069

What is the notebook about?

Problem - Gridworld Environment Algorithms

This problem deals with a grid world and stochastic actions. The tasks you have to do are:

  • Implement Policy Iteration
  • Implement Value Iteration
  • Implement TD lamdda
  • Visualize the results
  • Explain the results

How to use this notebook? 📝

  • This is a shared template and any edits you make here will not be saved.You should make a copy in your own drive. Click the "File" menu (top-left), then "Save a Copy in Drive". You will be working in your copy however you like.

  • Update the config parameters. You can define the common variables here

Variable Description
AICROWD_DATASET_PATH Path to the file containing test data. This should be an absolute path.
AICROWD_RESULTS_DIR Path to write the output to.
AICROWD_ASSETS_DIR In case your notebook needs additional files (like model weights, etc.,), you can add them to a directory and specify the path to the directory here (please specify relative path). The contents of this directory will be sent to AIcrowd for evaluation.
AICROWD_API_KEY In order to submit your code to AIcrowd, you need to provide your account's API key. This key is available at https://www.aicrowd.com/participants/me

Setup AIcrowd Utilities 🛠

We use this to bundle the files for submission and create a submission on AIcrowd. Do not edit this block.

In [2]:
!pip install aicrowd-cli > /dev/null

AIcrowd Runtime Configuration 🧷

Get login API key from https://www.aicrowd.com/participants/me

In [3]:
import os

AICROWD_DATASET_PATH = os.getenv("DATASET_PATH", os.getcwd()+"/a5562c7d-55f0-4d06-841c-110655bb04ec_a2_gridworld_inputs.zip")
AICROWD_RESULTS_DIR = os.getenv("OUTPUTS_DIR", "results")
API_KEY = "" # Get your key from https://www.aicrowd.com/participants/me
In [4]:

API Key valid
Saved API Key successfully!
a5562c7d-55f0-4d06-841c-110655bb04ec_a2_gridworld_inputs.zip: 100% 14.2k/14.2k [00:00<00:00, 610kB/s]
In [5]:
!unzip -q $AICROWD_DATASET_PATH
In [6]:
DATASET_DIR = 'inputs/'

GridWorld Environment

Read the code for the environment thoroughly

Do not edit the code for the environment

In [7]:
import numpy as np

class GridEnv_HW2:
    def __init__(self, 
                 goal_location, 
                 action_stochasticity,
                 non_terminal_reward,
                 terminal_reward,
                 grey_in,
                 brown_in,
                 grey_out,
                 brown_out
                ):

        # Do not edit this section 
        self.action_stochasticity = action_stochasticity
        self.non_terminal_reward = non_terminal_reward
        self.terminal_reward = terminal_reward
        self.grid_size = [10, 10]

        # Index of the actions 
        self.actions = {'N': (1, 0), 
                        'E': (0,1),
                        'S': (-1,0), 
                        'W': (0,-1)}
        
        self.perpendicular_order = ['N', 'E', 'S', 'W']
        
        l = ['normal' for _ in range(self.grid_size[0]) ]
        self.grid = np.array([l for _ in range(self.grid_size[1]) ], dtype=object)

        self.grid[goal_location[0], goal_location[1]] = 'goal'
        self.goal_location = goal_location

        for gi in grey_in:
            self.grid[gi[0],gi[1]] = 'grey_in'
        for bi in brown_in:    
            self.grid[bi[0], bi[1]] = 'brown_in'

        for go in grey_out:    
            self.grid[go[0], go[1]] = 'grey_out'
        for bo in brown_out:    
            self.grid[bo[0], bo[1]] = 'brown_out'

        self.grey_outs = grey_out
        self.brown_outs = brown_out

    def _out_of_grid(self, state):
        if state[0] < 0 or state[1] < 0:
            return True
        elif state[0] > self.grid_size[0] - 1:
            return True
        elif state[1] > self.grid_size[1] - 1:
            return True
        else:
            return False

    def _grid_state(self, state):
        return self.grid[state[0], state[1]]        
        
    def get_transition_probabilites_and_reward(self, state, action):
        """ 
        Returns the probabiltity of all possible transitions for the given action in the form:
        A list of tuples of (next_state, probability, reward)
        Note that based on number of state and action there can be many different next states
        Unless the state is All the probabilities of next states should add up to 1
        """

        grid_state = self._grid_state(state)
        
        if grid_state == 'goal':
            return [(self.goal_location, 1.0, 0.0)]
        elif grid_state == 'grey_in':
            npr = []
            for go in self.grey_outs:
                npr.append((go, 1/len(self.grey_outs), 
                            self.non_terminal_reward))
            return npr
        elif grid_state == 'brown_in':
            npr = []
            for bo in self.brown_outs:
                npr.append((bo, 1/len(self.brown_outs), 
                            self.non_terminal_reward))
            return npr
        
        direction = self.actions.get(action, None)
        if direction is None:
            raise ValueError("Invalid action %s , please select among" % action, list(self.actions.keys()))

        dir_index = self.perpendicular_order.index(action)
        wrap_acts = self.perpendicular_order[dir_index:] + self.perpendicular_order[:dir_index]
        next_state_probs = {}
        for prob, a in zip(self.action_stochasticity, wrap_acts):
            d = self.actions[a]
            next_state = (state[0] + d[0]), (state[1] + d[1])
            if self._out_of_grid(next_state):
                next_state = state
            next_state_probs.setdefault(next_state, 0.0)
            next_state_probs[next_state] += prob

        npr = []
        for ns, prob in next_state_probs.items():
            next_grid_state = self._grid_state(ns)
            reward = self.terminal_reward if next_grid_state == 'goal' else self.non_terminal_reward
            npr.append((ns, prob, reward))

        return npr

    def step(self, state, action):
        npr = self.get_transition_probabilites_and_reward(state, action)
        probs = [t[1] for t in npr]
        sampled_idx = np.random.choice(range(len(npr)), p=probs)
        sampled_npr = npr[sampled_idx]
        next_state = sampled_npr[0]
        reward = sampled_npr[2]
        is_terminal = next_state == tuple(self.goal_location)
        return next_state, reward, is_terminal

Example environment

This has the same setup as the pdf, do not edit the settings

In [8]:
def get_base_kwargs():
    goal_location = (9,9)
    action_stochasticity = [0.8, 0.2/3, 0.2/3, 0.2/3]
    grey_out = [(3,2), (4,2), (5,2), (6,2)]
    brown_in = [(9,7)]
    grey_in = [(0,0)]
    brown_out = [(1,7)]
    non_terminal_reward = 0
    terminal_reward = 10

    base_kwargs =  {"goal_location": goal_location, 
            "action_stochasticity": action_stochasticity,
            "brown_in": brown_in, 
            "grey_in": grey_in, 
            "brown_out": brown_out,
            "non_terminal_reward": non_terminal_reward,
            "terminal_reward": terminal_reward,
            "grey_out": grey_out,}
    
    return base_kwargs

base_kwargs = get_base_kwargs()

Task 2.1 - Value Iteration

Run value iteration on the environment and generate the policy and expected reward

In [39]:
def value_iteration(env, gamma):
    # Initial Values
    values = np.zeros((10, 10))

    # Initial policy
    policy = np.empty((10, 10), object)
    policy[:] = 'N' # Make all the policy values as 'N'

    # Begin code here
    extra_info = {}  #Put your extra information needed for plots etc in this dictionary
    delta=1e-8
    possible_actions=list(env.actions.keys())
    while (delta>=1e-8):  #repeat until delta reduces less than 1e-8 
        delta=0.0
        vg,pl = np.zeros((10, 10)),np.empty((10, 10), object)
        for x in range(env.grid_size[0]):  #go over all x-coordinates
            for y in range(env.grid_size[1]):  #go over all y-coordinates
                temp_J=[]
                for a in possible_actions:  #go over all possible actions
                    nextstates_probs_rews=env.get_transition_probabilites_and_reward((x,y),a)  #obtain possible next states, probabilities, rewards from environment
#                       print('a,temp_J,npr: ',a,temp_J,nextstates_probs_rews)
                    sum=0.0
                    for npr in nextstates_probs_rews:  #go over all possible next states
                        sum+=npr[1]*(npr[2]+gamma*values[(npr[0][0],npr[0][1])])  #approach optimal value incrementally by using operator T
                    temp_J.append(sum)
                max_J=max(temp_J)  #find maximum value amongst all action's values
                delta=max(delta,abs(values[(x,y)]-max_J))  #maximum value difference 
                vg[(x,y)],pl[(x,y)]=max_J,possible_actions[temp_J.index(max_J)]  #updating value, policy
        values,policy=vg.copy(),pl.copy()  #.copy() to avoid call by reference
    # End code

    # Do not change the number of output values
    return {"Values": values, "Policy": policy}, extra_info
In [40]:
env = GridEnv_HW2(**base_kwargs)
res, extra_info = value_iteration(env, 0.7)

 # The rounding off is just for making print statement cleaner
print(np.flipud(np.round(res['Values'], decimals=2)))
print(np.flipud(res['Policy']))
[[0.1  0.15 0.24 0.37 0.56 0.86 1.29 0.12 8.68 0.  ]
 [0.13 0.2  0.31 0.5  0.81 1.31 2.12 3.43 5.75 8.95]
 [0.1  0.16 0.25 0.39 0.62 0.97 1.52 2.38 3.7  5.61]
 [0.07 0.11 0.17 0.26 0.41 0.64 0.99 1.54 2.38 3.52]
 [0.05 0.07 0.11 0.17 0.27 0.41 0.64 0.99 1.53 2.21]
 [0.03 0.05 0.07 0.11 0.17 0.27 0.41 0.64 0.98 1.39]
 [0.02 0.03 0.05 0.07 0.11 0.17 0.27 0.41 0.63 0.87]
 [0.03 0.02 0.03 0.05 0.07 0.11 0.17 0.27 0.4  0.55]
 [0.04 0.03 0.02 0.03 0.05 0.07 0.11 0.17 0.26 0.35]
 [0.07 0.04 0.03 0.02 0.03 0.05 0.07 0.11 0.17 0.22]]
[['E' 'E' 'E' 'E' 'E' 'S' 'S' 'N' 'E' 'N']
 ['E' 'E' 'E' 'E' 'E' 'E' 'E' 'E' 'E' 'N']
 ['E' 'E' 'E' 'E' 'E' 'E' 'E' 'E' 'N' 'N']
 ['E' 'E' 'E' 'E' 'E' 'E' 'E' 'E' 'N' 'N']
 ['N' 'E' 'E' 'E' 'E' 'E' 'E' 'N' 'N' 'N']
 ['N' 'E' 'E' 'E' 'E' 'E' 'N' 'N' 'N' 'N']
 ['N' 'N' 'E' 'E' 'E' 'N' 'N' 'N' 'N' 'N']
 ['S' 'N' 'E' 'E' 'E' 'N' 'N' 'N' 'N' 'N']
 ['S' 'S' 'E' 'E' 'E' 'E' 'N' 'N' 'N' 'N']
 ['N' 'W' 'W' 'E' 'E' 'E' 'E' 'N' 'N' 'N']]

Task 2.2 - Policy Iteration

Run policy iteration on the environment and generate the policy and expected reward

In [65]:
def policy_iteration(env, gamma):
    # Initial Values
    values = np.zeros((10, 10))

    # Initial policy
    policy = np.empty((10, 10), object)
    policy[:] = 'N' # Make all the policy values as 'N'

    # Begin code here   
    extra_info = {}  #Put your extra information needed for plots etc in this dictionary
    done=0
    possible_actions=list(env.actions.keys())
    while (done==0):
        delta=1e-8
        while (delta>=1e-8):  #repeat until delta reduces less than 1e-8 
            delta=0.0
            for x in range(env.grid_size[0]):  #go over all x-coordinates
                for y in range(env.grid_size[1]):  #go over all y-coordinates
                    j=values[(x,y)]
                    action=policy[(x,y)]
                    nextstates_probs_rews=env.get_transition_probabilites_and_reward((x,y),action)  #obtain possible next states, probabilities, rewards from environment
                    sum=0.0
                    for npr in nextstates_probs_rews:  #go over all possible next states
                        sum+=npr[1]*(npr[2]+gamma*values[(npr[0][0],npr[0][1])])  #approach optimal value incrementally by using operator T
                    values[(x,y)]=sum
                    delta=max(delta,abs(values[(x,y)]-j))  #maximum value difference 
        done=1
        for x in range(env.grid_size[0]):  #go over all x-coordinates
            for y in range(env.grid_size[1]):  #go over all y-coordinates
                b=policy[(x,y)]
                temp_J=[]
                for a in possible_actions:  #go over all possible actions
                    nextstates_probs_rews=env.get_transition_probabilites_and_reward((x,y),a)  #obtain possible next states, probabilities, rewards from environment
                    sum=0.0
                    for npr in nextstates_probs_rews:  #go over all possible next states
                        sum+=npr[1]*(npr[2]+gamma*values[(npr[0][0],npr[0][1])])  #approach optimal value incrementally by using operator T
                    temp_J.append(sum)
                policy[(x,y)]=possible_actions[np.argmax(np.array(temp_J))]  #find maximum value amongst all action's values
                if b!=policy[(x,y)]:
                    done=0
    # End code

    # Do not change the number of output values
    return {"Values": values, "Policy": policy}, extra_info
In [66]:
env = GridEnv_HW2(**base_kwargs)
res, extra_info = policy_iteration(env, 0.7)

 # The rounding off is just for making print statement cleaner
print(np.flipud(np.round(res['Values'], decimals=2)))
print(np.flipud(res['Policy']))
[[0.1  0.15 0.24 0.37 0.56 0.86 1.29 0.12 8.68 0.  ]
 [0.13 0.2  0.31 0.5  0.81 1.31 2.12 3.43 5.75 8.95]
 [0.1  0.16 0.25 0.39 0.62 0.97 1.52 2.38 3.7  5.61]
 [0.07 0.11 0.17 0.26 0.41 0.64 0.99 1.54 2.38 3.52]
 [0.05 0.07 0.11 0.17 0.27 0.41 0.64 0.99 1.53 2.21]
 [0.03 0.05 0.07 0.11 0.17 0.27 0.41 0.64 0.98 1.39]
 [0.02 0.03 0.05 0.07 0.11 0.17 0.27 0.41 0.63 0.87]
 [0.03 0.02 0.03 0.05 0.07 0.11 0.17 0.27 0.4  0.55]
 [0.04 0.03 0.02 0.03 0.05 0.07 0.11 0.17 0.26 0.35]
 [0.07 0.04 0.03 0.02 0.03 0.05 0.07 0.11 0.17 0.22]]
[['E' 'E' 'E' 'E' 'E' 'S' 'S' 'N' 'E' 'N']
 ['E' 'E' 'E' 'E' 'E' 'E' 'E' 'E' 'E' 'N']
 ['E' 'E' 'E' 'E' 'E' 'E' 'E' 'E' 'N' 'N']
 ['E' 'E' 'E' 'E' 'E' 'E' 'E' 'E' 'N' 'N']
 ['N' 'E' 'E' 'E' 'E' 'E' 'E' 'N' 'N' 'N']
 ['N' 'E' 'E' 'E' 'E' 'E' 'N' 'N' 'N' 'N']
 ['N' 'N' 'E' 'E' 'E' 'N' 'N' 'N' 'N' 'N']
 ['S' 'N' 'E' 'E' 'E' 'N' 'N' 'N' 'N' 'N']
 ['S' 'S' 'E' 'E' 'E' 'E' 'N' 'N' 'N' 'N']
 ['N' 'W' 'W' 'E' 'E' 'E' 'E' 'N' 'N' 'N']]

Task 2.3 - TD Lambda

Use the heuristic policy and implement TD lambda to find values on the gridworld

In [67]:
# The policy mentioned in the pdf to be used for TD lambda, do not modify this
def heuristic_policy(env, state):
    goal = env.goal_location
    dx = goal[0] - state[0]
    dy = goal[1] - state[1]
    if abs(dx) >= abs(dy):
        direction = (np.sign(dx), 0)
    else:
        direction = (0, np.sign(dy))
    for action, dir_val in env.actions.items():
        if dir_val == direction:
            target_action = action
            break
    return target_action
In [71]:
def td_lambda(env, lamda, seeds):
    alpha = 0.5
    gamma = 0.7
    N = len(seeds)
    # Usage of input_policy
    # heuristic_policy(env, state) -> action
    example_action = heuristic_policy(env, (1,2)) # Returns 'N' if goal is (9,9)

    # Example of env.step
    # env.step(state, action) -> Returns next_state, reward, is_terminal

    # Initial values
    values = np.zeros((10, 10))
    es = np.zeros((10,10))

    for episode_idx in range(N):
         # Do not change this else the results will not match due to environment stochas
        np.random.seed(seeds[episode_idx])
        grey_in_loc = np.where(env.grid == 'grey_in')
        state = grey_in_loc[0][0], grey_in_loc[1][0]
        done = False
        while not done:
            action = heuristic_policy(env, state)
            ns, rew, is_terminal = env.step(state, action) 
            # env.step is already taken inside the loop for you, 
            # Don't use env.step anywhere else in your code
            # Begin code here
            extra_info = {}  #Put your extra information needed for plots etc in this dictionary
            delta = rew+gamma*values[ns]-values[state]
            es[state]+=1
            for x in range(env.grid_size[0]):  #go over all x-coordinates
                for y in range(env.grid_size[1]):  #go over all y-coordinates
                    values[(x,y)]+=alpha*delta*es[(x,y)]
                    es[(x,y)]=gamma*lamda*es[(x,y)]
            state=ns
            if is_terminal:  #env._grid_state(state) == 'goal'
                done = True
    # End code

    # Do not change the number of output values
    return {"Values": values}, extra_info
In [72]:
env = GridEnv_HW2(**base_kwargs)
res, extra_info = td_lambda(env, lamda=0.5, seeds=np.arange(1000))

 # The rounding off is just for making print statement cleaner
print(np.flipud(np.round(res['Values'], decimals=2)))
[[ 0.    0.    0.01  0.02  0.03  0.06  0.08  0.11 10.    0.  ]
 [ 0.    0.    0.04  0.18  0.91  1.4   1.28  4.85  6.98  9.92]
 [ 0.    0.05  0.24  0.42  0.63  0.71  2.08  3.28  3.8   5.89]
 [ 0.02  0.08  0.21  0.31  0.48  0.82  1.29  1.66  2.2   3.39]
 [ 0.02  0.07  0.08  0.11  0.25  0.4   0.52  0.96  1.62  1.44]
 [ 0.02  0.04  0.05  0.1   0.16  0.23  0.38  0.57  1.08  0.97]
 [ 0.01  0.03  0.03  0.05  0.08  0.17  0.2   0.35  0.58  0.26]
 [ 0.    0.01  0.03  0.03  0.07  0.1   0.15  0.23  0.18  0.18]
 [ 0.    0.    0.01  0.01  0.03  0.03  0.1   0.15  0.16  0.  ]
 [ 0.12  0.    0.    0.    0.    0.01  0.01  0.11  0.13  0.  ]]

Task 2.4 - TD Lamdba for multiple values of $\lambda$

Ideally this code should run as is

In [30]:
# This cell is only for your subjective evaluation results, display the results as asked in the pdf
# You can change it as you require, this code should run TD lamdba by default for different values of lambda

lamda_values = np.arange(0, 100+5, 5)/100
td_lamda_results = {}
extra_info = {}
for lamda in lamda_values:
    env = GridEnv_HW2(**base_kwargs)
    td_lamda_results[lamda], extra_info[lamda] = td_lambda(env, lamda,
                                                           seeds=np.arange(1000))

Generate Results ✅

In [31]:
def get_results(kwargs):

    gridenv = GridEnv_HW2(**kwargs)

    policy_iteration_results = policy_iteration(gridenv, 0.7)[0]
    value_iteration_results = value_iteration(gridenv, 0.7)[0]
    td_lambda_results = td_lambda(env, 0.5, np.arange(1000))[0]
    
    final_results = {}
    final_results["policy_iteration"] = policy_iteration_results
    final_results["value_iteration"] = value_iteration_results
    final_results["td_lambda"] = td_lambda_results

    return final_results
In [73]:
# Do not edit this cell, generate results with it as is
if not os.path.exists(AICROWD_RESULTS_DIR):
    os.mkdir(AICROWD_RESULTS_DIR)

for params_file in os.listdir(DATASET_DIR):
  kwargs = np.load(os.path.join(DATASET_DIR, params_file), allow_pickle=True).item()
  results = get_results(kwargs)
  idx = params_file.split('_')[-1][:-4]
  np.save(os.path.join(AICROWD_RESULTS_DIR, 'results_' + idx), results)

Check your score on the public data

This scores is not your final score, and it doesn't use the marks weightages. This is only for your reference of how arrays are matched and with what tolerance.

In [74]:
# Check your score on the given test cases (There are more private test cases not provided)
target_folder = 'targets'
result_folder = AICROWD_RESULTS_DIR

def check_algo_match(results, targets):
    if 'Policy' in results:
        policy_match = results['Policy'] == targets['Policy']
    else:
        policy_match = True
    # Reference https://numpy.org/doc/stable/reference/generated/numpy.allclose.html
    rewards_match = np.allclose(results['Values'], targets['Values'], rtol=3)
    equal = rewards_match and policy_match
    return equal

def check_score(target_folder, result_folder):
    match = []
    for out_file in os.listdir(result_folder):
        res_file = os.path.join(result_folder, out_file)
        results = np.load(res_file, allow_pickle=True).item()
        idx = out_file.split('_')[-1][:-4]  # Extract the file number
        target_file = os.path.join(target_folder, f"targets_{idx}.npy")
        targets = np.load(target_file, allow_pickle=True).item()
        algo_match = []
        for k in targets:
            algo_results = results[k]
            algo_targets = targets[k]
            print('k: ',k)
            print('aglo_results: ',algo_results)
            print('algo_targets: ',algo_targets)
            algo_match.append(check_algo_match(algo_results, algo_targets))
        match.append(np.mean(algo_match))
    return np.mean(match)

if os.path.exists(target_folder):
    print("Shared data Score (normalized to 1):", check_score(target_folder, result_folder))
k:  policy_iteration
aglo_results:  {'Values': array([[-2.46275854, -2.76083815, -3.02708341, -3.18470615, -3.26295115,
        -3.29789396, -3.30884987, -3.30567726, -3.31830887, -3.32485289],
       [-1.2986248 , -2.08484303, -2.70245736, -3.03813227, -3.19690025,
        -3.26660233, -3.28636816, -3.26581577, -3.30278955, -3.31802395],
       [ 2.41759509, -0.09673608, -1.79185073, -2.63499651, -3.02416847,
        -3.19059198, -3.23147986, -3.12756987, -3.26701566, -3.30686575],
       [13.41316139,  5.09782531,  0.46290022, -1.70402077, -2.65885863,
        -3.05780082, -3.210497  , -3.24596799, -3.29642296, -3.3155428 ],
       [46.06376654, 18.01479973,  5.5578918 ,  0.13229419, -2.02689072,
        -2.84858819, -3.15254032, -3.26160562, -3.30443986, -3.31949198],
       [ 0.        , 43.28984743, 14.6652538 ,  2.47234784, -1.4139694 ,
        -2.6857767 , -3.11081207, -3.25503909, -3.30466731, -3.32055469],
       [46.78475872, 17.72107474,  5.16077726, -0.08199397, -2.12226736,
        -2.88874854, -3.17126198, -3.27422222, -3.31125225, -3.32339259],
       [13.94655062,  5.41280061,  0.47378806, -1.78729709, -2.71857466,
        -3.09305105, -3.24062394, -3.29780457, -3.31947287, -3.32685625],
       [ 2.81928477,  0.22803461, -1.64398709, -2.60683311, -3.0337407 ,
        -3.21118832, -3.28406823, -3.3135965 , -3.32528326, -3.32940849],
       [-0.67919718, -1.63281145, -2.45812666, -2.93394332, -3.1618047 ,
        -3.26065235, -3.3029011 , -3.32068652, -3.3279813 , -3.33063051]]), 'Policy': array([['E', 'E', 'E', 'E', 'N', 'N', 'E', 'E', 'E', 'N'],
       ['E', 'E', 'E', 'E', 'N', 'N', 'E', 'E', 'N', 'N'],
       ['E', 'E', 'E', 'N', 'N', 'N', 'S', 'N', 'N', 'N'],
       ['E', 'E', 'N', 'N', 'N', 'N', 'N', 'W', 'N', 'N'],
       ['E', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N'],
       ['N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N'],
       ['W', 'W', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N'],
       ['W', 'W', 'W', 'N', 'N', 'N', 'N', 'N', 'N', 'N'],
       ['W', 'W', 'W', 'W', 'N', 'N', 'N', 'N', 'N', 'N'],
       ['W', 'W', 'W', 'W', 'N', 'N', 'N', 'N', 'N', 'N']], dtype=object)}
algo_targets:  {'Values': array([[-2.46275855, -2.76083816, -3.02708342, -3.18470617, -3.26295116,
        -3.29789398, -3.30884988, -3.30567727, -3.31830888, -3.3248529 ],
       [-1.29862481, -2.08484304, -2.70245737, -3.03813228, -3.19690026,
        -3.26660234, -3.28636817, -3.26581578, -3.30278956, -3.31802396],
       [ 2.41759508, -0.09673609, -1.79185074, -2.63499652, -3.02416848,
        -3.19059199, -3.23147986, -3.12756987, -3.26701567, -3.30686576],
       [13.41316138,  5.0978253 ,  0.46290021, -1.70402078, -2.65885864,
        -3.05780082, -3.21049701, -3.245968  , -3.29642297, -3.3155428 ],
       [46.06376653, 18.01479973,  5.55789179,  0.13229418, -2.02689073,
        -2.84858819, -3.15254032, -3.26160562, -3.30443986, -3.31949198],
       [ 0.        , 43.28984743, 14.66525379,  2.47234783, -1.4139694 ,
        -2.6857767 , -3.11081207, -3.25503909, -3.30466731, -3.32055469],
       [46.78475872, 17.72107474,  5.16077726, -0.08199397, -2.12226736,
        -2.88874854, -3.17126198, -3.27422222, -3.31125226, -3.32339259],
       [13.94655062,  5.41280061,  0.47378806, -1.78729709, -2.71857467,
        -3.09305105, -3.24062394, -3.29780457, -3.31947287, -3.32685625],
       [ 2.81928477,  0.22803461, -1.64398709, -2.60683311, -3.0337407 ,
        -3.21118832, -3.28406823, -3.3135965 , -3.32528326, -3.32940849],
       [-0.67919718, -1.63281145, -2.45812666, -2.93394332, -3.1618047 ,
        -3.26065235, -3.3029011 , -3.32068652, -3.3279813 , -3.33063051]]), 'Policy': array([['E', 'E', 'E', 'E', 'N', 'N', 'E', 'E', 'E', 'N'],
       ['E', 'E', 'E', 'E', 'N', 'N', 'E', 'E', 'N', 'N'],
       ['E', 'E', 'E', 'N', 'N', 'N', 'S', 'N', 'N', 'N'],
       ['E', 'E', 'N', 'N', 'N', 'N', 'N', 'W', 'N', 'N'],
       ['E', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N'],
       ['N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N'],
       ['W', 'W', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N'],
       ['W', 'W', 'W', 'N', 'N', 'N', 'N', 'N', 'N', 'N'],
       ['W', 'W', 'W', 'W', 'N', 'N', 'N', 'N', 'N', 'N'],
       ['W', 'W', 'W', 'W', 'N', 'N', 'N', 'N', 'N', 'N']], dtype=object)}
k:  value_iteration
aglo_results:  {'Values': array([[-2.46275855, -2.76083815, -3.02708342, -3.18470616, -3.26295115,
        -3.29789397, -3.30884988, -3.30567726, -3.31830888, -3.32485289],
       [-1.29862481, -2.08484304, -2.70245737, -3.03813228, -3.19690026,
        -3.26660234, -3.28636816, -3.26581577, -3.30278955, -3.31802395],
       [ 2.41759508, -0.09673609, -1.79185074, -2.63499652, -3.02416848,
        -3.19059199, -3.23147986, -3.12756987, -3.26701566, -3.30686575],
       [13.41316138,  5.0978253 ,  0.46290021, -1.70402078, -2.65885864,
        -3.05780083, -3.21049701, -3.245968  , -3.29642297, -3.3155428 ],
       [46.06376653, 18.01479973,  5.55789179,  0.13229418, -2.02689073,
        -2.8485882 , -3.15254032, -3.26160562, -3.30443986, -3.31949198],
       [ 0.        , 43.28984742, 14.66525379,  2.47234783, -1.41396941,
        -2.6857767 , -3.11081207, -3.25503909, -3.30466731, -3.32055469],
       [46.78475871, 17.72107474,  5.16077725, -0.08199398, -2.12226737,
        -2.88874855, -3.17126199, -3.27422222, -3.31125226, -3.32339259],
       [13.94655061,  5.4128006 ,  0.47378805, -1.7872971 , -2.71857467,
        -3.09305106, -3.24062395, -3.29780457, -3.31947287, -3.32685625],
       [ 2.81928476,  0.2280346 , -1.6439871 , -2.60683312, -3.03374071,
        -3.21118833, -3.28406823, -3.31359651, -3.32528326, -3.3294085 ],
       [-0.6791972 , -1.63281146, -2.45812667, -2.93394334, -3.16180472,
        -3.26065236, -3.30290111, -3.32068653, -3.3279813 , -3.33063051]]), 'Policy': array([['E', 'E', 'E', 'E', 'N', 'N', 'E', 'E', 'E', 'N'],
       ['E', 'E', 'E', 'E', 'N', 'N', 'E', 'E', 'N', 'N'],
       ['E', 'E', 'E', 'N', 'N', 'N', 'S', 'N', 'N', 'N'],
       ['E', 'E', 'N', 'N', 'N', 'N', 'N', 'W', 'N', 'N'],
       ['E', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N'],
       ['N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N'],
       ['W', 'W', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N'],
       ['W', 'W', 'W', 'N', 'N', 'N', 'N', 'N', 'N', 'N'],
       ['W', 'W', 'W', 'W', 'N', 'N', 'N', 'N', 'N', 'N'],
       ['W', 'W', 'W', 'W', 'N', 'N', 'N', 'N', 'N', 'N']], dtype=object)}
algo_targets:  {'Values': array([[-2.46275855, -2.76083815, -3.02708342, -3.18470616, -3.26295115,
        -3.29789397, -3.30884988, -3.30567726, -3.31830888, -3.32485289],
       [-1.29862481, -2.08484304, -2.70245737, -3.03813228, -3.19690026,
        -3.26660234, -3.28636816, -3.26581577, -3.30278955, -3.31802395],
       [ 2.41759508, -0.09673609, -1.79185074, -2.63499652, -3.02416848,
        -3.19059199, -3.23147986, -3.12756987, -3.26701566, -3.30686575],
       [13.41316138,  5.0978253 ,  0.46290021, -1.70402078, -2.65885864,
        -3.05780083, -3.21049701, -3.245968  , -3.29642297, -3.3155428 ],
       [46.06376653, 18.01479973,  5.55789179,  0.13229418, -2.02689073,
        -2.8485882 , -3.15254032, -3.26160562, -3.30443986, -3.31949198],
       [ 0.        , 43.28984742, 14.66525379,  2.47234783, -1.41396941,
        -2.6857767 , -3.11081207, -3.25503909, -3.30466731, -3.32055469],
       [46.78475871, 17.72107474,  5.16077725, -0.08199398, -2.12226737,
        -2.88874855, -3.17126199, -3.27422222, -3.31125226, -3.32339259],
       [13.94655061,  5.4128006 ,  0.47378805, -1.7872971 , -2.71857467,
        -3.09305106, -3.24062395, -3.29780457, -3.31947287, -3.32685625],
       [ 2.81928476,  0.2280346 , -1.6439871 , -2.60683312, -3.03374071,
        -3.21118833, -3.28406823, -3.31359651, -3.32528326, -3.3294085 ],
       [-0.6791972 , -1.63281146, -2.45812667, -2.93394334, -3.16180472,
        -3.26065236, -3.30290111, -3.32068653, -3.3279813 , -3.33063051]]), 'Policy': array([['E', 'E', 'E', 'E', 'N', 'N', 'E', 'E', 'E', 'N'],
       ['E', 'E', 'E', 'E', 'N', 'N', 'E', 'E', 'N', 'N'],
       ['E', 'E', 'E', 'N', 'N', 'N', 'S', 'N', 'N', 'N'],
       ['E', 'E', 'N', 'N', 'N', 'N', 'N', 'W', 'N', 'N'],
       ['E', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N'],
       ['N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N'],
       ['W', 'W', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N'],
       ['W', 'W', 'W', 'N', 'N', 'N', 'N', 'N', 'N', 'N'],
       ['W', 'W', 'W', 'W', 'N', 'N', 'N', 'N', 'N', 'N'],
       ['W', 'W', 'W', 'W', 'N', 'N', 'N', 'N', 'N', 'N']], dtype=object)}
k:  td_lambda
aglo_results:  {'Values': array([[1.17065175e-01, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,
        0.00000000e+00, 1.20869146e-02, 6.50801063e-03, 1.08455100e-01,
        1.25939840e-01, 0.00000000e+00],
       [0.00000000e+00, 0.00000000e+00, 9.30697487e-03, 6.74433462e-03,
        2.87816477e-02, 3.12467594e-02, 1.03059572e-01, 1.52781881e-01,
        1.58366091e-01, 0.00000000e+00],
       [1.77384263e-03, 1.47800884e-02, 2.74846931e-02, 3.04573845e-02,
        7.14399810e-02, 1.01562738e-01, 1.53524012e-01, 2.30581627e-01,
        1.78870946e-01, 1.75414748e-01],
       [6.40534487e-03, 2.82016679e-02, 3.19684901e-02, 5.26038043e-02,
        7.84100241e-02, 1.72884035e-01, 1.99857466e-01, 3.47990968e-01,
        5.79664376e-01, 2.56996466e-01],
       [2.04541062e-02, 4.19457138e-02, 5.22520506e-02, 1.02433955e-01,
        1.58553992e-01, 2.27612595e-01, 3.84148807e-01, 5.65629731e-01,
        1.07566085e+00, 9.74159503e-01],
       [2.39275526e-02, 6.98107944e-02, 8.44269638e-02, 1.09999353e-01,
        2.47482489e-01, 4.01109042e-01, 5.24005132e-01, 9.62735996e-01,
        1.61645974e+00, 1.43942491e+00],
       [2.09996045e-02, 8.22097499e-02, 2.10721662e-01, 3.12594289e-01,
        4.84813194e-01, 8.16088700e-01, 1.29269479e+00, 1.65792382e+00,
        2.20209915e+00, 3.39107140e+00],
       [0.00000000e+00, 5.22314165e-02, 2.41595651e-01, 4.22467516e-01,
        6.25736022e-01, 7.12439438e-01, 2.08346370e+00, 3.28464640e+00,
        3.79746486e+00, 5.89371046e+00],
       [0.00000000e+00, 0.00000000e+00, 4.14289002e-02, 1.78576928e-01,
        9.12966633e-01, 1.40156387e+00, 1.27983718e+00, 4.84976577e+00,
        6.98025075e+00, 9.92256338e+00],
       [0.00000000e+00, 0.00000000e+00, 6.74471744e-03, 1.92706213e-02,
        3.49830663e-02, 5.96848511e-02, 8.28928265e-02, 1.05060024e-01,
        1.00046447e+01, 0.00000000e+00]])}
algo_targets:  {'Values': array([[1.17065175e-01, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,
        0.00000000e+00, 1.20869146e-02, 6.50801063e-03, 1.08455100e-01,
        1.25939840e-01, 0.00000000e+00],
       [0.00000000e+00, 0.00000000e+00, 9.30697487e-03, 6.74433462e-03,
        2.87816477e-02, 3.12467594e-02, 1.03059572e-01, 1.52781881e-01,
        1.58366091e-01, 0.00000000e+00],
       [1.77384263e-03, 1.47800884e-02, 2.74846931e-02, 3.04573845e-02,
        7.14399810e-02, 1.01562738e-01, 1.53524012e-01, 2.30581627e-01,
        1.78870946e-01, 1.75414748e-01],
       [6.40534487e-03, 2.82016679e-02, 3.19684901e-02, 5.26038043e-02,
        7.84100241e-02, 1.72884035e-01, 1.99857466e-01, 3.47990968e-01,
        5.79664376e-01, 2.56996466e-01],
       [2.04541062e-02, 4.19457138e-02, 5.22520506e-02, 1.02433955e-01,
        1.58553992e-01, 2.27612595e-01, 3.84148807e-01, 5.65629731e-01,
        1.07566085e+00, 9.74159503e-01],
       [2.39275526e-02, 6.98107944e-02, 8.44269638e-02, 1.09999353e-01,
        2.47482489e-01, 4.01109042e-01, 5.24005132e-01, 9.62735996e-01,
        1.61645974e+00, 1.43942491e+00],
       [2.09996045e-02, 8.22097499e-02, 2.10721662e-01, 3.12594289e-01,
        4.84813194e-01, 8.16088700e-01, 1.29269479e+00, 1.65792382e+00,
        2.20209915e+00, 3.39107140e+00],
       [0.00000000e+00, 5.22314165e-02, 2.41595651e-01, 4.22467516e-01,
        6.25736022e-01, 7.12439438e-01, 2.08346370e+00, 3.28464640e+00,
        3.79746486e+00, 5.89371046e+00],
       [0.00000000e+00, 0.00000000e+00, 4.14289002e-02, 1.78576928e-01,
        9.12966633e-01, 1.40156387e+00, 1.27983718e+00, 4.84976577e+00,
        6.98025075e+00, 9.92256338e+00],
       [0.00000000e+00, 0.00000000e+00, 6.74471744e-03, 1.92706213e-02,
        3.49830663e-02, 5.96848511e-02, 8.28928265e-02, 1.05060024e-01,
        1.00046447e+01, 0.00000000e+00]])}
k:  policy_iteration
aglo_results:  {'Values': array([[-2.46275854, -2.76083815, -3.02708341, -3.18470615, -3.26295115,
        -3.29789396, -3.30884987, -3.30567726, -3.31830887, -3.32485289],
       [-1.2986248 , -2.08484303, -2.70245736, -3.03813227, -3.19690025,
        -3.26660233, -3.28636816, -3.26581577, -3.30278955, -3.31802395],
       [ 2.41759509, -0.09673608, -1.79185073, -2.63499651, -3.02416847,
        -3.19059198, -3.23147986, -3.12756987, -3.26701566, -3.30686575],
       [13.41316139,  5.09782531,  0.46290022, -1.70402077, -2.65885863,
        -3.05780082, -3.210497  , -3.24596799, -3.29642296, -3.3155428 ],
       [46.06376654, 18.01479973,  5.5578918 ,  0.13229419, -2.02689072,
        -2.84858819, -3.15254032, -3.26160562, -3.30443986, -3.31949198],
       [ 0.        , 43.28984743, 14.6652538 ,  2.47234784, -1.4139694 ,
        -2.6857767 , -3.11081207, -3.25503909, -3.30466731, -3.32055469],
       [46.78475872, 17.72107474,  5.16077726, -0.08199397, -2.12226736,
        -2.88874854, -3.17126198, -3.27422222, -3.31125225, -3.32339259],
       [13.94655062,  5.41280061,  0.47378806, -1.78729709, -2.71857466,
        -3.09305105, -3.24062394, -3.29780457, -3.31947287, -3.32685625],
       [ 2.81928477,  0.22803461, -1.64398709, -2.60683311, -3.0337407 ,
        -3.21118832, -3.28406823, -3.3135965 , -3.32528326, -3.32940849],
       [-0.67919718, -1.63281145, -2.45812666, -2.93394332, -3.1618047 ,
        -3.26065235, -3.3029011 , -3.32068652, -3.3279813 , -3.33063051]]), 'Policy': array([['E', 'E', 'E', 'E', 'N', 'N', 'E', 'E', 'E', 'N'],
       ['E', 'E', 'E', 'E', 'N', 'N', 'E', 'E', 'N', 'N'],
       ['E', 'E', 'E', 'N', 'N', 'N', 'S', 'N', 'N', 'N'],
       ['E', 'E', 'N', 'N', 'N', 'N', 'N', 'W', 'N', 'N'],
       ['E', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N'],
       ['N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N'],
       ['W', 'W', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N'],
       ['W', 'W', 'W', 'N', 'N', 'N', 'N', 'N', 'N', 'N'],
       ['W', 'W', 'W', 'W', 'N', 'N', 'N', 'N', 'N', 'N'],
       ['W', 'W', 'W', 'W', 'N', 'N', 'N', 'N', 'N', 'N']], dtype=object)}
algo_targets:  {'Values': array([[-2.46275855, -2.76083816, -3.02708342, -3.18470617, -3.26295116,
        -3.29789398, -3.30884988, -3.30567727, -3.31830888, -3.3248529 ],
       [-1.29862481, -2.08484304, -2.70245737, -3.03813228, -3.19690026,
        -3.26660234, -3.28636817, -3.26581578, -3.30278956, -3.31802396],
       [ 2.41759508, -0.09673609, -1.79185074, -2.63499652, -3.02416848,
        -3.19059199, -3.23147986, -3.12756987, -3.26701567, -3.30686576],
       [13.41316138,  5.0978253 ,  0.46290021, -1.70402078, -2.65885864,
        -3.05780082, -3.21049701, -3.245968  , -3.29642297, -3.3155428 ],
       [46.06376653, 18.01479973,  5.55789179,  0.13229418, -2.02689073,
        -2.84858819, -3.15254032, -3.26160562, -3.30443986, -3.31949198],
       [ 0.        , 43.28984743, 14.66525379,  2.47234783, -1.4139694 ,
        -2.6857767 , -3.11081207, -3.25503909, -3.30466731, -3.32055469],
       [46.78475872, 17.72107474,  5.16077726, -0.08199397, -2.12226736,
        -2.88874854, -3.17126198, -3.27422222, -3.31125226, -3.32339259],
       [13.94655062,  5.41280061,  0.47378806, -1.78729709, -2.71857467,
        -3.09305105, -3.24062394, -3.29780457, -3.31947287, -3.32685625],
       [ 2.81928477,  0.22803461, -1.64398709, -2.60683311, -3.0337407 ,
        -3.21118832, -3.28406823, -3.3135965 , -3.32528326, -3.32940849],
       [-0.67919718, -1.63281145, -2.45812666, -2.93394332, -3.1618047 ,
        -3.26065235, -3.3029011 , -3.32068652, -3.3279813 , -3.33063051]]), 'Policy': array([['E', 'E', 'E', 'E', 'N', 'N', 'E', 'E', 'E', 'N'],
       ['E', 'E', 'E', 'E', 'N', 'N', 'E', 'E', 'N', 'N'],
       ['E', 'E', 'E', 'N', 'N', 'N', 'S', 'N', 'N', 'N'],
       ['E', 'E', 'N', 'N', 'N', 'N', 'N', 'W', 'N', 'N'],
       ['E', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N'],
       ['N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N'],
       ['W', 'W', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N'],
       ['W', 'W', 'W', 'N', 'N', 'N', 'N', 'N', 'N', 'N'],
       ['W', 'W', 'W', 'W', 'N', 'N', 'N', 'N', 'N', 'N'],
       ['W', 'W', 'W', 'W', 'N', 'N', 'N', 'N', 'N', 'N']], dtype=object)}
k:  value_iteration
aglo_results:  {'Values': array([[-2.46275855, -2.76083815, -3.02708342, -3.18470616, -3.26295115,
        -3.29789397, -3.30884988, -3.30567726, -3.31830888, -3.32485289],
       [-1.29862481, -2.08484304, -2.70245737, -3.03813228, -3.19690026,
        -3.26660234, -3.28636816, -3.26581577, -3.30278955, -3.31802395],
       [ 2.41759508, -0.09673609, -1.79185074, -2.63499652, -3.02416848,
        -3.19059199, -3.23147986, -3.12756987, -3.26701566, -3.30686575],
       [13.41316138,  5.0978253 ,  0.46290021, -1.70402078, -2.65885864,
        -3.05780083, -3.21049701, -3.245968  , -3.29642297, -3.3155428 ],
       [46.06376653, 18.01479973,  5.55789179,  0.13229418, -2.02689073,
        -2.8485882 , -3.15254032, -3.26160562, -3.30443986, -3.31949198],
       [ 0.        , 43.28984742, 14.66525379,  2.47234783, -1.41396941,
        -2.6857767 , -3.11081207, -3.25503909, -3.30466731, -3.32055469],
       [46.78475871, 17.72107474,  5.16077725, -0.08199398, -2.12226737,
        -2.88874855, -3.17126199, -3.27422222, -3.31125226, -3.32339259],
       [13.94655061,  5.4128006 ,  0.47378805, -1.7872971 , -2.71857467,
        -3.09305106, -3.24062395, -3.29780457, -3.31947287, -3.32685625],
       [ 2.81928476,  0.2280346 , -1.6439871 , -2.60683312, -3.03374071,
        -3.21118833, -3.28406823, -3.31359651, -3.32528326, -3.3294085 ],
       [-0.6791972 , -1.63281146, -2.45812667, -2.93394334, -3.16180472,
        -3.26065236, -3.30290111, -3.32068653, -3.3279813 , -3.33063051]]), 'Policy': array([['E', 'E', 'E', 'E', 'N', 'N', 'E', 'E', 'E', 'N'],
       ['E', 'E', 'E', 'E', 'N', 'N', 'E', 'E', 'N', 'N'],
       ['E', 'E', 'E', 'N', 'N', 'N', 'S', 'N', 'N', 'N'],
       ['E', 'E', 'N', 'N', 'N', 'N', 'N', 'W', 'N', 'N'],
       ['E', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N'],
       ['N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N'],
       ['W', 'W', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N'],
       ['W', 'W', 'W', 'N', 'N', 'N', 'N', 'N', 'N', 'N'],
       ['W', 'W', 'W', 'W', 'N', 'N', 'N', 'N', 'N', 'N'],
       ['W', 'W', 'W', 'W', 'N', 'N', 'N', 'N', 'N', 'N']], dtype=object)}
algo_targets:  {'Values': array([[-2.46275855, -2.76083815, -3.02708342, -3.18470616, -3.26295115,
        -3.29789397, -3.30884988, -3.30567726, -3.31830888, -3.32485289],
       [-1.29862481, -2.08484304, -2.70245737, -3.03813228, -3.19690026,
        -3.26660234, -3.28636816, -3.26581577, -3.30278955, -3.31802395],
       [ 2.41759508, -0.09673609, -1.79185074, -2.63499652, -3.02416848,
        -3.19059199, -3.23147986, -3.12756987, -3.26701566, -3.30686575],
       [13.41316138,  5.0978253 ,  0.46290021, -1.70402078, -2.65885864,
        -3.05780083, -3.21049701, -3.245968  , -3.29642297, -3.3155428 ],
       [46.06376653, 18.01479973,  5.55789179,  0.13229418, -2.02689073,
        -2.8485882 , -3.15254032, -3.26160562, -3.30443986, -3.31949198],
       [ 0.        , 43.28984742, 14.66525379,  2.47234783, -1.41396941,
        -2.6857767 , -3.11081207, -3.25503909, -3.30466731, -3.32055469],
       [46.78475871, 17.72107474,  5.16077725, -0.08199398, -2.12226737,
        -2.88874855, -3.17126199, -3.27422222, -3.31125226, -3.32339259],
       [13.94655061,  5.4128006 ,  0.47378805, -1.7872971 , -2.71857467,
        -3.09305106, -3.24062395, -3.29780457, -3.31947287, -3.32685625],
       [ 2.81928476,  0.2280346 , -1.6439871 , -2.60683312, -3.03374071,
        -3.21118833, -3.28406823, -3.31359651, -3.32528326, -3.3294085 ],
       [-0.6791972 , -1.63281146, -2.45812667, -2.93394334, -3.16180472,
        -3.26065236, -3.30290111, -3.32068653, -3.3279813 , -3.33063051]]), 'Policy': array([['E', 'E', 'E', 'E', 'N', 'N', 'E', 'E', 'E', 'N'],
       ['E', 'E', 'E', 'E', 'N', 'N', 'E', 'E', 'N', 'N'],
       ['E', 'E', 'E', 'N', 'N', 'N', 'S', 'N', 'N', 'N'],
       ['E', 'E', 'N', 'N', 'N', 'N', 'N', 'W', 'N', 'N'],
       ['E', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N'],
       ['N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N'],
       ['W', 'W', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N'],
       ['W', 'W', 'W', 'N', 'N', 'N', 'N', 'N', 'N', 'N'],
       ['W', 'W', 'W', 'W', 'N', 'N', 'N', 'N', 'N', 'N'],
       ['W', 'W', 'W', 'W', 'N', 'N', 'N', 'N', 'N', 'N']], dtype=object)}
k:  td_lambda
aglo_results:  {'Values': array([[1.17065175e-01, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,
        0.00000000e+00, 1.20869146e-02, 6.50801063e-03, 1.08455100e-01,
        1.25939840e-01, 0.00000000e+00],
       [0.00000000e+00, 0.00000000e+00, 9.30697487e-03, 6.74433462e-03,
        2.87816477e-02, 3.12467594e-02, 1.03059572e-01, 1.52781881e-01,
        1.58366091e-01, 0.00000000e+00],
       [1.77384263e-03, 1.47800884e-02, 2.74846931e-02, 3.04573845e-02,
        7.14399810e-02, 1.01562738e-01, 1.53524012e-01, 2.30581627e-01,
        1.78870946e-01, 1.75414748e-01],
       [6.40534487e-03, 2.82016679e-02, 3.19684901e-02, 5.26038043e-02,
        7.84100241e-02, 1.72884035e-01, 1.99857466e-01, 3.47990968e-01,
        5.79664376e-01, 2.56996466e-01],
       [2.04541062e-02, 4.19457138e-02, 5.22520506e-02, 1.02433955e-01,
        1.58553992e-01, 2.27612595e-01, 3.84148807e-01, 5.65629731e-01,
        1.07566085e+00, 9.74159503e-01],
       [2.39275526e-02, 6.98107944e-02, 8.44269638e-02, 1.09999353e-01,
        2.47482489e-01, 4.01109042e-01, 5.24005132e-01, 9.62735996e-01,
        1.61645974e+00, 1.43942491e+00],
       [2.09996045e-02, 8.22097499e-02, 2.10721662e-01, 3.12594289e-01,
        4.84813194e-01, 8.16088700e-01, 1.29269479e+00, 1.65792382e+00,
        2.20209915e+00, 3.39107140e+00],
       [0.00000000e+00, 5.22314165e-02, 2.41595651e-01, 4.22467516e-01,
        6.25736022e-01, 7.12439438e-01, 2.08346370e+00, 3.28464640e+00,
        3.79746486e+00, 5.89371046e+00],
       [0.00000000e+00, 0.00000000e+00, 4.14289002e-02, 1.78576928e-01,
        9.12966633e-01, 1.40156387e+00, 1.27983718e+00, 4.84976577e+00,
        6.98025075e+00, 9.92256338e+00],
       [0.00000000e+00, 0.00000000e+00, 6.74471744e-03, 1.92706213e-02,
        3.49830663e-02, 5.96848511e-02, 8.28928265e-02, 1.05060024e-01,
        1.00046447e+01, 0.00000000e+00]])}
algo_targets:  {'Values': array([[1.17065175e-01, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,
        0.00000000e+00, 1.20869146e-02, 6.50801063e-03, 1.08455100e-01,
        1.25939840e-01, 0.00000000e+00],
       [0.00000000e+00, 0.00000000e+00, 9.30697487e-03, 6.74433462e-03,
        2.87816477e-02, 3.12467594e-02, 1.03059572e-01, 1.52781881e-01,
        1.58366091e-01, 0.00000000e+00],
       [1.77384263e-03, 1.47800884e-02, 2.74846931e-02, 3.04573845e-02,
        7.14399810e-02, 1.01562738e-01, 1.53524012e-01, 2.30581627e-01,
        1.78870946e-01, 1.75414748e-01],
       [6.40534487e-03, 2.82016679e-02, 3.19684901e-02, 5.26038043e-02,
        7.84100241e-02, 1.72884035e-01, 1.99857466e-01, 3.47990968e-01,
        5.79664376e-01, 2.56996466e-01],
       [2.04541062e-02, 4.19457138e-02, 5.22520506e-02, 1.02433955e-01,
        1.58553992e-01, 2.27612595e-01, 3.84148807e-01, 5.65629731e-01,
        1.07566085e+00, 9.74159503e-01],
       [2.39275526e-02, 6.98107944e-02, 8.44269638e-02, 1.09999353e-01,
        2.47482489e-01, 4.01109042e-01, 5.24005132e-01, 9.62735996e-01,
        1.61645974e+00, 1.43942491e+00],
       [2.09996045e-02, 8.22097499e-02, 2.10721662e-01, 3.12594289e-01,
        4.84813194e-01, 8.16088700e-01, 1.29269479e+00, 1.65792382e+00,
        2.20209915e+00, 3.39107140e+00],
       [0.00000000e+00, 5.22314165e-02, 2.41595651e-01, 4.22467516e-01,
        6.25736022e-01, 7.12439438e-01, 2.08346370e+00, 3.28464640e+00,
        3.79746486e+00, 5.89371046e+00],
       [0.00000000e+00, 0.00000000e+00, 4.14289002e-02, 1.78576928e-01,
        9.12966633e-01, 1.40156387e+00, 1.27983718e+00, 4.84976577e+00,
        6.98025075e+00, 9.92256338e+00],
       [0.00000000e+00, 0.00000000e+00, 6.74471744e-03, 1.92706213e-02,
        3.49830663e-02, 5.96848511e-02, 8.28928265e-02, 1.05060024e-01,
        1.00046447e+01, 0.00000000e+00]])}
k:  policy_iteration
aglo_results:  {'Values': array([[-2.46275854, -2.76083815, -3.02708341, -3.18470615, -3.26295115,
        -3.29789396, -3.30884987, -3.30567726, -3.31830887, -3.32485289],
       [-1.2986248 , -2.08484303, -2.70245736, -3.03813227, -3.19690025,
        -3.26660233, -3.28636816, -3.26581577, -3.30278955, -3.31802395],
       [ 2.41759509, -0.09673608, -1.79185073, -2.63499651, -3.02416847,
        -3.19059198, -3.23147986, -3.12756987, -3.26701566, -3.30686575],
       [13.41316139,  5.09782531,  0.46290022, -1.70402077, -2.65885863,
        -3.05780082, -3.210497  , -3.24596799, -3.29642296, -3.3155428 ],
       [46.06376654, 18.01479973,  5.5578918 ,  0.13229419, -2.02689072,
        -2.84858819, -3.15254032, -3.26160562, -3.30443986, -3.31949198],
       [ 0.        , 43.28984743, 14.6652538 ,  2.47234784, -1.4139694 ,
        -2.6857767 , -3.11081207, -3.25503909, -3.30466731, -3.32055469],
       [46.78475872, 17.72107474,  5.16077726, -0.08199397, -2.12226736,
        -2.88874854, -3.17126198, -3.27422222, -3.31125225, -3.32339259],
       [13.94655062,  5.41280061,  0.47378806, -1.78729709, -2.71857466,
        -3.09305105, -3.24062394, -3.29780457, -3.31947287, -3.32685625],
       [ 2.81928477,  0.22803461, -1.64398709, -2.60683311, -3.0337407 ,
        -3.21118832, -3.28406823, -3.3135965 , -3.32528326, -3.32940849],
       [-0.67919718, -1.63281145, -2.45812666, -2.93394332, -3.1618047 ,
        -3.26065235, -3.3029011 , -3.32068652, -3.3279813 , -3.33063051]]), 'Policy': array([['E', 'E', 'E', 'E', 'N', 'N', 'E', 'E', 'E', 'N'],
       ['E', 'E', 'E', 'E', 'N', 'N', 'E', 'E', 'N', 'N'],
       ['E', 'E', 'E', 'N', 'N', 'N', 'S', 'N', 'N', 'N'],
       ['E', 'E', 'N', 'N', 'N', 'N', 'N', 'W', 'N', 'N'],
       ['E', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N'],
       ['N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N'],
       ['W', 'W', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N'],
       ['W', 'W', 'W', 'N', 'N', 'N', 'N', 'N', 'N', 'N'],
       ['W', 'W', 'W', 'W', 'N', 'N', 'N', 'N', 'N', 'N'],
       ['W', 'W', 'W', 'W', 'N', 'N', 'N', 'N', 'N', 'N']], dtype=object)}
algo_targets:  {'Values': array([[-2.46275855, -2.76083816, -3.02708342, -3.18470617, -3.26295116,
        -3.29789398, -3.30884988, -3.30567727, -3.31830888, -3.3248529 ],
       [-1.29862481, -2.08484304, -2.70245737, -3.03813228, -3.19690026,
        -3.26660234, -3.28636817, -3.26581578, -3.30278956, -3.31802396],
       [ 2.41759508, -0.09673609, -1.79185074, -2.63499652, -3.02416848,
        -3.19059199, -3.23147986, -3.12756987, -3.26701567, -3.30686576],
       [13.41316138,  5.0978253 ,  0.46290021, -1.70402078, -2.65885864,
        -3.05780082, -3.21049701, -3.245968  , -3.29642297, -3.3155428 ],
       [46.06376653, 18.01479973,  5.55789179,  0.13229418, -2.02689073,
        -2.84858819, -3.15254032, -3.26160562, -3.30443986, -3.31949198],
       [ 0.        , 43.28984743, 14.66525379,  2.47234783, -1.4139694 ,
        -2.6857767 , -3.11081207, -3.25503909, -3.30466731, -3.32055469],
       [46.78475872, 17.72107474,  5.16077726, -0.08199397, -2.12226736,
        -2.88874854, -3.17126198, -3.27422222, -3.31125226, -3.32339259],
       [13.94655062,  5.41280061,  0.47378806, -1.78729709, -2.71857467,
        -3.09305105, -3.24062394, -3.29780457, -3.31947287, -3.32685625],
       [ 2.81928477,  0.22803461, -1.64398709, -2.60683311, -3.0337407 ,
        -3.21118832, -3.28406823, -3.3135965 , -3.32528326, -3.32940849],
       [-0.67919718, -1.63281145, -2.45812666, -2.93394332, -3.1618047 ,
        -3.26065235, -3.3029011 , -3.32068652, -3.3279813 , -3.33063051]]), 'Policy': array([['E', 'E', 'E', 'E', 'N', 'N', 'E', 'E', 'E', 'N'],
       ['E', 'E', 'E', 'E', 'N', 'N', 'E', 'E', 'N', 'N'],
       ['E', 'E', 'E', 'N', 'N', 'N', 'S', 'N', 'N', 'N'],
       ['E', 'E', 'N', 'N', 'N', 'N', 'N', 'W', 'N', 'N'],
       ['E', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N'],
       ['N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N'],
       ['W', 'W', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N'],
       ['W', 'W', 'W', 'N', 'N', 'N', 'N', 'N', 'N', 'N'],
       ['W', 'W', 'W', 'W', 'N', 'N', 'N', 'N', 'N', 'N'],
       ['W', 'W', 'W', 'W', 'N', 'N', 'N', 'N', 'N', 'N']], dtype=object)}
k:  value_iteration
aglo_results:  {'Values': array([[-2.46275855, -2.76083815, -3.02708342, -3.18470616, -3.26295115,
        -3.29789397, -3.30884988, -3.30567726, -3.31830888, -3.32485289],
       [-1.29862481, -2.08484304, -2.70245737, -3.03813228, -3.19690026,
        -3.26660234, -3.28636816, -3.26581577, -3.30278955, -3.31802395],
       [ 2.41759508, -0.09673609, -1.79185074, -2.63499652, -3.02416848,
        -3.19059199, -3.23147986, -3.12756987, -3.26701566, -3.30686575],
       [13.41316138,  5.0978253 ,  0.46290021, -1.70402078, -2.65885864,
        -3.05780083, -3.21049701, -3.245968  , -3.29642297, -3.3155428 ],
       [46.06376653, 18.01479973,  5.55789179,  0.13229418, -2.02689073,
        -2.8485882 , -3.15254032, -3.26160562, -3.30443986, -3.31949198],
       [ 0.        , 43.28984742, 14.66525379,  2.47234783, -1.41396941,
        -2.6857767 , -3.11081207, -3.25503909, -3.30466731, -3.32055469],
       [46.78475871, 17.72107474,  5.16077725, -0.08199398, -2.12226737,
        -2.88874855, -3.17126199, -3.27422222, -3.31125226, -3.32339259],
       [13.94655061,  5.4128006 ,  0.47378805, -1.7872971 , -2.71857467,
        -3.09305106, -3.24062395, -3.29780457, -3.31947287, -3.32685625],
       [ 2.81928476,  0.2280346 , -1.6439871 , -2.60683312, -3.03374071,
        -3.21118833, -3.28406823, -3.31359651, -3.32528326, -3.3294085 ],
       [-0.6791972 , -1.63281146, -2.45812667, -2.93394334, -3.16180472,
        -3.26065236, -3.30290111, -3.32068653, -3.3279813 , -3.33063051]]), 'Policy': array([['E', 'E', 'E', 'E', 'N', 'N', 'E', 'E', 'E', 'N'],
       ['E', 'E', 'E', 'E', 'N', 'N', 'E', 'E', 'N', 'N'],
       ['E', 'E', 'E', 'N', 'N', 'N', 'S', 'N', 'N', 'N'],
       ['E', 'E', 'N', 'N', 'N', 'N', 'N', 'W', 'N', 'N'],
       ['E', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N'],
       ['N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N'],
       ['W', 'W', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N'],
       ['W', 'W', 'W', 'N', 'N', 'N', 'N', 'N', 'N', 'N'],
       ['W', 'W', 'W', 'W', 'N', 'N', 'N', 'N', 'N', 'N'],
       ['W', 'W', 'W', 'W', 'N', 'N', 'N', 'N', 'N', 'N']], dtype=object)}
algo_targets:  {'Values': array([[-2.46275855, -2.76083815, -3.02708342, -3.18470616, -3.26295115,
        -3.29789397, -3.30884988, -3.30567726, -3.31830888, -3.32485289],
       [-1.29862481, -2.08484304, -2.70245737, -3.03813228, -3.19690026,
        -3.26660234, -3.28636816, -3.26581577, -3.30278955, -3.31802395],
       [ 2.41759508, -0.09673609, -1.79185074, -2.63499652, -3.02416848,
        -3.19059199, -3.23147986, -3.12756987, -3.26701566, -3.30686575],
       [13.41316138,  5.0978253 ,  0.46290021, -1.70402078, -2.65885864,
        -3.05780083, -3.21049701, -3.245968  , -3.29642297, -3.3155428 ],
       [46.06376653, 18.01479973,  5.55789179,  0.13229418, -2.02689073,
        -2.8485882 , -3.15254032, -3.26160562, -3.30443986, -3.31949198],
       [ 0.        , 43.28984742, 14.66525379,  2.47234783, -1.41396941,
        -2.6857767 , -3.11081207, -3.25503909, -3.30466731, -3.32055469],
       [46.78475871, 17.72107474,  5.16077725, -0.08199398, -2.12226737,
        -2.88874855, -3.17126199, -3.27422222, -3.31125226, -3.32339259],
       [13.94655061,  5.4128006 ,  0.47378805, -1.7872971 , -2.71857467,
        -3.09305106, -3.24062395, -3.29780457, -3.31947287, -3.32685625],
       [ 2.81928476,  0.2280346 , -1.6439871 , -2.60683312, -3.03374071,
        -3.21118833, -3.28406823, -3.31359651, -3.32528326, -3.3294085 ],
       [-0.6791972 , -1.63281146, -2.45812667, -2.93394334, -3.16180472,
        -3.26065236, -3.30290111, -3.32068653, -3.3279813 , -3.33063051]]), 'Policy': array([['E', 'E', 'E', 'E', 'N', 'N', 'E', 'E', 'E', 'N'],
       ['E', 'E', 'E', 'E', 'N', 'N', 'E', 'E', 'N', 'N'],
       ['E', 'E', 'E', 'N', 'N', 'N', 'S', 'N', 'N', 'N'],
       ['E', 'E', 'N', 'N', 'N', 'N', 'N', 'W', 'N', 'N'],
       ['E', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N'],
       ['N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N'],
       ['W', 'W', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N'],
       ['W', 'W', 'W', 'N', 'N', 'N', 'N', 'N', 'N', 'N'],
       ['W', 'W', 'W', 'W', 'N', 'N', 'N', 'N', 'N', 'N'],
       ['W', 'W', 'W', 'W', 'N', 'N', 'N', 'N', 'N', 'N']], dtype=object)}
k:  td_lambda
aglo_results:  {'Values': array([[1.17065175e-01, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,
        0.00000000e+00, 1.20869146e-02, 6.50801063e-03, 1.08455100e-01,
        1.25939840e-01, 0.00000000e+00],
       [0.00000000e+00, 0.00000000e+00, 9.30697487e-03, 6.74433462e-03,
        2.87816477e-02, 3.12467594e-02, 1.03059572e-01, 1.52781881e-01,
        1.58366091e-01, 0.00000000e+00],
       [1.77384263e-03, 1.47800884e-02, 2.74846931e-02, 3.04573845e-02,
        7.14399810e-02, 1.01562738e-01, 1.53524012e-01, 2.30581627e-01,
        1.78870946e-01, 1.75414748e-01],
       [6.40534487e-03, 2.82016679e-02, 3.19684901e-02, 5.26038043e-02,
        7.84100241e-02, 1.72884035e-01, 1.99857466e-01, 3.47990968e-01,
        5.79664376e-01, 2.56996466e-01],
       [2.04541062e-02, 4.19457138e-02, 5.22520506e-02, 1.02433955e-01,
        1.58553992e-01, 2.27612595e-01, 3.84148807e-01, 5.65629731e-01,
        1.07566085e+00, 9.74159503e-01],
       [2.39275526e-02, 6.98107944e-02, 8.44269638e-02, 1.09999353e-01,
        2.47482489e-01, 4.01109042e-01, 5.24005132e-01, 9.62735996e-01,
        1.61645974e+00, 1.43942491e+00],
       [2.09996045e-02, 8.22097499e-02, 2.10721662e-01, 3.12594289e-01,
        4.84813194e-01, 8.16088700e-01, 1.29269479e+00, 1.65792382e+00,
        2.20209915e+00, 3.39107140e+00],
       [0.00000000e+00, 5.22314165e-02, 2.41595651e-01, 4.22467516e-01,
        6.25736022e-01, 7.12439438e-01, 2.08346370e+00, 3.28464640e+00,
        3.79746486e+00, 5.89371046e+00],
       [0.00000000e+00, 0.00000000e+00, 4.14289002e-02, 1.78576928e-01,
        9.12966633e-01, 1.40156387e+00, 1.27983718e+00, 4.84976577e+00,
        6.98025075e+00, 9.92256338e+00],
       [0.00000000e+00, 0.00000000e+00, 6.74471744e-03, 1.92706213e-02,
        3.49830663e-02, 5.96848511e-02, 8.28928265e-02, 1.05060024e-01,
        1.00046447e+01, 0.00000000e+00]])}
algo_targets:  {'Values': array([[1.17065175e-01, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,
        0.00000000e+00, 1.20869146e-02, 6.50801063e-03, 1.08455100e-01,
        1.25939840e-01, 0.00000000e+00],
       [0.00000000e+00, 0.00000000e+00, 9.30697487e-03, 6.74433462e-03,
        2.87816477e-02, 3.12467594e-02, 1.03059572e-01, 1.52781881e-01,
        1.58366091e-01, 0.00000000e+00],
       [1.77384263e-03, 1.47800884e-02, 2.74846931e-02, 3.04573845e-02,
        7.14399810e-02, 1.01562738e-01, 1.53524012e-01, 2.30581627e-01,
        1.78870946e-01, 1.75414748e-01],
       [6.40534487e-03, 2.82016679e-02, 3.19684901e-02, 5.26038043e-02,
        7.84100241e-02, 1.72884035e-01, 1.99857466e-01, 3.47990968e-01,
        5.79664376e-01, 2.56996466e-01],
       [2.04541062e-02, 4.19457138e-02, 5.22520506e-02, 1.02433955e-01,
        1.58553992e-01, 2.27612595e-01, 3.84148807e-01, 5.65629731e-01,
        1.07566085e+00, 9.74159503e-01],
       [2.39275526e-02, 6.98107944e-02, 8.44269638e-02, 1.09999353e-01,
        2.47482489e-01, 4.01109042e-01, 5.24005132e-01, 9.62735996e-01,
        1.61645974e+00, 1.43942491e+00],
       [2.09996045e-02, 8.22097499e-02, 2.10721662e-01, 3.12594289e-01,
        4.84813194e-01, 8.16088700e-01, 1.29269479e+00, 1.65792382e+00,
        2.20209915e+00, 3.39107140e+00],
       [0.00000000e+00, 5.22314165e-02, 2.41595651e-01, 4.22467516e-01,
        6.25736022e-01, 7.12439438e-01, 2.08346370e+00, 3.28464640e+00,
        3.79746486e+00, 5.89371046e+00],
       [0.00000000e+00, 0.00000000e+00, 4.14289002e-02, 1.78576928e-01,
        9.12966633e-01, 1.40156387e+00, 1.27983718e+00, 4.84976577e+00,
        6.98025075e+00, 9.92256338e+00],
       [0.00000000e+00, 0.00000000e+00, 6.74471744e-03, 1.92706213e-02,
        3.49830663e-02, 5.96848511e-02, 8.28928265e-02, 1.05060024e-01,
        1.00046447e+01, 0.00000000e+00]])}
k:  policy_iteration
aglo_results:  {'Values': array([[0.06990123, 0.04381939, 0.02781757, 0.02150566, 0.03177758,
        0.04843078, 0.0738093 , 0.11235013, 0.16722416, 0.2225751 ],
       [0.04381812, 0.02853524, 0.02093494, 0.03018145, 0.04649546,
        0.07188254, 0.11118625, 0.1711766 , 0.2567688 , 0.34642434],
       [0.02779155, 0.02088371, 0.03007567, 0.04635918, 0.0717817 ,
        0.11117895, 0.17214118, 0.26564707, 0.40144695, 0.54980087],
       [0.02104052, 0.03009213, 0.04634983, 0.07177349, 0.11117723,
        0.17221672, 0.26672727, 0.41230604, 0.62751816, 0.87364793],
       [0.03099534, 0.04637978, 0.07176096, 0.11116745, 0.17221352,
        0.26677289, 0.41324336, 0.63960307, 0.97995139, 1.38917167],
       [0.04714752, 0.07163348, 0.11099575, 0.17206307, 0.26667019,
        0.41321143, 0.64017598, 0.99168994, 1.52855546, 2.21043278],
       [0.07171064, 0.10952695, 0.17032907, 0.26486022, 0.41154751,
        0.63897585, 0.99132254, 1.53684702, 2.38105715, 3.51985474],
       [0.10347498, 0.15971313, 0.2510634 , 0.39461385, 0.61963447,
        0.97171027, 1.52130989, 2.37673783, 3.70311633, 5.6095095 ],
       [0.12557793, 0.19666142, 0.31452166, 0.5044737 , 0.81119701,
        1.30803385, 2.11561091, 3.4345435 , 5.7487657 , 8.94760788],
       [0.10196562, 0.15462236, 0.23834058, 0.36665112, 0.5622787 ,
        0.85905854, 1.29065379, 0.11982362, 8.67888199, 0.        ]]), 'Policy': array([['N', 'W', 'W', 'E', 'E', 'E', 'E', 'N', 'N', 'N'],
       ['S', 'S', 'E', 'E', 'E', 'E', 'N', 'N', 'N', 'N'],
       ['S', 'N', 'E', 'E', 'E', 'N', 'N', 'N', 'N', 'N'],
       ['N', 'N', 'E', 'E', 'E', 'N', 'N', 'N', 'N', 'N'],
       ['N', 'E', 'E', 'E', 'E', 'E', 'N', 'N', 'N', 'N'],
       ['N', 'E', 'E', 'E', 'E', 'E', 'E', 'N', 'N', 'N'],
       ['E', 'E', 'E', 'E', 'E', 'E', 'E', 'E', 'N', 'N'],
       ['E', 'E', 'E', 'E', 'E', 'E', 'E', 'E', 'N', 'N'],
       ['E', 'E', 'E', 'E', 'E', 'E', 'E', 'E', 'E', 'N'],
       ['E', 'E', 'E', 'E', 'E', 'S', 'S', 'N', 'E', 'N']], dtype=object)}
algo_targets:  {'Values': array([[0.06990123, 0.04381939, 0.02781757, 0.02150566, 0.03177758,
        0.04843078, 0.0738093 , 0.11235013, 0.16722416, 0.2225751 ],
       [0.04381811, 0.02853524, 0.02093493, 0.03018144, 0.04649546,
        0.07188254, 0.11118625, 0.1711766 , 0.2567688 , 0.34642434],
       [0.02779154, 0.0208837 , 0.03007567, 0.04635918, 0.0717817 ,
        0.11117895, 0.17214118, 0.26564707, 0.40144695, 0.54980087],
       [0.02104052, 0.03009213, 0.04634982, 0.07177348, 0.11117723,
        0.17221672, 0.26672727, 0.41230604, 0.62751816, 0.87364793],
       [0.03099534, 0.04637978, 0.07176096, 0.11116745, 0.17221352,
        0.26677289, 0.41324336, 0.63960307, 0.97995139, 1.38917167],
       [0.04714752, 0.07163348, 0.11099575, 0.17206307, 0.26667019,
        0.41321143, 0.64017598, 0.99168994, 1.52855546, 2.21043278],
       [0.07171064, 0.10952695, 0.17032907, 0.26486022, 0.41154751,
        0.63897585, 0.99132254, 1.53684702, 2.38105715, 3.51985474],
       [0.10347498, 0.15971313, 0.2510634 , 0.39461385, 0.61963447,
        0.97171027, 1.52130989, 2.37673783, 3.70311633, 5.6095095 ],
       [0.12557793, 0.19666142, 0.31452166, 0.5044737 , 0.81119701,
        1.30803385, 2.11561091, 3.4345435 , 5.7487657 , 8.94760788],
       [0.10196562, 0.15462236, 0.23834058, 0.36665112, 0.5622787 ,
        0.85905854, 1.29065379, 0.11982362, 8.67888199, 0.        ]]), 'Policy': array([['N', 'W', 'W', 'E', 'E', 'E', 'E', 'N', 'N', 'N'],
       ['S', 'S', 'E', 'E', 'E', 'E', 'N', 'N', 'N', 'N'],
       ['S', 'N', 'E', 'E', 'E', 'N', 'N', 'N', 'N', 'N'],
       ['N', 'N', 'E', 'E', 'E', 'N', 'N', 'N', 'N', 'N'],
       ['N', 'E', 'E', 'E', 'E', 'E', 'N', 'N', 'N', 'N'],
       ['N', 'E', 'E', 'E', 'E', 'E', 'E', 'N', 'N', 'N'],
       ['E', 'E', 'E', 'E', 'E', 'E', 'E', 'E', 'N', 'N'],
       ['E', 'E', 'E', 'E', 'E', 'E', 'E', 'E', 'N', 'N'],
       ['E', 'E', 'E', 'E', 'E', 'E', 'E', 'E', 'E', 'N'],
       ['E', 'E', 'E', 'E', 'E', 'S', 'S', 'N', 'E', 'N']], dtype=object)}
k:  value_iteration
aglo_results:  {'Values': array([[0.06990123, 0.04381939, 0.02781757, 0.02150566, 0.03177757,
        0.04843078, 0.0738093 , 0.11235013, 0.16722416, 0.2225751 ],
       [0.04381811, 0.02853524, 0.02093493, 0.03018144, 0.04649545,
        0.07188254, 0.11118625, 0.1711766 , 0.2567688 , 0.34642434],
       [0.02779154, 0.0208837 , 0.03007566, 0.04635918, 0.07178169,
        0.11117895, 0.17214117, 0.26564707, 0.40144695, 0.54980087],
       [0.02104051, 0.03009213, 0.04634982, 0.07177348, 0.11117723,
        0.17221671, 0.26672727, 0.41230604, 0.62751816, 0.87364793],
       [0.03099534, 0.04637978, 0.07176095, 0.11116745, 0.17221351,
        0.26677289, 0.41324336, 0.63960307, 0.97995139, 1.38917167],
       [0.04714752, 0.07163348, 0.11099575, 0.17206307, 0.26667019,
        0.41321143, 0.64017598, 0.99168994, 1.52855546, 2.21043278],
       [0.07171064, 0.10952695, 0.17032907, 0.26486022, 0.41154751,
        0.63897585, 0.99132254, 1.53684702, 2.38105715, 3.51985474],
       [0.10347498, 0.15971313, 0.2510634 , 0.39461385, 0.61963447,
        0.97171027, 1.52130989, 2.37673783, 3.70311633, 5.6095095 ],
       [0.12557792, 0.19666142, 0.31452166, 0.5044737 , 0.81119701,
        1.30803385, 2.11561091, 3.4345435 , 5.7487657 , 8.94760788],
       [0.10196561, 0.15462236, 0.23834058, 0.36665112, 0.5622787 ,
        0.85905854, 1.29065379, 0.11982362, 8.67888199, 0.        ]]), 'Policy': array([['N', 'W', 'W', 'E', 'E', 'E', 'E', 'N', 'N', 'N'],
       ['S', 'S', 'E', 'E', 'E', 'E', 'N', 'N', 'N', 'N'],
       ['S', 'N', 'E', 'E', 'E', 'N', 'N', 'N', 'N', 'N'],
       ['N', 'N', 'E', 'E', 'E', 'N', 'N', 'N', 'N', 'N'],
       ['N', 'E', 'E', 'E', 'E', 'E', 'N', 'N', 'N', 'N'],
       ['N', 'E', 'E', 'E', 'E', 'E', 'E', 'N', 'N', 'N'],
       ['E', 'E', 'E', 'E', 'E', 'E', 'E', 'E', 'N', 'N'],
       ['E', 'E', 'E', 'E', 'E', 'E', 'E', 'E', 'N', 'N'],
       ['E', 'E', 'E', 'E', 'E', 'E', 'E', 'E', 'E', 'N'],
       ['E', 'E', 'E', 'E', 'E', 'S', 'S', 'N', 'E', 'N']], dtype=object)}
algo_targets:  {'Values': array([[0.06990123, 0.04381939, 0.02781757, 0.02150566, 0.03177757,
        0.04843078, 0.0738093 , 0.11235013, 0.16722416, 0.2225751 ],
       [0.04381811, 0.02853524, 0.02093493, 0.03018144, 0.04649545,
        0.07188254, 0.11118625, 0.1711766 , 0.2567688 , 0.34642434],
       [0.02779154, 0.0208837 , 0.03007566, 0.04635918, 0.07178169,
        0.11117895, 0.17214117, 0.26564707, 0.40144695, 0.54980087],
       [0.02104051, 0.03009213, 0.04634982, 0.07177348, 0.11117723,
        0.17221671, 0.26672727, 0.41230604, 0.62751816, 0.87364793],
       [0.03099534, 0.04637978, 0.07176095, 0.11116745, 0.17221351,
        0.26677289, 0.41324336, 0.63960307, 0.97995139, 1.38917167],
       [0.04714752, 0.07163348, 0.11099575, 0.17206307, 0.26667019,
        0.41321143, 0.64017598, 0.99168994, 1.52855546, 2.21043278],
       [0.07171064, 0.10952695, 0.17032907, 0.26486022, 0.41154751,
        0.63897585, 0.99132254, 1.53684702, 2.38105715, 3.51985474],
       [0.10347498, 0.15971313, 0.2510634 , 0.39461385, 0.61963447,
        0.97171027, 1.52130989, 2.37673783, 3.70311633, 5.6095095 ],
       [0.12557792, 0.19666142, 0.31452166, 0.5044737 , 0.81119701,
        1.30803385, 2.11561091, 3.4345435 , 5.7487657 , 8.94760788],
       [0.10196561, 0.15462236, 0.23834058, 0.36665112, 0.5622787 ,
        0.85905854, 1.29065379, 0.11982362, 8.67888199, 0.        ]]), 'Policy': array([['N', 'W', 'W', 'E', 'E', 'E', 'E', 'N', 'N', 'N'],
       ['S', 'S', 'E', 'E', 'E', 'E', 'N', 'N', 'N', 'N'],
       ['S', 'N', 'E', 'E', 'E', 'N', 'N', 'N', 'N', 'N'],
       ['N', 'N', 'E', 'E', 'E', 'N', 'N', 'N', 'N', 'N'],
       ['N', 'E', 'E', 'E', 'E', 'E', 'N', 'N', 'N', 'N'],
       ['N', 'E', 'E', 'E', 'E', 'E', 'E', 'N', 'N', 'N'],
       ['E', 'E', 'E', 'E', 'E', 'E', 'E', 'E', 'N', 'N'],
       ['E', 'E', 'E', 'E', 'E', 'E', 'E', 'E', 'N', 'N'],
       ['E', 'E', 'E', 'E', 'E', 'E', 'E', 'E', 'E', 'N'],
       ['E', 'E', 'E', 'E', 'E', 'S', 'S', 'N', 'E', 'N']], dtype=object)}
k:  td_lambda
aglo_results:  {'Values': array([[1.17065175e-01, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,
        0.00000000e+00, 1.20869146e-02, 6.50801063e-03, 1.08455100e-01,
        1.25939840e-01, 0.00000000e+00],
       [0.00000000e+00, 0.00000000e+00, 9.30697487e-03, 6.74433462e-03,
        2.87816477e-02, 3.12467594e-02, 1.03059572e-01, 1.52781881e-01,
        1.58366091e-01, 0.00000000e+00],
       [1.77384263e-03, 1.47800884e-02, 2.74846931e-02, 3.04573845e-02,
        7.14399810e-02, 1.01562738e-01, 1.53524012e-01, 2.30581627e-01,
        1.78870946e-01, 1.75414748e-01],
       [6.40534487e-03, 2.82016679e-02, 3.19684901e-02, 5.26038043e-02,
        7.84100241e-02, 1.72884035e-01, 1.99857466e-01, 3.47990968e-01,
        5.79664376e-01, 2.56996466e-01],
       [2.04541062e-02, 4.19457138e-02, 5.22520506e-02, 1.02433955e-01,
        1.58553992e-01, 2.27612595e-01, 3.84148807e-01, 5.65629731e-01,
        1.07566085e+00, 9.74159503e-01],
       [2.39275526e-02, 6.98107944e-02, 8.44269638e-02, 1.09999353e-01,
        2.47482489e-01, 4.01109042e-01, 5.24005132e-01, 9.62735996e-01,
        1.61645974e+00, 1.43942491e+00],
       [2.09996045e-02, 8.22097499e-02, 2.10721662e-01, 3.12594289e-01,
        4.84813194e-01, 8.16088700e-01, 1.29269479e+00, 1.65792382e+00,
        2.20209915e+00, 3.39107140e+00],
       [0.00000000e+00, 5.22314165e-02, 2.41595651e-01, 4.22467516e-01,
        6.25736022e-01, 7.12439438e-01, 2.08346370e+00, 3.28464640e+00,
        3.79746486e+00, 5.89371046e+00],
       [0.00000000e+00, 0.00000000e+00, 4.14289002e-02, 1.78576928e-01,
        9.12966633e-01, 1.40156387e+00, 1.27983718e+00, 4.84976577e+00,
        6.98025075e+00, 9.92256338e+00],
       [0.00000000e+00, 0.00000000e+00, 6.74471744e-03, 1.92706213e-02,
        3.49830663e-02, 5.96848511e-02, 8.28928265e-02, 1.05060024e-01,
        1.00046447e+01, 0.00000000e+00]])}
algo_targets:  {'Values': array([[1.17065175e-01, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,
        0.00000000e+00, 1.20869146e-02, 6.50801063e-03, 1.08455100e-01,
        1.25939840e-01, 0.00000000e+00],
       [0.00000000e+00, 0.00000000e+00, 9.30697487e-03, 6.74433462e-03,
        2.87816477e-02, 3.12467594e-02, 1.03059572e-01, 1.52781881e-01,
        1.58366091e-01, 0.00000000e+00],
       [1.77384263e-03, 1.47800884e-02, 2.74846931e-02, 3.04573845e-02,
        7.14399810e-02, 1.01562738e-01, 1.53524012e-01, 2.30581627e-01,
        1.78870946e-01, 1.75414748e-01],
       [6.40534487e-03, 2.82016679e-02, 3.19684901e-02, 5.26038043e-02,
        7.84100241e-02, 1.72884035e-01, 1.99857466e-01, 3.47990968e-01,
        5.79664376e-01, 2.56996466e-01],
       [2.04541062e-02, 4.19457138e-02, 5.22520506e-02, 1.02433955e-01,
        1.58553992e-01, 2.27612595e-01, 3.84148807e-01, 5.65629731e-01,
        1.07566085e+00, 9.74159503e-01],
       [2.39275526e-02, 6.98107944e-02, 8.44269638e-02, 1.09999353e-01,
        2.47482489e-01, 4.01109042e-01, 5.24005132e-01, 9.62735996e-01,
        1.61645974e+00, 1.43942491e+00],
       [2.09996045e-02, 8.22097499e-02, 2.10721662e-01, 3.12594289e-01,
        4.84813194e-01, 8.16088700e-01, 1.29269479e+00, 1.65792382e+00,
        2.20209915e+00, 3.39107140e+00],
       [0.00000000e+00, 5.22314165e-02, 2.41595651e-01, 4.22467516e-01,
        6.25736022e-01, 7.12439438e-01, 2.08346370e+00, 3.28464640e+00,
        3.79746486e+00, 5.89371046e+00],
       [0.00000000e+00, 0.00000000e+00, 4.14289002e-02, 1.78576928e-01,
        9.12966633e-01, 1.40156387e+00, 1.27983718e+00, 4.84976577e+00,
        6.98025075e+00, 9.92256338e+00],
       [0.00000000e+00, 0.00000000e+00, 6.74471744e-03, 1.92706213e-02,
        3.49830663e-02, 5.96848511e-02, 8.28928265e-02, 1.05060024e-01,
        1.00046447e+01, 0.00000000e+00]])}
Shared data Score (normalized to 1): 1.0
/usr/local/lib/python3.7/dist-packages/numpy/core/_asarray.py:136: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray
  return array(a, dtype, copy=False, order=order, subok=True)

Display Results of TD lambda

Display Results of TD lambda with lambda values from 0 to 1 with steps of 0.05

Add code/text as required

Subjective questions

2.a Value Iteration vs Policy Iteration

  1. Compare value iteration and policy iteration for states Brown in, Brown Out, Grey out and Grey In
  2. Which one converges faster and why

2.b How changing $\lambda$ affecting TD Lambda

2.c Policy iteration error curve

Plot error curve of $J_i$ vs iteration $i$ for policy iteration

2.d TD Lamdba error curve

Plot error curve of $J_i$ vs iteration $i$ for TD Lambda for $\lambda = [0, 0.25, 0.5, 0.75, 1]$

Submit to AIcrowd 🚀

In [44]:
!DATASET_PATH=$AICROWD_DATASET_PATH aicrowd notebook submit --no-verify -c iit-m-rl-assignment-2-gridworld -a assets
WARNING: No assets directory at assets... Creating one...
No jupyter lab module found. Using jupyter notebook.
Using notebook: /content/Copy%20of%20IITM_Assignment_2_Gridworld_Release.ipynb for submission...
Mounting Google Drive 💾
Your Google Drive will be mounted to access the colab notebook
Go to this URL in a browser: https://accounts.google.com/o/oauth2/auth?client_id=947318989803-6bn6qk8qdgf4n4g3pfee6491hc0brc4i.apps.googleusercontent.com&redirect_uri=urn%3aietf%3awg%3aoauth%3a2.0%3aoob&scope=email%20https%3a%2f%2fwww.googleapis.com%2fauth%2fdocs.test%20https%3a%2f%2fwww.googleapis.com%2fauth%2fdrive%20https%3a%2f%2fwww.googleapis.com%2fauth%2fdrive.photos.readonly%20https%3a%2f%2fwww.googleapis.com%2fauth%2fpeopleapi.readonly%20https%3a%2f%2fwww.googleapis.com%2fauth%2fdrive.activity.readonly%20https%3a%2f%2fwww.googleapis.com%2fauth%2fexperimentsandconfigs%20https%3a%2f%2fwww.googleapis.com%2fauth%2fphotos.native&response_type=code

Enter your authorization code:
4/1AY0e-g4gqMmxS5_-fyrYhkX8icRsD2796aa_z1vea0jhDKyyuzjZamn_PVU
Mounted at /content/drive
No jupyter lab module found. Using jupyter notebook.
Scrubbing API keys from the notebook...
Collecting notebook...
No jupyter lab module found. Using jupyter notebook.
submission.zip ━━━━━━━━━━━━━━━━━━━━━━ 100.0%27.8/26.1 KB2.0 MB/s0:00:00
                                                             ╭─────────────────────────╮                                                             
                                                             │ Successfully submitted! │                                                             
                                                             ╰─────────────────────────╯                                                             
                                                                   Important links                                                                   
┌──────────────────┬────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│  This submission │ https://www.aicrowd.com/challenges/iit-m-assignment-2/problems/iit-m-rl-assignment-2-gridworld/submissions/132103              │
│                  │                                                                                                                                │
│  All submissions │ https://www.aicrowd.com/challenges/iit-m-assignment-2/problems/iit-m-rl-assignment-2-gridworld/submissions?my_submissions=true │
│                  │                                                                                                                                │
│      Leaderboard │ https://www.aicrowd.com/challenges/iit-m-assignment-2/problems/iit-m-rl-assignment-2-gridworld/leaderboards                    │
│                  │                                                                                                                                │
│ Discussion forum │ https://discourse.aicrowd.com/c/iit-m-assignment-2                                                                             │
│                  │                                                                                                                                │
│   Challenge page │ https://www.aicrowd.com/challenges/iit-m-assignment-2/problems/iit-m-rl-assignment-2-gridworld                                 │
└──────────────────┴────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
451

Comments

You must login before you can post a comment.

Execute