AI 24/25 Project Software
Documentation for the AI 24/25 course programming project software
Loading...
Searching...
No Matches
probfd::pdbs::ProbabilityAwarePatternDatabase Class Reference

#include "probfd/pdbs/probability_aware_pattern_database.h"

Description

Implementation of a probability-aware pattern database.

This class bundles two objects:

  • A state ranking function, which implements the abstraction mapping of the projection. The ranking function also includes the pattern of the projection.
  • A lookup table containing the optimal state values of all abstract states.

A PDB does not store information about the projection state space for which it was constructed. The state space should be pre-computed and stored seperately if it is needed.

Public Member Functions

 ProbabilityAwarePatternDatabase (ProbabilisticTaskProxy task_proxy, std::shared_ptr< FDRSimpleCostFunction > task_cost_function, Pattern pattern, const State &initial_state, bool operator_pruning=true, const StateRankEvaluator &heuristic=heuristics::BlindEvaluator< StateRank >(), double max_time=std::numeric_limits< double >::infinity())
 Construct a probability-aware pattern database for a given task and pattern.
 
 ProbabilityAwarePatternDatabase (ProjectionStateSpace &projection, StateRankingFunction ranking_function, StateRank initial_state, const StateRankEvaluator &heuristic=heuristics::BlindEvaluator< StateRank >(), double max_time=std::numeric_limits< double >::infinity())
 Construct the probability-aware pattern database for the given projection state space.
 
 ProbabilityAwarePatternDatabase (ProbabilisticTaskProxy task_proxy, std::shared_ptr< FDRSimpleCostFunction > task_cost_function, const ::pdbs::PatternDatabase &pdb, const State &initial_state, bool operator_pruning=true, double max_time=std::numeric_limits< double >::infinity())
 Construct a probability-aware pattern database for a given task from a determinization-based pattern database, used as a heuristic.
 
 ProbabilityAwarePatternDatabase (ProjectionStateSpace &projection, StateRankingFunction ranking_function, const ::pdbs::PatternDatabase &pdb, StateRank initial_state, double max_time=std::numeric_limits< double >::infinity())
 Construct the probability-aware pattern database for the given projection state space from a determinization-based pattern database, used as a heuristic.
 
 ProbabilityAwarePatternDatabase (ProbabilisticTaskProxy task_proxy, std::shared_ptr< FDRSimpleCostFunction > task_cost_function, const ProbabilityAwarePatternDatabase &pdb, int add_var, const State &initial_state, bool operator_pruning=true, double max_time=std::numeric_limits< double >::infinity())
 Construct a probability-aware pattern database for a given task, by extending a previous probability-aware pattern by one variable.
 
 ProbabilityAwarePatternDatabase (ProjectionStateSpace &state_space, StateRankingFunction ranking_function, const ProbabilityAwarePatternDatabase &pdb, int add_var, StateRank initial_state, double max_time=std::numeric_limits< double >::infinity())
 Construct a pattern database for the given projection state space and the pattern of a previous pattern database with one additional variable.
 
 ProbabilityAwarePatternDatabase (ProbabilisticTaskProxy task_proxy, std::shared_ptr< FDRSimpleCostFunction > task_cost_function, const ProbabilityAwarePatternDatabase &left, const ProbabilityAwarePatternDatabase &right, const State &initial_state, bool operator_pruning=true, double max_time=std::numeric_limits< double >::infinity())
 Construct a probability-aware pattern database for a given task and the union of the patterns of two probability-aware PDBs.
 
 ProbabilityAwarePatternDatabase (ProjectionStateSpace &state_space, StateRankingFunction ranking_function, const ProbabilityAwarePatternDatabase &left, const ProbabilityAwarePatternDatabase &right, StateRank initial_state, double max_time=std::numeric_limits< double >::infinity())
 Construct a probability-aware pattern database the given projection state space and the union of the patterns of two probability-aware PDBs.
 
const Pattern & get_pattern () const
 Get the pattern of the pattern database.
 
const StateRankingFunctionget_state_ranking_function () const
 Get the abstraction mapping of the pattern database.
 
const std::vector< value_t > & get_value_table () const
 Get the abstraction mapping of the pattern database.
 
unsigned int num_states () const
 Get the number of states in this PDB's projection.
 
StateRank get_abstract_state (const State &state) const
 Compute the state rank of the abstract state of an input state.
 
value_t lookup_estimate (const State &s) const
 Get the optimal state value of the abstract state corresponding to the input state.
 
value_t lookup_estimate (StateRank s) const
 Look up the estimate of an abstract state specified by state rank in the lookup table.
 

Constructor & Destructor Documentation

◆ ProbabilityAwarePatternDatabase() [1/8]

probfd::pdbs::ProbabilityAwarePatternDatabase::ProbabilityAwarePatternDatabase ( ProbabilisticTaskProxy task_proxy,
std::shared_ptr< FDRSimpleCostFunction > task_cost_function,
Pattern pattern,
const State & initial_state,
bool operator_pruning = true,
const StateRankEvaluator & heuristic = heuristics::BlindEvaluator< StateRank >(),
double max_time = std::numeric_limits< double >::infinity() )

Construct a probability-aware pattern database for a given task and pattern.

Parameters
task_proxyThe input task.
patternThe pattern inducing the projection.
initial_stateThe initial state. States unreachable from the initial state are treated as dead ends.
operator_pruningSpecifies whether operators with the same precondition, cost, effect and effect probabilities shall be pruned during construction of the projection.
heuristicAn admissible heuristic for the projection, used to accelerate the computation of the lookup table.
max_timeThe time limit for construction. If exceeded, a utils::TimeoutException will be thrown.
Exceptions
utils::TimeoutExceptionif the given max_time is exceeded.

◆ ProbabilityAwarePatternDatabase() [2/8]

probfd::pdbs::ProbabilityAwarePatternDatabase::ProbabilityAwarePatternDatabase ( ProjectionStateSpace & projection,
StateRankingFunction ranking_function,
StateRank initial_state,
const StateRankEvaluator & heuristic = heuristics::BlindEvaluator< StateRank >(),
double max_time = std::numeric_limits< double >::infinity() )

Construct the probability-aware pattern database for the given projection state space.

Parameters
projectionThe projection state space.
ranking_functionThe state ranking function for the projection.
initial_stateThe abstract initial state of the projection. States unreachable from the initial state are treated as dead ends.
heuristicAn admissible heuristic for the projection, used to accelerate the computation of the lookup table.
max_timeThe time limit for construction. If exceeded, a utils::TimeoutException will be thrown.
Exceptions
utils::TimeoutExceptionif the given max_time is exceeded.

◆ ProbabilityAwarePatternDatabase() [3/8]

probfd::pdbs::ProbabilityAwarePatternDatabase::ProbabilityAwarePatternDatabase ( ProbabilisticTaskProxy task_proxy,
std::shared_ptr< FDRSimpleCostFunction > task_cost_function,
const ::pdbs::PatternDatabase & pdb,
const State & initial_state,
bool operator_pruning = true,
double max_time = std::numeric_limits< double >::infinity() )

Construct a probability-aware pattern database for a given task from a determinization-based pattern database, used as a heuristic.

Parameters
task_proxyThe input task.
task_cost_functionThe task's cost function.
pdbThe determinization-based pattern database. This PDB must be constructed for the same pattern.
initial_stateThe initial state. States unreachable from the initial state are treated as dead ends.
operator_pruningSpecifies whether operators with the same precondition, cost, effect and effect probabilities shall be pruned during construction of the projection.
max_timeThe time limit for construction. If exceeded, a utils::TimeoutException will be thrown.
Exceptions
utils::TimeoutExceptionif the given max_time is exceeded.

◆ ProbabilityAwarePatternDatabase() [4/8]

probfd::pdbs::ProbabilityAwarePatternDatabase::ProbabilityAwarePatternDatabase ( ProjectionStateSpace & projection,
StateRankingFunction ranking_function,
const ::pdbs::PatternDatabase & pdb,
StateRank initial_state,
double max_time = std::numeric_limits< double >::infinity() )

Construct the probability-aware pattern database for the given projection state space from a determinization-based pattern database, used as a heuristic.

Parameters
projectionThe projection state space.
ranking_functionThe state ranking function for the projection.
initial_stateThe abstract initial state of the projection. States unreachable from the initial state are treated as dead ends.
pdbThe determinization-based pattern database. This PDB must be constructed for the same pattern.
max_timeThe time limit for construction. If exceeded, a utils::TimeoutException will be thrown.
Exceptions
utils::TimeoutExceptionif the given max_time is exceeded.

◆ ProbabilityAwarePatternDatabase() [5/8]

probfd::pdbs::ProbabilityAwarePatternDatabase::ProbabilityAwarePatternDatabase ( ProbabilisticTaskProxy task_proxy,
std::shared_ptr< FDRSimpleCostFunction > task_cost_function,
const ProbabilityAwarePatternDatabase & pdb,
int add_var,
const State & initial_state,
bool operator_pruning = true,
double max_time = std::numeric_limits< double >::infinity() )

Construct a probability-aware pattern database for a given task, by extending a previous probability-aware pattern by one variable.

This constructor makes use of the probability-aware PDB which it extends by using it as a heuristic to accelerate the lookup computation.

Parameters
task_proxyThe input task with respect to which the projection is constructed.
task_cost_functionThe task's cost function.
pdbA previous probability-aware pattern database.
add_varA task variable with with the previous PDB shall be extended.
initial_stateThe initial state for the exhaustive solver. States unreachable from this state are treated as dead ends.
operator_pruningWhether equivalent operators shall be pruned during construction of the projection.
max_timeThe time limit for contruction. If exceeded, a utils::TimeoutException will be thrown.
Exceptions
utils::TimeoutExceptionif the given max_time is exceeded.

◆ ProbabilityAwarePatternDatabase() [6/8]

probfd::pdbs::ProbabilityAwarePatternDatabase::ProbabilityAwarePatternDatabase ( ProjectionStateSpace & state_space,
StateRankingFunction ranking_function,
const ProbabilityAwarePatternDatabase & pdb,
int add_var,
StateRank initial_state,
double max_time = std::numeric_limits< double >::infinity() )

Construct a pattern database for the given projection state space and the pattern of a previous pattern database with one additional variable.

This constructor makes use of the supplied PDB by using its induced heuristic to accelerate the value table computation.

Parameters
state_spaceThe preconstructed state space of the projection.
ranking_functionThe preconstructed ranking function for the PDB.
initial_stateThe rank of the initial state for the exhaustive solver. States unreachable from this state are treated as dead ends.
pdbA previous probability-aware pattern database.
add_varA task variable with with the previous PDB shall be extended.
max_timeThe time limit for contruction. If exceeded, a utils::TimeoutException will be thrown.
Exceptions
utils::TimeoutExceptionif the given max_time is exceeded.

◆ ProbabilityAwarePatternDatabase() [7/8]

probfd::pdbs::ProbabilityAwarePatternDatabase::ProbabilityAwarePatternDatabase ( ProbabilisticTaskProxy task_proxy,
std::shared_ptr< FDRSimpleCostFunction > task_cost_function,
const ProbabilityAwarePatternDatabase & left,
const ProbabilityAwarePatternDatabase & right,
const State & initial_state,
bool operator_pruning = true,
double max_time = std::numeric_limits< double >::infinity() )

Construct a probability-aware pattern database for a given task and the union of the patterns of two probability-aware PDBs.

This constructor makes use of the supplied PDBs by using the maximum over their heuristics to accelerate the value table computation.

Parameters
task_proxyThe input task with respect to which the projection is constructed.
task_cost_functionThe task's cost function.
leftA previous probability-aware pattern database for the given task.
rightA previous probability-aware pattern database for the given task.
initial_stateThe initial state for the exhaustive solver. States unreachable from this state are treated as dead ends.
operator_pruningWhether equivalent operators shall be pruned during construction of the projection.
max_timeThe time limit for contruction. If exceeded, a utils::TimeoutException will be thrown.
Exceptions
utils::TimeoutExceptionif the given max_time is exceeded.

◆ ProbabilityAwarePatternDatabase() [8/8]

probfd::pdbs::ProbabilityAwarePatternDatabase::ProbabilityAwarePatternDatabase ( ProjectionStateSpace & state_space,
StateRankingFunction ranking_function,
const ProbabilityAwarePatternDatabase & left,
const ProbabilityAwarePatternDatabase & right,
StateRank initial_state,
double max_time = std::numeric_limits< double >::infinity() )

Construct a probability-aware pattern database the given projection state space and the union of the patterns of two probability-aware PDBs.

This constructor makes use of the supplied PDBs by using the maximum over their heuristics to accelerate the value table computation.

Parameters
state_spaceThe preconstructed state space of the projection.
ranking_functionThe preconstructed ranking function for the PDB.
initial_stateThe rank of the initial state for the exhaustive solver. States unreachable from this state are treated as dead ends.
leftA previous pattern database for the given task.
rightA previous pattern database for the given task.
max_timeThe time limit for contruction. If exceeded, a utils::TimeoutException will be thrown.
Exceptions
utils::TimeoutExceptionif the given max_time is exceeded.

Member Function Documentation

◆ get_pattern()

const Pattern & probfd::pdbs::ProbabilityAwarePatternDatabase::get_pattern ( ) const
nodiscard

Get the pattern of the pattern database.

◆ get_state_ranking_function()

const StateRankingFunction & probfd::pdbs::ProbabilityAwarePatternDatabase::get_state_ranking_function ( ) const
nodiscard

Get the abstraction mapping of the pattern database.

◆ get_value_table()

const std::vector< value_t > & probfd::pdbs::ProbabilityAwarePatternDatabase::get_value_table ( ) const
nodiscard

Get the abstraction mapping of the pattern database.

◆ num_states()

unsigned int probfd::pdbs::ProbabilityAwarePatternDatabase::num_states ( ) const
nodiscard

Get the number of states in this PDB's projection.

◆ get_abstract_state()

StateRank probfd::pdbs::ProbabilityAwarePatternDatabase::get_abstract_state ( const State & state) const
nodiscard

Compute the state rank of the abstract state of an input state.

◆ lookup_estimate() [1/2]

value_t probfd::pdbs::ProbabilityAwarePatternDatabase::lookup_estimate ( const State & s) const
nodiscard

Get the optimal state value of the abstract state corresponding to the input state.

◆ lookup_estimate() [2/2]

value_t probfd::pdbs::ProbabilityAwarePatternDatabase::lookup_estimate ( StateRank s) const
nodiscard

Look up the estimate of an abstract state specified by state rank in the lookup table.