77 std::vector<int>* postsolve_mapping);
94 CpSolverStatus InfeasibleStatus();
99 void InitializeMappingModelVariables();
102 bool ProcessChangedVariables(std::vector<bool>* in_queue,
103 std::deque<int>* queue);
104 void PresolveToFixPoint();
120 bool PresolveAllDiff(ConstraintProto*
ct);
121 bool PresolveAutomaton(ConstraintProto*
ct);
122 bool PresolveElement(ConstraintProto*
ct);
123 bool PresolveIntDiv(
int c, ConstraintProto*
ct);
124 bool PresolveIntMod(
int c, ConstraintProto*
ct);
125 bool PresolveIntProd(ConstraintProto*
ct);
126 bool PresolveInterval(
int c, ConstraintProto*
ct);
127 bool PresolveInverse(ConstraintProto*
ct);
128 bool DivideLinMaxByGcd(
int c, ConstraintProto*
ct);
129 bool PresolveLinMax(ConstraintProto*
ct);
130 bool PresolveLinMaxWhenAllBoolean(ConstraintProto*
ct);
131 bool PropagateAndReduceAffineMax(ConstraintProto*
ct);
132 bool PropagateAndReduceIntAbs(ConstraintProto*
ct);
133 bool PropagateAndReduceLinMax(ConstraintProto*
ct);
134 bool PresolveTable(ConstraintProto*
ct);
135 void DetectDuplicateIntervals(
136 int c, google::protobuf::RepeatedField<int32_t>* intervals);
137 bool PresolveCumulative(ConstraintProto*
ct);
138 bool PresolveNoOverlap(ConstraintProto*
ct);
139 bool PresolveNoOverlap2D(
int c, ConstraintProto*
ct);
140 bool PresolveReservoir(ConstraintProto*
ct);
142 bool PresolveCircuit(ConstraintProto*
ct);
143 bool PresolveRoutes(ConstraintProto*
ct);
145 bool PresolveAtMostOrExactlyOne(ConstraintProto*
ct);
146 bool PresolveAtMostOne(ConstraintProto*
ct);
147 bool PresolveExactlyOne(ConstraintProto*
ct);
149 bool PresolveBoolAnd(ConstraintProto*
ct);
150 bool PresolveBoolOr(ConstraintProto*
ct);
151 bool PresolveBoolXor(ConstraintProto*
ct);
152 bool PresolveEnforcementLiteral(ConstraintProto*
ct);
156 bool CanonicalizeLinearExpression(
const ConstraintProto&
ct,
157 LinearExpressionProto*
proto);
158 bool CanonicalizeLinearArgument(
const ConstraintProto&
ct,
159 LinearArgumentProto*
proto);
162 bool CanonicalizeLinear(ConstraintProto*
ct);
163 bool PropagateDomainsInLinear(
int ct_index, ConstraintProto*
ct);
164 bool RemoveSingletonInLinear(ConstraintProto*
ct);
165 bool PresolveSmallLinear(ConstraintProto*
ct);
166 bool PresolveLinearOfSizeOne(ConstraintProto*
ct);
167 bool PresolveLinearOfSizeTwo(ConstraintProto*
ct);
168 bool PresolveLinearOnBooleans(ConstraintProto*
ct);
169 bool PresolveDiophantine(ConstraintProto*
ct);
170 bool AddVarAffineRepresentativeFromLinearEquality(
int target_index,
171 ConstraintProto*
ct);
172 bool PresolveLinearEqualityWithModulo(ConstraintProto*
ct);
181 void TryToReduceCoefficientsOfLinearConstraint(
int c, ConstraintProto*
ct);
187 void ExtractEncodingFromLinear();
188 bool ProcessEncodingFromLinear(
int linear_encoding_ct_index,
189 const ConstraintProto& at_most_or_exactly_one,
190 int64_t* num_unique_terms,
191 int64_t* num_multiple_terms);
195 void DetectDuplicateConstraints();
196 void DetectDuplicateConstraintsWithDifferentEnforcements(
199 Trail* trail =
nullptr);
202 void DetectDifferentVariables();
206 void DetectDominatedLinearConstraints();
211 void ProcessAtMostOneAndLinear();
212 void ProcessOneLinearWithAmo(
int ct_index, ConstraintProto*
ct,
218 void ProcessSetPPC();
221 void DetectIncludedEnforcement();
225 bool ProcessSetPPCSubset(
int subset_c,
int superset_c,
226 absl::flat_hash_set<int>* tmp_set,
227 bool* remove_subset,
bool* remove_superset,
228 bool* stop_processing_superset);
232 bool PresolvePureSatPart();
235 void ExtractAtMostOneFromLinear(ConstraintProto*
ct);
238 bool DivideLinearByGcd(ConstraintProto*
ct);
240 void ExtractEnforcementLiteralFromLinearConstraint(
int ct_index,
241 ConstraintProto*
ct);
242 void LowerThanCoeffStrengthening(
bool from_lower_bound, int64_t min_magnitude,
243 int64_t rhs, ConstraintProto*
ct);
247 void TransformIntoMaxCliques();
250 void ConvertToBoolAnd();
255 void ExpandObjective();
263 void ShiftObjectiveWithExactlyOnes();
265 void MaybeTransferLinear1ToAnotherVariable(
int var);
266 void ProcessVariableOnlyUsedInEncoding(
int var);
267 void TryToSimplifyDomain(
int var);
269 void LookAtVariableWithDegreeTwo(
int var);
270 void ProcessVariableInTwoAtMostOrExactlyOne(
int var);
272 void MergeNoOverlapConstraints();
283 bool RemoveCommonPart(
284 const absl::flat_hash_map<int, int64_t>& common_var_coeff_map,
285 const std::vector<std::pair<int, int64_t>>& block,
292 void FindAlmostIdenticalLinearConstraints();
312 void EncodeAllAffineRelations();
313 bool PresolveAffineRelationIfAny(
int var);
315 bool ExploitEquivalenceRelations(
int c, ConstraintProto*
ct);
317 ABSL_MUST_USE_RESULT
bool RemoveConstraint(ConstraintProto*
ct);
318 ABSL_MUST_USE_RESULT
bool MarkConstraintAsFalse(ConstraintProto*
ct);
320 std::vector<int>* postsolve_mapping_;
326 std::vector<std::pair<int, int64_t>> tmp_terms_;
329 std::vector<std::array<int64_t, 2>> conditional_mins_;
330 std::vector<std::array<int64_t, 2>> conditional_maxs_;
334 absl::flat_hash_map<int, int> temp_map_;
335 absl::flat_hash_set<int> temp_set_;
336 ConstraintProto temp_ct_;
341 int64_t max_variation;
344 std::vector<RdEntry> rd_entries_;
345 std::vector<int> rd_vars_;
346 std::vector<int64_t> rd_coeffs_;
347 std::vector<int64_t> rd_magnitudes_;
348 std::vector<int64_t> rd_lbs_;
349 std::vector<int64_t> rd_ubs_;
350 std::vector<int64_t> rd_divisors_;
356 struct IntervalConstraintEq {
357 const CpModelProto* working_model;
358 bool operator()(
int a,
int b)
const;
361 struct IntervalConstraintHash {
362 const CpModelProto* working_model;
363 std::size_t operator()(
int ct_idx)
const;
369 absl::flat_hash_map<int, int, IntervalConstraintHash, IntervalConstraintEq>
370 interval_representative_;