Class sdm::TabularQValueFunction
template <class TInput>
Class List > sdm > TabularQValueFunction
#include <tabular_qvalue_function.hpp>
Inherits the following classes: sdm::QValueFunction
Public Types
Type | Name |
---|---|
typedef MappedMatrix< TInput, std::shared_ptr< Action >, double > | Container |
Public Types inherited from sdm::QValueFunction
Type | Name |
---|---|
typedef Pair< TInput, std::shared_ptr< Action > > | TGlobalInput Initialization function. If defined, algorithms on value functions will get inital values using this function. |
Public Functions
Type | Name |
---|---|
TabularQValueFunction (number horizon, double learning_rate, std::shared_ptr< QInitializer< TInput >> initializer, bool active_learning=true) | |
TabularQValueFunction (number horizon=0, double learning_rate=0.1, double default_value=0., bool active_learning=true) | |
virtual int | getNumStates () const |
virtual double | getQValueAt (const TInput & state, const std::shared_ptr< Action > & action, number t) Get the q-value given state and action. |
virtual std::shared_ptr< VectorInterface< std::shared_ptr< Action >, double > > | getQValuesAt (const TInput & state, number t) Get the q-value at a state. |
virtual void | initialize () Initialize the value function. |
virtual void | initialize (double v, number t=0) Initialize the value function with a default value. |
virtual bool | isNotSeen (const TInput & state, number t) |
virtual std::string | str () const Define this function in order to be able to display the value function. |
virtual void | updateQValueAt (const TInput & state, const std::shared_ptr< Action > & action, number t=0) Update the value at a given state. |
virtual void | updateQValueAt (const TInput & state, const std::shared_ptr< Action > & action, number t, double delta) Update the value at a given state (given a delta) |
Public Functions inherited from sdm::QValueFunction
Type | Name |
---|---|
QValueFunction () | |
QValueFunction (number horizon) Construct a new Incremental Value Function object. | |
std::shared_ptr< Action > | getBestAction (const TGlobalInput & input, number t) Get the best action to do at a state. |
virtual int | getNumStates () const = 0 |
virtual double | getQValueAt (const TInput & state, const std::shared_ptr< Action > & action, number t) = 0 Get the q-value given state and action. |
virtual std::shared_ptr< VectorInterface< std::shared_ptr< Action >, double > > | getQValuesAt (const TInput & state, number t) = 0 Get the q-values for all actions at a state. |
double | getValueAt (const TGlobalInput & input, number t=0) Get the value at a given state. |
std::shared_ptr< QValueFunction > | getptr () Get shared pointer on the current QValueFunction . |
virtual void | initialize () = 0 Initialize the value function. |
virtual void | initialize (double v, number t=0) = 0 Initialize the value function with a default value. |
virtual bool | isNotSeen (const TInput & state, number t) = 0 |
virtual std::string | str () const = 0 Define this function in order to be able to display the value function. |
virtual void | updateQValueAt (const TInput & state, const std::shared_ptr< Action > & action, number t=0) = 0 Update the value at a given state. |
virtual void | updateQValueAt (const TInput & state, const std::shared_ptr< Action > & action, number t, double target) = 0 Update the value at a given state (given a target) |
void | updateValueAt (const TGlobalInput & input, number t=0) Update the value at a given state. |
Public Functions inherited from sdm::BaseValueFunction
Type | Name |
---|---|
BaseValueFunction () | |
BaseValueFunction (number horizon) | |
BaseValueFunction (const BaseValueFunction & copy) | |
virtual std::shared_ptr< Action > | getBestAction (const TInput & input, number t) = 0 Get the best action to do at a state. |
number | getHorizon () const |
virtual double | getValueAt (const TInput & input, number t=0) = 0 Get the value at a given state. |
std::shared_ptr< BaseValueFunction< TInput > > | getptr () Get a shared pointer on the current object. |
virtual void | initialize () = 0 Initialize the value function. |
virtual void | initialize (double v, number t=0) = 0 Initialize the value function with a default value. |
bool | isFiniteHorizon () const |
bool | isInfiniteHorizon () const |
virtual void | load (std::string) Load a value function from a file. The extension of the file will indicate the type of formatage for reading ( .txt = text format, '.xml' = XML format, other = binary format). |
virtual void | save (std::string) Save a value function into a file. The extension of the file will indicate the type of formatage for recording ( .txt = text format, '.xml' = XML format, other = binary format). |
virtual std::string | str () const = 0 Define this function in order to be able to display the value function. |
virtual void | updateValueAt (const TInput & input, number t=0) = 0 Get the q-value at a state. |
virtual | ~BaseValueFunction () Destroy the value function. |
Protected Attributes
Type | Name |
---|---|
bool | active_learning_ |
std::shared_ptr< QInitializer< TInput > > | initializer_ The initializer to use for this value function. |
double | learning_rate_ |
std::vector< Container > | representation The Q value function represention. The default representation is a MappedVector but every class implementingVectorInterface interface can be used. |
Protected Attributes inherited from sdm::BaseValueFunction
Type | Name |
---|---|
number | horizon_ The horizon for planning/learning. |
Public Types Documentation
typedef Container
using sdm::TabularQValueFunction< TInput >::Container = MappedMatrix<TInput, std::shared_ptr<Action>, double>;
Public Functions Documentation
function TabularQValueFunction [1/2]
sdm::TabularQValueFunction::TabularQValueFunction (
number horizon,
double learning_rate,
std::shared_ptr< QInitializer < TInput >> initializer,
bool active_learning=true
)
function TabularQValueFunction [2/2]
sdm::TabularQValueFunction::TabularQValueFunction (
number horizon=0,
double learning_rate=0.1,
double default_value=0.,
bool active_learning=true
)
function getNumStates
virtual int sdm::TabularQValueFunction::getNumStates () const
Implements sdm::QValueFunction::getNumStates
function getQValueAt
virtual double sdm::TabularQValueFunction::getQValueAt (
const TInput & state,
const std::shared_ptr< Action > & action,
number t
)
Parameters:
state
the stateaction
the action
Returns:
the q-value
Implements sdm::QValueFunction::getQValueAt
function getQValuesAt
virtual std::shared_ptr< VectorInterface < std::shared_ptr< Action >, double > > sdm::TabularQValueFunction::getQValuesAt (
const TInput & state,
number t
)
Parameters:
state
the state
Returns:
the action value vector
Implements sdm::QValueFunction::getQValuesAt
function initialize [1/2]
virtual void sdm::TabularQValueFunction::initialize ()
Implements sdm::QValueFunction::initialize
function initialize [2/2]
virtual void sdm::TabularQValueFunction::initialize (
double v,
number t=0
)
Implements sdm::QValueFunction::initialize
function isNotSeen
virtual bool sdm::TabularQValueFunction::isNotSeen (
const TInput & state,
number t
)
Implements sdm::QValueFunction::isNotSeen
function str
virtual std::string sdm::TabularQValueFunction::str () const
Implements sdm::QValueFunction::str
function updateQValueAt [1/2]
virtual void sdm::TabularQValueFunction::updateQValueAt (
const TInput & state,
const std::shared_ptr< Action > & action,
number t=0
)
Implements sdm::QValueFunction::updateQValueAt
function updateQValueAt [2/2]
virtual void sdm::TabularQValueFunction::updateQValueAt (
const TInput & state,
const std::shared_ptr< Action > & action,
number t,
double delta
)
Implements sdm::QValueFunction::updateQValueAt
Protected Attributes Documentation
variable active_learning_
bool sdm::TabularQValueFunction< TInput >::active_learning_;
variable initializer_
std::shared_ptr<QInitializer<TInput> > sdm::TabularQValueFunction< TInput >::initializer_;
variable learning_rate_
double sdm::TabularQValueFunction< TInput >::learning_rate_;
variable representation
std::vector<Container> sdm::TabularQValueFunction< TInput >::representation;
Friends Documentation
friend operator<<
inline friend std::ostream & sdm::TabularQValueFunction::operator<< (
std::ostream & os,
TabularQValueFunction & vf
)
The documentation for this class was generated from the following file src/sdm/utils/value_function/tabular_qvalue_function.hpp