Class sdm::AlphaStar
Class List > sdm > AlphaStar
The class for the algorithm A* (opens new window) .
#include <alpha_star.hpp>
Inherits the following classes: sdm::Algorithm, std::enable_shared_from_this< AlphaStar >
Public Static Attributes
| Type | Name | 
|---|---|
| double | TIME_TO_REMOVE  | 
Public Functions
| Type | Name | 
|---|---|
| AlphaStar (std::shared_ptr< SolvableByHSVI > & world, std::string name="A*")  Construct the AlphaStar algorithm with custom paramters.  | |
| 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 A* 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< AlphaStar > | getptr ()  | 
| void | initLogger ()  | 
| void | saveResults (std::string filename, double other)  | 
| void | updateTime (std::chrono::high_resolution_clock::time_point start_time, std::string information)  | 
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 ()  | 
Public Static Functions
| Type | Name | 
|---|---|
| bool | compare (const std::shared_ptr< AlphaStarItem > & item_1, const std::shared_ptr< AlphaStarItem > & item_2)  Compare two A* items.  | 
Protected Attributes
| Type | Name | 
|---|---|
| std::vector< std::shared_ptr< AlphaStarItem > > | FSet  | 
| std::shared_ptr< TabularValueFunction > | bound_  The representation.  | 
| std::chrono::high_resolution_clock::time_point | current_time  | 
| double | duration  | 
| std::shared_ptr< MultiLogger > | logger_  The logger.  | 
| std::vector< std::unordered_map< std::shared_ptr< State >, std::shared_ptr< AlphaStarItem > > > | map_element_to_alpha_item  | 
| std::string | name_   = = "backward_induction" | 
| std::vector< std::shared_ptr< AlphaStarItem > > | openSet  | 
| number | planning_horizon_  Some hyperparameters for the algorithm.  | 
| std::shared_ptr< State > | start_state  | 
| std::chrono::high_resolution_clock::time_point | start_time  | 
| std::shared_ptr< SolvableByHSVI > | world_  The problem to be solved.  | 
Public Static Attributes Documentation
variable TIME_TO_REMOVE
double sdm::AlphaStar::TIME_TO_REMOVE;
Public Functions Documentation
function AlphaStar
sdm::AlphaStar::AlphaStar (
    std::shared_ptr< SolvableByHSVI > & world,
    std::string name="A*"
) 
Parameters:
worldthe problem to be solved by A*namethe name of the algorithm (this name is used to save logs)
function do_explore
void sdm::AlphaStar::do_explore (
    const std::shared_ptr< State > & s,
    double,
    number h
) 
Parameters:
sthe state to explorehthe timestep of the exploration
function do_initialize
virtual void sdm::AlphaStar::do_initialize () 
Implements sdm::Algorithm::do_initialize
function do_save
virtual void sdm::AlphaStar::do_save () 
Implements sdm::Algorithm::do_save
function do_solve
virtual void sdm::AlphaStar::do_solve () 
Implements sdm::Algorithm::do_solve
function do_stop
bool sdm::AlphaStar::do_stop (
    const std::shared_ptr< State > &,
    double,
    number
) 
Parameters:
sthe current statehthe 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::AlphaStar::do_test () 
Implements sdm::Algorithm::do_test
function getBound
std::shared_ptr< ValueFunction > sdm::AlphaStar::getBound () const
function getResult
virtual double sdm::AlphaStar::getResult () 
Implements sdm::Algorithm::getResult
function getTrial
inline virtual int sdm::AlphaStar::getTrial () 
Implements sdm::Algorithm::getTrial
function getptr
std::shared_ptr< AlphaStar > sdm::AlphaStar::getptr () 
function initLogger
void sdm::AlphaStar::initLogger () 
function saveResults
void sdm::AlphaStar::saveResults (
    std::string filename,
    double other
) 
function updateTime
void sdm::AlphaStar::updateTime (
    std::chrono::high_resolution_clock::time_point start_time,
    std::string information
) 
Public Static Functions Documentation
function compare
static inline bool sdm::AlphaStar::compare (
    const std::shared_ptr< AlphaStarItem > & item_1,
    const std::shared_ptr< AlphaStarItem > & item_2
) 
Parameters:
item_1the first itemitem_2the second item
Protected Attributes Documentation
variable FSet
std::vector<std::shared_ptr<AlphaStarItem> > sdm::AlphaStar::FSet;
variable bound_
std::shared_ptr<TabularValueFunction> sdm::AlphaStar::bound_;
variable current_time
std::chrono::high_resolution_clock::time_point sdm::AlphaStar::current_time;
variable duration
double sdm::AlphaStar::duration;
variable logger_
std::shared_ptr<MultiLogger> sdm::AlphaStar::logger_;
variable map_element_to_alpha_item
std::vector<std::unordered_map<std::shared_ptr<State>,std::shared_ptr<AlphaStarItem> > > sdm::AlphaStar::map_element_to_alpha_item;
variable name_
std::string sdm::AlphaStar::name_;
variable openSet
std::vector<std::shared_ptr<AlphaStarItem> > sdm::AlphaStar::openSet;
variable planning_horizon_
number sdm::AlphaStar::planning_horizon_;
variable start_state
std::shared_ptr<State> sdm::AlphaStar::start_state;
variable start_time
std::chrono::high_resolution_clock::time_point sdm::AlphaStar::start_time;
variable world_
std::shared_ptr<SolvableByHSVI> sdm::AlphaStar::world_;
The documentation for this class was generated from the following file src/sdm/algorithms/alpha_star.hpp