Skip to content

Commit

Permalink
update operator-counting
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorianPommerening committed Feb 8, 2024
1 parent 0452fb9 commit ea73ee6
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/search/AAA_Mechanical_Changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,15 @@ search
├── ❓ heuristic.h
├── ✅ heuristics
├── ✅ landmarks
├── lp
├── lp
├── ✅ merge_and_shrink
├── ✅ open_list_factory.cc
├── ✅ open_list_factory.h
├── ✅ open_list.h
├── ❌ open_lists
├── ✅ operator_cost.cc
├── ✅ operator_cost.h
├── operator_counting
├── operator_counting
├── ✅ operator_id.cc
├── ✅ operator_id.h
├── ✅ parser
Expand Down
14 changes: 11 additions & 3 deletions src/search/operator_counting/delete_relaxation_constraints.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ static void add_lp_variables(int count, LPVariables &variables, vector<int> &ind
}


DeleteRelaxationConstraints::DeleteRelaxationConstraints(const plugins::Options &opts)
: use_time_vars(opts.get<bool>("use_time_vars")),
use_integer_vars(opts.get<bool>("use_integer_vars")) {
DeleteRelaxationConstraints::DeleteRelaxationConstraints(bool use_time_vars,
bool use_integer_vars)
: use_time_vars(use_time_vars),
use_integer_vars(use_integer_vars) {
}

int DeleteRelaxationConstraints::get_var_op_used(const OperatorProxy &op) {
Expand Down Expand Up @@ -280,6 +281,13 @@ class DeleteRelaxationConstraintsFeature : public plugins::TypedFeature<Constrai
"{{{\noperatorcounting([delete_relaxation_constraints(use_time_vars=true, "
"use_integer_vars=true)], use_integer_operator_counts=true))\n}}}\n");
}

virtual shared_ptr<DeleteRelaxationConstraints> create_component(
const plugins::Options &options, const utils::Context &) const override {
return make_shared<DeleteRelaxationConstraints>(
options.get<bool>("use_time_vars"),
options.get<bool>("use_integer_vars"));
}
};

static plugins::FeaturePlugin<DeleteRelaxationConstraintsFeature> _plugin;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class DeleteRelaxationConstraints : public ConstraintGenerator {
const TaskProxy &task_proxy, LPVariables &variables);
void create_constraints(const TaskProxy &task_proxy, lp::LinearProgram &lp);
public:
explicit DeleteRelaxationConstraints(const plugins::Options &opts);
explicit DeleteRelaxationConstraints(bool use_time_vars, bool use_integer_vars);

virtual void initialize_constraints(
const std::shared_ptr<AbstractTask> &task,
Expand Down
11 changes: 8 additions & 3 deletions src/search/operator_counting/pho_constraints.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@
using namespace std;

namespace operator_counting {
PhOConstraints::PhOConstraints(const plugins::Options &opts)
: pattern_generator(
opts.get<shared_ptr<pdbs::PatternCollectionGenerator>>("patterns")) {
PhOConstraints::PhOConstraints(const shared_ptr<pdbs::PatternCollectionGenerator> &pattern_generator)
: pattern_generator(pattern_generator) {
}

void PhOConstraints::initialize_constraints(
Expand Down Expand Up @@ -84,6 +83,12 @@ class PhOConstraintsFeature : public plugins::TypedFeature<ConstraintGenerator,
"pattern generation method",
"systematic(2)");
}

virtual shared_ptr<PhOConstraints> create_component(
const plugins::Options &options, const utils::Context &) const override {
return plugins::make_shared_from_arg_tuples<PhOConstraints>(
options.get<shared_ptr<pdbs::PatternCollectionGenerator>>("patterns"));
}
};

static plugins::FeaturePlugin<PhOConstraintsFeature> _plugin;
Expand Down
2 changes: 1 addition & 1 deletion src/search/operator_counting/pho_constraints.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class PhOConstraints : public ConstraintGenerator {
int constraint_offset;
std::shared_ptr<pdbs::PDBCollection> pdbs;
public:
explicit PhOConstraints(const plugins::Options &opts);
explicit PhOConstraints(const std::shared_ptr<pdbs::PatternCollectionGenerator> &pattern_generator);

virtual void initialize_constraints(
const std::shared_ptr<AbstractTask> &task, lp::LinearProgram &lp) override;
Expand Down
11 changes: 8 additions & 3 deletions src/search/operator_counting/state_equation_constraints.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@
using namespace std;

namespace operator_counting {
StateEquationConstraints::StateEquationConstraints(
const plugins::Options &opts)
: log(utils::get_log_from_options(opts)) {
StateEquationConstraints::StateEquationConstraints(utils::Verbosity verbosity)
: log(utils::get_log_for_verbosity(verbosity)) {
}

static void add_indices_to_constraint(lp::LPConstraint &constraint,
Expand Down Expand Up @@ -159,6 +158,12 @@ class StateEquationConstraintsFeature : public plugins::TypedFeature<ConstraintG

utils::add_log_options_to_feature(*this);
}

virtual shared_ptr<StateEquationConstraints> create_component(
const plugins::Options &options, const utils::Context &) const override {
return plugins::make_shared_from_arg_tuples<StateEquationConstraints>(
utils::get_log_arguments_from_options(options));
}
};


Expand Down
2 changes: 1 addition & 1 deletion src/search/operator_counting/state_equation_constraints.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class StateEquationConstraints : public ConstraintGenerator {
void build_propositions(const TaskProxy &task_proxy);
void add_constraints(named_vector::NamedVector<lp::LPConstraint> &constraints, double infinity);
public:
explicit StateEquationConstraints(const plugins::Options &opts);
explicit StateEquationConstraints(utils::Verbosity verbosity);
virtual void initialize_constraints(
const std::shared_ptr<AbstractTask> &task, lp::LinearProgram &lp) override;
virtual bool update_constraints(const State &state, lp::LPSolver &lp_solver) override;
Expand Down

0 comments on commit ea73ee6

Please sign in to comment.