Skip to content

The simulation plots and using RL algorithms #5

Description

@frostyduck

I trying to train RL algorihms from stable_baselines to control a wind turbine in gym-wind-turbine. I run the code for learning RL agent in WindTurbineStepwise-v0 env. The code is running without errors. However, I get empty simulation plots (without lines). Below, the example with TPRO algorithm (the same problem is with DDPG, SAC, PRO etc)

def run_TRPO_control_actions():

    wt = gym.make('WindTurbineStepwise-v0')
    wt = DummyVecEnv([lambda: wt])

    model = TRPO(MlpPolicy, wt, verbose=1)
    model.learn(total_timesteps=50000)
    model.save("trpo_turbine")

    del model  # remove to demonstrate saving and loading

    model = TRPO.load("trpo_turbine")

    print("Episode using real control with Stepwise Wind")
    done = False
    observation = wt.reset()

    while not done:
        action = model.predict(observation)
        observation, reward, done, info = wt.step(action)
    wt.render()

I have two guesses

  1. RL agent doesn't find an optimal policy and therefhore while the environment is not done, the RL algorithm cannot decide correctly what to do. As results, we don't have some simulations for the plot. The same is with running run_random_actions(). As results, we get empty simulation plots.
  2. This problem is somehow related to vectorized environments in stable_baselines. Instead of training an RL agent on 1 environment, it allows us to train it on n environments using n processes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions