Example #1
0
    def test_reset_forecasts(self):
        """
        Checks that episode forecasts is reset
        """
        env = ActiveEnv()
        start_env = copy.deepcopy(env)
        env.reset()

        assert norm(start_env.solar_forecasts - env.solar_forecasts) > 0.001
        assert norm(start_env.demand_forecasts[0][:24] -
                    env.demand_forecasts[0][:24]) > 0.001
    gamma=0.99,
    tensorboard_log=logdir,
    memory_limit=int(800000),
    nb_train_steps=50,
    nb_rollout_steps=100,
    critic_lr=0.001,  #default: 0.001
    actor_lr=0.001,  #default: 0.0001
    normalize_observations=False)
powermodel.learn(t_steps)

env = powerenv.envs[0]
net = env.powergrid
sol_bus = net.load['bus'].isin(net.sgen['bus'])

data = []
obs = powerenv.reset()


def save_model(model, model_name):
    path = 'models/' + model_name + '.pkl'
    i = 2
    while os.path.isfile(path):
        model_name += '_' + str(i)
        i += 1
        path = 'models/' + model_name + '.pkl'
    powermodel.save('models/' + model_name)
    with open('models/' + model_name + '_params.p', 'wb') as f:
        pickle.dump(env.params, f)


model_name = '800k_full'