154 : postsolver_(postsolver), num_trivial_clauses_(0), logger_(logger) {}
167 equiv_mapping_ = mapping;
173 void AddClause(absl::Span<const Literal> clause);
184 bool Presolve(
const std::vector<bool>& var_that_can_be_removed);
195 int NumVariables()
const {
return literal_to_clause_sizes_.size() / 2; }
231 bool ProcessClauseToSimplifyOthersUsingLiteral(
ClauseIndex clause_index,
237 void AddClauseInternal(std::vector<Literal>* clause);
241 void RebuildLiteralToClauses();
246 void RemoveAllClauseContaining(
Literal x,
bool register_for_postsolve);
252 bool ProcessAllClauses();
256 Literal FindLiteralWithShortestOccurrenceList(
257 absl::Span<const Literal> clause);
258 LiteralIndex FindLiteralWithShortestOccurrenceListExcluding(
259 const std::vector<Literal>& clause,
Literal to_exclude);
271 void SimpleBva(LiteralIndex l);
274 void DisplayStats(
double elapsed_seconds);
279 uint64_t ComputeSignatureOfClauseVariables(
ClauseIndex ci);
284 void InitializePriorityQueue();
285 void UpdatePriorityQueue(BooleanVariable var);
287 PQElement() : heap_index(-1), variable(-1), weight(0.0) {}
290 void SetHeapIndex(
int h) { heap_index = h; }
291 int GetHeapIndex()
const {
return heap_index; }
295 bool operator<(
const PQElement& other)
const {
296 return weight > other.weight;
300 BooleanVariable variable;
303 util_intops::StrongVector<BooleanVariable, PQElement> var_pq_elements_;
304 AdjustablePriorityQueue<PQElement> var_pq_;
308 void InitializeBvaPriorityQueue();
309 void UpdateBvaPriorityQueue(LiteralIndex lit);
310 void AddToBvaPriorityQueue(LiteralIndex lit);
311 struct BvaPqElement {
312 BvaPqElement() : heap_index(-1), literal(-1), weight(0.0) {}
315 void SetHeapIndex(
int h) { heap_index = h; }
316 int GetHeapIndex()
const {
return heap_index; }
320 bool operator<(
const BvaPqElement& other)
const {
321 return weight < other.weight;
325 LiteralIndex literal;
328 std::deque<BvaPqElement> bva_pq_elements_;
329 AdjustablePriorityQueue<BvaPqElement> bva_pq_;
332 absl::btree_set<LiteralIndex> m_lit_;
333 std::vector<ClauseIndex> m_cls_;
334 util_intops::StrongVector<LiteralIndex, int> literal_to_p_size_;
335 std::vector<std::pair<LiteralIndex, ClauseIndex>> flattened_p_;
336 std::vector<Literal> tmp_new_clause_;
340 std::vector<bool> in_clause_to_process_;
341 std::deque<ClauseIndex> clause_to_process_;
345 std::vector<std::vector<Literal>> clauses_;
348 std::vector<uint64_t> signatures_;
349 int64_t num_inspected_signatures_ = 0;
350 int64_t num_inspected_literals_ = 0;
357 int64_t num_deleted_literals_since_last_cleanup_ = 0;
358 util_intops::StrongVector<LiteralIndex, std::vector<ClauseIndex>>
363 util_intops::StrongVector<LiteralIndex, int> literal_to_clause_sizes_;
366 SatPostsolver* postsolver_;
369 util_intops::StrongVector<LiteralIndex, LiteralIndex> equiv_mapping_;
371 int num_trivial_clauses_;
372 SatParameters parameters_;
373 TimeLimit* time_limit_ =
nullptr;
374 SolverLogger* logger_;
SatPostsolver & operator=(const SatPostsolver &)=delete
std::vector< Literal > Clause(int i) const
const VariablesAssignment & assignment()
std::vector< bool > PostsolveSolution(const std::vector< bool > &solution)
void ApplyMapping(const util_intops::StrongVector< BooleanVariable, BooleanVariable > &mapping)
SatPostsolver(int num_variables)
void Add(Literal x, absl::Span< const Literal > clause)
SatPostsolver(const SatPostsolver &)=delete
std::vector< bool > ExtractAndPostsolveSolution(const SatSolver &solver)