Class sdm::BaseValueFunction

template <class TInput>

Class List > sdm > BaseValueFunction

This class is the abstract class of all kind of value functions. All {state,action,q}-value function must derived this class. More...

  • #include <base_value_function.hpp>

Inherits the following classes: std::enable_shared_from_this< BaseValueFunction< TInput > >

Inherited by the following classes: sdm::ValueFunction

Public Functions

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
number horizon_
The horizon for planning/learning.

Detailed Description

Template parameters:

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

Public Functions Documentation

function BaseValueFunction [1/3]

sdm::BaseValueFunction::BaseValueFunction () 

function BaseValueFunction [2/3]

sdm::BaseValueFunction::BaseValueFunction (
    number horizon
) 

function BaseValueFunction [3/3]

sdm::BaseValueFunction::BaseValueFunction (
    const BaseValueFunction & copy
) 

function getBestAction

virtual std::shared_ptr< Action > sdm::BaseValueFunction::getBestAction (
    const TInput & input,
    number t
) = 0

Parameters:

  • state the state

Returns:

the best action

function getHorizon

number sdm::BaseValueFunction::getHorizon () const

function getValueAt

virtual double sdm::BaseValueFunction::getValueAt (
    const TInput & input,
    number t=0
) = 0

function getptr

std::shared_ptr< BaseValueFunction < TInput > > sdm::BaseValueFunction::getptr () 

Returns:

the corresponding shared pointer

function initialize [1/2]

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

function initialize [2/2]

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

function isFiniteHorizon

bool sdm::BaseValueFunction::isFiniteHorizon () const

function isInfiniteHorizon

bool sdm::BaseValueFunction::isInfiniteHorizon () const

function load

inline virtual void sdm::BaseValueFunction::load (
    std::string
) 

Parameters:

  • filename the filename

function save

inline virtual void sdm::BaseValueFunction::save (
    std::string
) 

Parameters:

  • filename the filename

function str

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

function updateValueAt

virtual void sdm::BaseValueFunction::updateValueAt (
    const TInput & input,
    number t=0
) = 0

Parameters:

  • state the state

Returns:

the action value vector Get the q-value given state and action

Parameters:

  • state the state
  • action the action

Returns:

the q-value Update the value at a given state

function ~BaseValueFunction

inline virtual sdm::BaseValueFunction::~BaseValueFunction () 

Protected Attributes Documentation

variable horizon_

number sdm::BaseValueFunction< TInput >::horizon_;

Friends Documentation

friend operator<<

inline friend std::ostream & sdm::BaseValueFunction::operator<< (
    std::ostream & os,
    const BaseValueFunction < TInput > & vf
) 

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