Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Continuous Mountain Car Environment same as Gym implementation #1394

Merged
merged 5 commits into from
May 20, 2018

Conversation

sshkhr
Copy link
Contributor

@sshkhr sshkhr commented May 15, 2018

This PR make the contiunous Mountain Car Environment streamlined with the implementation in OpenAI Gym (https://github.com/openai/gym/blob/master/gym/envs/classic_control/continuous_mountain_car.py) . The changes are :

  • Added a goal position
  • The terminal state is reached when car crosses goal position (earlier it was set as when car reaches maximum allowed position)
  • The reward for reaching the terminal state is 100 - cost of action (earlier it was just 100)
  • The next state calculation is more configurable via introducing the power member variable (This was requested by @zoq in Added Continuous Mountain Car to Reinforcement Learning Environment #1368 but not addressed)

I have also added my name to list of contributors following #1388

@@ -96,13 +96,17 @@ class ContinuousMountainCar
* @param velocityMax Maximum legal velocity.
*/
ContinuousMountainCar(const double positionMin = -1.2,
const double positionMax = 0.5,
const double positionMax = 0.6,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a comment for each new parameter? Also I think you did some good additions to this file, so feel free to add yourself as another author.

return 100.0;
return -pow(action.action[0], 2)*0.1;
reward = 100.0;
reward -= std::pow(action.action[0], 2) * 0.1;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't think this makes a huge difference, but I guess it's a good idea to get the same results as the gym env.

Copy link
Member

@rcurtin rcurtin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No comments from my side; thanks for the contribution! :)

@zoq
Copy link
Member

zoq commented May 17, 2018

@mlpack-jenkins test this please

@zoq zoq merged commit 095f784 into mlpack:master May 20, 2018
@zoq
Copy link
Member

zoq commented May 20, 2018

Thanks again for the contribution 👍

@sshkhr sshkhr deleted the rl2 branch May 20, 2018 08:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants