|
bitsim
Model, simulate, estimate and control robots in C++
|
The ExperienceBuffer class. A buffer based on boost::circular_buffer to accumulate items of type ExperienceType. see for example the A2C algorithm in A2C.h and rl_example_15. More...
#include <experience_buffer.h>


Public Types | |
| typedef ExperienceType | value_type |
| typedef ExperienceType | experience_type |
| typedef boost::circular_buffer< ExperienceType >::iterator | iterator |
| typedef boost::circular_buffer< ExperienceType >::const_iterator | const_iterator |
| typedef boost::circular_buffer< ExperienceType >::reverse_iterator | reverse_iterator |
| typedef boost::circular_buffer< ExperienceType >::const_reverse_iterator | const_reverse_iterator |
Public Member Functions | |
| ExperienceBuffer () | |
| ExperienceBuffer. | |
| ExperienceBuffer (uint_t capacity) | |
| ExperienceBuffer. | |
| void | append (const experience_type &experience) |
| append Add the experience item in the buffer | |
| uint_t | size () const noexcept |
| size | |
| uint_t | capacity () const noexcept |
| capacity | |
| bool | empty () const noexcept |
| empty. Returns true if the buffer is empty | |
| void | clear () noexcept |
| clear | |
| value_type & | operator[] (uint_t idx) |
| operator [] | |
| void | resize (uint_t new_size, const experience_type &item=experience_type()) |
| Resize the buffer. | |
| const value_type & | operator[] (uint_t idx) const |
| operator [] | |
| template<typename BatchTp> | |
| void | sample (uint_t batch_size, BatchTp &batch, uint_t seed=42) const |
| sample. Sample batch_size experiences from the buffer and transfer them in the BatchTp container. | |
| template<typename ContainerType> | |
| void | get (ContainerType &container) const |
| Copy the contents of the buffer to the given container. | |
| template<typename ContainerType> | |
| ContainerType | get () const |
| Copy the contents of the buffer to the given container. | |
| iterator | begin () |
| iterator | end () |
| const_iterator | begin () const |
| const_iterator | end () const |
| reverse_iterator | rbegin () |
| reverse_iterator | rend () |
| const_reverse_iterator | rbegin () const |
| const_reverse_iterator | rend () const |
Static Public Attributes | |
| static const uint_t | DEFAULT_CAPACITY = 100 |
The ExperienceBuffer class. A buffer based on boost::circular_buffer to accumulate items of type ExperienceType. see for example the A2C algorithm in A2C.h and rl_example_15.
| typedef boost::circular_buffer<ExperienceType>::const_iterator bitrl::utils::ExperienceBuffer< ExperienceType >::const_iterator |
| typedef boost::circular_buffer<ExperienceType>::const_reverse_iterator bitrl::utils::ExperienceBuffer< ExperienceType >::const_reverse_iterator |
| typedef ExperienceType bitrl::utils::ExperienceBuffer< ExperienceType >::experience_type |
| typedef boost::circular_buffer<ExperienceType>::iterator bitrl::utils::ExperienceBuffer< ExperienceType >::iterator |
| typedef boost::circular_buffer<ExperienceType>::reverse_iterator bitrl::utils::ExperienceBuffer< ExperienceType >::reverse_iterator |
| typedef ExperienceType bitrl::utils::ExperienceBuffer< ExperienceType >::value_type |
| bitrl::utils::ExperienceBuffer< ExperienceTp >::ExperienceBuffer | ( | ) |
|
explicit |
| void bitrl::utils::ExperienceBuffer< ExperienceTp >::append | ( | const experience_type & | experience | ) |
append Add the experience item in the buffer
|
inline |
|
inline |
|
inlinenoexcept |
capacity
|
inlinenoexcept |
clear
|
inlinenoexcept |
empty. Returns true if the buffer is empty
|
inline |
|
inline |
| ContainerType bitrl::utils::ExperienceBuffer< ExperienceType >::get | ( | ) | const |
Copy the contents of the buffer to the given container.
| void bitrl::utils::ExperienceBuffer< ExperienceType >::get | ( | ContainerType & | container | ) | const |
Copy the contents of the buffer to the given container.
|
inline |
operator []
| idx |
|
inline |
operator []
| idx |
|
inline |
|
inline |
|
inline |
|
inline |
| void bitrl::utils::ExperienceBuffer< ExperienceTp >::resize | ( | uint_t | new_size, |
| const experience_type & | item = experience_type() ) |
Resize the buffer.
| void bitrl::utils::ExperienceBuffer< ExperienceTp >::sample | ( | uint_t | batch_size, |
| BatchTp & | batch, | ||
| uint_t | seed = 42 ) const |
sample. Sample batch_size experiences from the buffer and transfer them in the BatchTp container.
|
inlinenoexcept |
size
|
static |