3#include "containers/ClauseBuffer.hpp"
4#include "containers/ClauseDatabase.hpp"
7#include <unordered_map>
47 explicit ClauseDatabaseMallob(
int maxClauseSize,
int maxPartitioningLbd,
size_t maxCapacity,
int maxFreeSize);
76 size_t giveSelection(std::vector<ClauseExchangePtr>& selectedCls,
unsigned int literalCountLimit)
override;
83 void getClauses(std::vector<ClauseExchangePtr>& v_cls)
override;
145 if (size < UNIT_SIZE || lbd < MIN_LBD)
146 throw std::invalid_argument(
"size is less than 1 or lbd is less than 2");
Wrapper for boost::lockfree::queue to manage ClauseExchange objects.
Definition ClauseBuffer.hpp:26
A clause database implementation attempting to naively mimic the Simplified Adaptive Database from Ma...
Definition ClauseDatabaseMallob.hpp:33
size_t getSize() const override
Gets the total number of clauses in the database.
size_t shrinkDatabase() override
Shrinks the database by removing clauses to maintain the size within capacity.
void getClauses(std::vector< ClauseExchangePtr > &v_cls) override
Fills a buffer with all clauses in the database.
int getLbdPartitionFromIndex(unsigned index) const
Calculates the LBD partition from an index.
Definition ClauseDatabaseMallob.hpp:164
std::shared_mutex m_shrinkMutex
Mutex used to coordinate shrinking and clause addition.
Definition ClauseDatabaseMallob.hpp:174
~ClauseDatabaseMallob() override
Virtual destructor.
const int m_maxPartitioningLbd
Maximum LBD value for separate partitioning.
Definition ClauseDatabaseMallob.hpp:167
bool addClause(ClauseExchangePtr clause) override
Adds a clause to the database.
unsigned getIndex(int size, int lbd) const
Calculates the index for a clause based on its size and LBD.
Definition ClauseDatabaseMallob.hpp:143
int getSizeFromIndex(unsigned index) const
Calculates the size of a clause from its index.
Definition ClauseDatabaseMallob.hpp:156
std::vector< std::unique_ptr< ClauseBuffer > > m_clauses
Vector of clause buffers, indexed by size and LBD.
Definition ClauseDatabaseMallob.hpp:171
const size_t m_totalLiteralCapacity
Maximum total literal capacity of the database.
Definition ClauseDatabaseMallob.hpp:166
const int m_maxClauseSize
Maximum size of clauses to be stored.
Definition ClauseDatabaseMallob.hpp:168
bool getOneClause(ClauseExchangePtr &cls) override
Retrieves a single clause from the best (smallest index) buffer possible.
const int m_freeMaxSize
Maximum size for which giveSelection does not count in while filling exportBuffer.
Definition ClauseDatabaseMallob.hpp:169
ClauseDatabaseMallob(int maxClauseSize, int maxPartitioningLbd, size_t maxCapacity, int maxFreeSize)
Constructs a new ClauseDatabaseMallob object.
size_t giveSelection(std::vector< ClauseExchangePtr > &selectedCls, unsigned int literalCountLimit) override
Fills a buffer with selected clauses up to a given size limit.
std::atomic< long > m_currentLiteralSize
Current number of literals in the database (excluding unit clauses).
Definition ClauseDatabaseMallob.hpp:172
std::atomic< int > m_currentWorstIndex
Index of the current worst clause in the database.
Definition ClauseDatabaseMallob.hpp:173
void clearDatabase() override
Clears all clauses from the database and resets internal counters.
Abstract base class defining the interface for clause storage and management.
Definition ClauseDatabase.hpp:27