# Use Off-Policy VPG with Baseline to Play CartPole-v0¶

TensorFlow version

In [1]:

    %matplotlib inline

    import sys
    import logging
    import itertools

    import numpy as np
    np.random.seed(0)
    import pandas as pd
    import gym
    import matplotlib.pyplot as plt
    import tensorflow.compat.v2 as tf
    tf.random.set_seed(0)
    from tensorflow import keras
    from tensorflow import nn
    from tensorflow import optimizers
    from tensorflow.keras import layers
    from tensorflow.keras import losses

    logging.basicConfig(level=logging.INFO,
            format='%(asctime)s [%(levelname)s] %(message)s',
            stream=sys.stdout, datefmt='%H:%M:%S')

In [2]:

    env = gym.make('CartPole-v0')
    for key in vars(env):
        logging.info('%s: %s', key, vars(env)[key])
    for key in vars(env.spec):
        logging.info('%s: %s', key, vars(env.spec)[key])

    22:32:33 [INFO] env: <CartPoleEnv<CartPole-v0>>
    22:32:33 [INFO] action_space: Discrete(2)
    22:32:33 [INFO] observation_space: Box(-3.4028234663852886e+38, 3.4028234663852886e+38, (4,), float32)
    22:32:33 [INFO] reward_range: (-inf, inf)
    22:32:33 [INFO] metadata: {'render.modes': ['human', 'rgb_array'], 'video.frames_per_second': 50}
    22:32:33 [INFO] _max_episode_steps: 200
    22:32:33 [INFO] _elapsed_steps: None
    22:32:33 [INFO] id: CartPole-v0
    22:32:33 [INFO] entry_point: gym.envs.classic_control:CartPoleEnv
    22:32:33 [INFO] reward_threshold: 195.0
    22:32:33 [INFO] nondeterministic: False
    22:32:33 [INFO] max_episode_steps: 200
    22:32:33 [INFO] _kwargs: {}
    22:32:33 [INFO] _env_name: CartPole

In [3]:

    class OffPolicyVPGwBaselineAgent:
        def __init__(self, env):
            self.action_n = env.action_space.n
            self.gamma = 0.99

            def dot(y_true, y_pred):
                return -tf.reduce_sum(y_true * y_pred, axis=-1)

            self.policy_net = self.build_net(hidden_sizes=[],
                    output_size=self.action_n,
                    output_activation=nn.softmax,
                    loss=dot, learning_rate=0.06)
            self.baseline_net = self.build_net(hidden_sizes=[],
                    learning_rate=0.1)

        def build_net(self, hidden_sizes, output_size=1,
                activation=nn.relu, output_activation=None,
                use_bias=False, loss=losses.mse, learning_rate=0.001):
            model = keras.Sequential()
            for hidden_size in hidden_sizes:
                model.add(layers.Dense(units=hidden_size,
                        activation=activation, use_bias=use_bias))
            model.add(layers.Dense(units=output_size,
                    activation=output_activation, use_bias=use_bias))
            optimizer = optimizers.Adam(learning_rate)
            model.compile(optimizer=optimizer, loss=loss)
            return model

        def reset(self, mode=None):
            self.mode = mode
            if self.mode == 'train':
                self.trajectory = []

        def step(self, observation, reward, terminated):
            if self.mode == 'train':
                action = np.random.choice(self.action_n)  # use random policy
                self.trajectory += [observation, reward, terminated, action]
            else:
                probs = self.policy_net.predict(observation[np.newaxis], verbose=0)[0]
                action = np.random.choice(self.action_n, p=probs)
            return action

        def close(self):
            if self.mode == 'train':
                self.learn()

        def learn(self):
            df = pd.DataFrame(np.array(self.trajectory, dtype=object).reshape(-1, 4),
                    columns=['state', 'reward', 'terminated', 'action'])

            # update baseline
            df['discount'] = self.gamma ** df.index.to_series()
            df['discounted_reward'] = df['discount'] * df['reward'].astype(float)
            df['discounted_return'] = df['discounted_reward'][::-1].cumsum()
            df['return'] = df['discounted_return'] / df['discount']
            states = np.stack(df['state'])
            returns = df[['return',]].values
            self.baseline_net.fit(states, returns, verbose=0)

            # update policy
            states = np.stack(df['state'])
            df['baseline'] = self.baseline_net.predict(states, verbose=0)
            df['psi'] = df['discounted_return'] - df['baseline'] * df['discount']
            df['behavior_prob'] = 1. / self.action_n
            df['sample_weight'] = df['psi'] / df['behavior_prob']
            actions = np.eye(self.action_n)[df['action'].astype(int)]
            sample_weight = df[['sample_weight',]].values
            self.policy_net.fit(states, actions, sample_weight=sample_weight,
                    verbose=0)

    agent = OffPolicyVPGwBaselineAgent(env)

In [4]:

    def play_episode(env, agent, seed=None, mode=None, render=False):
        observation, _ = env.reset(seed=seed)
        reward, terminated, truncated = 0., False, False
        agent.reset(mode=mode)
        episode_reward, elapsed_steps = 0., 0
        while True:
            action = agent.step(observation, reward, terminated)
            if render:
                env.render()
            if terminated or truncated:
                break
            observation, reward, terminated, truncated, _ = env.step(action)
            episode_reward += reward
            elapsed_steps += 1
        agent.close()
        return episode_reward, elapsed_steps

    logging.info('==== train ====')
    episode_rewards = []
    for episode in itertools.count():
        play_episode(env, agent, seed=episode,
                mode='train')
        episode_reward, elapsed_steps = play_episode(env, agent)
        episode_rewards.append(episode_reward)
        logging.info('train episode %d: reward = %.2f, steps = %d',
                episode, episode_reward, elapsed_steps)
        if np.mean(episode_rewards[-10:]) > 195:
            break
    plt.plot(episode_rewards)

    logging.info('==== test ====')
    episode_rewards = []
    for episode in range(100):
        episode_reward, elapsed_steps = play_episode(env, agent)
        episode_rewards.append(episode_reward)
        logging.info('test episode %d: reward = %.2f, steps = %d',
                episode, episode_reward, elapsed_steps)
    logging.info('average episode reward = %.2f ± %.2f',
            np.mean(episode_rewards), np.std(episode_rewards))

    22:32:35 [INFO] ==== train ====
    22:32:35 [INFO] NumExpr defaulting to 8 threads.
    22:32:58 [INFO] train episode 0: reward = 119.00, steps = 119
    22:33:04 [INFO] train episode 1: reward = 31.00, steps = 31
    22:33:13 [INFO] train episode 2: reward = 60.00, steps = 60
    22:33:20 [INFO] train episode 3: reward = 40.00, steps = 40
    22:33:27 [INFO] train episode 4: reward = 42.00, steps = 42
    22:33:30 [INFO] train episode 5: reward = 15.00, steps = 15
    22:33:35 [INFO] train episode 6: reward = 22.00, steps = 22
    22:33:42 [INFO] train episode 7: reward = 38.00, steps = 38
    22:33:50 [INFO] train episode 8: reward = 44.00, steps = 44
    22:34:00 [INFO] train episode 9: reward = 62.00, steps = 62
    22:34:19 [INFO] train episode 10: reward = 102.00, steps = 102
    22:34:22 [INFO] train episode 11: reward = 16.00, steps = 16
    22:34:41 [INFO] train episode 12: reward = 134.00, steps = 134
    22:34:51 [INFO] train episode 13: reward = 59.00, steps = 59
    22:35:07 [INFO] train episode 14: reward = 111.00, steps = 111
    22:35:09 [INFO] train episode 15: reward = 16.00, steps = 16
    22:35:13 [INFO] train episode 16: reward = 25.00, steps = 25
    22:35:26 [INFO] train episode 17: reward = 88.00, steps = 88
    22:35:36 [INFO] train episode 18: reward = 79.00, steps = 79
    22:35:46 [INFO] train episode 19: reward = 59.00, steps = 59
    22:35:54 [INFO] train episode 20: reward = 61.00, steps = 61
    22:36:06 [INFO] train episode 21: reward = 82.00, steps = 82
    22:36:11 [INFO] train episode 22: reward = 33.00, steps = 33
    22:36:22 [INFO] train episode 23: reward = 76.00, steps = 76
    22:36:27 [INFO] train episode 24: reward = 32.00, steps = 32
    22:36:35 [INFO] train episode 25: reward = 58.00, steps = 58
    22:36:44 [INFO] train episode 26: reward = 73.00, steps = 73
    22:36:54 [INFO] train episode 27: reward = 75.00, steps = 75
    22:36:59 [INFO] train episode 28: reward = 38.00, steps = 38
    22:37:05 [INFO] train episode 29: reward = 50.00, steps = 50
    22:37:15 [INFO] train episode 30: reward = 70.00, steps = 70
    22:37:20 [INFO] train episode 31: reward = 38.00, steps = 38
    22:37:30 [INFO] train episode 32: reward = 71.00, steps = 71
    22:37:40 [INFO] train episode 33: reward = 63.00, steps = 63
    22:37:45 [INFO] train episode 34: reward = 29.00, steps = 29
    22:37:53 [INFO] train episode 35: reward = 41.00, steps = 41
    22:38:05 [INFO] train episode 36: reward = 69.00, steps = 69
    22:38:21 [INFO] train episode 37: reward = 96.00, steps = 96
    22:38:36 [INFO] train episode 38: reward = 93.00, steps = 93
    22:38:49 [INFO] train episode 39: reward = 100.00, steps = 100
    22:39:00 [INFO] train episode 40: reward = 76.00, steps = 76
    22:39:08 [INFO] train episode 41: reward = 47.00, steps = 47
    22:39:17 [INFO] train episode 42: reward = 58.00, steps = 58
    22:39:21 [INFO] train episode 43: reward = 31.00, steps = 31
    22:39:29 [INFO] train episode 44: reward = 57.00, steps = 57
    22:39:35 [INFO] train episode 45: reward = 41.00, steps = 41
    22:39:49 [INFO] train episode 46: reward = 100.00, steps = 100
    22:39:59 [INFO] train episode 47: reward = 74.00, steps = 74
    22:40:05 [INFO] train episode 48: reward = 43.00, steps = 43
    22:40:17 [INFO] train episode 49: reward = 86.00, steps = 86
    22:40:24 [INFO] train episode 50: reward = 49.00, steps = 49
    22:40:30 [INFO] train episode 51: reward = 40.00, steps = 40
    22:40:39 [INFO] train episode 52: reward = 69.00, steps = 69
    22:40:50 [INFO] train episode 53: reward = 73.00, steps = 73
    22:40:56 [INFO] train episode 54: reward = 43.00, steps = 43
    22:41:07 [INFO] train episode 55: reward = 75.00, steps = 75
    22:41:13 [INFO] train episode 56: reward = 46.00, steps = 46
    22:41:22 [INFO] train episode 57: reward = 57.00, steps = 57
    22:41:27 [INFO] train episode 58: reward = 38.00, steps = 38
    22:41:34 [INFO] train episode 59: reward = 54.00, steps = 54
    22:41:42 [INFO] train episode 60: reward = 54.00, steps = 54
    22:41:50 [INFO] train episode 61: reward = 61.00, steps = 61
    22:41:58 [INFO] train episode 62: reward = 61.00, steps = 61
    22:42:03 [INFO] train episode 63: reward = 30.00, steps = 30
    22:42:10 [INFO] train episode 64: reward = 65.00, steps = 65
    22:42:19 [INFO] train episode 65: reward = 69.00, steps = 69
    22:42:32 [INFO] train episode 66: reward = 104.00, steps = 104
    22:42:37 [INFO] train episode 67: reward = 41.00, steps = 41
    22:42:52 [INFO] train episode 68: reward = 114.00, steps = 114
    22:42:59 [INFO] train episode 69: reward = 56.00, steps = 56
    22:43:03 [INFO] train episode 70: reward = 34.00, steps = 34
    22:43:12 [INFO] train episode 71: reward = 68.00, steps = 68
    22:43:21 [INFO] train episode 72: reward = 74.00, steps = 74
    22:43:26 [INFO] train episode 73: reward = 39.00, steps = 39
    22:43:36 [INFO] train episode 74: reward = 80.00, steps = 80
    22:43:45 [INFO] train episode 75: reward = 68.00, steps = 68
    22:43:55 [INFO] train episode 76: reward = 83.00, steps = 83
    22:44:06 [INFO] train episode 77: reward = 87.00, steps = 87
    22:44:16 [INFO] train episode 78: reward = 78.00, steps = 78
    22:44:21 [INFO] train episode 79: reward = 39.00, steps = 39
    22:44:28 [INFO] train episode 80: reward = 54.00, steps = 54
    22:44:35 [INFO] train episode 81: reward = 56.00, steps = 56
    22:44:42 [INFO] train episode 82: reward = 50.00, steps = 50
    22:44:54 [INFO] train episode 83: reward = 93.00, steps = 93
    22:45:01 [INFO] train episode 84: reward = 55.00, steps = 55
    22:45:08 [INFO] train episode 85: reward = 54.00, steps = 54
    22:45:13 [INFO] train episode 86: reward = 41.00, steps = 41
    22:45:21 [INFO] train episode 87: reward = 61.00, steps = 61
    22:45:32 [INFO] train episode 88: reward = 88.00, steps = 88
    22:45:43 [INFO] train episode 89: reward = 84.00, steps = 84
    22:45:50 [INFO] train episode 90: reward = 51.00, steps = 51
    22:45:58 [INFO] train episode 91: reward = 61.00, steps = 61
    22:46:05 [INFO] train episode 92: reward = 55.00, steps = 55
    22:46:14 [INFO] train episode 93: reward = 65.00, steps = 65
    22:46:22 [INFO] train episode 94: reward = 56.00, steps = 56
    22:46:35 [INFO] train episode 95: reward = 86.00, steps = 86
    22:46:41 [INFO] train episode 96: reward = 34.00, steps = 34
    22:46:48 [INFO] train episode 97: reward = 50.00, steps = 50
    22:47:00 [INFO] train episode 98: reward = 92.00, steps = 92
    22:47:08 [INFO] train episode 99: reward = 63.00, steps = 63
    22:47:21 [INFO] train episode 100: reward = 97.00, steps = 97
    22:47:31 [INFO] train episode 101: reward = 71.00, steps = 71
    22:47:41 [INFO] train episode 102: reward = 64.00, steps = 64
    22:47:53 [INFO] train episode 103: reward = 84.00, steps = 84
    22:48:00 [INFO] train episode 104: reward = 54.00, steps = 54
    22:48:06 [INFO] train episode 105: reward = 43.00, steps = 43
    22:48:24 [INFO] train episode 106: reward = 144.00, steps = 144
    22:48:33 [INFO] train episode 107: reward = 58.00, steps = 58
    22:48:44 [INFO] train episode 108: reward = 79.00, steps = 79
    22:48:51 [INFO] train episode 109: reward = 48.00, steps = 48
    22:48:59 [INFO] train episode 110: reward = 56.00, steps = 56
    22:49:11 [INFO] train episode 111: reward = 86.00, steps = 86
    22:49:23 [INFO] train episode 112: reward = 92.00, steps = 92
    22:49:33 [INFO] train episode 113: reward = 73.00, steps = 73
    22:49:50 [INFO] train episode 114: reward = 126.00, steps = 126
    22:49:59 [INFO] train episode 115: reward = 64.00, steps = 64
    22:50:10 [INFO] train episode 116: reward = 77.00, steps = 77
    22:50:25 [INFO] train episode 117: reward = 91.00, steps = 91
    22:50:34 [INFO] train episode 118: reward = 66.00, steps = 66
    22:50:49 [INFO] train episode 119: reward = 98.00, steps = 98
    22:50:59 [INFO] train episode 120: reward = 48.00, steps = 48
    22:51:11 [INFO] train episode 121: reward = 72.00, steps = 72
    22:51:21 [INFO] train episode 122: reward = 56.00, steps = 56
    22:51:34 [INFO] train episode 123: reward = 79.00, steps = 79
    22:51:44 [INFO] train episode 124: reward = 62.00, steps = 62
    22:51:54 [INFO] train episode 125: reward = 66.00, steps = 66
    22:52:07 [INFO] train episode 126: reward = 106.00, steps = 106
    22:52:17 [INFO] train episode 127: reward = 73.00, steps = 73
    22:52:25 [INFO] train episode 128: reward = 58.00, steps = 58
    22:52:32 [INFO] train episode 129: reward = 45.00, steps = 45
    22:52:38 [INFO] train episode 130: reward = 42.00, steps = 42
    22:52:51 [INFO] train episode 131: reward = 96.00, steps = 96
    22:53:00 [INFO] train episode 132: reward = 66.00, steps = 66
    22:53:07 [INFO] train episode 133: reward = 49.00, steps = 49
    22:53:22 [INFO] train episode 134: reward = 107.00, steps = 107
    22:53:28 [INFO] train episode 135: reward = 42.00, steps = 42
    22:53:36 [INFO] train episode 136: reward = 55.00, steps = 55
    22:53:48 [INFO] train episode 137: reward = 75.00, steps = 75
    22:54:01 [INFO] train episode 138: reward = 70.00, steps = 70
    22:54:13 [INFO] train episode 139: reward = 59.00, steps = 59
    22:54:20 [INFO] train episode 140: reward = 35.00, steps = 35
    22:54:41 [INFO] train episode 141: reward = 105.00, steps = 105
    22:54:53 [INFO] train episode 142: reward = 65.00, steps = 65
    22:55:02 [INFO] train episode 143: reward = 48.00, steps = 48
    22:55:14 [INFO] train episode 144: reward = 62.00, steps = 62
    22:55:37 [INFO] train episode 145: reward = 109.00, steps = 109
    22:55:49 [INFO] train episode 146: reward = 64.00, steps = 64
    22:56:09 [INFO] train episode 147: reward = 102.00, steps = 102
    22:56:33 [INFO] train episode 148: reward = 113.00, steps = 113
    22:56:46 [INFO] train episode 149: reward = 64.00, steps = 64
    22:56:58 [INFO] train episode 150: reward = 52.00, steps = 52
    22:57:13 [INFO] train episode 151: reward = 68.00, steps = 68
    22:57:24 [INFO] train episode 152: reward = 49.00, steps = 49
    22:57:41 [INFO] train episode 153: reward = 88.00, steps = 88
    22:57:51 [INFO] train episode 154: reward = 46.00, steps = 46
    22:58:06 [INFO] train episode 155: reward = 82.00, steps = 82
    22:58:29 [INFO] train episode 156: reward = 130.00, steps = 130
    22:58:41 [INFO] train episode 157: reward = 63.00, steps = 63
    22:58:56 [INFO] train episode 158: reward = 78.00, steps = 78
    22:59:05 [INFO] train episode 159: reward = 57.00, steps = 57
    22:59:17 [INFO] train episode 160: reward = 77.00, steps = 77
    22:59:30 [INFO] train episode 161: reward = 77.00, steps = 77
    22:59:38 [INFO] train episode 162: reward = 51.00, steps = 51
    22:59:58 [INFO] train episode 163: reward = 123.00, steps = 123
    23:00:24 [INFO] train episode 164: reward = 177.00, steps = 177
    23:00:38 [INFO] train episode 165: reward = 90.00, steps = 90
    23:00:46 [INFO] train episode 166: reward = 54.00, steps = 54
    23:00:55 [INFO] train episode 167: reward = 56.00, steps = 56
    23:01:02 [INFO] train episode 168: reward = 42.00, steps = 42
    23:01:13 [INFO] train episode 169: reward = 78.00, steps = 78
    23:01:21 [INFO] train episode 170: reward = 63.00, steps = 63
    23:01:32 [INFO] train episode 171: reward = 86.00, steps = 86
    23:01:41 [INFO] train episode 172: reward = 66.00, steps = 66
    23:01:48 [INFO] train episode 173: reward = 59.00, steps = 59
    23:01:56 [INFO] train episode 174: reward = 55.00, steps = 55
    23:02:04 [INFO] train episode 175: reward = 58.00, steps = 58
    23:02:14 [INFO] train episode 176: reward = 80.00, steps = 80
    23:02:30 [INFO] train episode 177: reward = 120.00, steps = 120
    23:02:38 [INFO] train episode 178: reward = 56.00, steps = 56
    23:02:46 [INFO] train episode 179: reward = 59.00, steps = 59
    23:03:03 [INFO] train episode 180: reward = 130.00, steps = 130
    23:03:14 [INFO] train episode 181: reward = 92.00, steps = 92
    23:03:22 [INFO] train episode 182: reward = 61.00, steps = 61
    23:03:31 [INFO] train episode 183: reward = 64.00, steps = 64
    23:03:40 [INFO] train episode 184: reward = 70.00, steps = 70
    23:03:50 [INFO] train episode 185: reward = 76.00, steps = 76
    23:03:56 [INFO] train episode 186: reward = 49.00, steps = 49
    23:04:07 [INFO] train episode 187: reward = 82.00, steps = 82
    23:04:21 [INFO] train episode 188: reward = 118.00, steps = 118
    23:04:30 [INFO] train episode 189: reward = 69.00, steps = 69
    23:04:41 [INFO] train episode 190: reward = 91.00, steps = 91
    23:04:48 [INFO] train episode 191: reward = 59.00, steps = 59
    23:04:59 [INFO] train episode 192: reward = 88.00, steps = 88
    23:05:10 [INFO] train episode 193: reward = 88.00, steps = 88
    23:05:23 [INFO] train episode 194: reward = 107.00, steps = 107
    23:05:32 [INFO] train episode 195: reward = 72.00, steps = 72
    23:05:41 [INFO] train episode 196: reward = 76.00, steps = 76
    23:05:51 [INFO] train episode 197: reward = 78.00, steps = 78
    23:05:58 [INFO] train episode 198: reward = 57.00, steps = 57
    23:06:05 [INFO] train episode 199: reward = 60.00, steps = 60
    23:06:11 [INFO] train episode 200: reward = 50.00, steps = 50
    23:06:19 [INFO] train episode 201: reward = 65.00, steps = 65
    23:06:24 [INFO] train episode 202: reward = 39.00, steps = 39
    23:06:33 [INFO] train episode 203: reward = 68.00, steps = 68
    23:06:44 [INFO] train episode 204: reward = 98.00, steps = 98
    23:06:53 [INFO] train episode 205: reward = 69.00, steps = 69
    23:07:11 [INFO] train episode 206: reward = 148.00, steps = 148
    23:07:18 [INFO] train episode 207: reward = 63.00, steps = 63
    23:07:28 [INFO] train episode 208: reward = 79.00, steps = 79
    23:07:33 [INFO] train episode 209: reward = 42.00, steps = 42
    23:07:40 [INFO] train episode 210: reward = 54.00, steps = 54
    23:07:47 [INFO] train episode 211: reward = 57.00, steps = 57
    23:08:04 [INFO] train episode 212: reward = 142.00, steps = 142
    23:08:11 [INFO] train episode 213: reward = 55.00, steps = 55
    23:08:24 [INFO] train episode 214: reward = 109.00, steps = 109
    23:08:38 [INFO] train episode 215: reward = 114.00, steps = 114
    23:08:45 [INFO] train episode 216: reward = 57.00, steps = 57
    23:08:58 [INFO] train episode 217: reward = 110.00, steps = 110
    23:09:07 [INFO] train episode 218: reward = 68.00, steps = 68
    23:09:17 [INFO] train episode 219: reward = 89.00, steps = 89
    23:09:28 [INFO] train episode 220: reward = 77.00, steps = 77
    23:09:37 [INFO] train episode 221: reward = 62.00, steps = 62
    23:09:46 [INFO] train episode 222: reward = 54.00, steps = 54
    23:09:53 [INFO] train episode 223: reward = 53.00, steps = 53
    23:10:03 [INFO] train episode 224: reward = 69.00, steps = 69
    23:10:13 [INFO] train episode 225: reward = 67.00, steps = 67
    23:10:22 [INFO] train episode 226: reward = 57.00, steps = 57
    23:10:36 [INFO] train episode 227: reward = 100.00, steps = 100
    23:10:47 [INFO] train episode 228: reward = 69.00, steps = 69
    23:11:00 [INFO] train episode 229: reward = 95.00, steps = 95
    23:11:12 [INFO] train episode 230: reward = 74.00, steps = 74
    23:11:34 [INFO] train episode 231: reward = 144.00, steps = 144
    23:11:43 [INFO] train episode 232: reward = 70.00, steps = 70
    23:11:53 [INFO] train episode 233: reward = 81.00, steps = 81
    23:12:04 [INFO] train episode 234: reward = 79.00, steps = 79
    23:12:16 [INFO] train episode 235: reward = 87.00, steps = 87
    23:12:30 [INFO] train episode 236: reward = 110.00, steps = 110
    23:12:35 [INFO] train episode 237: reward = 47.00, steps = 47
    23:12:45 [INFO] train episode 238: reward = 77.00, steps = 77
    23:12:54 [INFO] train episode 239: reward = 74.00, steps = 74
    23:13:07 [INFO] train episode 240: reward = 103.00, steps = 103
    23:13:15 [INFO] train episode 241: reward = 64.00, steps = 64
    23:13:24 [INFO] train episode 242: reward = 70.00, steps = 70
    23:13:31 [INFO] train episode 243: reward = 57.00, steps = 57
    23:13:43 [INFO] train episode 244: reward = 97.00, steps = 97
    23:13:54 [INFO] train episode 245: reward = 91.00, steps = 91
    23:14:07 [INFO] train episode 246: reward = 104.00, steps = 104
    23:14:21 [INFO] train episode 247: reward = 117.00, steps = 117
    23:14:28 [INFO] train episode 248: reward = 55.00, steps = 55
    23:14:36 [INFO] train episode 249: reward = 69.00, steps = 69
    23:14:52 [INFO] train episode 250: reward = 131.00, steps = 131
    23:15:06 [INFO] train episode 251: reward = 115.00, steps = 115
    23:15:14 [INFO] train episode 252: reward = 62.00, steps = 62
    23:15:24 [INFO] train episode 253: reward = 88.00, steps = 88
    23:15:37 [INFO] train episode 254: reward = 108.00, steps = 108
    23:15:52 [INFO] train episode 255: reward = 114.00, steps = 114
    23:16:01 [INFO] train episode 256: reward = 74.00, steps = 74
    23:16:14 [INFO] train episode 257: reward = 111.00, steps = 111
    23:16:28 [INFO] train episode 258: reward = 118.00, steps = 118
    23:16:44 [INFO] train episode 259: reward = 124.00, steps = 124
    23:16:50 [INFO] train episode 260: reward = 47.00, steps = 47
    23:17:04 [INFO] train episode 261: reward = 116.00, steps = 116
    23:17:12 [INFO] train episode 262: reward = 68.00, steps = 68
    23:17:19 [INFO] train episode 263: reward = 60.00, steps = 60
    23:17:32 [INFO] train episode 264: reward = 105.00, steps = 105
    23:17:39 [INFO] train episode 265: reward = 51.00, steps = 51
    23:17:44 [INFO] train episode 266: reward = 46.00, steps = 46
    23:17:57 [INFO] train episode 267: reward = 108.00, steps = 108
    23:18:05 [INFO] train episode 268: reward = 65.00, steps = 65
    23:18:11 [INFO] train episode 269: reward = 43.00, steps = 43
    23:18:23 [INFO] train episode 270: reward = 105.00, steps = 105
    23:18:31 [INFO] train episode 271: reward = 61.00, steps = 61
    23:18:41 [INFO] train episode 272: reward = 81.00, steps = 81
    23:18:50 [INFO] train episode 273: reward = 73.00, steps = 73
    23:19:06 [INFO] train episode 274: reward = 112.00, steps = 112
    23:19:18 [INFO] train episode 275: reward = 85.00, steps = 85
    23:19:30 [INFO] train episode 276: reward = 88.00, steps = 88
    23:19:41 [INFO] train episode 277: reward = 76.00, steps = 76
    23:19:50 [INFO] train episode 278: reward = 71.00, steps = 71
    23:19:58 [INFO] train episode 279: reward = 51.00, steps = 51
    23:20:05 [INFO] train episode 280: reward = 55.00, steps = 55
    23:20:14 [INFO] train episode 281: reward = 61.00, steps = 61
    23:20:21 [INFO] train episode 282: reward = 55.00, steps = 55
    23:20:31 [INFO] train episode 283: reward = 75.00, steps = 75
    23:20:38 [INFO] train episode 284: reward = 59.00, steps = 59
    23:20:46 [INFO] train episode 285: reward = 64.00, steps = 64
    23:20:54 [INFO] train episode 286: reward = 67.00, steps = 67
    23:21:04 [INFO] train episode 287: reward = 80.00, steps = 80
    23:21:13 [INFO] train episode 288: reward = 69.00, steps = 69
    23:21:30 [INFO] train episode 289: reward = 140.00, steps = 140
    23:21:42 [INFO] train episode 290: reward = 90.00, steps = 90
    23:21:55 [INFO] train episode 291: reward = 110.00, steps = 110
    23:22:10 [INFO] train episode 292: reward = 109.00, steps = 109
    23:22:20 [INFO] train episode 293: reward = 82.00, steps = 82
    23:22:29 [INFO] train episode 294: reward = 60.00, steps = 60
    23:22:40 [INFO] train episode 295: reward = 76.00, steps = 76
    23:22:56 [INFO] train episode 296: reward = 102.00, steps = 102
    23:23:04 [INFO] train episode 297: reward = 57.00, steps = 57
    23:23:12 [INFO] train episode 298: reward = 63.00, steps = 63
    23:23:24 [INFO] train episode 299: reward = 89.00, steps = 89
    23:23:32 [INFO] train episode 300: reward = 56.00, steps = 56
    23:23:41 [INFO] train episode 301: reward = 68.00, steps = 68
    23:23:52 [INFO] train episode 302: reward = 85.00, steps = 85
    23:24:03 [INFO] train episode 303: reward = 83.00, steps = 83
    23:24:14 [INFO] train episode 304: reward = 78.00, steps = 78
    23:24:25 [INFO] train episode 305: reward = 81.00, steps = 81
    23:24:32 [INFO] train episode 306: reward = 55.00, steps = 55
    23:24:45 [INFO] train episode 307: reward = 95.00, steps = 95
    23:24:53 [INFO] train episode 308: reward = 57.00, steps = 57
    23:25:03 [INFO] train episode 309: reward = 77.00, steps = 77
    23:25:14 [INFO] train episode 310: reward = 92.00, steps = 92
    23:25:24 [INFO] train episode 311: reward = 69.00, steps = 69
    23:25:45 [INFO] train episode 312: reward = 169.00, steps = 169
    23:25:52 [INFO] train episode 313: reward = 56.00, steps = 56
    23:26:04 [INFO] train episode 314: reward = 85.00, steps = 85
    23:26:14 [INFO] train episode 315: reward = 76.00, steps = 76
    23:26:25 [INFO] train episode 316: reward = 77.00, steps = 77
    23:26:47 [INFO] train episode 317: reward = 149.00, steps = 149
    23:27:04 [INFO] train episode 318: reward = 134.00, steps = 134
    23:27:15 [INFO] train episode 319: reward = 81.00, steps = 81
    23:27:26 [INFO] train episode 320: reward = 76.00, steps = 76
    23:27:33 [INFO] train episode 321: reward = 53.00, steps = 53
    23:27:43 [INFO] train episode 322: reward = 74.00, steps = 74
    23:28:07 [INFO] train episode 323: reward = 171.00, steps = 171
    23:28:18 [INFO] train episode 324: reward = 74.00, steps = 74
    23:28:25 [INFO] train episode 325: reward = 48.00, steps = 48
    23:28:32 [INFO] train episode 326: reward = 48.00, steps = 48
    23:28:42 [INFO] train episode 327: reward = 78.00, steps = 78
    23:28:57 [INFO] train episode 328: reward = 105.00, steps = 105
    23:29:08 [INFO] train episode 329: reward = 72.00, steps = 72
    23:29:16 [INFO] train episode 330: reward = 57.00, steps = 57
    23:29:42 [INFO] train episode 331: reward = 200.00, steps = 200
    23:29:55 [INFO] train episode 332: reward = 97.00, steps = 97
    23:30:05 [INFO] train episode 333: reward = 80.00, steps = 80
    23:30:18 [INFO] train episode 334: reward = 94.00, steps = 94
    23:30:29 [INFO] train episode 335: reward = 84.00, steps = 84
    23:30:40 [INFO] train episode 336: reward = 81.00, steps = 81
    23:30:51 [INFO] train episode 337: reward = 79.00, steps = 79
    23:30:59 [INFO] train episode 338: reward = 61.00, steps = 61
    23:31:10 [INFO] train episode 339: reward = 97.00, steps = 97
    23:31:29 [INFO] train episode 340: reward = 154.00, steps = 154
    23:31:37 [INFO] train episode 341: reward = 75.00, steps = 75
    23:31:50 [INFO] train episode 342: reward = 108.00, steps = 108
    23:32:02 [INFO] train episode 343: reward = 71.00, steps = 71
    23:32:18 [INFO] train episode 344: reward = 137.00, steps = 137
    23:32:26 [INFO] train episode 345: reward = 63.00, steps = 63
    23:32:39 [INFO] train episode 346: reward = 109.00, steps = 109
    23:32:49 [INFO] train episode 347: reward = 89.00, steps = 89
    23:33:00 [INFO] train episode 348: reward = 97.00, steps = 97
    23:33:15 [INFO] train episode 349: reward = 140.00, steps = 140
    23:33:24 [INFO] train episode 350: reward = 84.00, steps = 84
    23:33:35 [INFO] train episode 351: reward = 92.00, steps = 92
    23:33:45 [INFO] train episode 352: reward = 90.00, steps = 90
    23:33:55 [INFO] train episode 353: reward = 94.00, steps = 94
    23:34:03 [INFO] train episode 354: reward = 84.00, steps = 84
    23:34:18 [INFO] train episode 355: reward = 94.00, steps = 94
    23:34:24 [INFO] train episode 356: reward = 59.00, steps = 59
    23:34:31 [INFO] train episode 357: reward = 65.00, steps = 65
    23:34:48 [INFO] train episode 358: reward = 170.00, steps = 170
    23:34:56 [INFO] train episode 359: reward = 76.00, steps = 76
    23:35:05 [INFO] train episode 360: reward = 83.00, steps = 83
    23:35:15 [INFO] train episode 361: reward = 87.00, steps = 87
    23:35:23 [INFO] train episode 362: reward = 68.00, steps = 68
    23:35:31 [INFO] train episode 363: reward = 69.00, steps = 69
    23:35:37 [INFO] train episode 364: reward = 56.00, steps = 56
    23:35:49 [INFO] train episode 365: reward = 107.00, steps = 107
    23:36:03 [INFO] train episode 366: reward = 147.00, steps = 147
    23:36:13 [INFO] train episode 367: reward = 94.00, steps = 94
    23:36:23 [INFO] train episode 368: reward = 99.00, steps = 99
    23:36:29 [INFO] train episode 369: reward = 57.00, steps = 57
    23:36:40 [INFO] train episode 370: reward = 109.00, steps = 109
    23:36:49 [INFO] train episode 371: reward = 80.00, steps = 80
    23:36:58 [INFO] train episode 372: reward = 93.00, steps = 93
    23:37:06 [INFO] train episode 373: reward = 73.00, steps = 73
    23:37:12 [INFO] train episode 374: reward = 57.00, steps = 57
    23:37:19 [INFO] train episode 375: reward = 59.00, steps = 59
    23:37:28 [INFO] train episode 376: reward = 86.00, steps = 86
    23:37:35 [INFO] train episode 377: reward = 79.00, steps = 79
    23:37:43 [INFO] train episode 378: reward = 67.00, steps = 67
    23:37:57 [INFO] train episode 379: reward = 134.00, steps = 134
    23:38:06 [INFO] train episode 380: reward = 85.00, steps = 85
    23:38:14 [INFO] train episode 381: reward = 86.00, steps = 86
    23:38:24 [INFO] train episode 382: reward = 90.00, steps = 90
    23:38:33 [INFO] train episode 383: reward = 90.00, steps = 90
    23:38:46 [INFO] train episode 384: reward = 122.00, steps = 122
    23:38:54 [INFO] train episode 385: reward = 77.00, steps = 77
    23:39:04 [INFO] train episode 386: reward = 91.00, steps = 91
    23:39:12 [INFO] train episode 387: reward = 71.00, steps = 71
    23:39:25 [INFO] train episode 388: reward = 115.00, steps = 115
    23:39:40 [INFO] train episode 389: reward = 133.00, steps = 133
    23:39:48 [INFO] train episode 390: reward = 72.00, steps = 72
    23:39:57 [INFO] train episode 391: reward = 81.00, steps = 81
    23:40:05 [INFO] train episode 392: reward = 68.00, steps = 68
    23:40:21 [INFO] train episode 393: reward = 142.00, steps = 142
    23:40:38 [INFO] train episode 394: reward = 154.00, steps = 154
    23:40:46 [INFO] train episode 395: reward = 70.00, steps = 70
    23:41:01 [INFO] train episode 396: reward = 129.00, steps = 129
    23:41:19 [INFO] train episode 397: reward = 162.00, steps = 162
    23:41:33 [INFO] train episode 398: reward = 134.00, steps = 134
    23:41:47 [INFO] train episode 399: reward = 135.00, steps = 135
    23:41:56 [INFO] train episode 400: reward = 83.00, steps = 83
    23:42:11 [INFO] train episode 401: reward = 142.00, steps = 142
    23:42:18 [INFO] train episode 402: reward = 72.00, steps = 72
    23:42:27 [INFO] train episode 403: reward = 78.00, steps = 78
    23:42:41 [INFO] train episode 404: reward = 139.00, steps = 139
    23:42:51 [INFO] train episode 405: reward = 90.00, steps = 90
    23:42:59 [INFO] train episode 406: reward = 76.00, steps = 76
    23:43:09 [INFO] train episode 407: reward = 95.00, steps = 95
    23:43:16 [INFO] train episode 408: reward = 56.00, steps = 56
    23:43:26 [INFO] train episode 409: reward = 85.00, steps = 85
    23:43:42 [INFO] train episode 410: reward = 141.00, steps = 141
    23:43:54 [INFO] train episode 411: reward = 89.00, steps = 89
    23:44:02 [INFO] train episode 412: reward = 67.00, steps = 67
    23:44:09 [INFO] train episode 413: reward = 66.00, steps = 66
    23:44:24 [INFO] train episode 414: reward = 115.00, steps = 115
    23:44:34 [INFO] train episode 415: reward = 86.00, steps = 86
    23:44:42 [INFO] train episode 416: reward = 73.00, steps = 73
    23:44:53 [INFO] train episode 417: reward = 85.00, steps = 85
    23:45:08 [INFO] train episode 418: reward = 102.00, steps = 102
    23:45:25 [INFO] train episode 419: reward = 106.00, steps = 106
    23:45:35 [INFO] train episode 420: reward = 93.00, steps = 93
    23:45:46 [INFO] train episode 421: reward = 88.00, steps = 88
    23:45:56 [INFO] train episode 422: reward = 92.00, steps = 92
    23:46:08 [INFO] train episode 423: reward = 89.00, steps = 89
    23:46:17 [INFO] train episode 424: reward = 82.00, steps = 82
    23:46:28 [INFO] train episode 425: reward = 89.00, steps = 89
    23:46:40 [INFO] train episode 426: reward = 103.00, steps = 103
    23:46:49 [INFO] train episode 427: reward = 74.00, steps = 74
    23:47:01 [INFO] train episode 428: reward = 85.00, steps = 85
    23:47:10 [INFO] train episode 429: reward = 82.00, steps = 82
    23:47:22 [INFO] train episode 430: reward = 105.00, steps = 105
    23:47:32 [INFO] train episode 431: reward = 90.00, steps = 90
    23:47:50 [INFO] train episode 432: reward = 156.00, steps = 156
    23:48:00 [INFO] train episode 433: reward = 83.00, steps = 83
    23:48:12 [INFO] train episode 434: reward = 102.00, steps = 102
    23:48:28 [INFO] train episode 435: reward = 124.00, steps = 124
    23:48:46 [INFO] train episode 436: reward = 161.00, steps = 161
    23:48:57 [INFO] train episode 437: reward = 98.00, steps = 98
    23:49:12 [INFO] train episode 438: reward = 120.00, steps = 120
    23:49:22 [INFO] train episode 439: reward = 82.00, steps = 82
    23:49:33 [INFO] train episode 440: reward = 85.00, steps = 85
    23:49:40 [INFO] train episode 441: reward = 65.00, steps = 65
    23:49:49 [INFO] train episode 442: reward = 70.00, steps = 70
    23:49:58 [INFO] train episode 443: reward = 70.00, steps = 70
    23:50:07 [INFO] train episode 444: reward = 74.00, steps = 74
    23:50:16 [INFO] train episode 445: reward = 88.00, steps = 88
    23:50:25 [INFO] train episode 446: reward = 59.00, steps = 59
    23:50:35 [INFO] train episode 447: reward = 88.00, steps = 88
    23:50:44 [INFO] train episode 448: reward = 82.00, steps = 82
    23:51:01 [INFO] train episode 449: reward = 135.00, steps = 135
    23:51:12 [INFO] train episode 450: reward = 98.00, steps = 98
    23:51:24 [INFO] train episode 451: reward = 92.00, steps = 92
    23:51:32 [INFO] train episode 452: reward = 72.00, steps = 72
    23:51:43 [INFO] train episode 453: reward = 92.00, steps = 92
    23:51:54 [INFO] train episode 454: reward = 99.00, steps = 99
    23:52:03 [INFO] train episode 455: reward = 79.00, steps = 79
    23:52:14 [INFO] train episode 456: reward = 103.00, steps = 103
    23:52:37 [INFO] train episode 457: reward = 200.00, steps = 200
    23:52:53 [INFO] train episode 458: reward = 135.00, steps = 135
    23:53:04 [INFO] train episode 459: reward = 104.00, steps = 104
    23:53:13 [INFO] train episode 460: reward = 81.00, steps = 81
    23:53:23 [INFO] train episode 461: reward = 104.00, steps = 104
    23:53:32 [INFO] train episode 462: reward = 89.00, steps = 89
    23:53:42 [INFO] train episode 463: reward = 100.00, steps = 100
    23:53:51 [INFO] train episode 464: reward = 81.00, steps = 81
    23:54:03 [INFO] train episode 465: reward = 118.00, steps = 118
    23:54:16 [INFO] train episode 466: reward = 133.00, steps = 133
    23:54:23 [INFO] train episode 467: reward = 66.00, steps = 66
    23:54:33 [INFO] train episode 468: reward = 105.00, steps = 105
    23:54:44 [INFO] train episode 469: reward = 102.00, steps = 102
    23:54:54 [INFO] train episode 470: reward = 102.00, steps = 102
    23:55:04 [INFO] train episode 471: reward = 97.00, steps = 97
    23:55:19 [INFO] train episode 472: reward = 145.00, steps = 145
    23:55:35 [INFO] train episode 473: reward = 160.00, steps = 160
    23:55:43 [INFO] train episode 474: reward = 81.00, steps = 81
    23:55:53 [INFO] train episode 475: reward = 102.00, steps = 102
    23:56:02 [INFO] train episode 476: reward = 79.00, steps = 79
    23:56:09 [INFO] train episode 477: reward = 70.00, steps = 70
    23:56:21 [INFO] train episode 478: reward = 89.00, steps = 89
    23:56:33 [INFO] train episode 479: reward = 112.00, steps = 112
    23:56:40 [INFO] train episode 480: reward = 74.00, steps = 74
    23:56:53 [INFO] train episode 481: reward = 123.00, steps = 123
    23:57:02 [INFO] train episode 482: reward = 88.00, steps = 88
    23:57:10 [INFO] train episode 483: reward = 75.00, steps = 75
    23:57:25 [INFO] train episode 484: reward = 153.00, steps = 153
    23:57:33 [INFO] train episode 485: reward = 70.00, steps = 70
    23:57:45 [INFO] train episode 486: reward = 126.00, steps = 126
    23:57:54 [INFO] train episode 487: reward = 85.00, steps = 85
    23:58:04 [INFO] train episode 488: reward = 96.00, steps = 96
    23:58:17 [INFO] train episode 489: reward = 133.00, steps = 133
    23:58:31 [INFO] train episode 490: reward = 140.00, steps = 140
    23:58:39 [INFO] train episode 491: reward = 76.00, steps = 76
    23:58:48 [INFO] train episode 492: reward = 87.00, steps = 87
    23:59:01 [INFO] train episode 493: reward = 124.00, steps = 124
    23:59:11 [INFO] train episode 494: reward = 100.00, steps = 100
    23:59:24 [INFO] train episode 495: reward = 124.00, steps = 124
    23:59:33 [INFO] train episode 496: reward = 89.00, steps = 89
    23:59:42 [INFO] train episode 497: reward = 81.00, steps = 81
    23:59:51 [INFO] train episode 498: reward = 88.00, steps = 88
    00:00:01 [INFO] train episode 499: reward = 98.00, steps = 98
    00:00:11 [INFO] train episode 500: reward = 100.00, steps = 100
    00:00:21 [INFO] train episode 501: reward = 99.00, steps = 99
    00:00:32 [INFO] train episode 502: reward = 107.00, steps = 107
    00:00:40 [INFO] train episode 503: reward = 76.00, steps = 76
    00:00:46 [INFO] train episode 504: reward = 59.00, steps = 59
    00:00:53 [INFO] train episode 505: reward = 66.00, steps = 66
    00:01:02 [INFO] train episode 506: reward = 89.00, steps = 89
    00:01:10 [INFO] train episode 507: reward = 70.00, steps = 70
    00:01:16 [INFO] train episode 508: reward = 62.00, steps = 62
    00:01:26 [INFO] train episode 509: reward = 92.00, steps = 92
    00:01:35 [INFO] train episode 510: reward = 88.00, steps = 88
    00:01:43 [INFO] train episode 511: reward = 77.00, steps = 77
    00:01:55 [INFO] train episode 512: reward = 120.00, steps = 120
    00:02:11 [INFO] train episode 513: reward = 149.00, steps = 149
    00:02:22 [INFO] train episode 514: reward = 111.00, steps = 111
    00:02:36 [INFO] train episode 515: reward = 131.00, steps = 131
    00:02:44 [INFO] train episode 516: reward = 71.00, steps = 71
    00:02:53 [INFO] train episode 517: reward = 96.00, steps = 96
    00:03:04 [INFO] train episode 518: reward = 104.00, steps = 104
    00:03:15 [INFO] train episode 519: reward = 111.00, steps = 111
    00:03:28 [INFO] train episode 520: reward = 131.00, steps = 131
    00:03:35 [INFO] train episode 521: reward = 64.00, steps = 64
    00:03:45 [INFO] train episode 522: reward = 92.00, steps = 92
    00:03:53 [INFO] train episode 523: reward = 79.00, steps = 79
    00:04:07 [INFO] train episode 524: reward = 144.00, steps = 144
    00:04:16 [INFO] train episode 525: reward = 89.00, steps = 89
    00:04:24 [INFO] train episode 526: reward = 83.00, steps = 83
    00:04:37 [INFO] train episode 527: reward = 122.00, steps = 122
    00:04:47 [INFO] train episode 528: reward = 103.00, steps = 103
    00:04:59 [INFO] train episode 529: reward = 115.00, steps = 115
    00:05:19 [INFO] train episode 530: reward = 197.00, steps = 197
    00:05:32 [INFO] train episode 531: reward = 124.00, steps = 124
    00:05:50 [INFO] train episode 532: reward = 185.00, steps = 185
    00:06:08 [INFO] train episode 533: reward = 185.00, steps = 185
    00:06:17 [INFO] train episode 534: reward = 82.00, steps = 82
    00:06:28 [INFO] train episode 535: reward = 112.00, steps = 112
    00:06:45 [INFO] train episode 536: reward = 175.00, steps = 175
    00:07:01 [INFO] train episode 537: reward = 156.00, steps = 156
    00:07:11 [INFO] train episode 538: reward = 97.00, steps = 97
    00:07:28 [INFO] train episode 539: reward = 168.00, steps = 168
    00:07:41 [INFO] train episode 540: reward = 126.00, steps = 126
    00:07:50 [INFO] train episode 541: reward = 95.00, steps = 95
    00:08:02 [INFO] train episode 542: reward = 113.00, steps = 113
    00:08:11 [INFO] train episode 543: reward = 92.00, steps = 92
    00:08:19 [INFO] train episode 544: reward = 69.00, steps = 69
    00:08:37 [INFO] train episode 545: reward = 183.00, steps = 183
    00:08:53 [INFO] train episode 546: reward = 158.00, steps = 158
    00:09:06 [INFO] train episode 547: reward = 129.00, steps = 129
    00:09:19 [INFO] train episode 548: reward = 131.00, steps = 131
    00:09:26 [INFO] train episode 549: reward = 73.00, steps = 73
    00:09:40 [INFO] train episode 550: reward = 135.00, steps = 135
    00:09:52 [INFO] train episode 551: reward = 114.00, steps = 114
    00:10:01 [INFO] train episode 552: reward = 93.00, steps = 93
    00:10:14 [INFO] train episode 553: reward = 131.00, steps = 131
    00:10:24 [INFO] train episode 554: reward = 94.00, steps = 94
    00:10:33 [INFO] train episode 555: reward = 87.00, steps = 87
    00:10:44 [INFO] train episode 556: reward = 113.00, steps = 113
    00:10:54 [INFO] train episode 557: reward = 98.00, steps = 98
    00:11:08 [INFO] train episode 558: reward = 135.00, steps = 135
    00:11:15 [INFO] train episode 559: reward = 73.00, steps = 73
    00:11:35 [INFO] train episode 560: reward = 200.00, steps = 200
    00:11:47 [INFO] train episode 561: reward = 125.00, steps = 125
    00:12:03 [INFO] train episode 562: reward = 163.00, steps = 163
    00:12:20 [INFO] train episode 563: reward = 166.00, steps = 166
    00:12:29 [INFO] train episode 564: reward = 88.00, steps = 88
    00:12:38 [INFO] train episode 565: reward = 86.00, steps = 86
    00:12:47 [INFO] train episode 566: reward = 92.00, steps = 92
    00:13:06 [INFO] train episode 567: reward = 192.00, steps = 192
    00:13:18 [INFO] train episode 568: reward = 114.00, steps = 114
    00:13:32 [INFO] train episode 569: reward = 145.00, steps = 145
    00:13:44 [INFO] train episode 570: reward = 111.00, steps = 111
    00:13:53 [INFO] train episode 571: reward = 92.00, steps = 92
    00:14:05 [INFO] train episode 572: reward = 105.00, steps = 105
    00:14:14 [INFO] train episode 573: reward = 94.00, steps = 94
    00:14:26 [INFO] train episode 574: reward = 114.00, steps = 114
    00:14:38 [INFO] train episode 575: reward = 101.00, steps = 101
    00:14:47 [INFO] train episode 576: reward = 87.00, steps = 87
    00:14:58 [INFO] train episode 577: reward = 115.00, steps = 115
    00:15:06 [INFO] train episode 578: reward = 76.00, steps = 76
    00:15:19 [INFO] train episode 579: reward = 123.00, steps = 123
    00:15:36 [INFO] train episode 580: reward = 172.00, steps = 172
    00:15:44 [INFO] train episode 581: reward = 80.00, steps = 80
    00:16:02 [INFO] train episode 582: reward = 176.00, steps = 176
    00:16:18 [INFO] train episode 583: reward = 161.00, steps = 161
    00:16:35 [INFO] train episode 584: reward = 164.00, steps = 164
    00:16:48 [INFO] train episode 585: reward = 130.00, steps = 130
    00:17:00 [INFO] train episode 586: reward = 118.00, steps = 118
    00:17:14 [INFO] train episode 587: reward = 147.00, steps = 147
    00:17:28 [INFO] train episode 588: reward = 134.00, steps = 134
    00:17:38 [INFO] train episode 589: reward = 101.00, steps = 101
    00:17:48 [INFO] train episode 590: reward = 95.00, steps = 95
    00:17:58 [INFO] train episode 591: reward = 103.00, steps = 103
    00:18:08 [INFO] train episode 592: reward = 103.00, steps = 103
    00:18:18 [INFO] train episode 593: reward = 98.00, steps = 98
    00:18:28 [INFO] train episode 594: reward = 95.00, steps = 95
    00:18:35 [INFO] train episode 595: reward = 69.00, steps = 69
    00:18:44 [INFO] train episode 596: reward = 85.00, steps = 85
    00:18:51 [INFO] train episode 597: reward = 73.00, steps = 73
    00:18:58 [INFO] train episode 598: reward = 71.00, steps = 71
    00:19:09 [INFO] train episode 599: reward = 101.00, steps = 101
    00:19:20 [INFO] train episode 600: reward = 112.00, steps = 112
    00:19:29 [INFO] train episode 601: reward = 86.00, steps = 86
    00:19:41 [INFO] train episode 602: reward = 116.00, steps = 116
    00:19:48 [INFO] train episode 603: reward = 75.00, steps = 75
    00:20:09 [INFO] train episode 604: reward = 200.00, steps = 200
    00:20:25 [INFO] train episode 605: reward = 165.00, steps = 165
    00:20:44 [INFO] train episode 606: reward = 196.00, steps = 196
    00:20:54 [INFO] train episode 607: reward = 103.00, steps = 103
    00:21:07 [INFO] train episode 608: reward = 126.00, steps = 126
    00:21:16 [INFO] train episode 609: reward = 89.00, steps = 89
    00:21:26 [INFO] train episode 610: reward = 98.00, steps = 98
    00:21:34 [INFO] train episode 611: reward = 78.00, steps = 78
    00:21:49 [INFO] train episode 612: reward = 150.00, steps = 150
    00:21:59 [INFO] train episode 613: reward = 98.00, steps = 98
    00:22:09 [INFO] train episode 614: reward = 102.00, steps = 102
    00:22:18 [INFO] train episode 615: reward = 76.00, steps = 76
    00:22:38 [INFO] train episode 616: reward = 162.00, steps = 162
    00:22:47 [INFO] train episode 617: reward = 80.00, steps = 80
    00:23:00 [INFO] train episode 618: reward = 137.00, steps = 137
    00:23:14 [INFO] train episode 619: reward = 140.00, steps = 140
    00:23:26 [INFO] train episode 620: reward = 124.00, steps = 124
    00:23:39 [INFO] train episode 621: reward = 130.00, steps = 130
    00:23:49 [INFO] train episode 622: reward = 101.00, steps = 101
    00:24:07 [INFO] train episode 623: reward = 177.00, steps = 177
    00:24:19 [INFO] train episode 624: reward = 119.00, steps = 119
    00:24:27 [INFO] train episode 625: reward = 77.00, steps = 77
    00:24:37 [INFO] train episode 626: reward = 101.00, steps = 101
    00:24:50 [INFO] train episode 627: reward = 126.00, steps = 126
    00:25:01 [INFO] train episode 628: reward = 105.00, steps = 105
    00:25:14 [INFO] train episode 629: reward = 123.00, steps = 123
    00:25:21 [INFO] train episode 630: reward = 72.00, steps = 72
    00:25:42 [INFO] train episode 631: reward = 200.00, steps = 200
    00:25:54 [INFO] train episode 632: reward = 118.00, steps = 118
    00:26:05 [INFO] train episode 633: reward = 112.00, steps = 112
    00:26:14 [INFO] train episode 634: reward = 92.00, steps = 92
    00:26:32 [INFO] train episode 635: reward = 176.00, steps = 176
    00:26:45 [INFO] train episode 636: reward = 132.00, steps = 132
    00:26:55 [INFO] train episode 637: reward = 100.00, steps = 100
    00:27:08 [INFO] train episode 638: reward = 130.00, steps = 130
    00:27:17 [INFO] train episode 639: reward = 81.00, steps = 81
    00:27:29 [INFO] train episode 640: reward = 124.00, steps = 124
    00:27:39 [INFO] train episode 641: reward = 92.00, steps = 92
    00:27:52 [INFO] train episode 642: reward = 138.00, steps = 138
    00:28:05 [INFO] train episode 643: reward = 116.00, steps = 116
    00:28:14 [INFO] train episode 644: reward = 96.00, steps = 96
    00:28:23 [INFO] train episode 645: reward = 90.00, steps = 90
    00:28:38 [INFO] train episode 646: reward = 141.00, steps = 141
    00:28:46 [INFO] train episode 647: reward = 76.00, steps = 76
    00:28:58 [INFO] train episode 648: reward = 125.00, steps = 125
    00:29:08 [INFO] train episode 649: reward = 83.00, steps = 83
    00:29:19 [INFO] train episode 650: reward = 102.00, steps = 102
    00:29:33 [INFO] train episode 651: reward = 145.00, steps = 145
    00:29:40 [INFO] train episode 652: reward = 68.00, steps = 68
    00:29:52 [INFO] train episode 653: reward = 111.00, steps = 111
    00:30:04 [INFO] train episode 654: reward = 120.00, steps = 120
    00:30:15 [INFO] train episode 655: reward = 106.00, steps = 106
    00:30:26 [INFO] train episode 656: reward = 106.00, steps = 106
    00:30:36 [INFO] train episode 657: reward = 99.00, steps = 99
    00:30:56 [INFO] train episode 658: reward = 200.00, steps = 200
    00:31:05 [INFO] train episode 659: reward = 86.00, steps = 86
    00:31:17 [INFO] train episode 660: reward = 120.00, steps = 120
    00:31:27 [INFO] train episode 661: reward = 103.00, steps = 103
    00:31:40 [INFO] train episode 662: reward = 128.00, steps = 128
    00:31:52 [INFO] train episode 663: reward = 115.00, steps = 115
    00:32:01 [INFO] train episode 664: reward = 88.00, steps = 88
    00:32:11 [INFO] train episode 665: reward = 87.00, steps = 87
    00:32:23 [INFO] train episode 666: reward = 128.00, steps = 128
    00:32:33 [INFO] train episode 667: reward = 93.00, steps = 93
    00:32:44 [INFO] train episode 668: reward = 104.00, steps = 104
    00:33:02 [INFO] train episode 669: reward = 177.00, steps = 177
    00:33:11 [INFO] train episode 670: reward = 91.00, steps = 91
    00:33:20 [INFO] train episode 671: reward = 87.00, steps = 87
    00:33:41 [INFO] train episode 672: reward = 200.00, steps = 200
    00:33:54 [INFO] train episode 673: reward = 125.00, steps = 125
    00:34:05 [INFO] train episode 674: reward = 113.00, steps = 113
    00:34:13 [INFO] train episode 675: reward = 85.00, steps = 85
    00:34:23 [INFO] train episode 676: reward = 89.00, steps = 89
    00:34:33 [INFO] train episode 677: reward = 102.00, steps = 102
    00:34:49 [INFO] train episode 678: reward = 154.00, steps = 154
    00:35:05 [INFO] train episode 679: reward = 160.00, steps = 160
    00:35:22 [INFO] train episode 680: reward = 177.00, steps = 177
    00:35:35 [INFO] train episode 681: reward = 125.00, steps = 125
    00:35:47 [INFO] train episode 682: reward = 111.00, steps = 111
    00:35:57 [INFO] train episode 683: reward = 98.00, steps = 98
    00:36:10 [INFO] train episode 684: reward = 127.00, steps = 127
    00:36:20 [INFO] train episode 685: reward = 105.00, steps = 105
    00:36:32 [INFO] train episode 686: reward = 116.00, steps = 116
    00:36:50 [INFO] train episode 687: reward = 181.00, steps = 181
    00:37:06 [INFO] train episode 688: reward = 154.00, steps = 154
    00:37:20 [INFO] train episode 689: reward = 142.00, steps = 142
    00:37:31 [INFO] train episode 690: reward = 104.00, steps = 104
    00:37:46 [INFO] train episode 691: reward = 151.00, steps = 151
    00:37:58 [INFO] train episode 692: reward = 121.00, steps = 121
    00:38:06 [INFO] train episode 693: reward = 79.00, steps = 79
    00:38:20 [INFO] train episode 694: reward = 145.00, steps = 145
    00:38:34 [INFO] train episode 695: reward = 140.00, steps = 140
    00:38:46 [INFO] train episode 696: reward = 120.00, steps = 120
    00:38:57 [INFO] train episode 697: reward = 106.00, steps = 106
    00:39:11 [INFO] train episode 698: reward = 144.00, steps = 144
    00:39:26 [INFO] train episode 699: reward = 155.00, steps = 155
    00:39:37 [INFO] train episode 700: reward = 101.00, steps = 101
    00:39:48 [INFO] train episode 701: reward = 107.00, steps = 107
    00:39:58 [INFO] train episode 702: reward = 101.00, steps = 101
    00:40:13 [INFO] train episode 703: reward = 146.00, steps = 146
    00:40:28 [INFO] train episode 704: reward = 156.00, steps = 156
    00:40:40 [INFO] train episode 705: reward = 117.00, steps = 117
    00:40:50 [INFO] train episode 706: reward = 102.00, steps = 102
    00:41:04 [INFO] train episode 707: reward = 140.00, steps = 140
    00:41:15 [INFO] train episode 708: reward = 106.00, steps = 106
    00:41:26 [INFO] train episode 709: reward = 106.00, steps = 106
    00:41:37 [INFO] train episode 710: reward = 106.00, steps = 106
    00:41:49 [INFO] train episode 711: reward = 119.00, steps = 119
    00:42:00 [INFO] train episode 712: reward = 113.00, steps = 113
    00:42:20 [INFO] train episode 713: reward = 200.00, steps = 200
    00:42:30 [INFO] train episode 714: reward = 104.00, steps = 104
    00:42:43 [INFO] train episode 715: reward = 128.00, steps = 128
    00:42:58 [INFO] train episode 716: reward = 144.00, steps = 144
    00:43:14 [INFO] train episode 717: reward = 161.00, steps = 161
    00:43:34 [INFO] train episode 718: reward = 200.00, steps = 200
    00:43:52 [INFO] train episode 719: reward = 185.00, steps = 185
    00:44:07 [INFO] train episode 720: reward = 157.00, steps = 157
    00:44:23 [INFO] train episode 721: reward = 149.00, steps = 149
    00:44:40 [INFO] train episode 722: reward = 173.00, steps = 173
    00:45:01 [INFO] train episode 723: reward = 200.00, steps = 200
    00:45:15 [INFO] train episode 724: reward = 135.00, steps = 135
    00:45:34 [INFO] train episode 725: reward = 200.00, steps = 200
    00:45:53 [INFO] train episode 726: reward = 195.00, steps = 195
    00:46:13 [INFO] train episode 727: reward = 200.00, steps = 200
    00:46:33 [INFO] train episode 728: reward = 200.00, steps = 200
    00:46:53 [INFO] train episode 729: reward = 200.00, steps = 200
    00:47:13 [INFO] train episode 730: reward = 200.00, steps = 200
    00:47:33 [INFO] train episode 731: reward = 200.00, steps = 200
    00:47:49 [INFO] train episode 732: reward = 157.00, steps = 157
    00:48:09 [INFO] train episode 733: reward = 200.00, steps = 200
    00:48:29 [INFO] train episode 734: reward = 200.00, steps = 200
    00:48:29 [INFO] ==== test ====
    00:48:43 [INFO] test episode 0: reward = 155.00, steps = 155
    00:49:01 [INFO] test episode 1: reward = 199.00, steps = 199
    00:49:16 [INFO] test episode 2: reward = 170.00, steps = 170
    00:49:34 [INFO] test episode 3: reward = 200.00, steps = 200
    00:49:51 [INFO] test episode 4: reward = 185.00, steps = 185
    00:50:06 [INFO] test episode 5: reward = 166.00, steps = 166
    00:50:20 [INFO] test episode 6: reward = 157.00, steps = 157
    00:50:34 [INFO] test episode 7: reward = 158.00, steps = 158
    00:50:47 [INFO] test episode 8: reward = 139.00, steps = 139
    00:51:00 [INFO] test episode 9: reward = 149.00, steps = 149
    00:51:14 [INFO] test episode 10: reward = 157.00, steps = 157
    00:51:27 [INFO] test episode 11: reward = 142.00, steps = 142
    00:51:44 [INFO] test episode 12: reward = 193.00, steps = 193
    00:51:59 [INFO] test episode 13: reward = 164.00, steps = 164
    00:52:17 [INFO] test episode 14: reward = 200.00, steps = 200
    00:52:32 [INFO] test episode 15: reward = 163.00, steps = 163
    00:52:50 [INFO] test episode 16: reward = 200.00, steps = 200
    00:53:07 [INFO] test episode 17: reward = 193.00, steps = 193
    00:53:26 [INFO] test episode 18: reward = 200.00, steps = 200
    00:53:42 [INFO] test episode 19: reward = 180.00, steps = 180
    00:54:00 [INFO] test episode 20: reward = 200.00, steps = 200
    00:54:14 [INFO] test episode 21: reward = 158.00, steps = 158
    00:54:33 [INFO] test episode 22: reward = 200.00, steps = 200
    00:54:48 [INFO] test episode 23: reward = 173.00, steps = 173
    00:55:02 [INFO] test episode 24: reward = 157.00, steps = 157
    00:55:17 [INFO] test episode 25: reward = 166.00, steps = 166
    00:55:35 [INFO] test episode 26: reward = 200.00, steps = 200
    00:55:53 [INFO] test episode 27: reward = 200.00, steps = 200
    00:56:06 [INFO] test episode 28: reward = 146.00, steps = 146
    00:56:24 [INFO] test episode 29: reward = 200.00, steps = 200
    00:56:42 [INFO] test episode 30: reward = 200.00, steps = 200
    00:56:56 [INFO] test episode 31: reward = 156.00, steps = 156
    00:57:14 [INFO] test episode 32: reward = 200.00, steps = 200
    00:57:32 [INFO] test episode 33: reward = 200.00, steps = 200
    00:57:50 [INFO] test episode 34: reward = 200.00, steps = 200
    00:58:06 [INFO] test episode 35: reward = 172.00, steps = 172
    00:58:22 [INFO] test episode 36: reward = 176.00, steps = 176
    00:58:40 [INFO] test episode 37: reward = 200.00, steps = 200
    00:58:52 [INFO] test episode 38: reward = 135.00, steps = 135
    00:59:10 [INFO] test episode 39: reward = 200.00, steps = 200
    00:59:25 [INFO] test episode 40: reward = 163.00, steps = 163
    00:59:39 [INFO] test episode 41: reward = 158.00, steps = 158
    00:59:51 [INFO] test episode 42: reward = 137.00, steps = 137
    01:00:07 [INFO] test episode 43: reward = 168.00, steps = 168
    01:00:24 [INFO] test episode 44: reward = 192.00, steps = 192
    01:00:42 [INFO] test episode 45: reward = 199.00, steps = 199
    01:00:58 [INFO] test episode 46: reward = 185.00, steps = 185
    01:01:15 [INFO] test episode 47: reward = 187.00, steps = 187
    01:01:30 [INFO] test episode 48: reward = 163.00, steps = 163
    01:01:43 [INFO] test episode 49: reward = 135.00, steps = 135
    01:01:59 [INFO] test episode 50: reward = 179.00, steps = 179
    01:02:17 [INFO] test episode 51: reward = 200.00, steps = 200
    01:02:35 [INFO] test episode 52: reward = 200.00, steps = 200
    01:02:49 [INFO] test episode 53: reward = 149.00, steps = 149
    01:03:01 [INFO] test episode 54: reward = 134.00, steps = 134
    01:03:13 [INFO] test episode 55: reward = 138.00, steps = 138
    01:03:32 [INFO] test episode 56: reward = 200.00, steps = 200
    01:03:49 [INFO] test episode 57: reward = 200.00, steps = 200
    01:04:05 [INFO] test episode 58: reward = 174.00, steps = 174
    01:04:19 [INFO] test episode 59: reward = 152.00, steps = 152
    01:04:32 [INFO] test episode 60: reward = 154.00, steps = 154
    01:04:48 [INFO] test episode 61: reward = 165.00, steps = 165
    01:05:04 [INFO] test episode 62: reward = 181.00, steps = 181
    01:05:22 [INFO] test episode 63: reward = 200.00, steps = 200
    01:05:40 [INFO] test episode 64: reward = 200.00, steps = 200
    01:05:57 [INFO] test episode 65: reward = 200.00, steps = 200
    01:06:15 [INFO] test episode 66: reward = 200.00, steps = 200
    01:06:31 [INFO] test episode 67: reward = 169.00, steps = 169
    01:06:48 [INFO] test episode 68: reward = 192.00, steps = 192
    01:07:05 [INFO] test episode 69: reward = 187.00, steps = 187
    01:07:21 [INFO] test episode 70: reward = 184.00, steps = 184
    01:07:39 [INFO] test episode 71: reward = 200.00, steps = 200
    01:07:52 [INFO] test episode 72: reward = 143.00, steps = 143
    01:08:10 [INFO] test episode 73: reward = 193.00, steps = 193
    01:08:24 [INFO] test episode 74: reward = 161.00, steps = 161
    01:08:42 [INFO] test episode 75: reward = 200.00, steps = 200
    01:09:01 [INFO] test episode 76: reward = 200.00, steps = 200
    01:09:21 [INFO] test episode 77: reward = 200.00, steps = 200
    01:09:35 [INFO] test episode 78: reward = 148.00, steps = 148
    01:09:48 [INFO] test episode 79: reward = 146.00, steps = 146
    01:10:06 [INFO] test episode 80: reward = 200.00, steps = 200
    01:10:23 [INFO] test episode 81: reward = 190.00, steps = 190
    01:10:37 [INFO] test episode 82: reward = 153.00, steps = 153
    01:10:52 [INFO] test episode 83: reward = 164.00, steps = 164
    01:11:10 [INFO] test episode 84: reward = 200.00, steps = 200
    01:11:28 [INFO] test episode 85: reward = 199.00, steps = 199
    01:11:46 [INFO] test episode 86: reward = 200.00, steps = 200
    01:12:03 [INFO] test episode 87: reward = 187.00, steps = 187
    01:12:21 [INFO] test episode 88: reward = 200.00, steps = 200
    01:12:37 [INFO] test episode 89: reward = 181.00, steps = 181
    01:12:53 [INFO] test episode 90: reward = 174.00, steps = 174
    01:13:07 [INFO] test episode 91: reward = 148.00, steps = 148
    01:13:24 [INFO] test episode 92: reward = 200.00, steps = 200
    01:13:42 [INFO] test episode 93: reward = 200.00, steps = 200
    01:14:00 [INFO] test episode 94: reward = 200.00, steps = 200
    01:14:18 [INFO] test episode 95: reward = 195.00, steps = 195
    01:14:35 [INFO] test episode 96: reward = 200.00, steps = 200
    01:14:54 [INFO] test episode 97: reward = 200.00, steps = 200
    01:15:12 [INFO] test episode 98: reward = 200.00, steps = 200
    01:15:23 [INFO] test episode 99: reward = 120.00, steps = 120
    01:15:23 [INFO] average episode reward = 178.56 ± 22.48

In [5]:

    env.close()