Skip to content

Commit

Permalink
Rename classes and include guards to match names of commandline options
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorianPommerening committed Jul 2, 2024
1 parent e9911f4 commit 92060af
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 47 deletions.
28 changes: 14 additions & 14 deletions src/search/operator_counting/delete_relaxation_if_constraints.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,37 +21,37 @@ static void add_lp_variables(int count, LPVariables &variables, vector<int> &ind
}


DeleteRelaxationConstraintsIF::DeleteRelaxationConstraintsIF(const plugins::Options &opts)
DeleteRelaxationIFConstraints::DeleteRelaxationIFConstraints(const plugins::Options &opts)
: use_time_vars(opts.get<bool>("use_time_vars")),
use_integer_vars(opts.get<bool>("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();
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -213,15 +213,15 @@ void DeleteRelaxationConstraintsIF::create_constraints(const TaskProxy &task_pro
}


void DeleteRelaxationConstraintsIF::initialize_constraints(
void DeleteRelaxationIFConstraints::initialize_constraints(
const shared_ptr<AbstractTask> &task, lp::LinearProgram &lp) {
TaskProxy task_proxy(*task);
create_auxiliary_variables(task_proxy, lp.get_variables());
create_constraints(task_proxy, lp);
}


bool DeleteRelaxationConstraintsIF::update_constraints(
bool DeleteRelaxationIFConstraints::update_constraints(
const State &state, lp::LPSolver &lp_solver) {
// Unset old bounds.
for (FactPair f : last_state) {
Expand All @@ -236,9 +236,9 @@ bool DeleteRelaxationConstraintsIF::update_constraints(
return false;
}

class DeleteRelaxationConstraintsIFFeature : public plugins::TypedFeature<ConstraintGenerator, DeleteRelaxationConstraintsIF> {
class DeleteRelaxationIFConstraintsFeature : public plugins::TypedFeature<ConstraintGenerator, DeleteRelaxationIFConstraints> {
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 "
Expand Down Expand Up @@ -287,5 +287,5 @@ class DeleteRelaxationConstraintsIFFeature : public plugins::TypedFeature<Constr
}
};

static plugins::FeaturePlugin<DeleteRelaxationConstraintsIFFeature> _plugin;
static plugins::FeaturePlugin<DeleteRelaxationIFConstraintsFeature> _plugin;
}
Original file line number Diff line number Diff line change
@@ -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"

Expand All @@ -20,7 +20,7 @@ namespace operator_counting {
using LPConstraints = named_vector::NamedVector<lp::LPConstraint>;
using LPVariables = named_vector::NamedVector<lp::LPVariable>;

class DeleteRelaxationConstraintsIF : public ConstraintGenerator {
class DeleteRelaxationIFConstraints : public ConstraintGenerator {
bool use_time_vars;
bool use_integer_vars;

Expand Down Expand Up @@ -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<AbstractTask> &task,
Expand Down
50 changes: 25 additions & 25 deletions src/search/operator_counting/delete_relaxation_rr_constraints.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<FactPair, FactPair> edge) const {
return e_ids.at(edge);
}

int DeleteRelaxationConstraintsRR::LPVariableIDs::has_e(
int DeleteRelaxationRRConstraints::LPVariableIDs::has_e(
pair<FactPair, FactPair> 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<AcyclicityType>("acyclicity_type")),
use_integer_vars(opts.get<bool>("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();
Expand Down Expand Up @@ -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<FactPair, FactPair> edge : ve_graph.get_edges()) {
Expand All @@ -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();
Expand All @@ -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();
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -500,7 +500,7 @@ void DeleteRelaxationConstraintsRR::create_constraints_tl(
}
}

void DeleteRelaxationConstraintsRR::initialize_constraints(
void DeleteRelaxationRRConstraints::initialize_constraints(
const shared_ptr<AbstractTask> &task, lp::LinearProgram &lp) {
TaskProxy task_proxy(*task);
LPVariableIDs lp_var_ids = create_auxiliary_variables(
Expand Down Expand Up @@ -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;
Expand All @@ -552,11 +552,11 @@ bool DeleteRelaxationConstraintsRR::update_constraints(
return false;
}

class DeleteRelaxationConstraintsRRFeature
class DeleteRelaxationRRConstraintsFeature
: public plugins::TypedFeature<ConstraintGenerator,
DeleteRelaxationConstraintsRR> {
DeleteRelaxationRRConstraints> {
public:
DeleteRelaxationConstraintsRRFeature()
DeleteRelaxationRRConstraintsFeature()
: TypedFeature("delete_relaxation_rr_constraints") {
document_title(
"Delete relaxation constraints from Rankooh and Rintanen");
Expand Down Expand Up @@ -616,7 +616,7 @@ class DeleteRelaxationConstraintsRRFeature
}
};

static plugins::FeaturePlugin<DeleteRelaxationConstraintsRRFeature> _plugin;
static plugins::FeaturePlugin<DeleteRelaxationRRConstraintsFeature> _plugin;

static plugins::TypedEnumPlugin<AcyclicityType> _enum_plugin({
{"time_labels",
Expand Down
Original file line number Diff line number Diff line change
@@ -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"

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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<AbstractTask> &task,
Expand Down

0 comments on commit 92060af

Please sign in to comment.