14 #ifndef OR_TOOLS_FLATZINC_PRESOLVE_H_ 15 #define OR_TOOLS_FLATZINC_PRESOLVE_H_ 21 #include "absl/container/flat_hash_map.h" 22 #include "absl/container/flat_hash_set.h" 23 #include "absl/strings/match.h" 51 struct AffineMapping {
58 : variable(nullptr),
coefficient(0), offset(0), constraint(nullptr) {}
59 AffineMapping(Variable* v, int64_t c, int64_t o,
Constraint*
ct)
68 struct Array2DIndexMapping {
73 Constraint* constraint;
80 constraint(nullptr) {}
81 Array2DIndexMapping(Variable* v1, int64_t c, Variable* v2, int64_t o,
91 void SubstituteEverywhere(Model*
model);
92 void SubstituteAnnotation(Annotation* ann);
95 void PresolveBool2Int(Constraint*
ct);
96 void PresolveStoreAffineMapping(Constraint*
ct);
97 void PresolveStoreFlatteningMapping(Constraint*
ct);
98 void PresolveSimplifyElement(Constraint*
ct);
99 void PresolveSimplifyExprElement(Constraint*
ct);
102 void UpdateRuleStats(
const std::string& rule_name) {
103 successful_rules_[rule_name]++;
112 void AddVariableSubstitution(Variable* from, Variable* to);
113 Variable* FindRepresentativeOfVar(Variable*
var);
114 absl::flat_hash_map<const Variable*, Variable*> var_representative_map_;
115 std::vector<Variable*> var_representative_vector_;
118 absl::flat_hash_map<const Variable*, AffineMapping> affine_map_;
121 absl::flat_hash_map<const Variable*, Array2DIndexMapping> array2d_index_map_;
125 std::map<std::string, int> successful_rules_;
127 SolverLogger* logger_;
132 #endif // OR_TOOLS_FLATZINC_PRESOLVE_H_
Presolver(SolverLogger *logger)
A constraint is the main modeling object.
Collection of objects used to extend the Constraint Solver library.