code: def run_n_episodes(self, env, num_episodes, policy):
      acc_rws = []
      for e in range(num_episodes):
          start_time = time.time()
          ob = env.reset()
          acc_rw = 0
          for i in range(env.max_steps):
              action = policy(env, ob)
              ob, rw, done, info = env.step(action)
              print(
                  "After action {}: reward {}, observation {}".format(
                      action, rw, ob
                  )
              )
              acc_rw += rw
              if done:
                  logger.debug(
                      "Epoch {} done in {} step {} seconds, acc. reward {}".format(
                          e, i, time.time() - start_time, acc_rw
                      )
                  )
                  break
              print("")
          acc_rws.append(acc_rw)
  
      mean_acc_rw = np.mean(acc_rws)
      return mean_acc_rw
  
file_path: ReAgent/reagent/gym/tests/test_linear_dynamics.py
imports: import logging
  import time
  import unittest
  import numpy
  import scipy.linalg
  from reagent.gym.envs import Gym
label_desc: Use image node_id 3 for calling the TestLinearDynamicsEnvironment obj's underlying member method code with example usage: obj.run_n_episodes(env, num_episodes, policy) and returns: mean_acc_rw