Skip to content

Commit

Permalink
[issue1082] update linear().
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonDold committed Feb 7, 2024
1 parent 4b865dd commit 1b0ef71
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 8 deletions.
9 changes: 6 additions & 3 deletions src/search/evaluator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,12 @@ void add_evaluator_options_to_feature(plugins::Feature &feature) {
}

shared_ptr<tuple<string, utils::Verbosity>> get_evaluator_parameters_from_options(const plugins::Options &opts) {
auto parent_parameter_tuple = utils::get_log_parameters_from_options(opts);
auto own_parameter_tuple = make_tuple(opts.get<string>("description"));
return make_shared<tuple<string, utils::Verbosity>>(tuple_cat(own_parameter_tuple, *parent_parameter_tuple));
return make_shared<tuple<string, utils::Verbosity>>(
tuple_cat(
make_tuple(opts.get<string>("description")),
*utils::get_log_parameters_from_options(opts)
)
);
}

static class EvaluatorCategoryPlugin : public plugins::TypedCategoryPlugin<Evaluator> {
Expand Down
9 changes: 9 additions & 0 deletions src/search/merge_and_shrink/merge_tree_factory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,15 @@ void MergeTreeFactory::add_options_to_feature(plugins::Feature &feature) {
"use_random");
}

shared_ptr<tuple<int, UpdateOption>> get_merge_tree_parameters_from_options(const plugins::Options &opts) {
return make_shared<tuple<int, UpdateOption>>(
make_tuple(
opts.get<int>("random_seed"),
opts.get<UpdateOption>("update_option")
)
);
}

static class MergeTreeFactoryCategoryPlugin : public plugins::TypedCategoryPlugin<MergeTreeFactory> {
public:
MergeTreeFactoryCategoryPlugin() : TypedCategoryPlugin("MergeTree") {
Expand Down
2 changes: 2 additions & 0 deletions src/search/merge_and_shrink/merge_tree_factory.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ class MergeTreeFactory {
// Derived classes must call this method in their parsing methods.
static void add_options_to_feature(plugins::Feature &feature);
};

extern std::shared_ptr<std::tuple<int, UpdateOption>> get_merge_tree_parameters_from_options(const plugins::Options &opts);
}

#endif
7 changes: 3 additions & 4 deletions src/search/merge_and_shrink/merge_tree_factory_linear.cc
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,9 @@ class MergeTreeFactoryLinearFeature : public plugins::TypedFeature<MergeTreeFact

virtual shared_ptr<MergeTreeFactoryLinear> create_component(
const plugins::Options &opts, const utils::Context &) const override {
return make_shared<MergeTreeFactoryLinear>(
opts.get<variable_order_finder::VariableOrderType>("variable_order"),
opts.get<int>("random_seed"),
opts.get<UpdateOption>("update_option")
return plugins::make_shared_from_args_tuple_and_args<MergeTreeFactoryLinear>(
get_merge_tree_parameters_from_options(opts),
opts.get<variable_order_finder::VariableOrderType>("variable_order")
);
}
};
Expand Down
2 changes: 1 addition & 1 deletion src/search/plugins/plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ class TypedFeature : public FeatureAuto<Constructed> {
template<typename T, typename ParentTuple, typename ... ChildSingletons>
std::shared_ptr<T> make_shared_from_args_tuple_and_args(ParentTuple parent_tuple, ChildSingletons ... child_singletons) {
return std::apply([](auto ... args) {
return make_shared<T>(args ...);
return std::make_shared<T>(args ...);
},
std::tuple_cat(std::make_tuple(child_singletons ...), *parent_tuple)
);
Expand Down

0 comments on commit 1b0ef71

Please sign in to comment.