AI 24/25 Project Software
Documentation for the AI 24/25 course programming project software
Loading...
Searching...
No Matches
state_equation_constraints.h
1#ifndef OPERATOR_COUNTING_STATE_EQUATION_CONSTRAINTS_H
2#define OPERATOR_COUNTING_STATE_EQUATION_CONSTRAINTS_H
3
4#include "downward/operator_counting/constraint_generator.h"
5
6#include "downward/utils/logging.h"
7
8#include <set>
9
10class TaskProxy;
11
12namespace lp {
13class LPConstraint;
14}
15
16namespace operator_counting {
17/* A proposition is an atom of the form Var = Val. It stores the index of the
18 constraint representing it in the LP */
19struct Proposition {
20 int constraint_index;
21 std::set<int> always_produced_by;
22 std::set<int> sometimes_produced_by;
23 std::set<int> always_consumed_by;
24
25 Proposition()
26 : constraint_index(-1)
27 {
28 }
29 ~Proposition() = default;
30};
31
32class StateEquationConstraints : public ConstraintGenerator {
33 mutable utils::LogProxy log;
34 std::vector<std::vector<Proposition>> propositions;
35 // Map goal variables to their goal value and other variables to max int.
36 std::vector<int> goal_state;
37
38 void build_propositions(const TaskProxy& task_proxy);
39 void add_constraints(
40 named_vector::NamedVector<lp::LPConstraint>& constraints,
41 double infinity);
42
43public:
44 explicit StateEquationConstraints(utils::Verbosity verbosity);
45 virtual void initialize_constraints(
46 const std::shared_ptr<AbstractTask>& task,
47 lp::LinearProgram& lp) override;
48 virtual bool
49 update_constraints(const State& state, lp::LPSolver& lp_solver) override;
50};
51} // namespace operator_counting
52
53#endif