1#ifndef HEURISTICS_HM_HEURISTIC_H
2#define HEURISTICS_HM_HEURISTIC_H
4#include "downward/heuristic.h"
12namespace hm_heuristic {
20class HMHeuristic :
public Heuristic {
21 using Tuple = std::vector<FactPair>;
24 const bool has_cond_effects;
29 std::map<Tuple, int> hm_table;
33 void init_hm_table(
const Tuple& t);
34 void update_hm_table();
35 int eval(
const Tuple& t)
const;
36 int update_hm_entry(
const Tuple& t,
int val);
37 void extend_tuple(
const Tuple& t,
const OperatorProxy& op);
39 int check_tuple_in_tuple(
const Tuple& tuple,
const Tuple& big_tuple)
const;
41 int get_operator_pre_value(
const OperatorProxy& op,
int var)
const;
42 Tuple get_operator_pre(
const OperatorProxy& op)
const;
43 Tuple get_operator_eff(
const OperatorProxy& op)
const;
44 bool contradict_effect_of(
const OperatorProxy& op,
int var,
int val)
const;
46 void generate_all_tuples();
47 void generate_all_tuples_aux(
int var,
int sz,
const Tuple& base);
49 void generate_all_partial_tuples(
50 const Tuple& base_tuple,
51 std::vector<Tuple>& res)
const;
52 void generate_all_partial_tuples_aux(
53 const Tuple& base_tuple,
57 std::vector<Tuple>& res)
const;
59 void dump_table()
const;
62 virtual int compute_heuristic(
const State& ancestor_state)
override;
67 const std::shared_ptr<AbstractTask>& transform,
69 const std::string& description,
70 utils::Verbosity verbosity);
72 virtual bool dead_ends_are_reliable()
const override;