AI 24/25 Project Software
Documentation for the AI 24/25 course programming project software
Loading...
Searching...
No Matches
state_ranking_function.h
1#ifndef PROBFD_PDBS_STATE_RANKING_FUNCTION_H
2#define PROBFD_PDBS_STATE_RANKING_FUNCTION_H
3
4#include "probfd/pdbs/assignment_enumerator.h"
5#include "probfd/pdbs/types.h"
6
7#include "downward/task_proxy.h"
8
9#include <span>
10#include <string>
11#include <vector>
12
13namespace probfd::pdbs {
14
25 Pattern pattern_;
26 AssignmentEnumerator enumerator_;
27
28public:
29 StateRankingFunction() = default;
30
35 StateRankingFunction(const VariablesProxy& variables, Pattern pattern);
36
40 [[nodiscard]]
41 unsigned int num_states() const;
42
46 [[nodiscard]]
47 unsigned int num_vars() const;
48
52 [[nodiscard]]
53 const Pattern& get_pattern() const;
54
58 [[nodiscard]]
59 const AssignmentEnumerator& get_enumerator() const;
60
66 [[nodiscard]]
67 long long int get_multiplier(int i) const;
68
72 [[nodiscard]]
73 int get_domain_size(int i) const;
74
85 [[nodiscard]]
86 StateRank get_abstract_rank(const State& state) const;
87
97 [[nodiscard]]
98 int rank_fact(int idx, int val) const;
99
115 [[nodiscard]]
116 std::vector<int> unrank(StateRank abstract_state) const;
117
128 [[nodiscard]]
129 int value_of(StateRank rank, int idx) const;
130
154 bool next_rank(StateRank& s, std::span<int> mutable_variables) const;
155};
156
157class StateRankToString {
158 const VariablesProxy variables_;
159 const StateRankingFunction& state_mapper_;
160
161public:
162 explicit StateRankToString(
163 VariablesProxy variables,
164 const StateRankingFunction& state_mapper);
165
166 std::string operator()(StateRank state) const;
167};
168
169} // namespace probfd::pdbs
170
171#endif // PROBFD_PDBS_STATE_RANKING_FUNCTION_H
Implements the state ranking function for abstract states of projections.
Definition state_ranking_function.h:24
unsigned int num_states() const
Get the number of abstract states.
int rank_fact(int idx, int val) const
Ranks a projection fact by multiplying the ranking coefficient of fact's variable with the fact's val...
StateRank get_abstract_rank(const State &state) const
Get the rank of the abstract state induced by a state.
StateRankingFunction(const VariablesProxy &variables, Pattern pattern)
Constructs the ranking function for a projection specified by a given pattern and the task's variable...
bool next_rank(StateRank &s, std::span< int > mutable_variables) const
Compute the next-highest rank that corresponds to the same abstract state modulo a given subset of pr...
long long int get_multiplier(int i) const
Get the ranking coefficient for variable of the projection.
std::vector< int > unrank(StateRank abstract_state) const
Unrank a given state rank and converts it into an explicit abstract state.
const Pattern & get_pattern() const
Get the pattern of the projection.
unsigned int num_vars() const
Get the number of variables considered by the projection.
int get_domain_size(int i) const
Get the domain size for a projection variable.
const AssignmentEnumerator & get_enumerator() const
Get the assignment enumerator for the projection's assignments.
int value_of(StateRank rank, int idx) const
Compute the value of a projection variable for the abstract state of a state rank.
Namespace dedicated to probabilistic pattern databases.
Definition gzocp_heuristic.h:16