Class sdm::HSVI

Class List > sdm > HSVI

Heuristic Search Value Iteration (HSVI) (opens new window) and its extensions (FB-HSVI, one-sidedHSVI ).

  • #include <hsvi.hpp>

Inherits the following classes: sdm::Algorithm, std::enable_shared_from_this< HSVI >

Public Attributes

Type Name
std::shared_ptr< MultiLogger > logger_
Logger .
std::shared_ptr< MultiLogger > logger_precise_

Public Static Attributes

Type Name
double TIME_BEST_ACTION_LB
double TIME_BEST_ACTION_UB
double TIME_EVALUATE_LB
double TIME_EVALUATE_UB
double TIME_GET_VALUE_AT_LB
double TIME_GET_VALUE_AT_UB
double TIME_INITIALIZATION
double TIME_IN_DO_EXCESS
double TIME_IN_PRUNING_LB
double TIME_IN_PRUNING_UB
double TIME_IN_SELECT_ACTION
double TIME_IN_SELECT_STATE
double TIME_IN_UPDATE_LB
double TIME_IN_UPDATE_UB
double TIME_TO_REMOVE
double TIME_UPDATE_BACKUP_LB
double TIME_UPDATE_BACKUP_UB
double TOTAL_TIME_LB
double TOTAL_TIME_UB

Public Functions

Type Name
HSVI (std::shared_ptr< SolvableByHSVI > & world, std::shared_ptr< ValueFunction > lower_bound, std::shared_ptr< ValueFunction > upper_bound, number planning_horizon, double epsilon, number num_max_trials=10000, std::string name="hsvi", number lb_update_frequency=1, number ub_update_frequency=1, double time_max=1000, bool keep_same_action_forward_backward=false)
Construct the HSVI algorithm.
double do_excess (const std::shared_ptr< State > &, double, number)
Computes the error between bounds (or excess).
void do_explore (const std::shared_ptr< State > & s, double, number h)
Explore a state.
virtual void do_initialize ()
Initialize the algorithm. It will initialize the lower bound and the upper bound.
virtual void do_save ()
Save the lower bound under "name_lb.bin".
virtual void do_solve ()
Solve a problem that is solvable by HSVI .
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 > getLowerBound () const
Get the lower bound value function.
virtual double getResult ()
virtual int getTrial ()
std::shared_ptr< ValueFunction > getUpperBound () const
Get the upper bound value function.
std::shared_ptr< HSVI > getptr ()
void initLogger ()
Initialize the logger.
void saveResults (std::string filename, double other)
void updateTime (std::chrono::high_resolution_clock::time_point start_time, std::string information)
Update the function associate with the time.

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
void cleanTIME ()
Clean all the data Time.

Protected Attributes

Type Name
int MAX_TRIALS
std::chrono::high_resolution_clock::time_point current_time
double duration
double error_
bool keep_same_action_forward_backward_
number lb_update_frequency_
std::shared_ptr< ValueFunction > lower_bound_
Lower Bound representation.
std::string name_ = = "hsvi"
number planning_horizon_
std::shared_ptr< State > start_state
std::chrono::high_resolution_clock::time_point start_time
double time_max_
int trial
Some variables for the algorithm.
number ub_update_frequency_
std::shared_ptr< ValueFunction > upper_bound_
Upper Bound representation.
std::shared_ptr< SolvableByHSVI > world_
The problem to be solved.

Public Attributes Documentation

variable logger_

std::shared_ptr<MultiLogger> sdm::HSVI::logger_;

variable logger_precise_

std::shared_ptr<MultiLogger> sdm::HSVI::logger_precise_;

Public Static Attributes Documentation

variable TIME_BEST_ACTION_LB

double sdm::HSVI::TIME_BEST_ACTION_LB;

variable TIME_BEST_ACTION_UB

double sdm::HSVI::TIME_BEST_ACTION_UB;

variable TIME_EVALUATE_LB

double sdm::HSVI::TIME_EVALUATE_LB;

variable TIME_EVALUATE_UB

double sdm::HSVI::TIME_EVALUATE_UB;

variable TIME_GET_VALUE_AT_LB

double sdm::HSVI::TIME_GET_VALUE_AT_LB;

variable TIME_GET_VALUE_AT_UB

double sdm::HSVI::TIME_GET_VALUE_AT_UB;

variable TIME_INITIALIZATION

double sdm::HSVI::TIME_INITIALIZATION;

variable TIME_IN_DO_EXCESS

double sdm::HSVI::TIME_IN_DO_EXCESS;

variable TIME_IN_PRUNING_LB

double sdm::HSVI::TIME_IN_PRUNING_LB;

variable TIME_IN_PRUNING_UB

double sdm::HSVI::TIME_IN_PRUNING_UB;

variable TIME_IN_SELECT_ACTION

double sdm::HSVI::TIME_IN_SELECT_ACTION;

variable TIME_IN_SELECT_STATE

double sdm::HSVI::TIME_IN_SELECT_STATE;

variable TIME_IN_UPDATE_LB

double sdm::HSVI::TIME_IN_UPDATE_LB;

variable TIME_IN_UPDATE_UB

double sdm::HSVI::TIME_IN_UPDATE_UB;

variable TIME_TO_REMOVE

double sdm::HSVI::TIME_TO_REMOVE;

variable TIME_UPDATE_BACKUP_LB

double sdm::HSVI::TIME_UPDATE_BACKUP_LB;

variable TIME_UPDATE_BACKUP_UB

double sdm::HSVI::TIME_UPDATE_BACKUP_UB;

variable TOTAL_TIME_LB

double sdm::HSVI::TOTAL_TIME_LB;

variable TOTAL_TIME_UB

double sdm::HSVI::TOTAL_TIME_UB;

Public Functions Documentation

function HSVI

sdm::HSVI::HSVI (
    std::shared_ptr< SolvableByHSVI > & world,
    std::shared_ptr< ValueFunction > lower_bound,
    std::shared_ptr< ValueFunction > upper_bound,
    number planning_horizon,
    double epsilon,
    number num_max_trials=10000,
    std::string name="hsvi",
    number lb_update_frequency=1,
    number ub_update_frequency=1,
    double time_max=1000,
    bool keep_same_action_forward_backward=false
) 

Parameters:

  • world the problem to be solved by HSVI
  • lower_bound the lower bound
  • upper_bound the upperbound
  • planning_horizon the planning horizon
  • epsilon the error
  • num_max_trials the maximum number of trials before stop
  • name the name of the algorithm (this name is used to save logs)

function do_excess

double sdm::HSVI::do_excess (
    const std::shared_ptr< State > &,
    double,
    number
) 

Parameters:

  • const std::shared_ptr<State> & : the state
  • double cost so far
  • number the timestep

Returns:

the error

function do_explore

void sdm::HSVI::do_explore (
    const std::shared_ptr< State > & s,
    double,
    number h
) 

Parameters:

  • s the state to explore
  • h the timestep of the exploration

function do_initialize

virtual void sdm::HSVI::do_initialize () 

Implements sdm::Algorithm::do_initialize

function do_save

virtual void sdm::HSVI::do_save () 

Implements sdm::Algorithm::do_save

function do_solve

virtual void sdm::HSVI::do_solve () 

Implements sdm::Algorithm::do_solve

function do_stop

bool sdm::HSVI::do_stop (
    const std::shared_ptr< State > &,
    double,
    number
) 

Parameters:

  • s the current state
  • h 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::HSVI::do_test () 

Implements sdm::Algorithm::do_test

function getLowerBound

std::shared_ptr< ValueFunction > sdm::HSVI::getLowerBound () const

function getResult

virtual double sdm::HSVI::getResult () 

Implements sdm::Algorithm::getResult

function getTrial

virtual int sdm::HSVI::getTrial () 

Implements sdm::Algorithm::getTrial

function getUpperBound

std::shared_ptr< ValueFunction > sdm::HSVI::getUpperBound () const

function getptr

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

function initLogger

void sdm::HSVI::initLogger () 

function saveResults

void sdm::HSVI::saveResults (
    std::string filename,
    double other
) 

function updateTime

void sdm::HSVI::updateTime (
    std::chrono::high_resolution_clock::time_point start_time,
    std::string information
) 

Parameters:

  • start_time
  • information

Public Static Functions Documentation

function cleanTIME

static void sdm::HSVI::cleanTIME () 

Protected Attributes Documentation

variable MAX_TRIALS

int sdm::HSVI::MAX_TRIALS;

variable current_time

std::chrono::high_resolution_clock::time_point sdm::HSVI::current_time;

variable duration

double sdm::HSVI::duration;

variable error_

double sdm::HSVI::error_;

variable keep_same_action_forward_backward_

bool sdm::HSVI::keep_same_action_forward_backward_;

variable lb_update_frequency_

number sdm::HSVI::lb_update_frequency_;

variable lower_bound_

std::shared_ptr<ValueFunction> sdm::HSVI::lower_bound_;

variable name_

std::string sdm::HSVI::name_;

variable planning_horizon_

number sdm::HSVI::planning_horizon_;

variable start_state

std::shared_ptr<State> sdm::HSVI::start_state;

variable start_time

std::chrono::high_resolution_clock::time_point sdm::HSVI::start_time;

variable time_max_

double sdm::HSVI::time_max_;

variable trial

int sdm::HSVI::trial;

variable ub_update_frequency_

number sdm::HSVI::ub_update_frequency_;

variable upper_bound_

std::shared_ptr<ValueFunction> sdm::HSVI::upper_bound_;

variable world_

std::shared_ptr<SolvableByHSVI> sdm::HSVI::world_;

The documentation for this class was generated from the following file src/sdm/algorithms/hsvi.hpp