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

Implement RandomPolicy #89

Merged
merged 3 commits into from
Aug 30, 2023
Merged

Implement RandomPolicy #89

merged 3 commits into from
Aug 30, 2023

Conversation

Junyoungpark
Copy link
Collaborator

Description

This update contains the implementation of the RandomPolicy class
The random policy constructs solutions with randomly chosen actions.

Motivation and Context

Having a random policy can be useful during the development of a new environment to perform the sanity check.

Types of changes

What types of changes does your code introduce? Remove all that do not 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)
  • Example (update in the folder of examples)

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!

  • 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.

@codecov
Copy link

codecov bot commented Aug 30, 2023

Codecov Report

Patch coverage is 61.90% of modified lines.

Files Changed Coverage
rl4co/models/nn/utils.py 61.90%

📢 Thoughts on this report? Let us know!.

def forward(
self,
td: TensorDict,
env: Union[str, RL4COEnvBase] = None,
Copy link
Member

Choose a reason for hiding this comment

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

How about setting themax_steps to inf by default?
Since there may be cases in which one wants to test a very large scale problem, but this max_steps is kinda hardcoded. Or, perhaps we can log a warning if this happens

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I set the default value of max_steps as None. If max_steps=None, rollout decodes until it finds the environments are done.

Copy link
Member

Choose a reason for hiding this comment

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

LGTM!

@Junyoungpark Junyoungpark merged commit 0455cbe into main Aug 30, 2023
20 checks passed
@cbhua cbhua deleted the random_rollout branch March 8, 2024 07:35
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