Loading

IIT-M RL-ASSIGNMENT-2-GRIDWORLD

Solution for submission 132153

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

rohan_jagdish_vashodia_cs17b025

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
In [3]:

Drive already mounted at /content/drive; to attempt to forcibly remount, call drive.mount("/content/drive", force_remount=True).

Setup AIcrowd Utilities 🛠

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

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

AIcrowd Runtime Configuration 🧷

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

In [5]:
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")
In [5]:

In [6]:

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, 1.28MB/s]
In [7]:
!unzip -q $AICROWD_DATASET_PATH
In [8]:
DATASET_DIR = 'inputs/'

GridWorld Environment

Read the code for the environment thoroughly

Do not edit the code for the environment

In [9]:
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 [10]:
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 [14]:
def value_iteration(env, gamma):
  # Initial Values
  values = np.zeros((10, 10))
  H=np.zeros((10, 10))
  # Initial policy
  policy = np.empty((10, 10), object)
  policy[:] = 'N' # Make all the policy values as 'N'

  # Begin code here
  
  # Put your extra information needed for plots etc in this dictionary
  extra_info = {}
  while(1):
  #print(values)
    l=0
    for m in range(10):
      for n in range(10):
        s=[m,n]
        actions=['N','E','S','W']
        sum_dict = {a : 0 for a in actions}
        temp=float('-inf')
        #print(actions,len(actions))
        for a in actions:
          L=env.get_transition_probabilites_and_reward((m,n),a)
          for t in L:	
            sum_dict[a] += t[1]*(t[2]+gamma*values[t[0][0],t[0][1]])
          
          if(sum_dict[a]>temp):
            temp=sum_dict[a]
            policy[m,n]=a
        #print(sum_dict,p[s],temp)
        H[m,n]=temp
        l=max(l,abs(values[m,n]-H[m,n]))
    for m in range(10):
      for n in range(10):
        values[m,n]=H[m,n]

          
      #print(values)
      # End code

      # Do not change the number of output values
    if(l<0.00000001):
      break
  return {"Values": values, "Policy": policy}, extra_info
In [15]:
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 [16]:
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   
  
  # Put your extra information needed for plots etc in this dictionary
  extra_info = []
  done=False
  while(done==False):
    while(1):
      v=values.copy()
      extra_info.append(v)
      lamb=0
      for m in range(10):
        for n in range(10):
          j=values[m,n]
          c=0
          a=policy[m,n]
          L=env.get_transition_probabilites_and_reward((m,n),a)
          for t in L:	
            c += t[1]*(t[2]+gamma*values[t[0][0],t[0][1]])
          values[m,n]=c
          lamb=max(lamb,abs(j-values[m,n]))
        #print(lamb)
      #print(lamb)
      if(lamb<0.00000001):
          break
      #print(lamb)
    done=True
    for m in range(10):
      for n in range(10):
        b=policy[m,n]
        actions=['N','E','S','W']
        sum_dict = {a : 0 for a in actions}
        for a in actions:
          L=env.get_transition_probabilites_and_reward((m,n),a)
          for t in L:	
            sum_dict[a] += t[1]*(t[2]+gamma*values[t[0][0],t[0][1]])
        temp=float('-inf') 
        for i in sum_dict.keys():
          if(sum_dict[i]>temp):
            policy[m,n]=i
            temp=sum_dict[i]
        if(b!=policy[m,n]):
          done=False

  # End code

  # Do not change the number of output values
  return {"Values": values, "Policy": policy}, extra_info
In [17]:
env = GridEnv_HW2(**base_kwargs)
res, extra_info_pi = 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 [18]:
# 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 [19]:
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
    extra_info_td=[]
    # 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:
            v=values.copy()
            extra_info_td.append(v)
            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
            delta=rew + gamma*values[ns[0],ns[1]]-values[state[0],state[1]]
            es[state[0],state[1]]=es[state[0],state[1]]+1
            for i in range(10):
              for j in range(10):
                values[i,j]=values[i,j]+alpha*delta*es[i,j]
                es[i,j]=gamma*lamda*es[i,j]
            state=ns
            if is_terminal==True:
              done=True
    # Put your extra information needed for plots etc in this dictionary
    

    # End code

    # Do not change the number of output values
    return {"Values": values}, extra_info_td.copy()
In [20]:
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 [21]:
# 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 [22]:
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 [23]:
# 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 [24]:
# 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]
            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))
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)
In [25]:
#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

lamda_values = list(np.arange(0,1,0.05))
td_lamda_results = []
extra_info = {}
for lamda in lamda_values:
    env = GridEnv_HW2(**base_kwargs)
    x, extra_info[lamda] = td_lambda(env, lamda,seeds=np.arange(1000))
    td_lamda_results.append(x)
print(td_lamda_results)
[{'Values': array([[1.12205780e-01, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,
        0.00000000e+00, 1.73760435e-03, 0.00000000e+00, 6.57787744e-02,
        6.83468875e-02, 0.00000000e+00],
       [0.00000000e+00, 0.00000000e+00, 5.54975309e-03, 0.00000000e+00,
        1.27654538e-02, 1.37659396e-03, 8.28701918e-02, 1.53914701e-01,
        1.42261986e-01, 0.00000000e+00],
       [0.00000000e+00, 9.00393221e-03, 2.42017272e-02, 1.90126256e-02,
        3.57879377e-02, 6.93120813e-02, 1.29888473e-01, 2.19197873e-01,
        1.86041779e-01, 7.14497181e-02],
       [1.86486893e-03, 1.71686321e-02, 3.70097105e-02, 4.48033447e-02,
        7.43643489e-02, 1.24373633e-01, 1.43895491e-01, 3.29617087e-01,
        5.54287467e-01, 0.00000000e+00],
       [5.54681074e-03, 2.99737385e-02, 5.34547685e-02, 9.21462313e-02,
        1.37756740e-01, 2.21775837e-01, 3.04568538e-01, 5.66782375e-01,
        9.87898640e-01, 3.47094902e-01],
       [1.30811583e-02, 5.07909928e-02, 9.91140955e-02, 1.07387846e-01,
        1.86668853e-01, 2.57309269e-01, 4.83892685e-01, 9.62428401e-01,
        1.54914648e+00, 1.08445436e+00],
       [4.85809272e-03, 4.74447088e-02, 1.76899510e-01, 1.98858462e-01,
        2.73656121e-01, 4.71328731e-01, 8.19454638e-01, 1.50190621e+00,
        2.28670725e+00, 3.51808552e+00],
       [0.00000000e+00, 4.63756494e-02, 1.94074187e-01, 3.79150319e-01,
        5.50070567e-01, 6.06525109e-01, 1.67621868e+00, 3.13408381e+00,
        3.41814494e+00, 5.58550125e+00],
       [0.00000000e+00, 0.00000000e+00, 3.44987083e-02, 9.33458419e-02,
        6.89167449e-01, 1.09165659e+00, 1.56170961e+00, 4.78755751e+00,
        6.94519419e+00, 9.91044954e+00],
       [0.00000000e+00, 0.00000000e+00, 1.78732819e-03, 9.48535675e-03,
        2.65285395e-02, 5.17893952e-02, 7.84088201e-02, 1.02590038e-01,
        9.99289736e+00, 0.00000000e+00]])}, {'Values': array([[1.11165857e-01, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,
        0.00000000e+00, 2.09136154e-03, 4.01034518e-06, 7.01934886e-02,
        7.57028621e-02, 0.00000000e+00],
       [0.00000000e+00, 0.00000000e+00, 6.26275807e-03, 3.74738832e-04,
        1.40750990e-02, 3.48475454e-03, 8.58422521e-02, 1.55508105e-01,
        1.46923956e-01, 0.00000000e+00],
       [1.20927666e-05, 9.75371093e-03, 2.48750774e-02, 2.01219999e-02,
        3.85384985e-02, 7.17157300e-02, 1.31410591e-01, 2.23105743e-01,
        1.88853483e-01, 7.38013731e-02],
       [2.21406162e-03, 1.82428149e-02, 3.66233116e-02, 4.57266929e-02,
        7.56683016e-02, 1.29708042e-01, 1.48387920e-01, 3.38364663e-01,
        5.62541434e-01, 4.14448672e-03],
       [6.48341234e-03, 3.12256644e-02, 5.38541565e-02, 9.19383341e-02,
        1.35397509e-01, 2.23610796e-01, 3.13953171e-01, 5.79031771e-01,
        1.00392652e+00, 4.01682236e-01],
       [1.40600585e-02, 5.34578375e-02, 9.68248089e-02, 1.06827593e-01,
        1.87137605e-01, 2.66866149e-01, 4.89022916e-01, 9.68732980e-01,
        1.56617503e+00, 1.13096346e+00],
       [5.81052566e-03, 5.03156851e-02, 1.75818199e-01, 2.03994172e-01,
        2.90837716e-01, 5.00603367e-01, 8.67494397e-01, 1.51197532e+00,
        2.27949497e+00, 3.54940086e+00],
       [0.00000000e+00, 4.75345013e-02, 2.00913593e-01, 3.80794194e-01,
        5.48440585e-01, 6.17062931e-01, 1.71917789e+00, 3.14872651e+00,
        3.45275391e+00, 5.61313210e+00],
       [0.00000000e+00, 0.00000000e+00, 3.58453249e-02, 9.97675314e-02,
        7.06425956e-01, 1.14201147e+00, 1.53210437e+00, 4.79381862e+00,
        6.94841517e+00, 9.91011886e+00],
       [0.00000000e+00, 0.00000000e+00, 2.22631679e-03, 1.04227239e-02,
        2.74491962e-02, 5.26205308e-02, 7.79476397e-02, 1.04896471e-01,
        9.99398638e+00, 0.00000000e+00]])}, {'Values': array([[1.10055292e-01, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,
        0.00000000e+00, 2.52551142e-03, 3.41190521e-05, 7.47447224e-02,
        8.30702733e-02, 0.00000000e+00],
       [0.00000000e+00, 0.00000000e+00, 6.90635542e-03, 8.48304182e-04,
        1.54495073e-02, 5.72002328e-03, 8.86270119e-02, 1.57079475e-01,
        1.50931131e-01, 0.00000000e+00],
       [4.91321942e-05, 1.04677737e-02, 2.54413468e-02, 2.12263414e-02,
        4.14518297e-02, 7.42983842e-02, 1.33314975e-01, 2.27003031e-01,
        1.91128538e-01, 7.69010422e-02],
       [2.57819270e-03, 1.93321831e-02, 3.62287424e-02, 4.65995480e-02,
        7.67804503e-02, 1.35084843e-01, 1.53042935e-01, 3.45652982e-01,
        5.69932569e-01, 1.33408832e-02],
       [7.50125348e-03, 3.25312963e-02, 5.39984974e-02, 9.17836981e-02,
        1.33982547e-01, 2.25107509e-01, 3.22974632e-01, 5.87985068e-01,
        1.01687479e+00, 4.57981392e-01],
       [1.50847101e-02, 5.58375929e-02, 9.44399977e-02, 1.06020537e-01,
        1.88817429e-01, 2.77729050e-01, 4.93550275e-01, 9.73947822e-01,
        1.58194772e+00, 1.17412700e+00],
       [6.93982465e-03, 5.32629050e-02, 1.75418258e-01, 2.10437251e-01,
        3.08118077e-01, 5.31250536e-01, 9.15782701e-01, 1.52321725e+00,
        2.27188626e+00, 3.57281593e+00],
       [0.00000000e+00, 4.83769272e-02, 2.06870129e-01, 3.82712863e-01,
        5.49774413e-01, 6.28486363e-01, 1.76203023e+00, 3.16362618e+00,
        3.48841296e+00, 5.64225206e+00],
       [0.00000000e+00, 0.00000000e+00, 3.70130939e-02, 1.06341455e-01,
        7.26502929e-01, 1.18915215e+00, 1.50345498e+00, 4.80013584e+00,
        6.95172707e+00, 9.91000504e+00],
       [0.00000000e+00, 0.00000000e+00, 2.68026974e-03, 1.13621088e-02,
        2.82969782e-02, 5.34683521e-02, 7.77849927e-02, 1.06832276e-01,
        9.99508491e+00, 0.00000000e+00]])}, {'Values': array([[1.09079561e-01, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,
        0.00000000e+00, 3.06321544e-03, 1.22679781e-04, 7.93613911e-02,
        9.03268389e-02, 0.00000000e+00],
       [0.00000000e+00, 0.00000000e+00, 7.47011242e-03, 1.41099630e-03,
        1.68918224e-02, 8.09735875e-03, 9.12397978e-02, 1.58488387e-01,
        1.54339430e-01, 0.00000000e+00],
       [1.13368484e-04, 1.11392057e-02, 2.59126570e-02, 2.23282034e-02,
        4.45209451e-02, 7.71000307e-02, 1.35573795e-01, 2.30497062e-01,
        1.92768978e-01, 8.11071841e-02],
       [2.95831927e-03, 2.04477550e-02, 3.58195297e-02, 4.74109018e-02,
        7.77068367e-02, 1.40472523e-01, 1.57953894e-01, 3.51341776e-01,
        5.76115598e-01, 2.74666255e-02],
       [8.63127125e-03, 3.38699327e-02, 5.39608063e-02, 9.17568385e-02,
        1.33549368e-01, 2.26257150e-01, 3.31700930e-01, 5.93616110e-01,
        1.02724342e+00, 5.16183797e-01],
       [1.61490589e-02, 5.79256713e-02, 9.21085598e-02, 1.05146340e-01,
        1.91767706e-01, 2.89784137e-01, 4.97662067e-01, 9.77797876e-01,
        1.59576357e+00, 1.21459132e+00],
       [8.23415271e-03, 5.62947293e-02, 1.75871325e-01, 2.18205338e-01,
        3.25925928e-01, 5.63309733e-01, 9.64213796e-01, 1.53553429e+00,
        2.26392138e+00, 3.58794180e+00],
       [0.00000000e+00, 4.89431240e-02, 2.12050478e-01, 3.85097577e-01,
        5.53820914e-01, 6.40254794e-01, 1.80463240e+00, 3.17872168e+00,
        3.52496828e+00, 5.67255602e+00],
       [0.00000000e+00, 0.00000000e+00, 3.80224865e-02, 1.13185667e-01,
        7.48849847e-01, 1.23274500e+00, 1.47548213e+00, 4.80647758e+00,
        6.95510719e+00, 9.91013642e+00],
       [0.00000000e+00, 0.00000000e+00, 3.14451296e-03, 1.22958360e-02,
        2.90957925e-02, 5.43324744e-02, 7.79092370e-02, 1.08410510e-01,
        9.99618851e+00, 0.00000000e+00]])}, {'Values': array([[1.08400803e-01, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,
        0.00000000e+00, 3.72921619e-03, 3.09643923e-04, 8.39779215e-02,
        9.73435873e-02, 0.00000000e+00],
       [0.00000000e+00, 0.00000000e+00, 7.95009434e-03, 2.05116002e-03,
        1.84006108e-02, 1.06381955e-02, 9.36822189e-02, 1.59567984e-01,
        1.57149696e-01, 0.00000000e+00],
       [2.08696023e-04, 1.17631611e-02, 2.63045746e-02, 2.34296451e-02,
        4.77545866e-02, 8.01346362e-02, 1.38140466e-01, 2.33288339e-01,
        1.93655960e-01, 8.67809885e-02],
       [3.35644675e-03, 2.15916706e-02, 3.53855660e-02, 4.81542231e-02,
        7.84593652e-02, 1.45838750e-01, 1.63192047e-01, 3.55321853e-01,
        5.80838074e-01, 4.63938644e-02],
       [9.90311751e-03, 3.52201947e-02, 5.37977982e-02, 9.19435095e-02,
        1.34121577e-01, 2.27081422e-01, 3.40175360e-01, 5.96013914e-01,
        1.03556151e+00, 5.76401510e-01],
       [1.72490422e-02, 5.97570031e-02, 8.99472324e-02, 1.04378439e-01,
        1.96006690e-01, 3.02939434e-01, 5.01540342e-01, 9.80083802e-01,
        1.60711667e+00, 1.25282466e+00],
       [9.68129766e-03, 5.94228823e-02, 1.77304332e-01, 2.27339203e-01,
        3.44601823e-01, 5.96736124e-01, 1.01265056e+00, 1.54889624e+00,
        2.25562458e+00, 3.59421421e+00],
       [0.00000000e+00, 4.92951757e-02, 2.16595634e-01, 3.88119894e-01,
        5.60272506e-01, 6.51970353e-01, 1.84683902e+00, 3.19394955e+00,
        3.56228129e+00, 5.70374516e+00],
       [0.00000000e+00, 0.00000000e+00, 3.88906115e-02, 1.20420101e-01,
        7.72864550e-01, 1.27239308e+00, 1.44794549e+00, 4.81281520e+00,
        6.95854045e+00, 9.91055532e+00],
       [0.00000000e+00, 0.00000000e+00, 3.61702837e-03, 1.32261750e-02,
        2.98728427e-02, 5.52046520e-02, 7.82911206e-02, 1.09599403e-01,
        9.99729815e+00, 0.00000000e+00]])}, {'Values': array([[1.08150150e-01, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,
        0.00000000e+00, 4.54970963e-03, 6.42565687e-04, 8.85303107e-02,
        1.03982011e-01, 0.00000000e+00],
       [0.00000000e+00, 0.00000000e+00, 8.34786405e-03, 2.75569274e-03,
        1.99733025e-02, 1.33697654e-02, 9.59408726e-02, 1.60153437e-01,
        1.59326786e-01, 0.00000000e+00],
       [3.40498666e-04, 1.23383894e-02, 2.66321602e-02, 2.45337053e-02,
        5.11719372e-02, 8.33912835e-02, 1.40941113e-01, 2.35167890e-01,
        1.93674183e-01, 9.42942593e-02],
       [3.77525518e-03, 2.27573160e-02, 3.49168161e-02, 4.88348177e-02,
        7.90431692e-02, 1.51137194e-01, 1.68791547e-01, 3.57539072e-01,
        5.83948335e-01, 7.00092150e-02],
       [1.13388013e-02, 3.65575701e-02, 5.35534979e-02, 9.24337642e-02,
        1.35708783e-01, 2.27617980e-01, 3.48410980e-01, 5.95392987e-01,
        1.04238726e+00, 6.38658157e-01],
       [1.83787628e-02, 6.13936441e-02, 8.80460711e-02, 1.03880605e-01,
        2.01526970e-01, 3.17118273e-01, 5.05336059e-01, 9.80695685e-01,
        1.61568173e+00, 1.28911820e+00],
       [1.12703903e-02, 6.26696262e-02, 1.79814226e-01, 2.37888785e-01,
        3.64406198e-01, 6.31414380e-01, 1.06092847e+00, 1.56334140e+00,
        2.24701799e+00, 3.59088927e+00],
       [0.00000000e+00, 4.95134250e-02, 2.20682151e-01, 3.91913984e-01,
        5.68769811e-01, 6.63360629e-01, 1.88850209e+00, 3.20924554e+00,
        3.60023231e+00, 5.73552721e+00],
       [0.00000000e+00, 0.00000000e+00, 3.96298238e-02, 1.28163594e-01,
        7.97894634e-01, 1.30765583e+00, 1.42062718e+00, 4.81912445e+00,
        6.96201877e+00, 9.91131570e+00],
       [0.00000000e+00, 0.00000000e+00, 4.09876380e-03, 1.41621856e-02,
        3.06534888e-02, 5.60716518e-02, 7.88853024e-02, 1.10335572e-01,
        9.99841883e+00, 0.00000000e+00]])}, {'Values': array([[1.08439205e-01, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,
        0.00000000e+00, 5.55272983e-03, 1.17575191e-03, 9.29564939e-02,
        1.10092489e-01, 0.00000000e+00],
       [0.00000000e+00, 0.00000000e+00, 8.66889180e-03, 3.51070200e-03,
        2.16081935e-02, 1.63243474e-02, 9.79873249e-02, 1.60106106e-01,
        1.60812975e-01, 0.00000000e+00],
       [5.15145777e-04, 1.28682638e-02, 2.69062758e-02, 2.56462002e-02,
        5.47958590e-02, 8.68383188e-02, 1.43868696e-01, 2.36018034e-01,
        1.92730658e-01, 1.04043899e-01],
       [4.21847081e-03, 2.39299715e-02, 3.44057112e-02, 4.94738776e-02,
        7.94484057e-02, 1.56297045e-01, 1.74739104e-01, 3.58021446e-01,
        5.85410576e-01, 9.82288247e-02],
       [1.29463162e-02, 3.78535612e-02, 5.32631220e-02, 9.33170018e-02,
        1.38308490e-01, 2.27912136e-01, 3.56387480e-01, 5.92109399e-01,
        1.04830709e+00, 7.02880014e-01],
       [1.95276376e-02, 6.29148473e-02, 8.64739188e-02, 1.03802671e-01,
        2.08306850e-01, 3.32253742e-01, 5.09148601e-01, 9.79626726e-01,
        1.62130134e+00, 1.32358659e+00],
       [1.29915704e-02, 6.60711674e-02, 1.83477844e-01, 2.49899794e-01,
        3.85526976e-01, 6.67170989e-01, 1.10885921e+00, 1.57897660e+00,
        2.23813757e+00, 3.57703871e+00],
       [0.00000000e+00, 4.96925283e-02, 2.24516252e-01, 3.96560029e-01,
        5.78903211e-01, 6.74261170e-01, 1.92947174e+00, 3.22454630e+00,
        3.63872592e+00, 5.76761737e+00],
       [0.00000000e+00, 0.00000000e+00, 4.02472808e-02, 1.36533224e-01,
        8.23243824e-01, 1.33806575e+00, 1.39331748e+00, 4.82538616e+00,
        6.96554057e+00, 9.91248015e+00],
       [0.00000000e+00, 0.00000000e+00, 4.59287241e-03, 1.51160642e-02,
        3.14572998e-02, 5.69168130e-02, 7.96330731e-02, 1.10541414e-01,
        9.99955910e+00, 0.00000000e+00]])}, {'Values': array([[1.09370298e-01, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,
        0.00000000e+00, 6.76904144e-03, 1.96854444e-03, 9.71997567e-02,
        1.15514466e-01, 0.00000000e+00],
       [0.00000000e+00, 0.00000000e+00, 8.92037858e-03, 4.30199502e-03,
        2.33052390e-02, 1.95392751e-02, 9.97793569e-02, 1.59333809e-01,
        1.61536816e-01, 0.00000000e+00],
       [7.39341907e-04, 1.33613170e-02, 2.71313992e-02, 2.67773164e-02,
        5.86446685e-02, 9.04298325e-02, 1.46780547e-01, 2.35819012e-01,
        1.90767750e-01, 1.16471608e-01],
       [4.69179604e-03, 2.50881270e-02, 3.38489882e-02, 5.01098486e-02,
        7.96461007e-02, 1.61214892e-01, 1.80967932e-01, 3.56910976e-01,
        5.85327631e-01, 1.31009003e-01],
       [1.47135676e-02, 3.90758881e-02, 5.29569859e-02, 9.46790638e-02,
        1.41909254e-01, 2.28012205e-01, 3.64050362e-01, 5.86681193e-01,
        1.05393528e+00, 7.68888028e-01],
       [2.06790482e-02, 6.44109192e-02, 8.52838583e-02, 1.04276474e-01,
        2.16318585e-01, 3.48283822e-01, 5.13010103e-01, 9.76986516e-01,
        1.62397467e+00, 1.35616897e+00],
       [1.48349841e-02, 6.96763171e-02, 1.88357572e-01, 2.63400494e-01,
        4.08086996e-01, 7.03785570e-01, 1.15623397e+00, 1.59597666e+00,
        2.22905077e+00, 3.55154479e+00],
       [0.00000000e+00, 4.99377882e-02, 2.28321196e-01, 4.02067916e-01,
        5.90211791e-01, 6.84597648e-01, 1.96959801e+00, 3.23979089e+00,
        3.67769780e+00, 5.79973988e+00],
       [0.00000000e+00, 0.00000000e+00, 4.07446203e-02, 1.45644710e-01,
        8.48181257e-01, 1.36314205e+00, 1.36580455e+00, 4.83158645e+00,
        6.96911045e+00, 9.91411677e+00],
       [0.00000000e+00, 0.00000000e+00, 5.10322359e-03, 1.60994108e-02,
        3.22952868e-02, 5.77206886e-02, 8.04672665e-02, 1.10144207e-01,
        1.00007312e+01, 0.00000000e+00]])}, {'Values': array([[1.11045109e-01, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,
        0.00000000e+00, 8.23371054e-03, 3.08263290e-03, 1.01213979e-01,
        1.20078603e-01, 0.00000000e+00],
       [0.00000000e+00, 0.00000000e+00, 9.10879770e-03, 5.11511981e-03,
        2.50658213e-02, 2.30585293e-02, 1.01263419e-01, 1.57807747e-01,
        1.61419747e-01, 0.00000000e+00],
       [1.01961872e-03, 1.38312851e-02, 2.73058256e-02, 2.79424345e-02,
        6.27224263e-02, 9.41136082e-02, 1.49499841e-01, 2.34663829e-01,
        1.87771331e-01, 1.32087313e-01],
       [5.20418556e-03, 2.62053920e-02, 3.32492921e-02, 5.07973993e-02,
        7.95871943e-02, 1.65748762e-01, 1.87355741e-01, 3.54501467e-01,
        5.83972837e-01, 1.68352899e-01],
       [1.66031529e-02, 4.01894234e-02, 5.26642866e-02, 9.66012463e-02,
        1.46494606e-01, 2.27966451e-01, 3.71312420e-01, 5.79811536e-01,
        1.05991475e+00, 8.36391858e-01],
       [2.18110772e-02, 6.59815147e-02, 8.45189735e-02, 1.05412681e-01,
        2.25534110e-01, 3.65147096e-01, 5.16874470e-01, 9.73013550e-01,
        1.62384778e+00, 1.38663128e+00],
       [1.67902473e-02, 7.35397432e-02, 1.94503360e-01, 2.78388736e-01,
        4.32151502e-01, 7.41001480e-01, 1.20282674e+00, 1.61458380e+00,
        2.21987542e+00, 3.51309501e+00],
       [0.00000000e+00, 5.03622367e-02, 2.32317950e-01, 4.08360952e-01,
        6.02180250e-01, 6.94367472e-01, 2.00873304e+00, 3.25492233e+00,
        3.71712225e+00, 5.83162974e+00],
       [0.00000000e+00, 0.00000000e+00, 4.11171995e-02, 1.55612978e-01,
        8.71953538e-01, 1.38240129e+00, 1.33786947e+00, 4.83771702e+00,
        6.97273925e+00, 9.91629633e+00],
       [0.00000000e+00, 0.00000000e+00, 5.63257222e-03, 1.71198412e-02,
        3.31685184e-02, 5.84619699e-02, 8.13204854e-02, 1.09094820e-01,
        1.00019522e+01, 0.00000000e+00]])}, {'Values': array([[1.13571115e-01, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,
        0.00000000e+00, 9.98868519e-03, 4.57815073e-03, 1.04969206e-01,
        1.23611019e-01, 0.00000000e+00],
       [0.00000000e+00, 0.00000000e+00, 9.23775710e-03, 5.93485487e-03,
        2.68915261e-02, 2.69367740e-02, 1.02378241e-01, 1.55576991e-01,
        1.60383951e-01, 0.00000000e+00],
       [1.36226238e-03, 1.42966976e-02, 2.74245807e-02, 2.91616311e-02,
        6.70076250e-02, 9.78390580e-02, 1.51821581e-01, 2.32783210e-01,
        1.83776028e-01, 1.51494471e-01],
       [5.76911097e-03, 2.72528252e-02, 3.26165013e-02, 5.16039821e-02,
        7.92036116e-02, 1.69714366e-01, 1.93726669e-01, 3.51282806e-01,
        5.81832951e-01, 2.10313886e-01],
       [1.85487604e-02, 4.11577856e-02, 5.24167264e-02, 9.91609898e-02,
        1.52047364e-01, 2.27820230e-01, 3.78057755e-01, 5.72412814e-01,
        1.06691986e+00, 9.04987399e-01],
       [2.29000212e-02, 6.77382645e-02, 8.42188304e-02, 1.07298922e-01,
        2.35928659e-01, 3.82779053e-01, 5.20611299e-01, 9.68086767e-01,
        1.62120482e+00, 1.41457092e+00],
       [1.88473146e-02, 7.77095876e-02, 2.01951649e-01, 2.94819607e-01,
        4.57735816e-01, 7.78535806e-01, 1.24839742e+00, 1.63510728e+00,
        2.21079926e+00, 3.46017668e+00],
       [0.00000000e+00, 5.10849673e-02, 2.36699034e-01, 4.15259831e-01,
        6.14234448e-01, 7.03620608e-01, 2.04673363e+00, 3.26988906e+00,
        3.75701995e+00, 5.86303390e+00],
       [0.00000000e+00, 0.00000000e+00, 4.13526491e-02, 1.66552439e-01,
        8.93799391e-01, 1.39536495e+00, 1.30928761e+00, 4.84377549e+00,
        6.97644451e+00, 9.91908940e+00],
       [0.00000000e+00, 0.00000000e+00, 6.18090688e-03, 1.81786384e-02,
        3.40688462e-02, 5.91205442e-02, 8.21375737e-02, 1.07384622e-01,
        1.00032458e+01, 0.00000000e+00]])}, {'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]])}, {'Values': array([[1.21653444e-01, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,
        0.00000000e+00, 1.45988309e-02, 8.90935444e-03, 1.11678094e-01,
        1.26904807e-01, 0.00000000e+00],
       [0.00000000e+00, 0.00000000e+00, 9.31312760e-03, 7.52432785e-03,
        3.07285399e-02, 3.60911461e-02, 1.03245917e-01, 1.49668080e-01,
        1.55342754e-01, 0.00000000e+00],
       [2.26222173e-03, 1.53068971e-02, 2.74917169e-02, 3.18501557e-02,
        7.59047726e-02, 1.05247863e-01, 1.54386781e-01, 2.28683817e-01,
        1.73210599e-01, 2.04708608e-01],
       [7.13680093e-03, 2.90269439e-02, 3.13309204e-02, 5.38689342e-02,
        7.71050690e-02, 1.74989563e-01, 2.05488793e-01, 3.45661250e-01,
        5.78564848e-01, 3.08555656e-01],
       [2.21954430e-02, 4.25224625e-02, 5.22176823e-02, 1.06497168e-01,
        1.66008682e-01, 2.27372350e-01, 3.89437217e-01, 5.60859270e-01,
        1.08688930e+00, 1.04329181e+00],
       [2.48926179e-02, 7.23542836e-02, 8.51993363e-02, 1.13555496e-01,
        2.60180763e-01, 4.20057989e-01, 5.26760565e-01, 9.57651180e-01,
        1.61014726e+00, 1.46048309e+00],
       [2.32502749e-02, 8.70176981e-02, 2.20809481e-01, 3.31550796e-01,
        5.13322694e-01, 8.53351831e-01, 1.33545919e+00, 1.68347917e+00,
        2.19415866e+00, 3.30384929e+00],
       [0.00000000e+00, 5.39367485e-02, 2.47038732e-01, 4.29555987e-01,
        6.35976169e-01, 7.20917875e-01, 2.11879659e+00, 3.29915757e+00,
        3.83858971e+00, 5.92342408e+00],
       [0.00000000e+00, 0.00000000e+00, 4.13123514e-02, 1.91799780e-01,
        9.28731068e-01, 1.40053987e+00, 1.24931529e+00, 4.85569802e+00,
        6.98418930e+00, 9.92677852e+00],
       [0.00000000e+00, 0.00000000e+00, 7.31814342e-03, 2.03878852e-02,
        3.59021560e-02, 6.01654150e-02, 8.36117672e-02, 1.02235154e-01,
        1.00061942e+01, 0.00000000e+00]])}, {'Values': array([[1.27466653e-01, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,
        0.00000000e+00, 1.76224833e-02, 1.17899738e-02, 1.14645563e-01,
        1.26372063e-01, 0.00000000e+00],
       [0.00000000e+00, 0.00000000e+00, 9.25294553e-03, 8.25343355e-03,
        3.27088867e-02, 4.16200260e-02, 1.02884827e-01, 1.46603171e-01,
        1.51374491e-01, 0.00000000e+00],
       [2.83749906e-03, 1.59040606e-02, 2.74655628e-02, 3.33517047e-02,
        8.02138115e-02, 1.08852854e-01, 1.54217417e-01, 2.27988947e-01,
        1.67036938e-01, 2.40387133e-01],
       [7.99123744e-03, 2.97131347e-02, 3.07356604e-02, 5.54571962e-02,
        7.51713379e-02, 1.75731514e-01, 2.10343500e-01, 3.45679843e-01,
        5.80062066e-01, 3.65195988e-01],
       [2.36287790e-02, 4.28664816e-02, 5.23748284e-02, 1.11432876e-01,
        1.74416843e-01, 2.27114132e-01, 3.93779706e-01, 5.59765189e-01,
        1.10140322e+00, 1.11168577e+00],
       [2.58293936e-02, 7.55557412e-02, 8.66132726e-02, 1.17987853e-01,
        2.74011612e-01, 4.39536983e-01, 5.28513615e-01, 9.53690258e-01,
        1.60291186e+00, 1.47690797e+00],
       [2.56227113e-02, 9.20391968e-02, 2.32180135e-01, 3.51457180e-01,
        5.43176566e-01, 8.90015481e-01, 1.37642439e+00, 1.71229075e+00,
        2.18748252e+00, 3.19636281e+00],
       [0.00000000e+00, 5.63542908e-02, 2.52915383e-01, 4.35955798e-01,
        6.44167997e-01, 7.29140386e-01, 2.15261690e+00, 3.31339381e+00,
        3.88058914e+00, 5.95193535e+00],
       [0.00000000e+00, 0.00000000e+00, 4.09573677e-02, 2.06335052e-01,
        9.40416712e-01, 1.39184478e+00, 1.21756230e+00, 4.86158745e+00,
        6.98829649e+00, 9.93178239e+00],
       [0.00000000e+00, 0.00000000e+00, 7.89696465e-03, 2.15291549e-02,
        3.68368292e-02, 6.06151535e-02, 8.43963522e-02, 9.91043040e-02,
        1.00079551e+01, 0.00000000e+00]])}, {'Values': array([[1.34629719e-01, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,
        0.00000000e+00, 2.12992819e-02, 1.51059330e-02, 1.17327355e-01,
        1.24258781e-01, 0.00000000e+00],
       [0.00000000e+00, 0.00000000e+00, 9.12806088e-03, 8.90994309e-03,
        3.46673034e-02, 4.80556677e-02, 1.01938465e-01, 1.44097160e-01,
        1.46676064e-01, 0.00000000e+00],
       [3.51191612e-03, 1.65981833e-02, 2.74426335e-02, 3.49561461e-02,
        8.40816537e-02, 1.12302330e-01, 1.52887466e-01, 2.29726386e-01,
        1.60718564e-01, 2.83608728e-01],
       [8.99843386e-03, 3.02639528e-02, 3.02174798e-02, 5.73963090e-02,
        7.24747768e-02, 1.74799796e-01, 2.14154857e-01, 3.49825853e-01,
        5.86219472e-01, 4.27171430e-01],
       [2.46029517e-02, 4.29717411e-02, 5.28038517e-02, 1.17332744e-01,
        1.83797670e-01, 2.26835644e-01, 3.97060605e-01, 5.64284445e-01,
        1.12004933e+00, 1.17859077e+00],
       [2.68328464e-02, 7.96351663e-02, 8.87758206e-02, 1.23297521e-01,
        2.88962422e-01, 4.59446958e-01, 5.28849467e-01, 9.51885383e-01,
        1.59549303e+00, 1.48776329e+00],
       [2.81764504e-02, 9.70817426e-02, 2.44757709e-01, 3.72007548e-01,
        5.74266177e-01, 9.25773417e-01, 1.41531794e+00, 1.74495111e+00,
        2.18270633e+00, 3.06624040e+00],
       [0.00000000e+00, 5.96722150e-02, 2.58923229e-01, 4.40949199e-01,
        6.49435934e-01, 7.37162353e-01, 2.18482168e+00, 3.32733240e+00,
        3.92372027e+00, 5.97898203e+00],
       [0.00000000e+00, 0.00000000e+00, 4.03085905e-02, 2.22301233e-01,
        9.47416502e-01, 1.37503751e+00, 1.18449485e+00, 4.86745121e+00,
        6.99260941e+00, 9.93760227e+00],
       [0.00000000e+00, 0.00000000e+00, 8.48578489e-03, 2.27156020e-02,
        3.78390732e-02, 6.11544002e-02, 8.54510119e-02, 9.59567249e-02,
        1.00100067e+01, 0.00000000e+00]])}, {'Values': array([[1.43244600e-01, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,
        0.00000000e+00, 2.58381033e-02, 1.87242411e-02, 1.19581977e-01,
        1.20576509e-01, 0.00000000e+00],
       [0.00000000e+00, 0.00000000e+00, 8.94960256e-03, 9.47558971e-03,
        3.64862347e-02, 5.57260884e-02, 1.00385629e-01, 1.42826920e-01,
        1.41720228e-01, 0.00000000e+00],
       [4.29759565e-03, 1.74132481e-02, 2.74694782e-02, 3.66287748e-02,
        8.70950153e-02, 1.15432015e-01, 1.50378234e-01, 2.35502927e-01,
        1.54811384e-01, 3.35652388e-01],
       [1.01902299e-02, 3.07188018e-02, 2.98085854e-02, 5.96632638e-02,
        6.88668420e-02, 1.71914196e-01, 2.16708989e-01, 3.60292255e-01,
        5.99757500e-01, 4.94787652e-01],
       [2.49792812e-02, 4.28565553e-02, 5.36126160e-02, 1.24301986e-01,
        1.94185598e-01, 2.26517457e-01, 3.99223387e-01, 5.76622612e-01,
        1.14371985e+00, 1.24324725e+00],
       [2.80936593e-02, 8.48367137e-02, 9.18299927e-02, 1.29466968e-01,
        3.05014587e-01, 4.79679756e-01, 5.27326200e-01, 9.53446944e-01,
        1.58870534e+00, 1.49205234e+00],
       [3.10296378e-02, 1.01828696e-01, 2.58413118e-01, 3.92820746e-01,
        6.06464720e-01, 9.60324113e-01, 1.45185857e+00, 1.78213098e+00,
        2.18060023e+00, 2.91088126e+00],
       [0.00000000e+00, 6.41434839e-02, 2.64526376e-01, 4.43666960e-01,
        6.50799361e-01, 7.44994148e-01, 2.21532065e+00, 3.34095177e+00,
        3.96829972e+00, 6.00425106e+00],
       [0.00000000e+00, 0.00000000e+00, 3.93070509e-02, 2.39828658e-01,
        9.49212210e-01, 1.34968023e+00, 1.15014860e+00, 4.87330207e+00,
        6.99715804e+00, 9.94423531e+00],
       [0.00000000e+00, 0.00000000e+00, 9.10702049e-03, 2.40114513e-02,
        3.90261682e-02, 6.19941525e-02, 8.71047146e-02, 9.31968335e-02,
        1.00124475e+01, 0.00000000e+00]])}, {'Values': array([[1.53365551e-01, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,
        0.00000000e+00, 3.15510606e-02, 2.23611714e-02, 1.21032147e-01,
        1.15507978e-01, 0.00000000e+00],
       [0.00000000e+00, 0.00000000e+00, 8.73806822e-03, 9.93997302e-03,
        3.79328126e-02, 6.51083592e-02, 9.82149343e-02, 1.43662061e-01,
        1.37380239e-01, 0.00000000e+00],
       [5.20166022e-03, 1.83686741e-02, 2.75795939e-02, 3.82925028e-02,
        8.86725112e-02, 1.17896809e-01, 1.46832984e-01, 2.47326312e-01,
        1.50139668e-01, 3.97856745e-01],
       [1.16082292e-02, 3.11783747e-02, 2.95300246e-02, 6.21571675e-02,
        6.41978750e-02, 1.66899791e-01, 2.17906957e-01, 3.79670555e-01,
        6.24186400e-01, 5.68408214e-01],
       [2.46569014e-02, 4.25774012e-02, 5.49513305e-02, 1.32462955e-01,
        2.05630500e-01, 2.26126820e-01, 4.00314728e-01, 5.99235211e-01,
        1.17334064e+00, 1.30494439e+00],
       [2.99445423e-02, 9.14039018e-02, 9.59570769e-02, 1.36459561e-01,
        3.22137244e-01, 5.00120958e-01, 5.23503390e-01, 9.59764609e-01,
        1.58341213e+00, 1.48876640e+00],
       [3.43881616e-02, 1.05816063e-01, 2.72948699e-01, 4.13440957e-01,
        6.39623971e-01, 9.93366276e-01, 1.48574905e+00, 1.82458095e+00,
        2.18206556e+00, 2.72745587e+00],
       [0.00000000e+00, 7.01365596e-02, 2.68917733e-01, 4.43088145e-01,
        6.47145858e-01, 7.52592808e-01, 2.24403575e+00, 3.35422217e+00,
        4.01469595e+00, 6.02734355e+00],
       [0.00000000e+00, 0.00000000e+00, 3.78990809e-02, 2.59070470e-01,
        9.45391455e-01, 1.31533436e+00, 1.11473032e+00, 4.87913840e+00,
        7.00195318e+00, 9.95163729e+00],
       [0.00000000e+00, 0.00000000e+00, 9.80698277e-03, 2.55429036e-02,
        4.05987445e-02, 6.34445811e-02, 8.98209193e-02, 9.13722396e-02,
        1.00153933e+01, 0.00000000e+00]])}, {'Values': array([[1.64966725e-01, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,
        0.00000000e+00, 3.89037057e-02, 2.54827166e-02, 1.20872239e-01,
        1.09538823e-01, 0.00000000e+00],
       [0.00000000e+00, 0.00000000e+00, 8.50985026e-03, 1.03013648e-02,
        3.85694417e-02, 7.68799896e-02, 9.54002893e-02, 1.47685855e-01,
        1.35110195e-01, 0.00000000e+00],
       [6.22072968e-03, 1.94815332e-02, 2.77375872e-02, 3.98113529e-02,
        8.80108741e-02, 1.19029272e-01, 1.42606714e-01, 2.67584992e-01,
        1.47885846e-01, 4.71511415e-01],
       [1.33307773e-02, 3.18406006e-02, 2.93775719e-02, 6.46629152e-02,
        5.83595424e-02, 1.59821947e-01, 2.17853089e-01, 4.10881302e-01,
        6.63944927e-01, 6.48466865e-01],
       [2.35986683e-02, 4.22542315e-02, 5.70407408e-02, 1.41957546e-01,
        2.18196566e-01, 2.25626423e-01, 4.00546772e-01, 6.34792581e-01,
        1.20984853e+00, 1.36309433e+00],
       [3.29203995e-02, 9.95317367e-02, 1.01373364e-01, 1.44218908e-01,
        3.40280828e-01, 5.20654668e-01, 5.16973322e-01, 9.72404800e-01,
        1.58049283e+00, 1.47694213e+00],
       [3.85790313e-02, 1.08413673e-01, 2.88078493e-01, 4.33338867e-01,
        6.73561361e-01, 1.02458630e+00, 1.51666300e+00, 1.87313190e+00,
        2.18812392e+00, 2.51292408e+00],
       [0.00000000e+00, 7.82174430e-02, 2.70993307e-01, 4.38040751e-01,
        6.37186866e-01, 7.59867420e-01, 2.27090033e+00, 3.36709158e+00,
        4.06331318e+00, 6.04774203e+00],
       [0.00000000e+00, 0.00000000e+00, 3.60427390e-02, 2.80213276e-01,
        9.35658077e-01, 1.27155651e+00, 1.07867551e+00, 4.88493002e+00,
        7.00696986e+00, 9.95971306e+00],
       [0.00000000e+00, 0.00000000e+00, 1.06494313e-02, 2.75015720e-02,
        4.28378867e-02, 6.58872611e-02, 9.41825738e-02, 9.12095971e-02,
        1.00189704e+01, 0.00000000e+00]])}, {'Values': array([[1.77904318e-01, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,
        0.00000000e+00, 4.85793164e-02, 2.71488068e-02, 1.17587566e-01,
        1.03671014e-01, 0.00000000e+00],
       [0.00000000e+00, 0.00000000e+00, 8.23421985e-03, 1.05533219e-02,
        3.76115928e-02, 9.19706266e-02, 9.18455437e-02, 1.56200449e-01,
        1.37149099e-01, 0.00000000e+00],
       [7.34270043e-03, 2.07844249e-02, 2.77205412e-02, 4.09698406e-02,
        8.40131023e-02, 1.17635713e-01, 1.38295792e-01, 2.98961591e-01,
        1.49659370e-01, 5.57684101e-01],
       [1.55394729e-02, 3.30457004e-02, 2.92969484e-02, 6.68030233e-02,
        5.13911375e-02, 1.51220807e-01, 2.16977694e-01, 4.57034125e-01,
        7.24540068e-01, 7.35490368e-01],
       [2.18436453e-02, 4.21220036e-02, 6.02262659e-02, 1.52947216e-01,
        2.31959612e-01, 2.24987425e-01, 4.00386819e-01, 6.86129442e-01,
        1.25415877e+00, 1.41732774e+00],
       [3.78356721e-02, 1.09287198e-01, 1.08320327e-01, 1.52672135e-01,
        3.59371592e-01, 5.41170031e-01, 5.07390335e-01, 9.93105724e-01,
        1.58080574e+00, 1.45572607e+00],
       [4.40805330e-02, 1.08812125e-01, 3.03403454e-01, 4.51912160e-01,
        7.08032807e-01, 1.05363563e+00, 1.54422510e+00, 1.92870054e+00,
        2.19989854e+00, 2.26409767e+00],
       [0.00000000e+00, 8.92768195e-02, 2.69344006e-01, 4.27198985e-01,
        6.19384185e-01, 7.66706284e-01, 2.29586000e+00, 3.37946695e+00,
        4.11455997e+00, 6.06480407e+00],
       [0.00000000e+00, 0.00000000e+00, 3.36997979e-02, 3.03476091e-01,
        9.19828809e-01, 1.21789108e+00, 1.04269940e+00, 4.89060054e+00,
        7.01212696e+00, 9.96831370e+00],
       [0.00000000e+00, 0.00000000e+00, 1.16816358e-02, 3.01093077e-02,
        4.60588972e-02, 6.96791893e-02, 1.00833308e-01, 9.36535107e-02,
        1.00233022e+01, 0.00000000e+00]])}, {'Values': array([[1.91880564e-01, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,
        0.00000000e+00, 6.15492574e-02, 2.57773423e-02, 1.08560903e-01,
        9.97435631e-02, 0.00000000e+00],
       [0.00000000e+00, 0.00000000e+00, 7.73018198e-03, 1.06339873e-02,
        3.37171043e-02, 1.11594952e-01, 8.72814930e-02, 1.70702914e-01,
        1.46707401e-01, 0.00000000e+00],
       [8.57600696e-03, 2.23868444e-02, 2.68812499e-02, 4.14462718e-02,
        7.51947114e-02, 1.11724014e-01, 1.34717828e-01, 3.44263445e-01,
        1.57487988e-01, 6.56962965e-01],
       [1.86559773e-02, 3.53262211e-02, 2.91389282e-02, 6.79783416e-02,
        4.37152182e-02, 1.42509529e-01, 2.16206560e-01, 5.21213373e-01,
        8.12692807e-01, 8.30143032e-01],
       [1.94756167e-02, 4.26376962e-02, 6.50804817e-02, 1.65607917e-01,
        2.47001857e-01, 2.24201700e-01, 4.00689313e-01, 7.56190673e-01,
        1.30713197e+00, 1.46762411e+00],
       [4.58833999e-02, 1.20487479e-01, 1.17048443e-01, 1.61746951e-01,
        3.79308309e-01, 5.61567814e-01, 4.94488981e-01, 1.02377679e+00,
        1.58515303e+00, 1.42444805e+00],
       [5.15342335e-02, 1.06015196e-01, 3.18382843e-01, 4.68485615e-01,
        7.42686277e-01, 1.08009741e+00, 1.56798619e+00, 1.99232089e+00,
        2.21858906e+00, 1.97780512e+00],
       [0.00000000e+00, 1.04717976e-01, 2.62268350e-01, 4.09069078e-01,
        5.91827374e-01, 7.73029446e-01, 2.31887844e+00, 3.39119281e+00,
        4.16879099e+00, 6.07783567e+00],
       [0.00000000e+00, 0.00000000e+00, 3.07940959e-02, 3.29072794e-01,
        8.97802869e-01, 1.15384933e+00, 1.00781327e+00, 4.89600784e+00,
        7.01726461e+00, 9.97724897e+00],
       [0.00000000e+00, 0.00000000e+00, 1.28556438e-02, 3.35121044e-02,
        5.04925723e-02, 7.49452634e-02, 1.10349612e-01, 9.98971162e-02,
        1.00284907e+01, 0.00000000e+00]])}, {'Values': array([[2.06427172e-01, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,
        0.00000000e+00, 7.91277325e-02, 1.87972518e-02, 8.95361983e-02,
        1.00869627e-01, 0.00000000e+00],
       [0.00000000e+00, 0.00000000e+00, 6.44636407e-03, 1.02912332e-02,
        2.47052474e-02, 1.37231425e-01, 8.10988050e-02, 1.92824209e-01,
        1.68042388e-01, 0.00000000e+00],
       [1.00507589e-02, 2.46374246e-02, 2.36995080e-02, 4.07777127e-02,
        5.95692694e-02, 9.81834233e-02, 1.32800598e-01, 4.06180685e-01,
        1.73638733e-01, 7.69085298e-01],
       [2.35873428e-02, 3.94571556e-02, 2.85801382e-02, 6.73121560e-02,
        3.66242758e-02, 1.36644100e-01, 2.17202522e-01, 6.06222379e-01,
        9.36530675e-01, 9.33320810e-01],
       [1.64888272e-02, 4.46940808e-02, 7.25928053e-02, 1.80112892e-01,
        2.63399802e-01, 2.23276447e-01, 4.02893263e-01, 8.48010424e-01,
        1.36956879e+00, 1.51451217e+00],
       [5.87605298e-02, 1.32522415e-01, 1.27796084e-01, 1.71421878e-01,
        3.99961321e-01, 5.81761023e-01, 4.78070409e-01, 1.06652477e+00,
        1.59426440e+00, 1.38271841e+00],
       [6.17179318e-02, 9.88291985e-02, 3.32308072e-01, 4.82315285e-01,
        7.76990585e-01, 1.10344388e+00, 1.58739667e+00, 2.06525765e+00,
        2.24544949e+00, 1.65127813e+00],
       [0.00000000e+00, 1.26717974e-01, 2.47801766e-01, 3.81947200e-01,
        5.52024699e-01, 7.78837008e-01, 2.33995389e+00, 3.40203123e+00,
        4.22621053e+00, 6.08635471e+00],
       [0.00000000e+00, 0.00000000e+00, 2.71154315e-02, 3.57092445e-01,
        8.69478836e-01, 1.07885210e+00, 9.75257161e-01, 4.90092420e+00,
        7.02212144e+00, 9.98632371e+00],
       [0.00000000e+00, 0.00000000e+00, 1.38955868e-02, 3.75664940e-02,
        5.60608203e-02, 8.12052990e-02, 1.23013948e-01, 1.11387951e-01,
        1.00345917e+01, 0.00000000e+00]])}]
In [25]:

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 Ans : As we increase lambda ,The loss curve converges faster

2.c Policy iteration error curve

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

In [26]:
import matplotlib.pyplot as plt
import math
diffs = []
for ii in range(len(extra_info_pi)):
    diff = np.linalg.norm(extra_info_pi[ii] - extra_info_pi[len(extra_info_pi)-1])/10
    diffs.append(diff)
plt.plot(diffs)
Out[26]:
[<matplotlib.lines.Line2D at 0x7fce5576f510>]

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]$

In [ ]:
# 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 = [0,0.25,0.5,0.75,1]
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))
In [ ]:
#lamda =0 
extra_info_pi=extra_info[0][0:2500]
diffs = []
for ii in range(0,len(extra_info_pi),10):
    diff = np.linalg.norm(extra_info_pi[ii] - extra_info_pi[len(extra_info_pi)-1])/10
    diffs.append(diff)
plt.plot(diffs)
print(len(extra_info_pi))
2500
In [ ]:
#lamda =0.25
extra_info_pi=extra_info[0.25][0:2500]
diffs = []
for ii in range(0,len(extra_info_pi),10):
    diff = np.linalg.norm(extra_info_pi[ii] - extra_info_pi[len(extra_info_pi)-1])/10
    diffs.append(diff)
plt.plot(diffs)
print(len(extra_info_pi))
2500
In [ ]:
#lamda =0.5
extra_info_pi=extra_info[0.5][0:2500]
diffs = []
for ii in range(0,len(extra_info_pi),10):
    diff = np.linalg.norm(extra_info_pi[ii] - extra_info_pi[len(extra_info_pi)-1])/10
    diffs.append(diff)
plt.plot(diffs)
Out[ ]:
[<matplotlib.lines.Line2D at 0x7fef095e0d10>]
In [ ]:
#lamda =0.75
extra_info_pi=extra_info[0.75][0:2500]
diffs = []
for ii in range(0,len(extra_info_pi),10):
    diff = np.linalg.norm(extra_info_pi[ii] - extra_info_pi[len(extra_info_pi)-1])/10
    diffs.append(diff)
plt.plot(diffs)
Out[ ]:
[<matplotlib.lines.Line2D at 0x7fef0954e890>]
In [ ]:
#lamda =1
extra_info_pi=extra_info[1][0:2500]
diffs = []
for ii in range(0,len(extra_info_pi),10):
    diff = np.linalg.norm(extra_info_pi[ii] - extra_info_pi[len(extra_info_pi)-1])/10
    diffs.append(diff)
plt.plot(diffs)
Out[ ]:
[<matplotlib.lines.Line2D at 0x7fef09531dd0>]

It can be easily seen that as we increase lambda it converges faster

Submit to AIcrowd 🚀

In [ ]:
!DATASET_PATH=$AICROWD_DATASET_PATH aicrowd notebook submit --no-verify -c iit-m-rl-assignment-2-gridworld -a assets
No jupyter lab module found. Using jupyter notebook.
Using notebook: /content/Copy%20of%20IITM_Assignment_2_Gridworld_Release.ipynb for submission...
Removing existing files from submission directory...
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%33.4/31.8 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/130470              │
│                  │                                                                                                                                │
│  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                                 │
└──────────────────┴────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
In [ ]:

827

Comments

You must login before you can post a comment.

Execute