14#ifndef OR_TOOLS_SAT_CP_MODEL_PRESOLVE_H_
15#define OR_TOOLS_SAT_CP_MODEL_PRESOLVE_H_
41 const PresolveContext&
context);
67 std::vector<int>* postsolve_mapping);
87 void PresolveToFixPoint();
134 template <
typename ProtoWithVarsAndCoeffs>
136 ProtoWithVarsAndCoeffs*
proto,
150 bool AddVarAffineRepresentativeFromLinearEquality(
int target_index,
158 bool ProcessSetPPC();
164 void ExtractEncodingFromLinear();
165 bool ProcessEncodingFromLinear(
int linear_encoding_ct_index,
167 int64_t* num_unique_terms,
168 int64_t* num_multiple_terms);
173 bool ProcessSetPPCSubset(
int c1,
int c2,
const std::vector<int>& c2_minus_c1,
174 const std::vector<int>& original_constraint_index,
175 std::vector<bool>* marked_for_removal);
177 void PresolvePureSatPart();
185 void ExtractEnforcementLiteralFromLinearConstraint(
int ct_index,
190 void TransformIntoMaxCliques();
193 void ExtractBoolAnd();
195 void ExpandObjective();
197 void TryToSimplifyDomain(
int var);
199 void MergeNoOverlapConstraints();
203 void EncodeAllAffineRelations();
204 bool PresolveAffineRelationIfAny(
int var);
211 std::vector<int>* postsolve_mapping_;
216 std::vector<std::pair<int, int64_t>> tmp_terms_;
241 const std::vector<int>& ignored_constraints);
245 bool CreateUnsatModel();
260 int64_t skipped_non_zero_ = 0;
263 std::vector<int> non_fixed_variables_;
264 std::vector<int64_t> non_fixed_coefficients_;
265 absl::flat_hash_map<int, int> interval_mapping_;
266 int starting_constraint_index_ = 0;
267 std::vector<int> temp_enforcement_literals_;
268 std::vector<int> temp_literals_;
283 std::vector<int>* postsolve_mapping);
CpSolverStatus Presolve()
void RemoveEmptyConstraints()
CpModelPresolver(PresolveContext *context, std::vector< int > *postsolve_mapping)
bool PresolveOneConstraint(int c)
ModelCopy(PresolveContext *context)
bool ImportAndSimplifyConstraints(const CpModelProto &in_model, const std::vector< int > &ignored_constraints)
CpModelProto const * model_proto
GurobiMPCallbackContext * context
void CopyEverythingExceptVariablesAndConstraintsFieldsIntoContext(const CpModelProto &in_model, PresolveContext *context)
bool ImportConstraintsWithBasicPresolveIntoContext(const CpModelProto &in_model, PresolveContext *context)
std::vector< std::pair< int, int > > FindDuplicateConstraints(const CpModelProto &model_proto)
CpSolverStatus PresolveCpModel(PresolveContext *context, std::vector< int > *postsolve_mapping)
void ApplyVariableMapping(const std::vector< int > &mapping, const PresolveContext &context)
Collection of objects used to extend the Constraint Solver library.