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"
37#include "ortools/sat/sat_parameters.pb.h"
55 absl::Span<const Literal> clause);
101 params_(*
model->GetOrCreate<SatParameters>()),
111 blocked_clause_simplifier_(
113 bounded_variable_elimination_(
154 const SatParameters& params_;
169 bool first_inprocessing_call_ =
true;
170 double reference_dtime_ = 0.0;
171 double total_dtime_ = 0.0;
180 int64_t last_num_redundant_literals_ = 0;
181 int64_t last_num_fixed_variables_ = 0;
224 return first_stamps_[
a.Index()] < first_stamps_[
b.Index()] &&
225 last_stamps_[
b.Index()] < last_stamps_[
a.Index()];
238 bool stamps_are_already_computed_ =
false;
242 int64_t num_subsumed_clauses_ = 0;
243 int64_t num_removed_literals_ = 0;
244 int64_t num_fixed_ = 0;
252 std::vector<LiteralIndex> children_;
256 std::vector<LiteralIndex> dfs_stack_;
286 void InitializeForNewRound();
287 void ProcessLiteral(
Literal current_literal);
288 bool ClauseIsBlocked(
Literal current_literal,
289 absl::Span<const Literal> clause);
298 int32_t num_blocked_clauses_ = 0;
299 int64_t num_inspected_literals_ = 0;
307 std::deque<Literal> queue_;
320 : parameters_(*
model->GetOrCreate<SatParameters>()),
331 int NumClausesContaining(
Literal l);
332 void UpdatePriorityQueue(BooleanVariable
var);
333 bool CrossProduct(BooleanVariable
var);
334 void DeleteClause(
SatClause* sat_clause);
336 void AddClause(absl::Span<const Literal> clause);
345 template <
bool score_only,
bool with_binary_only>
348 const SatParameters& parameters_;
356 int propagation_index_;
359 int64_t num_inspected_literals_ = 0;
360 int64_t num_simplifications_ = 0;
361 int64_t num_blocked_clauses_ = 0;
362 int64_t num_eliminated_variables_ = 0;
363 int64_t num_literals_diff_ = 0;
364 int64_t num_clauses_diff_ = 0;
367 int64_t score_threshold_;
371 std::vector<Literal> resolvant_;
375 struct VariableWithPriority {
380 int Index()
const {
return var.value(); }
381 bool operator<(
const VariableWithPriority& o)
const {
382 return priority < o.priority;
385 IntegerPriorityQueue<VariableWithPriority> queue_;
389 std::vector<BooleanVariable> need_to_be_updated_;
BlockedClauseSimplifier(Model *model)
void DoOneRound(bool log_info)
BoundedVariableElimination(Model *model)
bool DoOneRound(bool log_info)
bool SubsumeAndStrenghtenRound(bool log_info)
bool DetectEquivalencesAndStamp(bool use_transitive_reduction, bool log_info)
bool MoreFixedVariableToClean() const
bool RemoveFixedAndEquivalentVariables(bool log_info)
bool MoreRedundantVariableToClean() const
bool PresolveLoop(SatPresolveOptions options)
void ProvideLogger(SolverLogger *logger)
A bit hacky. Only needed during refactoring.
Inprocessing(Model *model)
bool LevelZeroPropagate()
A class that stores the collection of all LP constraints in a model.
bool ComputeStampsForNextRound(bool log_info)
bool ImplicationIsInTree(Literal a, Literal b) const
StampingSimplifier(Model *model)
void SampleTreeAndFillParent()
Visible for testing.
bool DoOneRound(bool log_info)
In SWIG mode, we don't want anything besides these top-level includes.
#define DEFINE_STRONG_INDEX_TYPE(index_type_name)
std::deque< std::vector< Literal > > clauses
void AddClauseWithSpecialLiteral(Literal literal, absl::Span< const Literal > clause)
double deterministic_time_limit
The time budget to spend.
bool use_transitive_reduction
bool extract_binary_clauses_in_probing
See ProbingOptions in probing.h.