# Path: pyrl/tasktools.py
# def generate_ei(N, pE=0.8):
# def to_map(*args):
# def get_idx(t, (start, end)):
# def get_epochs_idx(dt, epochs):
# def choice(rng, a):
# def unravel_index(i, dims):
# def uniform(rng, dt, xmin, xmax):
# def truncated_exponential(rng, dt, mean, xmin=0, xmax=np.inf):
# def divide(x, y):
# def correct_2AFC(perf):
#     def __init__(self):
#     EXC = idx[:Nexc]
#     INH = idx[Nexc:]
# class Task(object):


import numpy as np
import gym
from pyrl import tasktools
    from pyrl.model import Model
"""
OpenAI Gym: CartPole-v0

  https://gym.openai.com/envs/CartPole-v0

Method: Policy network (ReLU-GRUs) + baseline network (ReLU-GRUs)
        + REINFORCE + Adam + gradient clipping.

Sorry this is a little opaque/overkill but we wanted to test some policy gradient RNN
code (actually intended for neuroscience tasks) on a classic RL task. To reproduce the
results, please download

  https://github.com/frsong/pyrl

and add it to your PYTHONPATH, then run the code below. Requires Theano 0.8.2.

"""



# Environment
env = gym.make('CartPole-v0')

# Inputs
inputs = tasktools.to_map(range(env.observation_space.high.size))

# Actions

# Path: pyrl/tasktools.py
# def generate_ei(N, pE=0.8):
# def to_map(*args):
# def get_idx(t, (start, end)):
# def get_epochs_idx(dt, epochs):
# def choice(rng, a):
# def unravel_index(i, dims):
# def uniform(rng, dt, xmin, xmax):
# def truncated_exponential(rng, dt, mean, xmin=0, xmax=np.inf):
# def divide(x, y):
# def correct_2AFC(perf):
#     def __init__(self):
#     EXC = idx[:Nexc]
#     INH = idx[Nexc:]
# class Task(object):


# Path: examples/models/cartpole.py
import numpy as np
import gym
from pyrl import tasktools
    from pyrl.model import Model

"""
OpenAI Gym: CartPole-v0

  https://gym.openai.com/envs/CartPole-v0

Method: Policy network (ReLU-GRUs) + baseline network (ReLU-GRUs)
        + REINFORCE + Adam + gradient clipping.

Sorry this is a little opaque/overkill but we wanted to test some policy gradient RNN
code (actually intended for neuroscience tasks) on a classic RL task. To reproduce the
results, please download

  https://github.com/frsong/pyrl

and add it to your PYTHONPATH, then run the code below. Requires Theano 0.8.2.

"""



# Environment
env = gym.make('CartPole-v0')

# Inputs
inputs = tasktools.to_map(range(env.observation_space.high.size))

# Actions

actions = tasktools.to_map(range(env.action_space.n))