-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add new abstract classes * flatten all.agents directory structure * add uncommitted files * refactor PresetBuilder * update classic control presets * update atari presets * fix continuous presets * update independent multiagent * fix unit tests * update integration tests * run formatter * update atari script * update run scripts * update docstring for agent base classes * make paramaters optional * remove unnecessary print statement * fix multiagent atari script
- Loading branch information
Showing
58 changed files
with
524 additions
and
408 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
from abc import ABC, abstractmethod | ||
from all.optim import Schedulable | ||
|
||
|
||
class ParallelAgent(ABC, Schedulable): | ||
""" | ||
A reinforcement learning agent that chooses actions for multiple states simultaneously. | ||
Differs from SingleAgent in that it accepts a StateArray instead of a State to process | ||
input from multiple environments in parallel. | ||
In reinforcement learning, an Agent learns by interacting with an Environment. | ||
Usually, an Agent tries to maximize a reward signal. | ||
It does this by observing environment "states", taking "actions", receiving "rewards", | ||
and learning which state-action pairs correlate with high rewards. | ||
An Agent implementation should encapsulate some particular reinforcement learning algorithm. | ||
""" | ||
|
||
@abstractmethod | ||
def act(self, state_array): | ||
""" | ||
Select an action for the current timestep and update internal parameters. | ||
In general, a reinforcement learning agent does several things during a timestep: | ||
1. Choose an action, | ||
2. Compute the TD error from the previous time step | ||
3. Update the value function and/or policy | ||
The order of these steps differs depending on the agent. | ||
This method allows the agent to do whatever is necessary for itself on a given timestep. | ||
However, the agent must ultimately return an action. | ||
Args: | ||
state_array (all.environment.StateArray): An array of states for each parallel environment. | ||
Returns: | ||
torch.Tensor: The actions to take for each parallel environmets. | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.