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(cbf): support crabs as a representative control barrier function based algorithm #327

Merged
merged 23 commits into from
Apr 30, 2024

Conversation

muchvo
Copy link
Collaborator

@muchvo muchvo commented Apr 18, 2024

Description

feat(cbf): support crabs as a representative control barrier function based algorithm.

We are delighted to have implemented the CRABS(NeurIPS 2021) algorithm, a representative control barrier function based method, and compared it with the original implementation. During the implementation process, we carefully compared the implementation details to ensure that the gradient flow was completely consistent with the code provided by the authors. Our results achieved similar performance, and we hope this contribution will facilitate easier comparisons with CBF-based methods within the SafeRL community, while also leveraging our tool for enhanced research.

However, we observed that this algorithm requires the use of pretrained model parameters as a starting point for training, and it is currently unclear how these parameters are obtained. This issue was also mentioned in the Paper Decision that decide to accept this paper. Fortunately, the authors provided pretrained model parameters for the Swing environment, which allowed us to successfully replicate part of the performance.

Here is the performance of the original paper:
image

Here is the performance from our implementation:
env_id---SafeInvertedPendulumSwing-v2---6b9b13e5feee035b0c4eef4bf5d8e2d20cb5800c36f27ed24e878b6d82f18c74

Regarding the remaining environments: Move, Upright, and Tilt, we are actively communicating with the authors. If the community has any solutions to this issue and is willing to support us, please feel free to contact us. Your support is crucial to our progress.

Motivation and Context

Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.
You can use the syntax close #15213 if this solves the issue #15213

  • I have raised an issue to propose this change (required for new features and bug fixes)

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)

@muchvo muchvo marked this pull request as draft April 18, 2024 16:25
@muchvo muchvo marked this pull request as ready for review April 21, 2024 17:28
Copy link

codecov bot commented Apr 22, 2024

Codecov Report

Attention: Patch coverage is 84.61538% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 96.57%. Comparing base (c6c8aa9) to head (a0d10b8).

Files Patch % Lines
omnisafe/common/offline/dataset.py 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #327      +/-   ##
==========================================
- Coverage   96.59%   96.57%   -0.01%     
==========================================
  Files         139      139              
  Lines        7090     7089       -1     
==========================================
- Hits         6848     6846       -2     
- Misses        242      243       +1     

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

Gaiejj
Gaiejj previously approved these changes Apr 30, 2024
Copy link
Member

@Gaiejj Gaiejj left a comment

Choose a reason for hiding this comment

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

LGTM.

@muchvo muchvo merged commit 89717ba into PKU-Alignment:main Apr 30, 2024
4 checks passed
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.

2 participants