Class sdm::BaseTabularValueFunction
template <class Hash, class KeyEqual>
Class List > sdm > BaseTabularValueFunction
#include <tabular_value_function.hpp>
Inherits the following classes: sdm::ValueFunction
Inherited by the following classes: sdm::BasePointSetValueFunction
Public Types
Type | Name |
---|---|
typedef MappedVector< std::shared_ptr< State >, double, Hash, KeyEqual > | Container |
Public Types inherited from sdm::BinaryFunction
Type | Name |
---|---|
typedef std::pair< TInput1, TInput2 > | input_type |
typedef TOutput | output_type |
Public Types inherited from sdm::Function
See sdm::Function
Type | Name |
---|---|
typedef TInput | input_type |
typedef TOutput | output_type |
Public Attributes inherited from sdm::ValueFunction
Type | Name |
---|---|
std::shared_ptr< BackupInterfaceForValueFunction > | backup_ The backup operator. |
double | time_get_value_at = = 0 |
double | time_pruning = =0 |
double | time_update_value = =0 |
double | total_time_evaluate = =0 |
double | total_time_exist = =0 |
double | total_time_update_backup = =0 |
double | total_time_update_best_action = =0 |
Public Functions
Type | Name |
---|---|
BaseTabularValueFunction (number horizon, const std::shared_ptr< Initializer > & initializer, const std::shared_ptr< BackupInterfaceForValueFunction > & backup, const std::shared_ptr< ActionVFInterface > & action_vf, bool is_upper_bound) | |
BaseTabularValueFunction (number horizon=0, double default_value=0., const std::shared_ptr< BackupInterfaceForValueFunction > & backup=nullptr, const std::shared_ptr< ActionVFInterface > & action_vf=nullptr, bool is_upper_bound=false) | |
BaseTabularValueFunction (const BaseTabularValueFunction & copy) | |
virtual void | do_pruning (number t) |
virtual Pair< std::shared_ptr< State >, double > | evaluate (const std::shared_ptr< State > & state, number t) Evaluate the element given. |
double | getDefaultAt (number t) |
Container | getRepresentation (number t) |
virtual size_t | getSize (number t) const Get the size of the value function at timestep t. |
virtual std::vector< std::shared_ptr< State > > | getSupport (number t) Return the possible indexes of the value function. |
virtual double | getValueAt (const std::shared_ptr< State > & state, number t=0) Evaluate the value at a state. |
virtual void | initialize () Initialize the value function by using initializer. |
virtual void | initialize (double default_value, number t=0) Set all values of the vector to a default value. |
virtual void | load (std::string filename) 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 filename) 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). |
void | serialize (Archive & archive, const unsigned int &) |
virtual std::string | str () const Define this function in order to be able to display the value function. |
virtual void | updateValueAt (const std::shared_ptr< State > & state, number t=0) Update the value at a specific state and timestep. |
virtual void | updateValueAt (const std::shared_ptr< State > & state, const std::shared_ptr< Action > & action, number t=0) Update the value at a given state knowing an action. |
void | updateValueAt (const std::shared_ptr< State > & state, number t, double target) Update the value function at state s and timestep t to the target value. |
Public Functions inherited from sdm::ValueFunction
Type | Name |
---|---|
void | StartTime () |
ValueFunction () | |
ValueFunction (number horizon=0, const std::shared_ptr< Initializer > & intializer=nullptr, const std::shared_ptr< BackupInterfaceForValueFunction > & backup=nullptr, const std::shared_ptr< ActionVFInterface > & action=nullptr) Construct a new Incremental Value Function object. | |
ValueFunction (const ValueFunction & copy) | |
TData | backup (const std::shared_ptr< State > & state, const std::shared_ptr< Action > & action, number t) Do the backup operator. |
virtual void | do_pruning (number t) = 0 |
virtual Pair< std::shared_ptr< State >, double > | evaluate (const std::shared_ptr< State > & state, number t) = 0 Evaluate the element given. |
std::shared_ptr< Action > | getBestAction (const std::shared_ptr< State > & state, number t) Select the best Action for a precise state and a time step. |
Pair< std::shared_ptr< Action >, double > | getBestActionAndValue (const std::shared_ptr< State > & state, number t) Select the best Action and the value associated for a precise state and a time step. |
std::shared_ptr< BinaryFunction< std::shared_ptr< State >, number, double > > | getInitFunction () Get the Init Function . |
virtual size_t | getSize (number t) const = 0 Get the size of the value function at timestep t. |
size_t | getSize () const Get the total size of the value function. |
virtual std::vector< std::shared_ptr< State > > | getSupport (number t) = 0 Return the possible indexes of the value function. |
double | getTime (std::string information) |
virtual double | getValueAt (const std::shared_ptr< State > & state, number t=0) = 0 Get the value at a given state. |
std::shared_ptr< ValueFunction > | 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. |
void | initialize (const std::shared_ptr< BinaryFunction< std::shared_ptr< State >, number, double >> & init_function) Set a function as a interactive way to get initial values for state that are not already initialized. |
virtual double | operator() (const std::shared_ptr< State > & state, const number & t=0) |
virtual std::string | str () const = 0 Define this function in order to be able to display the value function. |
void | updateTime (std::chrono::high_resolution_clock::time_point start_time, std::string information) |
virtual void | updateValueAt (const std::shared_ptr< State > & state, number t=0) = 0 Update the value at a given state. |
virtual void | updateValueAt (const std::shared_ptr< State > & state, const std::shared_ptr< Action > & action, number t=0) = 0 Update the value at a given state knowing an action. |
virtual | ~ValueFunction () Destroy the value function. |
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. |
Public Functions inherited from sdm::BinaryFunction
Type | Name |
---|---|
virtual output_type | operator() (const TInput1 &, const TInput2 &) = 0 |
virtual output_type | operator() (const input_type & p_input) |
virtual | ~BinaryFunction () |
Public Functions inherited from sdm::Function
See sdm::Function
Type | Name |
---|---|
virtual output_type | operator() (const input_type &) = 0 |
virtual | ~Function () |
Protected Attributes
Type | Name |
---|---|
bool | is_upper_bound_ |
std::vector< Container > | representation The value function represention. The default representation is a MappedVector but every class implementingVectorInterface interface can be used. |
Protected Attributes inherited from sdm::ValueFunction
Type | Name |
---|---|
std::shared_ptr< ActionVFInterface > | action_ The evaluate operator. |
std::shared_ptr< BinaryFunction< std::shared_ptr< State >, number, double > > | init_function_ = = nullptr Initialization function. If defined, algorithms on value functions will get inital values using this function. |
std::shared_ptr< Initializer > | initializer_ The initializer to use for this value function. |
Protected Attributes inherited from sdm::BaseValueFunction
Type | Name |
---|---|
number | horizon_ The horizon for planning/learning. |
Public Types Documentation
typedef Container
using sdm::BaseTabularValueFunction< Hash, KeyEqual >::Container = MappedVector<std::shared_ptr<State>, double, Hash, KeyEqual>;
Public Functions Documentation
function BaseTabularValueFunction [1/3]
sdm::BaseTabularValueFunction::BaseTabularValueFunction (
number horizon,
const std::shared_ptr< Initializer > & initializer,
const std::shared_ptr< BackupInterfaceForValueFunction > & backup,
const std::shared_ptr< ActionVFInterface > & action_vf,
bool is_upper_bound
)
function BaseTabularValueFunction [2/3]
sdm::BaseTabularValueFunction::BaseTabularValueFunction (
number horizon=0,
double default_value=0.,
const std::shared_ptr< BackupInterfaceForValueFunction > & backup=nullptr,
const std::shared_ptr< ActionVFInterface > & action_vf=nullptr,
bool is_upper_bound=false
)
function BaseTabularValueFunction [3/3]
sdm::BaseTabularValueFunction::BaseTabularValueFunction (
const BaseTabularValueFunction & copy
)
function do_pruning
virtual void sdm::BaseTabularValueFunction::do_pruning (
number t
)
Implements sdm::ValueFunction::do_pruning
function evaluate
virtual Pair < std::shared_ptr< State >, double > sdm::BaseTabularValueFunction::evaluate (
const std::shared_ptr< State > & state,
number t
)
Parameters:
state
: ELement to evaluatet
Returns:
Pair<std::shared_ptr<State>, double>
Implements sdm::ValueFunction::evaluate
function getDefaultAt
double sdm::BaseTabularValueFunction::getDefaultAt (
number t
)
function getRepresentation
Container sdm::BaseTabularValueFunction::getRepresentation (
number t
)
function getSize
virtual size_t sdm::BaseTabularValueFunction::getSize (
number t
) const
Implements sdm::ValueFunction::getSize
function getSupport
virtual std::vector< std::shared_ptr< State > > sdm::BaseTabularValueFunction::getSupport (
number t
)
Returns:
std::string
Implements sdm::ValueFunction::getSupport
function getValueAt
virtual double sdm::BaseTabularValueFunction::getValueAt (
const std::shared_ptr< State > & state,
number t=0
)
Parameters:
state
the state where we want to evaluate the function
Returns:
the value
Implements sdm::ValueFunction::getValueAt
function initialize [1/2]
virtual void sdm::BaseTabularValueFunction::initialize ()
Implements sdm::ValueFunction::initialize
function initialize [2/2]
virtual void sdm::BaseTabularValueFunction::initialize (
double default_value,
number t=0
)
Parameters:
default_value
the default value
Implements sdm::ValueFunction::initialize
function load
virtual void sdm::BaseTabularValueFunction::load (
std::string filename
)
Parameters:
filename
the filename
Implements sdm::BaseValueFunction::load
function save
virtual void sdm::BaseTabularValueFunction::save (
std::string filename
)
Parameters:
filename
the filename 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).filename
the filename
Implements sdm::BaseValueFunction::save
function serialize
template<class Archive class Archive>
inline void sdm::BaseTabularValueFunction::serialize (
Archive & archive,
const unsigned int &
)
function str
virtual std::string sdm::BaseTabularValueFunction::str () const
Implements sdm::ValueFunction::str
function updateValueAt [1/3]
virtual void sdm::BaseTabularValueFunction::updateValueAt (
const std::shared_ptr< State > & state,
number t=0
)
Parameters:
state
the statet
the timestep. Must be less than the horizon, t < h. Except in serialized problem solving where real timesteps are serialized and thus we need t < h n.
Implements sdm::ValueFunction::updateValueAt
function updateValueAt [2/3]
virtual void sdm::BaseTabularValueFunction::updateValueAt (
const std::shared_ptr< State > & state,
const std::shared_ptr< Action > & action,
number t=0
)
Implements sdm::ValueFunction::updateValueAt
function updateValueAt [3/3]
void sdm::BaseTabularValueFunction::updateValueAt (
const std::shared_ptr< State > & state,
number t,
double target
)
Parameters:
state
the statet
the timesteptarget
the target
Protected Attributes Documentation
variable is_upper_bound_
bool sdm::BaseTabularValueFunction< Hash, KeyEqual >::is_upper_bound_;
variable representation
std::vector<Container> sdm::BaseTabularValueFunction< Hash, KeyEqual >::representation;
Friends Documentation
friend access
friend class sdm::BaseTabularValueFunction::access ()
friend operator<<
inline friend std::ostream & sdm::BaseTabularValueFunction::operator<< (
std::ostream & os,
BaseTabularValueFunction & vf
)
The documentation for this class was generated from the following file src/sdm/utils/value_function/tabular_value_function.hpp