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,
151 bool AddVarAffineRepresentativeFromLinearEquality(
int target_index,
159 bool ProcessSetPPC();
165 void ExtractEncodingFromLinear();
166 bool ProcessEncodingFromLinear(
int linear_encoding_ct_index,
168 int64_t* num_unique_terms,
169 int64_t* num_multiple_terms);
174 bool ProcessSetPPCSubset(
int c1,
int c2,
const std::vector<int>& c2_minus_c1,
175 const std::vector<int>& original_constraint_index,
176 std::vector<bool>* marked_for_removal);
178 void PresolvePureSatPart();
186 void ExtractEnforcementLiteralFromLinearConstraint(
int ct_index,
191 void TransformIntoMaxCliques();
194 void ExtractBoolAnd();
196 void ExpandObjective();
198 void TryToSimplifyDomain(
int var);
200 void MergeNoOverlapConstraints();
204 void EncodeAllAffineRelations();
205 bool PresolveAffineRelationIfAny(
int var);
212 std::vector<int>* postsolve_mapping_;
217 std::vector<std::pair<int, int64_t>> tmp_terms_;
245 const std::vector<int>& ignored_constraints,
246 bool first_copy =
false);
250 bool CreateUnsatModel();
272 int64_t skipped_non_zero_ = 0;
275 std::vector<int> non_fixed_variables_;
276 std::vector<int64_t> non_fixed_coefficients_;
277 absl::flat_hash_map<int, int> interval_mapping_;
278 int starting_constraint_index_ = 0;
279 std::vector<int> temp_enforcement_literals_;
280 std::vector<int> temp_literals_;
299 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, bool first_copy=false)
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.