From 92060afaf750e208e50aa504d7c868bc65f01862 Mon Sep 17 00:00:00 2001 From: Florian Pommerening Date: Tue, 2 Jul 2024 17:21:18 +0200 Subject: [PATCH] Rename classes and include guards to match names of commandline options --- .../delete_relaxation_if_constraints.cc | 28 +++++------ .../delete_relaxation_if_constraints.h | 8 +-- .../delete_relaxation_rr_constraints.cc | 50 +++++++++---------- .../delete_relaxation_rr_constraints.h | 8 +-- 4 files changed, 47 insertions(+), 47 deletions(-) diff --git a/src/search/operator_counting/delete_relaxation_if_constraints.cc b/src/search/operator_counting/delete_relaxation_if_constraints.cc index b5564936d2..6890d0c2ae 100644 --- a/src/search/operator_counting/delete_relaxation_if_constraints.cc +++ b/src/search/operator_counting/delete_relaxation_if_constraints.cc @@ -21,37 +21,37 @@ static void add_lp_variables(int count, LPVariables &variables, vector &ind } -DeleteRelaxationConstraintsIF::DeleteRelaxationConstraintsIF(const plugins::Options &opts) +DeleteRelaxationIFConstraints::DeleteRelaxationIFConstraints(const plugins::Options &opts) : use_time_vars(opts.get("use_time_vars")), use_integer_vars(opts.get("use_integer_vars")) { } -int DeleteRelaxationConstraintsIF::get_var_op_used(const OperatorProxy &op) { +int DeleteRelaxationIFConstraints::get_var_op_used(const OperatorProxy &op) { return lp_var_id_op_used[op.get_id()]; } -int DeleteRelaxationConstraintsIF::get_var_fact_reached(FactPair f) { +int DeleteRelaxationIFConstraints::get_var_fact_reached(FactPair f) { return lp_var_id_fact_reached[f.var][f.value]; } -int DeleteRelaxationConstraintsIF::get_var_first_achiever( +int DeleteRelaxationIFConstraints::get_var_first_achiever( const OperatorProxy &op, FactPair f) { return lp_var_id_first_achiever[op.get_id()][f.var][f.value]; } -int DeleteRelaxationConstraintsIF::get_var_op_time(const OperatorProxy &op) { +int DeleteRelaxationIFConstraints::get_var_op_time(const OperatorProxy &op) { return lp_var_id_op_time[op.get_id()]; } -int DeleteRelaxationConstraintsIF::get_var_fact_time(FactPair f) { +int DeleteRelaxationIFConstraints::get_var_fact_time(FactPair f) { return lp_var_id_fact_time[f.var][f.value]; } -int DeleteRelaxationConstraintsIF::get_constraint_id(FactPair f) { +int DeleteRelaxationIFConstraints::get_constraint_id(FactPair f) { return constraint_ids[f.var][f.value]; } -void DeleteRelaxationConstraintsIF::create_auxiliary_variables( +void DeleteRelaxationIFConstraints::create_auxiliary_variables( const TaskProxy &task_proxy, LPVariables &variables) { OperatorsProxy ops = task_proxy.get_operators(); int num_ops = ops.size(); @@ -94,7 +94,7 @@ void DeleteRelaxationConstraintsIF::create_auxiliary_variables( } } -void DeleteRelaxationConstraintsIF::create_constraints(const TaskProxy &task_proxy, +void DeleteRelaxationIFConstraints::create_constraints(const TaskProxy &task_proxy, lp::LinearProgram &lp) { LPVariables &variables = lp.get_variables(); LPConstraints &constraints = lp.get_constraints(); @@ -213,7 +213,7 @@ void DeleteRelaxationConstraintsIF::create_constraints(const TaskProxy &task_pro } -void DeleteRelaxationConstraintsIF::initialize_constraints( +void DeleteRelaxationIFConstraints::initialize_constraints( const shared_ptr &task, lp::LinearProgram &lp) { TaskProxy task_proxy(*task); create_auxiliary_variables(task_proxy, lp.get_variables()); @@ -221,7 +221,7 @@ void DeleteRelaxationConstraintsIF::initialize_constraints( } -bool DeleteRelaxationConstraintsIF::update_constraints( +bool DeleteRelaxationIFConstraints::update_constraints( const State &state, lp::LPSolver &lp_solver) { // Unset old bounds. for (FactPair f : last_state) { @@ -236,9 +236,9 @@ bool DeleteRelaxationConstraintsIF::update_constraints( return false; } -class DeleteRelaxationConstraintsIFFeature : public plugins::TypedFeature { +class DeleteRelaxationIFConstraintsFeature : public plugins::TypedFeature { public: - DeleteRelaxationConstraintsIFFeature() : TypedFeature("delete_relaxation_if_constraints") { + DeleteRelaxationIFConstraintsFeature() : TypedFeature("delete_relaxation_if_constraints") { document_title("Delete relaxation constraints"); document_synopsis( "Operator-counting constraints based on the delete relaxation. By " @@ -287,5 +287,5 @@ class DeleteRelaxationConstraintsIFFeature : public plugins::TypedFeature _plugin; +static plugins::FeaturePlugin _plugin; } diff --git a/src/search/operator_counting/delete_relaxation_if_constraints.h b/src/search/operator_counting/delete_relaxation_if_constraints.h index b508bd0026..7adfb543e9 100644 --- a/src/search/operator_counting/delete_relaxation_if_constraints.h +++ b/src/search/operator_counting/delete_relaxation_if_constraints.h @@ -1,5 +1,5 @@ -#ifndef OPERATOR_COUNTING_DELETE_RELAXATION_CONSTRAINTS_IF_H -#define OPERATOR_COUNTING_DELETE_RELAXATION_CONSTRAINTS_IF_H +#ifndef OPERATOR_COUNTING_DELETE_RELAXATION_IF_CONSTRAINTS_H +#define OPERATOR_COUNTING_DELETE_RELAXATION_IF_CONSTRAINTS_H #include "constraint_generator.h" @@ -20,7 +20,7 @@ namespace operator_counting { using LPConstraints = named_vector::NamedVector; using LPVariables = named_vector::NamedVector; -class DeleteRelaxationConstraintsIF : public ConstraintGenerator { +class DeleteRelaxationIFConstraints : public ConstraintGenerator { bool use_time_vars; bool use_integer_vars; @@ -63,7 +63,7 @@ class DeleteRelaxationConstraintsIF : public ConstraintGenerator { const TaskProxy &task_proxy, LPVariables &variables); void create_constraints(const TaskProxy &task_proxy, lp::LinearProgram &lp); public: - explicit DeleteRelaxationConstraintsIF(const plugins::Options &opts); + explicit DeleteRelaxationIFConstraints(const plugins::Options &opts); virtual void initialize_constraints( const std::shared_ptr &task, diff --git a/src/search/operator_counting/delete_relaxation_rr_constraints.cc b/src/search/operator_counting/delete_relaxation_rr_constraints.cc index 887b6fcd13..0e305279ec 100644 --- a/src/search/operator_counting/delete_relaxation_rr_constraints.cc +++ b/src/search/operator_counting/delete_relaxation_rr_constraints.cc @@ -161,41 +161,41 @@ class VEGraph { } }; -int DeleteRelaxationConstraintsRR::LPVariableIDs::id_of_fp(FactPair f) const { +int DeleteRelaxationRRConstraints::LPVariableIDs::id_of_fp(FactPair f) const { return fp_offsets[f.var] + f.value; } -int DeleteRelaxationConstraintsRR::LPVariableIDs::id_of_fpa( +int DeleteRelaxationRRConstraints::LPVariableIDs::id_of_fpa( FactPair f, const OperatorProxy &op) const { return fpa_ids[op.get_id()].at(f); } -int DeleteRelaxationConstraintsRR::LPVariableIDs::id_of_e( +int DeleteRelaxationRRConstraints::LPVariableIDs::id_of_e( pair edge) const { return e_ids.at(edge); } -int DeleteRelaxationConstraintsRR::LPVariableIDs::has_e( +int DeleteRelaxationRRConstraints::LPVariableIDs::has_e( pair edge) const { return e_ids.find(edge) != e_ids.end(); } -int DeleteRelaxationConstraintsRR::LPVariableIDs::id_of_t(FactPair f) const { +int DeleteRelaxationRRConstraints::LPVariableIDs::id_of_t(FactPair f) const { return t_offsets[f.var] + f.value; } -DeleteRelaxationConstraintsRR::DeleteRelaxationConstraintsRR( +DeleteRelaxationRRConstraints::DeleteRelaxationRRConstraints( const plugins::Options &opts) : acyclicity_type(opts.get("acyclicity_type")), use_integer_vars(opts.get("use_integer_vars")) { } -int DeleteRelaxationConstraintsRR::get_constraint_id(FactPair f) const { +int DeleteRelaxationRRConstraints::get_constraint_id(FactPair f) const { return constraint_offsets[f.var] + f.value; } -DeleteRelaxationConstraintsRR::LPVariableIDs -DeleteRelaxationConstraintsRR::create_auxiliary_variables( +DeleteRelaxationRRConstraints::LPVariableIDs +DeleteRelaxationRRConstraints::create_auxiliary_variables( const TaskProxy &task_proxy, LPVariables &variables) const { OperatorsProxy ops = task_proxy.get_operators(); VariablesProxy task_variables = task_proxy.get_variables(); @@ -234,9 +234,9 @@ DeleteRelaxationConstraintsRR::create_auxiliary_variables( return lp_var_ids; } -void DeleteRelaxationConstraintsRR::create_auxiliary_variables_ve( +void DeleteRelaxationRRConstraints::create_auxiliary_variables_ve( const TaskProxy &task_proxy, const VEGraph &ve_graph, LPVariables &variables, - DeleteRelaxationConstraintsRR::LPVariableIDs &lp_var_ids) const { + DeleteRelaxationRRConstraints::LPVariableIDs &lp_var_ids) const { utils::unused_variable(task_proxy); // Add e_{i,j} variables. for (pair edge : ve_graph.get_edges()) { @@ -253,9 +253,9 @@ void DeleteRelaxationConstraintsRR::create_auxiliary_variables_ve( } } -void DeleteRelaxationConstraintsRR::create_auxiliary_variables_tl( +void DeleteRelaxationRRConstraints::create_auxiliary_variables_tl( const TaskProxy &task_proxy, LPVariables &variables, - DeleteRelaxationConstraintsRR::LPVariableIDs &lp_var_ids) const { + DeleteRelaxationRRConstraints::LPVariableIDs &lp_var_ids) const { int num_facts = 0; for (VariableProxy var : task_proxy.get_variables()) { num_facts += var.get_domain_size(); @@ -275,9 +275,9 @@ void DeleteRelaxationConstraintsRR::create_auxiliary_variables_tl( } } -void DeleteRelaxationConstraintsRR::create_constraints( +void DeleteRelaxationRRConstraints::create_constraints( const TaskProxy &task_proxy, - const DeleteRelaxationConstraintsRR::LPVariableIDs &lp_var_ids, + const DeleteRelaxationRRConstraints::LPVariableIDs &lp_var_ids, lp::LinearProgram &lp) { LPVariables &variables = lp.get_variables(); LPConstraints &constraints = lp.get_constraints(); @@ -391,9 +391,9 @@ void DeleteRelaxationConstraintsRR::create_constraints( } } -void DeleteRelaxationConstraintsRR::create_constraints_ve( +void DeleteRelaxationRRConstraints::create_constraints_ve( const TaskProxy &task_proxy, const VEGraph &ve_graph, - const DeleteRelaxationConstraintsRR::LPVariableIDs &lp_var_ids, + const DeleteRelaxationRRConstraints::LPVariableIDs &lp_var_ids, lp::LinearProgram &lp) { LPConstraints &constraints = lp.get_constraints(); double infinity = lp.get_infinity(); @@ -459,9 +459,9 @@ void DeleteRelaxationConstraintsRR::create_constraints_ve( } } -void DeleteRelaxationConstraintsRR::create_constraints_tl( +void DeleteRelaxationRRConstraints::create_constraints_tl( const TaskProxy &task_proxy, - const DeleteRelaxationConstraintsRR::LPVariableIDs &lp_var_ids, + const DeleteRelaxationRRConstraints::LPVariableIDs &lp_var_ids, lp::LinearProgram &lp) { /* Constraint (9) in paper: @@ -500,7 +500,7 @@ void DeleteRelaxationConstraintsRR::create_constraints_tl( } } -void DeleteRelaxationConstraintsRR::initialize_constraints( +void DeleteRelaxationRRConstraints::initialize_constraints( const shared_ptr &task, lp::LinearProgram &lp) { TaskProxy task_proxy(*task); LPVariableIDs lp_var_ids = create_auxiliary_variables( @@ -532,7 +532,7 @@ void DeleteRelaxationConstraintsRR::initialize_constraints( } } -bool DeleteRelaxationConstraintsRR::update_constraints( +bool DeleteRelaxationRRConstraints::update_constraints( const State &state, lp::LPSolver &lp_solver) { // Unset old bounds. int con_id; @@ -552,11 +552,11 @@ bool DeleteRelaxationConstraintsRR::update_constraints( return false; } -class DeleteRelaxationConstraintsRRFeature +class DeleteRelaxationRRConstraintsFeature : public plugins::TypedFeature { + DeleteRelaxationRRConstraints> { public: - DeleteRelaxationConstraintsRRFeature() + DeleteRelaxationRRConstraintsFeature() : TypedFeature("delete_relaxation_rr_constraints") { document_title( "Delete relaxation constraints from Rankooh and Rintanen"); @@ -616,7 +616,7 @@ class DeleteRelaxationConstraintsRRFeature } }; -static plugins::FeaturePlugin _plugin; +static plugins::FeaturePlugin _plugin; static plugins::TypedEnumPlugin _enum_plugin({ {"time_labels", diff --git a/src/search/operator_counting/delete_relaxation_rr_constraints.h b/src/search/operator_counting/delete_relaxation_rr_constraints.h index 4af9bce7d4..cb43921cd9 100644 --- a/src/search/operator_counting/delete_relaxation_rr_constraints.h +++ b/src/search/operator_counting/delete_relaxation_rr_constraints.h @@ -1,5 +1,5 @@ -#ifndef OPERATOR_COUNTING_DELETE_RELAXATION_CONSTRAINTS_RR_H -#define OPERATOR_COUNTING_DELETE_RELAXATION_CONSTRAINTS_RR_H +#ifndef OPERATOR_COUNTING_DELETE_RELAXATION_RR_CONSTRAINTS_H +#define OPERATOR_COUNTING_DELETE_RELAXATION_RR_CONSTRAINTS_H #include "constraint_generator.h" @@ -27,7 +27,7 @@ enum class AcyclicityType { TIME_LABELS, VERTEX_ELIMINATION, NONE }; -class DeleteRelaxationConstraintsRR : public ConstraintGenerator { +class DeleteRelaxationRRConstraints : public ConstraintGenerator { struct LPVariableIDs { /* The variables f_p in the paper represent if a fact p is reached by the @@ -103,7 +103,7 @@ class DeleteRelaxationConstraintsRR : public ConstraintGenerator { const TaskProxy &task_proxy, const LPVariableIDs &lp_var_ids, lp::LinearProgram &lp); public: - explicit DeleteRelaxationConstraintsRR(const plugins::Options &opts); + explicit DeleteRelaxationRRConstraints(const plugins::Options &opts); virtual void initialize_constraints( const std::shared_ptr &task,