14 #ifndef OR_TOOLS_FLATZINC_PRESOLVE_H_
15 #define OR_TOOLS_FLATZINC_PRESOLVE_H_
23 #include "absl/container/flat_hash_map.h"
24 #include "absl/container/flat_hash_set.h"
25 #include "absl/strings/match.h"
53 struct AffineMapping {
60 : variable(nullptr),
coefficient(0), offset(0), constraint(nullptr) {}
61 AffineMapping(Variable* v, int64_t c, int64_t o,
Constraint*
ct)
70 struct Array2DIndexMapping {
75 Constraint* constraint;
82 constraint(nullptr) {}
83 Array2DIndexMapping(Variable* v1, int64_t c, Variable* v2, int64_t o,
93 void SubstituteEverywhere(Model*
model);
94 void SubstituteAnnotation(Annotation* ann);
97 void PresolveBool2Int(Constraint*
ct);
98 void PresolveStoreAffineMapping(Constraint*
ct);
99 void PresolveStoreFlatteningMapping(Constraint*
ct);
100 void PresolveSimplifyElement(Constraint*
ct);
101 void PresolveSimplifyExprElement(Constraint*
ct);
104 void UpdateRuleStats(
const std::string& rule_name) {
105 successful_rules_[rule_name]++;
114 void AddVariableSubstitution(Variable* from, Variable* to);
115 Variable* FindRepresentativeOfVar(Variable*
var);
116 absl::flat_hash_map<const Variable*, Variable*> var_representative_map_;
117 std::vector<Variable*> var_representative_vector_;
120 absl::flat_hash_map<const Variable*, AffineMapping> affine_map_;
123 absl::flat_hash_map<const Variable*, Array2DIndexMapping> array2d_index_map_;
127 std::map<std::string, int> successful_rules_;
129 SolverLogger* logger_;
A constraint is the main modeling object.
Presolver(SolverLogger *logger)
Collection of objects used to extend the Constraint Solver library.