Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[issue1082] Use Options objects only in Features #218

Merged
merged 238 commits into from
Jul 5, 2024
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
238 commits
Select commit Hold shift + click to select a range
c37b2c3
Move unpacking of opts to BlindSearchHeuristicFeature.
SimonDold Nov 8, 2023
681c3e1
Florians feedback
SimonDold Nov 16, 2023
8db40f2
add malte discussion comment
SimonDold Nov 16, 2023
d2403f9
remove destructor.
SimonDold Nov 20, 2023
3eca358
add name parameter to evaluator
FlorianPommerening Nov 22, 2023
829df0a
Move unpacking of opts to BlindSearchHeuristicFeature.
SimonDold Nov 8, 2023
a92b5b4
Florians feedback
SimonDold Nov 16, 2023
696a2d9
add malte discussion comment
SimonDold Nov 16, 2023
5428d7f
remove destructor.
SimonDold Nov 20, 2023
dac2226
Move unpacking of opts to BlindSearchHeuristicFeature.
SimonDold Nov 8, 2023
f6a4256
Florians feedback
SimonDold Nov 16, 2023
e8c9874
remove destructor.
SimonDold Nov 20, 2023
a72fffd
add name parameter to evaluator
FlorianPommerening Nov 22, 2023
3fc0abc
[issue1082] intern parameter order
SimonDold Feb 1, 2024
0e160d5
[issue1082] style
SimonDold Feb 1, 2024
1e315dd
[issue1082] fix rebase
SimonDold Feb 1, 2024
770cc27
Merge remote-tracking branch 'MyFork/issue1082' into issue1082
SimonDold Feb 1, 2024
f03ba76
[issue1082] restore destructors
SimonDold Feb 1, 2024
af6f95a
[issue1082] Jendriks requested changes
SimonDold Feb 1, 2024
4f671ae
[issue1082] make transform const
SimonDold Feb 1, 2024
1170b1e
[issue1082] add default name, adjust wiki order
SimonDold Feb 1, 2024
d688a65
[issue1082] style
SimonDold Feb 1, 2024
a6ca706
[issue1082] move 'name' to log_options
SimonDold Feb 2, 2024
34e63ba
[issue1082] comments
SimonDold Feb 2, 2024
87f0f8b
[issue1082] style
SimonDold Feb 2, 2024
50cf916
[issue1082] comment
SimonDold Feb 2, 2024
edc1fdd
[issue1082] update merge_strategy_factory_precomputed
SimonDold Feb 2, 2024
218c31a
[issue1082] update merge_strategy_factory_sccs
SimonDold Feb 2, 2024
6047e02
[issue1082] style
SimonDold Feb 2, 2024
853ddd9
[issue1082] update constructor of merge_strategy_factory_stateless
SimonDold Feb 2, 2024
8ee8739
[issue1082] remove ByOptions-constructor
SimonDold Feb 2, 2024
587dfb1
[issue1082] style
SimonDold Feb 2, 2024
5b8728b
Merge pull request #3 from SimonDold/issue1082-MergeStrategy
SimonDold Feb 2, 2024
1db6f50
[issue1082] update merge_tree_factory_linear
SimonDold Feb 2, 2024
acf0b1c
[issue1082] update merge_tree_factory_linear (#4)
SimonDold Feb 2, 2024
7e27747
[issue1082] update label_reduction
SimonDold Feb 2, 2024
e55e395
[issue1082] handle warning
SimonDold Feb 2, 2024
8543ab0
[issue1082] remove const
SimonDold Feb 2, 2024
d5ead08
Merge remote-tracking branch 'MyFork/issue1082' into issue1082
SimonDold Feb 2, 2024
b49e3ae
change constructors in pdb code
FlorianPommerening Feb 2, 2024
c6733b7
[issue1082] handle warnings
SimonDold Feb 3, 2024
8347a5a
[issue1082] handle warnings
SimonDold Feb 3, 2024
b99ceef
Merge remote-tracking branch 'MyFork/issue1082' into issue1082
SimonDold Feb 3, 2024
4954365
[issue1082] style
SimonDold Feb 3, 2024
0b0d16d
[issue1082] add get_parameters_from_options functions
SimonDold Feb 5, 2024
93973cf
[issue1082] flatten HMHeuristic
SimonDold Feb 5, 2024
9cd7e6d
[issue1082] fix compiler complaints.
SimonDold Feb 5, 2024
e559495
[issue1082] style.
SimonDold Feb 5, 2024
7551e69
[issue1082] remove names or replace name with description.
SimonDold Feb 5, 2024
d0b73b1
[issue1082] restore name() and remove introduced log.
SimonDold Feb 6, 2024
ee1e5c0
[issue1082] replace name with description.
SimonDold Feb 6, 2024
9887d7c
[issue1082] use smart_pointers to tuples.
SimonDold Feb 6, 2024
4b865dd
[issue1082] reduce boiler plate.
SimonDold Feb 6, 2024
1b0ef71
[issue1082] update linear().
SimonDold Feb 7, 2024
3c32e69
[issue1082] update MergeScoringFunctions.
SimonDold Feb 7, 2024
e2893b7
[issue1082] add coordination file
SimonDold Feb 7, 2024
453e658
[issue1082] update RelaxationHeuristics.
SimonDold Feb 7, 2024
015fe60
style
SimonDold Feb 7, 2024
72b0915
[issue1082] update pdbs.
SimonDold Feb 7, 2024
a956c83
[issue1082] add more indirection to RelaxationHeuristics to mathc the…
SimonDold Feb 7, 2024
9fe28ad
[issue1082] style.
SimonDold Feb 7, 2024
2e08173
Update BlindSearchHeuristic
grucla Feb 7, 2024
97246e8
Update ContextEnhancedAdditiveHeuristic
grucla Feb 7, 2024
adf5127
[issue1082] Update CGHeuristic
grucla Feb 7, 2024
4153073
Fix style.
grucla Feb 7, 2024
e023dea
[issue1082] BREAKING update many M&S components.
SimonDold Feb 7, 2024
ce38266
[issue1082] Update GoalCountHeuristic
grucla Feb 7, 2024
681209e
[halfmas] comment.
SimonDold Feb 7, 2024
4c2bdb1
Merge branch 'issue1082-MaS' into issue1082-partial-Mas
SimonDold Feb 7, 2024
0f703df
Remove explicity from GoalCountHeuristic constructor
grucla Feb 7, 2024
3172488
[issue1082] Update LandmarkCutHeuristic
grucla Feb 7, 2024
2125076
mark files that do not require changes
FlorianPommerening Feb 7, 2024
2b7bf6c
[issue1082] update M&S components.
SimonDold Feb 7, 2024
9c53523
Merge remote-tracking branch 'MyFork/issue1082' into issue1082
SimonDold Feb 7, 2024
b2ef706
[issue1082] fix merge.
SimonDold Feb 7, 2024
0503015
new approach for argument tuples
FlorianPommerening Feb 7, 2024
5e74d90
use flattened arguments in make_shared_from_arg_tuples
FlorianPommerening Feb 8, 2024
5158467
[issue1082] update mechanical changes
SimonDold Feb 8, 2024
1ea373a
Issue1082 with fixed order in make_shared (#5)
FlorianPommerening Feb 8, 2024
1ef655b
Update AAA_Mechanical_Changes.md
SimonDold Feb 8, 2024
669444c
Add landmark files to TODO list.
ClemensBuechner Feb 7, 2024
cb86f12
Implement flat constructors for landmark factories.
ClemensBuechner Feb 7, 2024
1fd6ab2
Fix order.
ClemensBuechner Feb 8, 2024
36dc0f2
Update to new model.
ClemensBuechner Feb 8, 2024
bd63331
Remove all options from constructors in landmark directory.
ClemensBuechner Feb 8, 2024
f014045
Add comments and make option-related functions external.
ClemensBuechner Feb 8, 2024
d90e3d8
Fix typo.
ClemensBuechner Feb 8, 2024
74d1f98
[issue1082] update rng_options, add get_xyz_arguments_from_options.
SimonDold Feb 8, 2024
39f7407
Merge branch 'issue1082FP' into issue1082
SimonDold Feb 8, 2024
ae4f482
[issue1082] fix argument order.
SimonDold Feb 8, 2024
52c9451
[issue1082] style.
SimonDold Feb 8, 2024
3244f79
style.
SimonDold Feb 8, 2024
ff1c0ce
style.
SimonDold Feb 8, 2024
d2fae48
Merge branch 'issue1082CleBue' into issue1082
SimonDold Feb 8, 2024
c4e15fd
[issue1082] minimize the use of Options in lm_heuristics.
SimonDold Feb 8, 2024
fa28521
[issue1082] remove unused field.
SimonDold Feb 8, 2024
1b2acb9
[issue1082] move add_heuristic_options_to_feature outside of class.
SimonDold Feb 8, 2024
7aa2c45
smaller implementation of tuple flattening
FlorianPommerening Feb 8, 2024
0452fb9
small fixes
FlorianPommerening Feb 8, 2024
bd5addc
[issue1082] move add_xyz_options_to_feature outside of class.
SimonDold Feb 8, 2024
ea73ee6
update operator-counting
FlorianPommerening Feb 8, 2024
4f13d8a
update pruning
FlorianPommerening Feb 8, 2024
9884598
update tasks
FlorianPommerening Feb 8, 2024
7fe1b62
mark changes
FlorianPommerening Feb 8, 2024
d3c6336
update cegar heuristic
FlorianPommerening Feb 9, 2024
3e11f79
[issue1082] update SearchAlgorithms.
SimonDold Feb 9, 2024
4c499c0
[issue1082] style.
SimonDold Feb 9, 2024
67ac356
Merge remote-tracking branch 'MyFork/issue1082' into issue1082
SimonDold Feb 9, 2024
720f058
[issue1082] style.
SimonDold Feb 9, 2024
d77141f
[issue1082] reduce use of auto.
SimonDold Feb 9, 2024
01da84a
update cegar generators
FlorianPommerening Feb 9, 2024
b140624
mark changes
FlorianPommerening Feb 9, 2024
4dcee46
[issue1082] update done list .
SimonDold Feb 9, 2024
87b6fb5
[issue1082] style.
SimonDold Feb 9, 2024
d9b984d
[issue1082] fix merge.
SimonDold Feb 9, 2024
fc94d78
[issue1082] update done file.
SimonDold Feb 9, 2024
d73e301
[issue1082] style.
SimonDold Feb 9, 2024
9b6f0d8
[issue1082] OpenList (in progress)
SimonDold Feb 9, 2024
ce85f32
[issue1082] reduce tox complaints.
SimonDold Feb 9, 2024
dae511e
[issue1082] in progress.
SimonDold Feb 9, 2024
03cde6e
Merge branch 'issue1082OpenList' into issue1082
SimonDold Feb 9, 2024
d065ca0
[issue1082] in progress.
SimonDold Feb 11, 2024
3f4d729
update best_first
SimonDold Feb 11, 2024
62b19df
update alternation_open_list.
SimonDold Feb 11, 2024
04995d6
update pareto_open_list.
SimonDold Feb 11, 2024
e4caa43
update tiebreaking_open_list.
SimonDold Feb 11, 2024
d42fb1a
update type_based_open_list.
SimonDold Feb 11, 2024
26459cd
update epsilon_greedy_open_list.
SimonDold Feb 11, 2024
57b2106
remove options include.
SimonDold Feb 11, 2024
a2dc81f
change constructor call to match pattern.
SimonDold Feb 11, 2024
ab042d3
style
SimonDold Feb 11, 2024
309ccc5
style
SimonDold Feb 11, 2024
1dd1747
style
SimonDold Feb 11, 2024
846ee62
reduce use of options object in search common
SimonDold Feb 11, 2024
96edee9
reduce use of options object in search common
SimonDold Feb 11, 2024
6ce4aee
removeoptions object in search common header
SimonDold Feb 11, 2024
25c3203
remove options object from open list factories
SimonDold Feb 11, 2024
433d5a6
style
SimonDold Feb 11, 2024
b8d7399
polish
SimonDold Feb 11, 2024
02b471c
polish
SimonDold Feb 11, 2024
7cea103
merge update OpenLists
SimonDold Feb 11, 2024
e2d1689
reduce copies.
SimonDold Feb 12, 2024
ebcf047
issue1082 evaluators
tanjaschindler Feb 12, 2024
1e49199
[issue1082] update done file.
tanjaschindler Feb 12, 2024
c72419e
Merge remote-tracking branch 'MyFork/issue1082' into issue1082
SimonDold Feb 15, 2024
1ff99aa
style
SimonDold Feb 15, 2024
1ce8c7a
remove ByOpts-Constructors, reduce copies.
SimonDold Feb 15, 2024
1845863
update potentials
SimonDold Feb 16, 2024
8b8247a
style
SimonDold Feb 16, 2024
9e9a1cc
[issue1082] remove unused ByOpts methods
tanjaschindler Feb 16, 2024
77586ee
style
tanjaschindler Feb 16, 2024
957a6d4
[issue1082] triage TODOs
tanjaschindler Feb 16, 2024
95d3579
add automated check (not working yet)
SimonDold Mar 1, 2024
407d2e0
add automated check for constructor parameter order
SimonDold Mar 3, 2024
1462992
remove unused function
SimonDold Mar 3, 2024
3866efc
fix recognition for multiple features in one .cc
SimonDold Mar 3, 2024
89b3ba3
Merge remote-tracking branch 'MyFork/issue1082' into issue1082
SimonDold Mar 3, 2024
8cffea8
make code cleaner
SimonDold Mar 3, 2024
073209a
adjust constructor parameters to fit CLI parameters
SimonDold Mar 3, 2024
a9b1368
remove never changing parameters.
SimonDold Mar 4, 2024
f78cd78
rename 'name' to description.
SimonDold Mar 4, 2024
f6b0149
add exceptions.
SimonDold Mar 4, 2024
314e4e0
fix order
SimonDold Mar 4, 2024
eb9eff6
match parameter names.
SimonDold Mar 4, 2024
4e99bb6
add exceptions.
SimonDold Mar 4, 2024
503d5db
remove options object from LandmarHeuristic.
SimonDold Mar 6, 2024
4e13d05
deactivate parameter_check
SimonDold Mar 7, 2024
863df3d
fix feature_parameter extraction
SimonDold Mar 12, 2024
6eea000
fix typo
SimonDold Mar 12, 2024
dc60080
fix typo
SimonDold Mar 12, 2024
31b323b
Revert "fix typo"
SimonDold Mar 12, 2024
d2a4882
style
SimonDold Mar 12, 2024
e162e78
change parameter_names in constructor to match feature
SimonDold Mar 12, 2024
6313754
add pwd output
SimonDold Mar 13, 2024
d1ff2b3
Revert "add pwd output"
SimonDold Mar 13, 2024
e336ea1
add pwd output
SimonDold Mar 13, 2024
fb522c2
add tree output
SimonDold Mar 13, 2024
574de7f
update tree
SimonDold Mar 13, 2024
4da75db
update tree
SimonDold Mar 13, 2024
7371d9a
add separate parameters check
SimonDold Mar 14, 2024
f22623d
typo
SimonDold Mar 14, 2024
45a7daa
style
SimonDold Mar 14, 2024
c42d9b3
fix comment
SimonDold Apr 5, 2024
7fdf881
triage todo
SimonDold Apr 5, 2024
35a2867
add comment
SimonDold Apr 5, 2024
b697025
Merge branch 'aibasel:main' into issue1082
SimonDold Apr 5, 2024
8639708
put parameter in few lines
SimonDold Apr 8, 2024
45488a6
tox fix style
SimonDold Apr 8, 2024
f05376d
style
SimonDold Apr 10, 2024
55c2c9e
style
SimonDold Apr 10, 2024
cf3262f
reduce line length
SimonDold Apr 11, 2024
427c1a7
remove issue 1082 comments
SimonDold Apr 11, 2024
5f7c9d1
use perfect forwarding
SimonDold Apr 12, 2024
b12fd9d
style
SimonDold Apr 12, 2024
bde514e
style
SimonDold Apr 12, 2024
e8f5ec8
delete accidental commited files
SimonDold Apr 13, 2024
c013093
delete accidental commited files
SimonDold Apr 13, 2024
ca33ae0
accept position of make_shared_from_arg_tuples
SimonDold Apr 13, 2024
94a0f91
add tree output
SimonDold Apr 13, 2024
8db5b2a
add output
SimonDold Apr 13, 2024
bf80ae7
add tree output
SimonDold Apr 13, 2024
0d11710
reduce output
SimonDold Apr 13, 2024
a5dd482
add output
SimonDold Apr 13, 2024
faafea1
add output
SimonDold Apr 13, 2024
74ca884
add trailing slash
SimonDold Apr 13, 2024
3c942d4
replace tree with ls
SimonDold Apr 13, 2024
a97fc33
add pwd output
SimonDold Apr 13, 2024
d4fe6b7
.
SimonDold Apr 13, 2024
8605c1f
add output
SimonDold Apr 13, 2024
1f79d57
change dir before output
SimonDold Apr 13, 2024
bc2432e
change dir before output
SimonDold Apr 13, 2024
e73ddc5
change dir before output
SimonDold Apr 13, 2024
745b38e
add src to artifact
SimonDold Apr 17, 2024
dbee140
remove output
SimonDold Apr 17, 2024
0af7fae
remove debug output
SimonDold Jun 19, 2024
45d501e
Update logging.h
SimonDold Jun 28, 2024
361fbdd
style
SimonDold Jun 28, 2024
7dd6c8d
implement feddback
SimonDold Jun 28, 2024
7fd9d24
reduce error message width.
SimonDold Jun 28, 2024
dd1fda2
adjust to review comments.
SimonDold Jul 2, 2024
d4f8655
review comments
SimonDold Jul 3, 2024
22b3c76
style
SimonDold Jul 3, 2024
fd037d7
remove unused function.
SimonDold Jul 3, 2024
2ae78b9
remove unused function.
SimonDold Jul 3, 2024
0306ecc
undo unnecessary change.
SimonDold Jul 3, 2024
a6fc4a5
adjust parameter order.
SimonDold Jul 3, 2024
97a16f2
undo unnecessary include.
SimonDold Jul 3, 2024
c50b1a0
fix style
SimonDold Jul 3, 2024
03ee101
use move in constructor.
SimonDold Jul 4, 2024
a4eadf7
change parameter order.
SimonDold Jul 4, 2024
2c9f383
break ling line.
SimonDold Jul 4, 2024
f9b49dc
rename function.
SimonDold Jul 4, 2024
8f3b87b
adjust field order to match constructor parameter order.
SimonDold Jul 4, 2024
51e101c
put include back into .cc and add get_canonical_pdbs_arguments_from_o…
SimonDold Jul 4, 2024
1e13122
remove unnecessary include.
SimonDold Jul 4, 2024
c623d0d
fix style.
SimonDold Jul 4, 2024
e228cac
merge
SimonDold Jul 5, 2024
4a7cea2
add comment.
SimonDold Jul 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions src/search/cartesian_abstractions/utils.cc
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#include "utils.h"

#include "../plugins/plugin.h"
#include "../heuristics/additive_heuristic.h"
#include "../task_utils/task_properties.h"
#include "../utils/logging.h"
#include "../utils/memory.h"

Expand All @@ -15,11 +13,8 @@ using namespace std;
namespace cartesian_abstractions {
unique_ptr<additive_heuristic::AdditiveHeuristic> create_additive_heuristic(
SimonDold marked this conversation as resolved.
Show resolved Hide resolved
const shared_ptr<AbstractTask> &task) {
plugins::Options opts;
opts.set<shared_ptr<AbstractTask>>("transform", task);
opts.set<bool>("cache_estimates", false);
opts.set<utils::Verbosity>("verbosity", utils::Verbosity::SILENT);
return utils::make_unique_ptr<additive_heuristic::AdditiveHeuristic>(opts);
return utils::make_unique_ptr<additive_heuristic::AdditiveHeuristic>(
task, false, "h^add within CEGAR abstractions", utils::Verbosity::SILENT);
}

static bool operator_applicable(
Expand Down
26 changes: 21 additions & 5 deletions src/search/evaluator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,24 @@
using namespace std;


Evaluator::Evaluator(bool use_for_reporting_minima,
SimonDold marked this conversation as resolved.
Show resolved Hide resolved
bool use_for_boosting,
bool use_for_counting_evaluations,
const string &name,
utils::Verbosity verbosity)
: name(name),
use_for_reporting_minima(use_for_reporting_minima),
use_for_boosting(use_for_boosting),
use_for_counting_evaluations(use_for_counting_evaluations),
log(utils::get_log_from_verbosity(verbosity)) {
}


Evaluator::Evaluator(const plugins::Options &opts,
bool use_for_reporting_minima,
bool use_for_boosting,
bool use_for_counting_evaluations)
: description(opts.get_unparsed_config()),
: name(opts.get_unparsed_config()),
use_for_reporting_minima(use_for_reporting_minima),
use_for_boosting(use_for_boosting),
use_for_counting_evaluations(use_for_counting_evaluations),
Expand All @@ -28,7 +41,7 @@ void Evaluator::report_value_for_initial_state(
const EvaluationResult &result) const {
if (log.is_at_least_normal()) {
assert(use_for_reporting_minima);
log << "Initial heuristic value for " << description << ": ";
log << "Initial heuristic value for " << name << ": ";
if (result.is_infinite())
log << "infinity";
else
Expand All @@ -41,13 +54,13 @@ void Evaluator::report_new_minimum_value(
const EvaluationResult &result) const {
if (log.is_at_least_normal()) {
assert(use_for_reporting_minima);
log << "New best heuristic value for " << description << ": "
log << "New best heuristic value for " << name << ": "
<< result.get_evaluator_value() << endl;
}
}

const string &Evaluator::get_description() const {
return description;
const string &Evaluator::get_name() const {
return name;
}

bool Evaluator::is_used_for_reporting_minima() const {
Expand Down Expand Up @@ -75,6 +88,9 @@ int Evaluator::get_cached_estimate(const State &) const {
}

void add_evaluator_options_to_feature(plugins::Feature &feature) {
feature.add_option<string>("name",
"name used to identify evaluator in logs",
"\"<Evaluator>\"");
utils::add_log_options_to_feature(feature);
}

Expand Down
10 changes: 8 additions & 2 deletions src/search/evaluator.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,19 @@ class Options;
}

class Evaluator {
const std::string description;
const std::string name;
const bool use_for_reporting_minima;
const bool use_for_boosting;
const bool use_for_counting_evaluations;
protected:
mutable utils::LogProxy log;
public:
explicit Evaluator(
bool use_for_reporting_minima,
bool use_for_boosting,
bool use_for_counting_evaluations,
const std::string &name,
utils::Verbosity verbosity);
explicit Evaluator(
const plugins::Options &opts,
bool use_for_reporting_minima = false,
Expand Down Expand Up @@ -86,7 +92,7 @@ class Evaluator {
void report_value_for_initial_state(const EvaluationResult &result) const;
void report_new_minimum_value(const EvaluationResult &result) const;

const std::string &get_description() const;
const std::string &get_name() const;
bool is_used_for_reporting_minima() const;
bool is_used_for_boosting() const;
bool is_used_for_counting_evaluations() const;
Expand Down
15 changes: 12 additions & 3 deletions src/search/heuristic.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,18 @@
#include <limits>

using namespace std;
Heuristic::Heuristic(
shared_ptr<AbstractTask> transform,
bool cache_estimates,
const string &name,
utils::Verbosity verbosity
)
: Evaluator(true, true, true, name, verbosity),
heuristic_cache(HEntry(NO_VALUE, true)), //TODO: is true really a good idea here?
cache_evaluator_values(cache_estimates),
task(transform),
SimonDold marked this conversation as resolved.
Show resolved Hide resolved
task_proxy(*task) {
}

Heuristic::Heuristic(const plugins::Options &opts)
: Evaluator(opts, true, true, true),
Expand All @@ -22,9 +34,6 @@ Heuristic::Heuristic(const plugins::Options &opts)
task_proxy(*task) {
}

Heuristic::~Heuristic() {
}

void Heuristic::set_preferred(const OperatorProxy &op) {
preferred_operators.insert(op.get_ancestor_operator_id(tasks::g_root_task.get()));
}
Expand Down
6 changes: 5 additions & 1 deletion src/search/heuristic.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "task_proxy.h"

#include "algorithms/ordered_set.h"
#include "tasks/root_task.h"

#include <memory>
#include <vector>
Expand Down Expand Up @@ -73,8 +74,11 @@ class Heuristic : public Evaluator {
State convert_ancestor_state(const State &ancestor_state) const;

public:
explicit Heuristic(std::shared_ptr<AbstractTask> transform,
SimonDold marked this conversation as resolved.
Show resolved Hide resolved
bool cache_estimates,
const std::string &name,
utils::Verbosity verbosity);
explicit Heuristic(const plugins::Options &opts);
virtual ~Heuristic() override;

virtual void get_path_dependent_evaluators(
std::set<Evaluator *> & /*evals*/) override {
Expand Down
17 changes: 14 additions & 3 deletions src/search/heuristics/additive_heuristic.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,12 @@ using namespace std;
namespace additive_heuristic {
const int AdditiveHeuristic::MAX_COST_VALUE;

// construction and destruction
AdditiveHeuristic::AdditiveHeuristic(const plugins::Options &opts)
: RelaxationHeuristic(opts),
AdditiveHeuristic::AdditiveHeuristic(const shared_ptr<AbstractTask> &transform,
bool cache_estimates,
const string &name,
utils::Verbosity verbosity
)
: RelaxationHeuristic(transform, cache_estimates, name, verbosity),
did_write_overflow_warning(false) {
if (log.is_at_least_normal()) {
log << "Initializing additive heuristic..." << endl;
Expand Down Expand Up @@ -165,6 +168,14 @@ class AdditiveHeuristicFeature : public plugins::TypedFeature<Evaluator, Additiv
document_property("safe", "yes for tasks without axioms");
document_property("preferred operators", "yes");
}

virtual shared_ptr<AdditiveHeuristic> create_component(
const plugins::Options &opts, const utils::Context &) const override {
return make_shared<AdditiveHeuristic>(opts.get<shared_ptr<AbstractTask>>("transform"),
opts.get<bool>("cache_estimates"),
opts.get<string>("name"),
opts.get<utils::Verbosity>("verbosity"));
}
};

static plugins::FeaturePlugin<AdditiveHeuristicFeature> _plugin;
Expand Down
5 changes: 4 additions & 1 deletion src/search/heuristics/additive_heuristic.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,10 @@ class AdditiveHeuristic : public relaxation_heuristic::RelaxationHeuristic {
// Common part of h^add and h^ff computation.
int compute_add_and_ff(const State &state);
public:
explicit AdditiveHeuristic(const plugins::Options &opts);
AdditiveHeuristic(const std::shared_ptr<AbstractTask> &transform,
bool cache_estimates,
const std::string &name,
utils::Verbosity verbosity);

/*
TODO: The two methods below are temporarily needed for the CEGAR
Expand Down
19 changes: 14 additions & 5 deletions src/search/heuristics/blind_search_heuristic.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,18 @@
using namespace std;

namespace blind_search_heuristic {
BlindSearchHeuristic::BlindSearchHeuristic(const plugins::Options &opts)
: Heuristic(opts),
BlindSearchHeuristic::BlindSearchHeuristic(const shared_ptr<AbstractTask> &transform,
bool cache_estimates,
const string &name,
utils::Verbosity verbosity
)
: Heuristic(transform, cache_estimates, name, verbosity),
min_operator_cost(task_properties::get_min_operator_cost(task_proxy)) {
if (log.is_at_least_normal()) {
log << "Initializing blind search heuristic..." << endl;
}
}

BlindSearchHeuristic::~BlindSearchHeuristic() {
}

int BlindSearchHeuristic::compute_heuristic(const State &ancestor_state) {
State state = convert_ancestor_state(ancestor_state);
if (task_properties::is_goal_state(task_proxy, state))
Expand Down Expand Up @@ -50,6 +51,14 @@ class BlindSearchHeuristicFeature : public plugins::TypedFeature<Evaluator, Blin
document_property("safe", "yes");
document_property("preferred operators", "no");
}

virtual shared_ptr<BlindSearchHeuristic> create_component(
const plugins::Options &opts, const utils::Context &) const override {
return make_shared<BlindSearchHeuristic>(opts.get<shared_ptr<AbstractTask>>("transform"),
opts.get<bool>("cache_estimates"),
opts.get<string>("name"),
opts.get<utils::Verbosity>("verbosity"));
}
};

static plugins::FeaturePlugin<BlindSearchHeuristicFeature> _plugin;
Expand Down
6 changes: 4 additions & 2 deletions src/search/heuristics/blind_search_heuristic.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ class BlindSearchHeuristic : public Heuristic {
protected:
virtual int compute_heuristic(const State &ancestor_state) override;
public:
BlindSearchHeuristic(const plugins::Options &opts);
~BlindSearchHeuristic();
BlindSearchHeuristic(const std::shared_ptr<AbstractTask> &transform,
bool cache_estimates,
const std::string &name,
utils::Verbosity verbosity);
};
}

Expand Down
16 changes: 14 additions & 2 deletions src/search/heuristics/ff_heuristic.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@ using namespace std;

namespace ff_heuristic {
// construction and destruction
FFHeuristic::FFHeuristic(const plugins::Options &opts)
: AdditiveHeuristic(opts),
FFHeuristic::FFHeuristic(const shared_ptr<AbstractTask> &transform,
bool cache_estimates,
const string &name,
utils::Verbosity verbosity
)
: AdditiveHeuristic(transform, cache_estimates, name, verbosity),
relaxed_plan(task_proxy.get_operators().size(), false) {
if (log.is_at_least_normal()) {
log << "Initializing FF heuristic..." << endl;
Expand Down Expand Up @@ -89,6 +93,14 @@ class FFHeuristicFeature : public plugins::TypedFeature<Evaluator, FFHeuristic>
document_property("safe", "yes for tasks without axioms");
document_property("preferred operators", "yes");
}

virtual shared_ptr<FFHeuristic> create_component(
const plugins::Options &opts, const utils::Context &) const override {
return make_shared<FFHeuristic>(opts.get<shared_ptr<AbstractTask>>("transform"),
opts.get<bool>("cache_estimates"),
opts.get<string>("name"),
opts.get<utils::Verbosity>("verbosity"));
}
};

static plugins::FeaturePlugin<FFHeuristicFeature> _plugin;
Expand Down
5 changes: 4 additions & 1 deletion src/search/heuristics/ff_heuristic.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ class FFHeuristic : public additive_heuristic::AdditiveHeuristic {
protected:
virtual int compute_heuristic(const State &ancestor_state) override;
public:
explicit FFHeuristic(const plugins::Options &opts);
explicit FFHeuristic(const std::shared_ptr<AbstractTask> &transform,
bool cache_estimates,
const std::string &name,
utils::Verbosity verbosity);
};
}

Expand Down
16 changes: 14 additions & 2 deletions src/search/heuristics/max_heuristic.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,12 @@ namespace max_heuristic {
*/

// construction and destruction
HSPMaxHeuristic::HSPMaxHeuristic(const plugins::Options &opts)
: RelaxationHeuristic(opts) {
HSPMaxHeuristic::HSPMaxHeuristic(const shared_ptr<AbstractTask> &transform,
bool cache_estimates,
const string &name,
utils::Verbosity verbosity
)
: RelaxationHeuristic(transform, cache_estimates, name, verbosity) {
if (log.is_at_least_normal()) {
log << "Initializing HSP max heuristic..." << endl;
}
Expand Down Expand Up @@ -118,6 +122,14 @@ class HSPMaxHeuristicFeature : public plugins::TypedFeature<Evaluator, HSPMaxHeu
document_property("safe", "yes for tasks without axioms");
document_property("preferred operators", "no");
}

virtual shared_ptr<HSPMaxHeuristic> create_component(
const plugins::Options &opts, const utils::Context &) const override {
return make_shared<HSPMaxHeuristic>(opts.get<shared_ptr<AbstractTask>>("transform"),
opts.get<bool>("cache_estimates"),
opts.get<string>("name"),
opts.get<utils::Verbosity>("verbosity"));
}
};

static plugins::FeaturePlugin<HSPMaxHeuristicFeature> _plugin;
Expand Down
5 changes: 4 additions & 1 deletion src/search/heuristics/max_heuristic.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ class HSPMaxHeuristic : public relaxation_heuristic::RelaxationHeuristic {
protected:
virtual int compute_heuristic(const State &ancestor_state) override;
public:
explicit HSPMaxHeuristic(const plugins::Options &opts);
explicit HSPMaxHeuristic(const std::shared_ptr<AbstractTask> &transform,
SimonDold marked this conversation as resolved.
Show resolved Hide resolved
bool cache_estimates,
const std::string &name,
utils::Verbosity verbosity);
};
}

Expand Down
8 changes: 6 additions & 2 deletions src/search/heuristics/relaxation_heuristic.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,12 @@ UnaryOperator::UnaryOperator(


// construction and destruction
RelaxationHeuristic::RelaxationHeuristic(const plugins::Options &opts)
: Heuristic(opts) {
RelaxationHeuristic::RelaxationHeuristic(const shared_ptr<AbstractTask> &transform,
bool cache_estimates,
const string &name,
utils::Verbosity verbosity
)
: Heuristic(transform, cache_estimates, name, verbosity) {
// Build propositions.
propositions.resize(task_properties::get_num_facts(task_proxy));

Expand Down
5 changes: 4 additions & 1 deletion src/search/heuristics/relaxation_heuristic.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,10 @@ class RelaxationHeuristic : public Heuristic {
Proposition *get_proposition(int var, int value);
Proposition *get_proposition(const FactProxy &fact);
public:
explicit RelaxationHeuristic(const plugins::Options &options);
RelaxationHeuristic(const std::shared_ptr<AbstractTask> &transform,
bool cache_estimates,
const std::string &name,
utils::Verbosity verbosity);

virtual bool dead_ends_are_reliable() const override;
};
Expand Down
7 changes: 7 additions & 0 deletions src/search/utils/logging.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ void add_log_options_to_feature(plugins::Feature &feature) {
"normal");
}

LogProxy get_log_from_verbosity(const Verbosity &verbosity) {
SimonDold marked this conversation as resolved.
Show resolved Hide resolved
if (verbosity == Verbosity::NORMAL) {
return LogProxy(global_log);
}
return LogProxy(make_shared<Log>(verbosity));
}

LogProxy get_log_from_options(const plugins::Options &options) {
/* NOTE: We return (a proxy to) the global log if all options match the
default values of the global log. */
Expand Down
1 change: 1 addition & 0 deletions src/search/utils/logging.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ class LogProxy {
extern LogProxy g_log;

extern void add_log_options_to_feature(plugins::Feature &feature);
extern LogProxy get_log_from_verbosity(const Verbosity &verbosity);
extern LogProxy get_log_from_options(const plugins::Options &options);
extern LogProxy get_silent_log();

Expand Down
Loading