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

feat: support discrete environment #286

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

Gaiejj
Copy link
Member

@Gaiejj Gaiejj commented Nov 5, 2023

Description

This pull request is aimed at supporting environments with discrete action spaces and observation spaces. It has been implemented in the Taxi-v3 and CartPole-v1 environments in Gymnasium. Relevant documents, code checks, and standards have been updated. Currently, it supports the following on-policy algorithms:

['NaturalPG', 'PolicyGradient', 'PPO', 'TRPO', 'RCPO', 'PDO', 'PPOLag', 'TRPOLag', 'OnCRPO', 'P3O', 'IPO', 'CPPOPID', 'TRPOPID', 'CPO', 'PCPO',]

to run in discrete environments.
The performance curve below shows the correctness of our implementation.
algo---CartPole-v1---bd252e6d92d63ae5628feb2cb9f076c4535775919201e12bb086eb4496b3ed4f

Motivation and Context

resolve #273 #283

Types of changes

What types of changes does your code introduce? Put an x in all the boxes that apply:

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds core functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation (update in the documentation)

Checklist

Go over all the following points, and put an x in all the boxes that apply.
If you are unsure about any of these, don't hesitate to ask. We are here to help!

  • I have read the CONTRIBUTION guide. (required)
  • My change requires a change to the documentation.
  • I have updated the tests accordingly. (required for a bug fix or a new feature)
  • I have updated the documentation accordingly.
  • I have reformatted the code using make format. (required)
  • I have checked the code using make lint. (required)
  • I have ensured make test pass. (required)

@Gaiejj Gaiejj added enhancement New feature or request environment Something related to the RL environment algorithm Some issues about algorithm feature Something related to new features and removed algorithm Some issues about algorithm labels Nov 5, 2023
Copy link

codecov bot commented Nov 7, 2023

Codecov Report

Attention: 15 lines in your changes are missing coverage. Please review.

Comparison is base (d55958a) 96.84% compared to head (e68bf5c) 96.70%.
Report is 1 commits behind head on main.

Files Patch % Lines
omnisafe/envs/discrete_env.py 85.96% 8 Missing ⚠️
omnisafe/models/base.py 63.64% 4 Missing ⚠️
omnisafe/evaluator.py 83.33% 2 Missing ⚠️
omnisafe/utils/config.py 87.50% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #286      +/-   ##
==========================================
- Coverage   96.84%   96.70%   -0.14%     
==========================================
  Files         138      140       +2     
  Lines        7000     7130     +130     
==========================================
+ Hits         6779     6895     +116     
- Misses        221      235      +14     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Gaiejj Gaiejj mentioned this pull request Nov 13, 2023
3 tasks
@Gaiejj Gaiejj requested a review from zmsn-2077 March 22, 2024 06:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request environment Something related to the RL environment feature Something related to new features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Customizing my environment
1 participant