def run_single_classifier_experiment(strageties, expt_name, dataset_name, run_name): for strat in strageties: agent_config[strat] = STRATS[strat] env_config = { 'env_id': 'Flex-v1', 'dataset_name': dataset_name, 'episode_length': 0, 'flex_size': 0.02, 'max_flex_time': 6, 'relax_time': 0 } expt_path = os.path.join(os.getcwd(), 'results', expt_name) paths = energy_py.make_paths(expt_path, run_name=run_name) logger = energy_py.make_logger(paths, 'master') energy_py.experiment(agent_config=agent_config, env_config=env_config, total_steps=total_steps, paths=paths, seed=args.seed)
def test_cartpole_expt(): env_config = {'env_id': 'cartpole-v0'} experiment(agent_config=AGENT_CONFIG, env_config=env_config, total_steps=TOTAL_STEPS, paths=PATHS)
def test_battery_expt(): env_config = {'env_id': 'battery', 'dataset': 'example', 'episode_length': 10, 'episode_sample': 'random', 'initial_charge': 'random'} experiment(agent_config=AGENT_CONFIG, env_config=env_config, total_steps=TOTAL_STEPS, paths=PATHS)
def test_cartpole_expt(): env = CartPoleEnv() agent, env, sess = experiment(agent=DQN, agent_config=AGENT_CONFIG, env=env, total_steps=TOTAL_STEPS, data_path=DATA_PATH, results_path=RESULTS_PATH)
def test_flex_expt(): env = FlexEnv env_config = {'episode_length': 10, 'episode_random': True} agent, env, sess = experiment(agent=DQN, agent_config=AGENT_CONFIG, env=env, env_config=env_config, total_steps=TOTAL_STEPS, data_path=DATA_PATH, results_path=RESULTS_PATH)
def test_battery_expt(): env = BatteryEnv env_config = { 'episode_length': 10, 'episode_random': True, 'initial_charge': 'random' } agent, env, sess = experiment(agent=DQN, agent_config=AGENT_CONFIG, env=env, env_config=env_config, total_steps=TOTAL_STEPS, data_path=DATA_PATH, results_path=RESULTS_PATH)
import logging import os from energy_py import experiment from energy_py.agents import ClassifierAgent from energy_py.envs import FlexEnv if __name__ == '__main__': total_steps = 1e6 data_path = os.getcwd() + '/classifier_deterministic/' results_path = os.getcwd() + '/results/classifier/' env_config = { 'episode_length': 0, 'episode_random': False, 'data_path': data_path, 'flex_effy': 1.0, 'flex_size': 0.05 } agent_config = {'discount': 0.9} total_steps = 10 env = FlexEnv agent = ClassifierAgent agent, env, sess = experiment(agent, agent_config, env, total_steps, data_path, results_path, env_config)
total_steps = 5e5 agent = DQN agent_config = { 'discount': 0.97, 'tau': 0.001, 'batch_size': 32, 'layers': (10, 10, 10), 'learning_rate': 0.0001, 'epsilon_decay_fraction': 0.3, 'memory_fraction': 0.1, 'memory_type': 'deque', 'double_q': True, 'total_steps': total_steps, 'target_processor': 'normalizer', 'observation_processor': 'standardizer' } env = CartPoleEnv() data_path = os.getcwd() + '/gym/' results_path = os.getcwd() + '/results/cartpole/' agent, env, sess = experiment(agent=DQN, agent_config=agent_config, env=env, total_steps=total_steps, data_path=data_path, results_path=results_path, run_name='DDQN')
env_config = {'env_id': 'flex-v0', 'dataset': 'tempus', 'flex_size': 0.5, 'flex_time': 1, 'relax_time': 0, 'episode_length': 2016, 'episode_sample': 'random'} # env_config = {'env_id': 'CartPole'} # env_config = {'env_id': 'Battery', # 'dataset_name': args.dataset, # 'episode_sample': 'random'} # env_config = {'env_id': 'Flex-v0', # 'dataset_name': args.dataset, # 'episode_sample': 'random'} expt_path = os.path.join(os.getcwd(), 'results', args.expt_name) paths = make_paths(expt_path, run_name=args.run_name) logger = make_logger(paths, 'master') experiment(agent_config=agent_config, env_config=env_config, total_steps=TOTAL_STEPS, paths=paths, seed=args.seed)