21#ifndef OR_TOOLS_SAT_SAT_INPROCESSING_H_
22#define OR_TOOLS_SAT_SAT_INPROCESSING_H_
28#include "absl/strings/string_view.h"
29#include "absl/types/span.h"
36#include "ortools/sat/sat_parameters.pb.h"
54 absl::Span<const Literal> clause);
107 blocked_clause_simplifier_(
109 bounded_variable_elimination_(
155 double total_dtime_ = 0.0;
164 int64_t last_num_redundant_literals_ = 0;
165 int64_t last_num_fixed_variables_ = 0;
208 return first_stamps_[
a.Index()] < first_stamps_[
b.Index()] &&
209 last_stamps_[
b.Index()] < last_stamps_[
a.Index()];
222 bool stamps_are_already_computed_ =
false;
226 int64_t num_subsumed_clauses_ = 0;
227 int64_t num_removed_literals_ = 0;
228 int64_t num_fixed_ = 0;
236 std::vector<LiteralIndex> children_;
240 std::vector<LiteralIndex> dfs_stack_;
270 void InitializeForNewRound();
271 void ProcessLiteral(
Literal current_literal);
272 bool ClauseIsBlocked(
Literal current_literal,
273 absl::Span<const Literal> clause);
282 int32_t num_blocked_clauses_ = 0;
283 int64_t num_inspected_literals_ = 0;
291 std::deque<Literal> queue_;
295 DEFINE_STRONG_INDEX_TYPE(rat_literal_clause_index);
304 : parameters_(*
model->GetOrCreate<SatParameters>()),
315 int NumClausesContaining(
Literal l);
316 void UpdatePriorityQueue(BooleanVariable
var);
317 bool CrossProduct(BooleanVariable
var);
318 void DeleteClause(
SatClause* sat_clause);
320 void AddClause(absl::Span<const Literal> clause);
329 template <
bool score_only,
bool with_binary_only>
330 bool ResolveAllClauseContaining(
Literal lit);
332 const SatParameters& parameters_;
340 int propagation_index_;
343 int64_t num_inspected_literals_ = 0;
344 int64_t num_simplifications_ = 0;
345 int64_t num_blocked_clauses_ = 0;
346 int64_t num_eliminated_variables_ = 0;
347 int64_t num_literals_diff_ = 0;
348 int64_t num_clauses_diff_ = 0;
351 int64_t score_threshold_;
355 std::vector<Literal> resolvant_;
359 struct VariableWithPriority {
364 int Index()
const {
return var.value(); }
365 bool operator<(
const VariableWithPriority& o)
const {
366 return priority < o.priority;
369 IntegerPriorityQueue<VariableWithPriority> queue_;
373 std::vector<BooleanVariable> need_to_be_updated_;
378 DEFINE_STRONG_INDEX_TYPE(ClauseIndex);
An Assignment is a variable -> domains mapping, used to report solutions to the user.
A simple class to enforce both an elapsed time limit and a deterministic time limit in the same threa...
BlockedClauseSimplifier(Model *model)
void DoOneRound(bool log_info)
bool DoOneRound(bool log_info)
BoundedVariableElimination(Model *model)
bool PresolveLoop(SatPresolveOptions options)
bool MoreFixedVariableToClean() const
bool RemoveFixedAndEquivalentVariables(bool log_info)
bool LevelZeroPropagate()
Inprocessing(Model *model)
bool MoreRedundantVariableToClean() const
bool SubsumeAndStrenghtenRound(bool log_info)
bool DetectEquivalencesAndStamp(bool use_transitive_reduction, bool log_info)
Class that owns everything related to a particular optimization model.
bool DoOneRound(bool log_info)
bool ComputeStampsForNextRound(bool log_info)
bool ImplicationIsInTree(Literal a, Literal b) const
StampingSimplifier(Model *model)
void SampleTreeAndFillParent()
Collection of objects used to extend the Constraint Solver library.
std::deque< std::vector< Literal > > clauses
void AddClauseWithSpecialLiteral(Literal literal, absl::Span< const Literal > clause)
bool use_transitive_reduction
bool extract_binary_clauses_in_probing
double deterministic_time_limit