248 bool AddConstraint(absl::Span<const Literal> enforcement_literals,
249 absl::Span<const IntegerVariable> vars,
250 absl::Span<const IntegerValue> coeffs,
251 IntegerValue upper_bound);
257 push_affine_ub_for_binary_relations_ =
true;
268 struct ConstraintInfo {
269 unsigned int enf_status : 2;
271 unsigned int all_coeffs_are_one : 1;
272 unsigned int initial_size : 29;
274 EnforcementId enf_id;
277 IntegerValue rev_rhs;
280 static_assert(
sizeof(ConstraintInfo) == 24,
281 "ERROR_ConstraintInfo_is_not_well_compacted");
283 absl::Span<IntegerValue> GetCoeffs(
const ConstraintInfo& info);
284 absl::Span<IntegerVariable> GetVariables(
const ConstraintInfo& info);
288 void OnVariableChange(IntegerVariable var, IntegerValue lb,
int id);
291 ABSL_MUST_USE_RESULT
bool PropagateOneConstraint(
int id);
292 ABSL_MUST_USE_RESULT
bool PropagateInfeasibleConstraint(
int id,
294 ABSL_MUST_USE_RESULT
bool ReportConflictingCycle();
295 ABSL_MUST_USE_RESULT
bool DisassembleSubtree(
int root_id,
int num_tight);
302 std::pair<IntegerValue, IntegerValue> GetCycleCoefficients(
303 int id, IntegerVariable var, IntegerVariable next_var);
308 std::pair<IntegerValue, int> AnalyzeConstraint(
int id);
310 void ClearPropagatedBy();
311 void CanonicalizeConstraint(
int id);
312 void AddToQueueIfNeeded(
int id);
313 void SetPropagatedBy(IntegerVariable var,
int id);
314 std::string ConstraintDebugString(
int id);
318 IntegerTrail* integer_trail_;
319 EnforcementPropagator* enforcement_propagator_;
320 EnforcementHelper* enforcement_helper_;
321 GenericLiteralWatcher* watcher_;
323 RevIntRepository* rev_int_repository_;
324 RevIntegerValueRepository* rev_integer_value_repository_;
325 EnforcedLinear2Bounds* precedences_;
326 Linear2BoundsFromLinear3* linear3_bounds_;
327 ModelRandomGenerator* random_;
328 SharedStatistics* shared_stats_ =
nullptr;
329 const int watcher_id_;
331 bool push_affine_ub_for_binary_relations_ =
false;
334 int previous_level_ = 0;
343 std::deque<ConstraintInfo> infos_;
344 std::vector<IntegerValue> initial_rhs_;
347 std::vector<IntegerVariable> variables_buffer_;
348 std::vector<IntegerValue> coeffs_buffer_;
349 std::vector<IntegerValue> buffer_of_ones_;
352 std::vector<IntegerValue> max_variations_;
355 std::vector<IntegerLiteral> integer_reason_;
356 std::vector<IntegerValue> reason_coeffs_;
357 std::vector<Literal> literal_reason_;
361 std::deque<int> propagation_queue_;
364 ConstraintPropagationOrder order_;
368 int rev_unenforced_size_ = 0;
369 std::vector<int> unenforced_constraints_;
374 var_to_constraint_ids_;
381 std::vector<int> id_to_propagation_count_;
384 struct DissasembleQueueEntry {
387 IntegerValue increase;
389 std::vector<DissasembleQueueEntry> disassemble_queue_;
390 std::vector<DissasembleQueueEntry> disassemble_branch_;
391 std::vector<std::pair<IntegerVariable, IntegerValue>> disassemble_candidates_;
394 int64_t num_terms_for_dtime_update_ = 0;
397 int64_t num_pushes_ = 0;
398 int64_t num_enforcement_pushes_ = 0;
399 int64_t num_cycles_ = 0;
400 int64_t num_failed_cycles_ = 0;
401 int64_t num_short_reasons_ = 0;
402 int64_t num_long_reasons_ = 0;
403 int64_t num_scanned_ = 0;
404 int64_t num_explored_in_disassemble_ = 0;
405 int64_t num_delayed_ = 0;
406 int64_t num_bool_aborts_ = 0;
407 int64_t num_loop_aborts_ = 0;
408 int64_t num_ignored_ = 0;