|
TorchCraftAI
A bot for machine learning research on StarCraft: Brood War
|
Stores an unordered_map[GameUID] = unordered_map[int, Episode] All the public functions here should be autolocking and therefore relatively thread safe. More...
#include <trainer.h>
Public Types | |
| using | Episode = std::vector< std::shared_ptr< ReplayBufferFrame >> |
| using | Store = std::unordered_map< GameUID, std::unordered_map< EpisodeKey, Episode >> |
| using | UIDKeyStore = std::unordered_map< GameUID, std::unordered_set< EpisodeKey >> |
| using | SampleOutput = std::pair< EpisodeTuple, std::reference_wrapper< Episode >> |
Public Member Functions | |
| Episode & | append (GameUID uid, EpisodeKey key, std::shared_ptr< ReplayBufferFrame > value, bool isDone=false) |
| std::size_t | size () const |
| std::size_t | size (GameUID const &) const |
| std::size_t | sizeDone () const |
| std::size_t | sizeDone (GameUID const &) const |
| void | clear () |
| void | erase (GameUID const &, EpisodeKey const &=kDefaultEpisodeKey) |
| std::vector< SampleOutput > | getAllEpisodes () |
| template<typename RandomGenerator > | |
| std::vector< SampleOutput > | sample (RandomGenerator &g, uint32_t num=1) |
| std::vector< SampleOutput > | sample (uint32_t num=1) |
| Episode & | get (GameUID const &, EpisodeKey const &=kDefaultEpisodeKey) |
| bool | has (GameUID const &, EpisodeKey const &=kDefaultEpisodeKey) |
| bool | isDone (GameUID const &, EpisodeKey const &=kDefaultEpisodeKey) |
Protected Member Functions | |
| template<typename RandomGenerator > | |
| SampleOutput | sample_ (RandomGenerator &g) |
Protected Attributes | |
| Store | storage_ |
| UIDKeyStore | dones_ |
| std::shared_timed_mutex | replayerRWMutex_ |
Stores an unordered_map[GameUID] = unordered_map[int, Episode] All the public functions here should be autolocking and therefore relatively thread safe.
However, things like size do no perfectly accurately represent the size in a multithreaded environment.
| using cpid::ReplayBuffer::Episode = std::vector<std::shared_ptr<ReplayBufferFrame>> |
| using cpid::ReplayBuffer::SampleOutput = std::pair<EpisodeTuple, std::reference_wrapper<Episode>> |
| using cpid::ReplayBuffer::Store = std::unordered_map<GameUID, std::unordered_map<EpisodeKey, Episode>> |
| using cpid::ReplayBuffer::UIDKeyStore = std::unordered_map<GameUID, std::unordered_set<EpisodeKey>> |
| Episode & cpid::ReplayBuffer::append | ( | GameUID | uid, |
| EpisodeKey | key, | ||
| std::shared_ptr< ReplayBufferFrame > | value, | ||
| bool | isDone = false |
||
| ) |
| void cpid::ReplayBuffer::clear | ( | ) |
| void cpid::ReplayBuffer::erase | ( | GameUID const & | id, |
| EpisodeKey const & | key = kDefaultEpisodeKey |
||
| ) |
| Episode & cpid::ReplayBuffer::get | ( | GameUID const & | uid, |
| EpisodeKey const & | key = kDefaultEpisodeKey |
||
| ) |
| std::vector< std::pair< EpisodeTuple, std::reference_wrapper< Episode > > > cpid::ReplayBuffer::getAllEpisodes | ( | ) |
| bool cpid::ReplayBuffer::has | ( | GameUID const & | uid, |
| EpisodeKey const & | key = kDefaultEpisodeKey |
||
| ) |
| bool cpid::ReplayBuffer::isDone | ( | GameUID const & | uid, |
| EpisodeKey const & | key = kDefaultEpisodeKey |
||
| ) |
|
inline |
| std::vector< std::pair< EpisodeTuple, std::reference_wrapper< Episode > > > cpid::ReplayBuffer::sample | ( | uint32_t | num = 1 | ) |
|
inlineprotected |
| std::size_t cpid::ReplayBuffer::size | ( | ) | const |
| std::size_t cpid::ReplayBuffer::size | ( | GameUID const & | id | ) | const |
| std::size_t cpid::ReplayBuffer::sizeDone | ( | ) | const |
| std::size_t cpid::ReplayBuffer::sizeDone | ( | GameUID const & | id | ) | const |
|
protected |
|
mutableprotected |
|
protected |
1.8.11