# Use VPG 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 import losses
    from tensorflow.keras import layers

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

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

In [3]:

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

            self.policy_net = self.build_net(hidden_sizes=[],
                    output_size=self.action_n,
                    output_activation=nn.softmax,
                    loss=losses.categorical_crossentropy)

        def build_net(self, hidden_sizes, output_size,
                activation=nn.relu, output_activation=None,
                use_bias=False, loss=losses.mse, learning_rate=0.005):
            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):
            probs = self.policy_net.predict(observation[np.newaxis], verbose=0)[0]
            action = np.random.choice(self.action_n, p=probs)
            if self.mode == 'train':
                self.trajectory += [observation, reward, terminated, action]
            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'])
            df['discount'] = self.gamma ** df.index.to_series()
            df['discounted_reward'] = df['discount'] * df['reward']
            df['discounted_return'] = df['discounted_reward'][::-1].cumsum()
            states = np.stack(df['state'])
            actions = np.eye(self.action_n)[df['action'].astype(int)]
            sample_weight = df[['discounted_return',]].values.astype(float)
            self.policy_net.fit(states, actions, sample_weight=sample_weight,
                    verbose=0)

    agent = VPGAgent(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():
        episode_reward, elapsed_steps = play_episode(env, agent, seed=episode,
                mode='train')
        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))

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

In [5]:

    env.close()