Class sdm::BackwardInduction
Class List > sdm > BackwardInduction
The algorithm Backward Induction (opens new window) .
#include <backward_induction.hpp>
Inherits the following classes: sdm::Algorithm, std::enable_shared_from_this< BackwardInduction >
Public Functions
Type | Name |
---|---|
BackwardInduction (std::shared_ptr< SolvableByHSVI > & world, std::string name="backward induction") Construct the Backward Induction algorithm. | |
void | do_explore (const std::shared_ptr< State > & s, double, number h) Explore a state. |
virtual void | do_initialize () Initialize the algorithm. |
virtual void | do_save () Save the lower bound under "name_lb.bin". |
virtual void | do_solve () Solve a problem with backward induction algorithm. |
bool | do_stop (const std::shared_ptr< State > &, double, number) Check the end of HSVI algo. |
virtual void | do_test () Test the learnt value function on one episode. |
std::shared_ptr< ValueFunction > | getBound () const Get the bound value function. |
virtual double | getResult () |
virtual int | getTrial () |
std::shared_ptr< BackwardInduction > | getptr () |
void | saveResults (std::string filename, double other) |
Public Functions inherited from sdm::Algorithm
See sdm::Algorithm
Type | Name |
---|---|
virtual void | do_initialize () = 0 Initialize the algorithm. |
virtual void | do_save () = 0 Save the policy in a file. |
virtual void | do_solve () = 0 Solve the problem. |
virtual void | do_test () = 0 Test the result of the algorithm. |
virtual double | getResult () = 0 |
virtual int | getTrial () = 0 |
virtual | ~Algorithm () |
Protected Attributes
Type | Name |
---|---|
std::shared_ptr< TabularValueFunction > | bound_ representation. |
std::shared_ptr< MultiLogger > | logger_ Logger . |
std::string | name_ = = "backward_induction" Some variables for the algorithm. |
std::shared_ptr< State > | start_state |
std::shared_ptr< SolvableByHSVI > | world_ The problem to be solved. |
Public Functions Documentation
function BackwardInduction
sdm::BackwardInduction::BackwardInduction (
std::shared_ptr< SolvableByHSVI > & world,
std::string name="backward induction"
)
Parameters:
world
the problem to be solved by Backward inductionname
the name of the algorithm (this name is used to save logs)
function do_explore
void sdm::BackwardInduction::do_explore (
const std::shared_ptr< State > & s,
double,
number h
)
Parameters:
s
the state to exploreh
the timestep of the exploration
function do_initialize
virtual void sdm::BackwardInduction::do_initialize ()
Implements sdm::Algorithm::do_initialize
function do_save
virtual void sdm::BackwardInduction::do_save ()
Implements sdm::Algorithm::do_save
function do_solve
virtual void sdm::BackwardInduction::do_solve ()
Implements sdm::Algorithm::do_solve
function do_stop
bool sdm::BackwardInduction::do_stop (
const std::shared_ptr< State > &,
double,
number
)
Parameters:
s
the current stateh
the current timestep
Returns:
true if optimal is reached or number of trials is bigger than maximal number of trials
Returns:
false elsewhere
function do_test
virtual void sdm::BackwardInduction::do_test ()
Implements sdm::Algorithm::do_test
function getBound
std::shared_ptr< ValueFunction > sdm::BackwardInduction::getBound () const
function getResult
virtual double sdm::BackwardInduction::getResult ()
Implements sdm::Algorithm::getResult
function getTrial
inline virtual int sdm::BackwardInduction::getTrial ()
Implements sdm::Algorithm::getTrial
function getptr
std::shared_ptr< BackwardInduction > sdm::BackwardInduction::getptr ()
function saveResults
void sdm::BackwardInduction::saveResults (
std::string filename,
double other
)
Protected Attributes Documentation
variable bound_
std::shared_ptr<TabularValueFunction> sdm::BackwardInduction::bound_;
variable logger_
std::shared_ptr<MultiLogger> sdm::BackwardInduction::logger_;
variable name_
std::string sdm::BackwardInduction::name_;
variable start_state
std::shared_ptr<State> sdm::BackwardInduction::start_state;
variable world_
std::shared_ptr<SolvableByHSVI> sdm::BackwardInduction::world_;
The documentation for this class was generated from the following file src/sdm/algorithms/backward_induction.hpp