80 absl::Span<const Literal> enforcement,
85 std::vector<Literal>* reason)
const;
90 EnforcementId
id, absl::Span<const Literal> literal_reason,
91 absl::Span<const IntegerLiteral> integer_reason);
101 if (
id < 0)
return {};
106 absl::Span<Literal> GetSpan(EnforcementId
id);
107 absl::Span<const Literal> GetSpan(EnforcementId
id)
const;
112 LiteralIndex ProcessIdOnTrue(
Literal watched, EnforcementId
id);
124 std::vector<Literal> buffer_;
132 std::vector<std::pair<EnforcementId, EnforcementStatus>> untrail_stack_;
133 int rev_stack_size_ = 0;
134 int64_t rev_stamp_ = 0;
140 std::vector<Literal> temp_literals_;
141 std::vector<Literal> temp_reason_;
313 bool AddConstraint(absl::Span<const Literal> enforcement_literals,
314 absl::Span<const IntegerVariable> vars,
315 absl::Span<const IntegerValue> coeffs,
319 void Explain(
int id, IntegerValue propagation_slack,
320 IntegerVariable var_to_explain,
int trail_index,
321 std::vector<Literal>* literals_reason,
322 std::vector<int>* trail_indices_reason)
final;
332 struct ConstraintInfo {
333 unsigned int enf_status : 2;
335 unsigned int all_coeffs_are_one : 1;
336 unsigned int initial_size : 29;
338 EnforcementId enf_id;
341 IntegerValue rev_rhs;
344 static_assert(
sizeof(ConstraintInfo) == 24,
345 "ERROR_ConstraintInfo_is_not_well_compacted");
347 absl::Span<IntegerValue> GetCoeffs(
const ConstraintInfo& info);
348 absl::Span<IntegerVariable> GetVariables(
const ConstraintInfo& info);
352 void OnVariableChange(IntegerVariable
var, IntegerValue lb,
int id);
355 ABSL_MUST_USE_RESULT
bool PropagateOneConstraint(
int id);
356 ABSL_MUST_USE_RESULT
bool PropagateInfeasibleConstraint(
int id,
358 ABSL_MUST_USE_RESULT
bool ReportConflictingCycle();
359 ABSL_MUST_USE_RESULT
bool DisassembleSubtree(
int root_id,
int num_tight);
366 std::pair<IntegerValue, IntegerValue> GetCycleCoefficients(
367 int id, IntegerVariable
var, IntegerVariable next_var);
372 std::pair<IntegerValue, int> AnalyzeConstraint(
int id);
374 void ClearPropagatedBy();
375 void CanonicalizeConstraint(
int id);
376 void AddToQueueIfNeeded(
int id);
377 void SetPropagatedBy(IntegerVariable
var,
int id);
378 std::string ConstraintDebugString(
int id);
391 const int watcher_id_;
394 int previous_level_ = 0;
403 std::deque<ConstraintInfo> infos_;
404 std::vector<IntegerValue> initial_rhs_;
407 std::vector<IntegerVariable> variables_buffer_;
408 std::vector<IntegerValue> coeffs_buffer_;
409 std::vector<IntegerValue> buffer_of_ones_;
412 std::vector<IntegerValue> max_variations_;
415 std::vector<IntegerLiteral> integer_reason_;
416 std::vector<IntegerValue> reason_coeffs_;
417 std::vector<Literal> literal_reason_;
421 std::deque<int> propagation_queue_;
428 int rev_unenforced_size_ = 0;
429 std::vector<int> unenforced_constraints_;
434 var_to_constraint_ids_;
441 std::vector<int> id_to_propagation_count_;
444 struct DissasembleQueueEntry {
447 IntegerValue increase;
449 std::vector<DissasembleQueueEntry> disassemble_queue_;
450 std::vector<DissasembleQueueEntry> disassemble_branch_;
451 std::vector<std::pair<IntegerVariable, IntegerValue>> disassemble_candidates_;
454 int64_t num_terms_for_dtime_update_ = 0;
457 int64_t num_pushes_ = 0;
458 int64_t num_enforcement_pushes_ = 0;
459 int64_t num_cycles_ = 0;
460 int64_t num_failed_cycles_ = 0;
461 int64_t num_short_reasons_ = 0;
462 int64_t num_long_reasons_ = 0;
463 int64_t num_scanned_ = 0;
464 int64_t num_explored_in_disassemble_ = 0;
465 int64_t num_delayed_ = 0;
466 int64_t num_bool_aborts_ = 0;
467 int64_t num_loop_aborts_ = 0;
468 int64_t num_ignored_ = 0;