1#ifndef OPERATOR_COUNTING_DELETE_RELAXATION_IF_CONSTRAINTS_H
2#define OPERATOR_COUNTING_DELETE_RELAXATION_IF_CONSTRAINTS_H
4#include "downward/operator_counting/constraint_generator.h"
6#include "downward/task_proxy.h"
15namespace operator_counting {
16using LPConstraints = named_vector::NamedVector<lp::LPConstraint>;
17using LPVariables = named_vector::NamedVector<lp::LPVariable>;
19class DeleteRelaxationIFConstraints :
public ConstraintGenerator {
21 bool use_integer_vars;
25 std::vector<int> lp_var_id_op_used;
29 std::vector<std::vector<int>> lp_var_id_fact_reached;
33 std::vector<std::vector<std::vector<int>>> lp_var_id_first_achiever;
37 std::vector<int> lp_var_id_op_time;
41 std::vector<std::vector<int>> lp_var_id_fact_time;
45 std::vector<std::vector<int>> constraint_ids;
49 std::vector<FactPair> last_state;
51 int get_var_op_used(
const OperatorProxy& op);
52 int get_var_fact_reached(FactPair f);
53 int get_var_first_achiever(
const OperatorProxy& op, FactPair f);
54 int get_var_op_time(
const OperatorProxy& op);
55 int get_var_fact_time(FactPair f);
56 int get_constraint_id(FactPair f);
58 void create_auxiliary_variables(
59 const TaskProxy& task_proxy,
60 LPVariables& variables);
61 void create_constraints(
const TaskProxy& task_proxy, lp::LinearProgram& lp);
64 explicit DeleteRelaxationIFConstraints(
66 bool use_integer_vars);
68 virtual void initialize_constraints(
69 const std::shared_ptr<AbstractTask>& task,
70 lp::LinearProgram& lp)
override;
72 update_constraints(
const State& state, lp::LPSolver& lp_solver)
override;