MultiAgentDecisionProcess
|
OptimalValueDatabase provides values of optimal policies for problems, so to be used for verification purposes. More...
#include <OptimalValueDatabase.h>
Public Member Functions | |
std::string | GetEntryName () const |
Get the name of the current entry. More... | |
double | GetOptimalValue () const |
Get the optimal value (if known, otherwise expection is thrown). More... | |
bool | IsInDatabase () const |
Check if the particular (problem, discount, horizon) tuple is stored. More... | |
bool | IsOptimal (double value) const |
Check if the value is optimal. More... | |
OptimalValueDatabase (const PlanningUnitDecPOMDPDiscrete *pu) | |
(default) Constructor More... | |
OptimalValueDatabase (const std::string &problemName, double discount, size_t horizon) | |
void | SetOptimalValue (double value) |
Add an entry to the database. Saves it to disk. More... | |
std::string | SoftPrint () const |
A string representation of the database. More... | |
Private Types | |
typedef std::pair < nameDiscountT, size_t > | nameDiscountHorizonT |
typedef std::pair< std::string, double > | nameDiscountT |
Private Member Functions | |
void | AddEntry (const std::string &problemName, double discount, size_t horizon, double value) |
Add an entry to the database. More... | |
double | GetEntry (const std::string &problemName, double discount, size_t horizon) const |
Get an entry from the database. More... | |
bool | IsInDatabase (const std::string &problemName, double discount, size_t horizon) const |
Check if the problem is in the database already. More... | |
bool | IsOptimal (const std::string &problemName, double discount, size_t horizon, double value) const |
Check if the value corresponds with a known optimal value. More... | |
void | Load () |
Load the database from disk. More... | |
void | Save () const |
Store the database to disk. More... | |
Private Attributes | |
std::string | _filename |
double | _m_discount |
size_t | _m_horizon |
std::map< nameDiscountHorizonT, double > | _m_optimalValues |
The database. More... | |
std::string | _m_problemName |
OptimalValueDatabase provides values of optimal policies for problems, so to be used for verification purposes.
|
private |
|
private |
OptimalValueDatabase::OptimalValueDatabase | ( | const PlanningUnitDecPOMDPDiscrete * | pu | ) |
(default) Constructor
References Load().
OptimalValueDatabase::OptimalValueDatabase | ( | const std::string & | problemName, |
double | discount, | ||
size_t | horizon | ||
) |
References Load().
|
private |
Add an entry to the database.
References _m_optimalValues.
Referenced by Load(), and SetOptimalValue().
|
private |
Get an entry from the database.
References _m_optimalValues.
Referenced by GetOptimalValue(), and IsOptimal().
string OptimalValueDatabase::GetEntryName | ( | ) | const |
Get the name of the current entry.
References _m_discount, _m_horizon, and _m_problemName.
double OptimalValueDatabase::GetOptimalValue | ( | ) | const |
Get the optimal value (if known, otherwise expection is thrown).
References _m_discount, _m_horizon, _m_problemName, and GetEntry().
|
private |
Check if the problem is in the database already.
References _m_optimalValues.
bool OptimalValueDatabase::IsInDatabase | ( | ) | const |
Check if the particular (problem, discount, horizon) tuple is stored.
References _m_discount, _m_horizon, and _m_problemName.
|
private |
Check if the value corresponds with a known optimal value.
References Globals::EqualReward(), and GetEntry().
Referenced by IsOptimal().
bool OptimalValueDatabase::IsOptimal | ( | double | value | ) | const |
Check if the value is optimal.
References _m_discount, _m_horizon, _m_problemName, and IsOptimal().
|
private |
Load the database from disk.
References _filename, _m_optimalValues, AddEntry(), and directories::MADPGetResultsDir().
Referenced by OptimalValueDatabase().
|
private |
void OptimalValueDatabase::SetOptimalValue | ( | double | value | ) |
Add an entry to the database. Saves it to disk.
References _m_discount, _m_horizon, _m_problemName, AddEntry(), and Save().
string OptimalValueDatabase::SoftPrint | ( | void | ) | const |
|
private |
Referenced by GetEntryName(), GetOptimalValue(), IsInDatabase(), IsOptimal(), and SetOptimalValue().
|
private |
Referenced by GetEntryName(), GetOptimalValue(), IsInDatabase(), IsOptimal(), and SetOptimalValue().
|
private |
The database.
Referenced by AddEntry(), GetEntry(), IsInDatabase(), Load(), and SoftPrint().
|
private |
Referenced by GetEntryName(), GetOptimalValue(), IsInDatabase(), IsOptimal(), and SetOptimalValue().