Skip to content

Refactor/agent types #221

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

Merged
merged 18 commits into from
Jan 24, 2021
Merged

Refactor/agent types #221

merged 18 commits into from
Jan 24, 2021

Conversation

cpnota
Copy link
Owner

@cpnota cpnota commented Jan 24, 2021

This PR makes Agent and ParallelAgent distinct types. This is because Agent.act(state) accepts a State whereas ParallelAgent(state_array) accepts a StateArray, meaning that one cannot be substituted for the other, i.e. the Liskov substitution principle is violated if they are treated as the same type. Similarly, this has the ripple effect of making Preset and ParallelPreset distinct types, as well as PresetBuilder and ParallelPresetBuilder.

There are also a few other minor changes:

  1. PresetBuilder objects imported by users are instansiated by default. E.g., what was previously a2c().device('cuda') should now be written a2c.device('cuda').
  2. The name attribute is now passed from the Builder to the Preset, which will be used to improve logging.
  3. The Preset base classes were extended to store the name, device, and hyperparameter attributes which are shared across all presets, improving code reuse.
  4. Addresses Preset import structure #199 to make presets easier to copy/paste into custom presets

@cpnota cpnota merged commit 15411aa into develop Jan 24, 2021
@cpnota cpnota mentioned this pull request Jan 24, 2021
@cpnota cpnota deleted the refactor/agent-types branch March 4, 2021 15:46
@sonelu sonelu mentioned this pull request Jan 6, 2022
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.

1 participant