Class sdm::QValueFunction

template <class TInput>

Class List > sdm > QValueFunction

This class is the abstract class of value function. All value function must derived this class. More...

  • #include <qvalue_function.hpp>

Inherits the following classes: sdm::BaseValueFunction

Inherited by the following classes: sdm::TabularQValueFunction

Public Types

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
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

See 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 inherited from sdm::BaseValueFunction

See sdm::BaseValueFunction

Type Name
number horizon_
The horizon for planning/learning.

Detailed Description

Template parameters:

  • std::shared_ptr<State> Type of the state.
  • std::shared_ptr<Action> Type of the action.
  • double Type of the value.

Public Types Documentation

typedef TGlobalInput

using sdm::QValueFunction< TInput >::TGlobalInput =  Pair<TInput,std::shared_ptr<Action> >;

Public Functions Documentation

function QValueFunction [1/2]

sdm::QValueFunction::QValueFunction () 

function QValueFunction [2/2]

sdm::QValueFunction::QValueFunction (
    number horizon
) 

Parameters:

  • problem
  • default_value

function getBestAction

std::shared_ptr< Action > sdm::QValueFunction::getBestAction (
    const TGlobalInput & input,
    number t
) 

Parameters:

  • state the state

Returns:

the best action

function getNumStates

virtual int sdm::QValueFunction::getNumStates () const = 0

function getQValueAt

virtual double sdm::QValueFunction::getQValueAt (
    const TInput & state,
    const std::shared_ptr< Action > & action,
    number t
) = 0

Parameters:

  • state the state
  • action the action

Returns:

the q-value

function getQValuesAt

virtual std::shared_ptr< VectorInterface < std::shared_ptr< Action >, double > > sdm::QValueFunction::getQValuesAt (
    const TInput & state,
    number t
) = 0

Parameters:

  • state the state

Returns:

the q-value vector

function getValueAt

double sdm::QValueFunction::getValueAt (
    const TGlobalInput & input,
    number t=0
) 

function getptr

std::shared_ptr< QValueFunction > sdm::QValueFunction::getptr () 

function initialize [1/2]

virtual void sdm::QValueFunction::initialize () = 0

Implements sdm::BaseValueFunction::initialize

function initialize [2/2]

virtual void sdm::QValueFunction::initialize (
    double v,
    number t=0
) = 0

Implements sdm::BaseValueFunction::initialize

function isNotSeen

virtual bool sdm::QValueFunction::isNotSeen (
    const TInput & state,
    number t
) = 0

function str

virtual std::string sdm::QValueFunction::str () const = 0

Implements sdm::BaseValueFunction::str

function updateQValueAt [1/2]

virtual void sdm::QValueFunction::updateQValueAt (
    const TInput & state,
    const std::shared_ptr< Action > & action,
    number t=0
) = 0

function updateQValueAt [2/2]

virtual void sdm::QValueFunction::updateQValueAt (
    const TInput & state,
    const std::shared_ptr< Action > & action,
    number t,
    double target
) = 0

function updateValueAt

void sdm::QValueFunction::updateValueAt (
    const TGlobalInput & input,
    number t=0
) 

The documentation for this class was generated from the following file src/sdm/utils/value_function/qvalue_function.hpp