<jupyter_start><jupyter_text>Evolving Stable Strategies> While RL algorithms require a reward signal to be given to the agent at every timestep, ES algorithms only care about the final cumulative reward that an agent gets at the end of its rollout in an environment. In many problems, we only know the outcome at the end of the task, such as whether the agent wins or loses, whether the robot arm picks up the object or not, or whether the agent has survived, and these are problems where ES may have an advantage over traditional RL.[1]<jupyter_code>import gym
# taken from [1]
def rollout(agent, env):
    obs = env.reset()
    done = False
    total_reward = 0
    while not done:
        a = agent.get_action(obs)
        obs, reward, done = env.step(a)
        total_reward += reward
    return total_reward
env = gym.make('worlddomination-v0')<jupyter_output>[2017-11-13 11:08:50,218] Making new env: worlddomination-v0
{'fraction_non_alphanumeric': 0.06594594594594595, 'fraction_numerical': 0.023783783783783784, 'mean_word_length': 3.9518716577540105, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '361536', 'license': 'MIT', 'n_tokens_mistral': 281, 'n_tokens_neox': 263, 'n_words': 125, 'path': 'reinforcement-learning/evolving-stable-strategies.ipynb', 'repo_name': 'ashishpatel26/learning', 'size': '925'}