Skip to content

Commit

Permalink
update tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorianPommerening committed Feb 8, 2024
1 parent 4f13d8a commit 9884598
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
4 changes: 4 additions & 0 deletions src/search/operator_cost.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ void add_cost_type_option_to_feature(plugins::Feature &feature) {
"normal");
}

OperatorCost get_cost_type_arguments_from_options(const plugins::Options &opts) {
return opts.get<OperatorCost>("cost_type");
}

static plugins::TypedEnumPlugin<OperatorCost> _enum_plugin({
{"normal", "all actions are accounted for with their real cost"},
{"one", "all actions are accounted for as unit cost"},
Expand Down
4 changes: 3 additions & 1 deletion src/search/operator_cost.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ class OperatorProxy;

namespace plugins {
class Feature;
class Options;
}

enum OperatorCost {NORMAL = 0, ONE = 1, PLUSONE = 2, MAX_OPERATOR_COST};

int get_adjusted_action_cost(const OperatorProxy &op, OperatorCost cost_type, bool is_unit_cost);
void add_cost_type_option_to_feature(plugins::Feature &feature);
extern void add_cost_type_option_to_feature(plugins::Feature &feature);
extern OperatorCost get_cost_type_arguments_from_options(const plugins::Options &opts);

#endif
5 changes: 3 additions & 2 deletions src/search/tasks/cost_adapted_task.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ class CostAdaptedTaskFeature : public plugins::TypedFeature<AbstractTask, CostAd
}

virtual shared_ptr<CostAdaptedTask> create_component(const plugins::Options &options, const utils::Context &) const override {
OperatorCost cost_type = options.get<OperatorCost>("cost_type");
return make_shared<CostAdaptedTask>(g_root_task, cost_type);
return make_shared<CostAdaptedTask>(
g_root_task,
get_cost_type_arguments_from_options(options));
}
};

Expand Down

0 comments on commit 9884598

Please sign in to comment.