def discrete_atari_env(): env = AtariEnvironment(name="MsPacman-v0", clone_seeds=True, autoreset=True) env.reset() env = DiscreteEnv(env) return env
def classic_control_env(): env = ClassicControl() env.reset() env = DiscreteEnv(env) params = {"actions": {"dtype": np.int64}, "dt": {"dtype": np.float32}} states = States(state_dict=params, batch_size=N_WALKERS) states.update(actions=np.ones(N_WALKERS), dt=np.ones(N_WALKERS)) return env, states
def create_cartpole_swarm(): swarm = Swarm( model=lambda x: DiscreteUniform(env=x), walkers=Walkers, env=lambda: DiscreteEnv(ClassicControl("CartPole-v0")), reward_limit=121, n_walkers=150, max_epochs=300, reward_scale=2, ) return swarm
def create_cartpole_swarm(): swarm = Swarm( model=lambda x: DiscreteUniform(env=x), walkers=Walkers, env=lambda: DiscreteEnv(ClassicControl()), n_walkers=20, max_iters=200, prune_tree=True, reward_scale=2, ) return swarm
def create_atari_swarm(): env = AtariEnvironment(name="MsPacman-ram-v0", ) dt = GaussianDt(min_dt=10, max_dt=100, loc_dt=5, scale_dt=2) swarm = Swarm( model=lambda x: DiscreteUniform(env=x, critic=dt), env=lambda: DiscreteEnv(env), n_walkers=6, max_epochs=10, reward_scale=2, reward_limit=1, ) return swarm
def create_atari_swarm(): env = AtariEnvironment(name="MsPacman-ram-v0", clone_seeds=True, autoreset=True) dt = GaussianDt(min_dt=3, max_dt=100, loc_dt=5, scale_dt=2) swarm = Swarm( model=lambda x: DiscreteUniform(env=x, critic=dt), walkers=Walkers, env=lambda: DiscreteEnv(env), n_walkers=67, max_epochs=500, reward_scale=2, reward_limit=751, ) return swarm
def atari_env(): env = AtariEnvironment(name="MsPacman-v0", clone_seeds=True, autoreset=True) env.reset() env = DiscreteEnv(env) params = { "actions": { "dtype": np.int64 }, "critic": { "dtype": np.float32 } } states = States(state_dict=params, batch_size=N_WALKERS) states.update(actions=np.ones(N_WALKERS), critic=np.ones(N_WALKERS)) return env, states
def create_atari_swarm(): env = ParallelEnvironment( env_class=AtariEnvironment, name="MsPacman-ram-v0", clone_seeds=True, autoreset=True, blocking=False, ) dt = GaussianDt(min_dt=3, max_dt=100, loc_dt=5, scale_dt=2) swarm = Swarm( model=lambda x: DiscreteUniform(env=x, critic=dt), walkers=Walkers, env=lambda: DiscreteEnv(env), n_walkers=67, max_iters=20, prune_tree=True, reward_scale=2, ) return swarm
def env(self): from fragile.core.env import DiscreteEnv return DiscreteEnv(DummyEnv())
def classic_control_env(): env = ClassicControl() env.reset() env = DiscreteEnv(env) return env