3#include "containers/ClauseBuffer.hpp"
4#include "containers/ClauseUtils.hpp"
6#include "utils/Threading.hpp"
10#include <unordered_map>
12#include "SolverCdclInterface.hpp"
17#include "cadical/src/cadical.hpp"
27 ,
public CaDiCaL::Learner
28 ,
public CaDiCaL::Terminator
32 Cadical(
int id,
const std::shared_ptr<ClauseDatabase>& clauseDB);
52 void diversify(
const SeedGenerator& getSeed)
override;
60 void addInitialClauses(
const std::vector<simpleClause>& clauses,
unsigned int nbVars)
override;
66 void addClauses(
const std::vector<ClauseExchangePtr>& clauses)
override;
77 void importClauses(
const std::vector<ClauseExchangePtr>& clauses)
override;
88 void setPhase(
const unsigned int var,
const bool phase)
override;
152 simpleClause tempClause;
158 ClauseExchangePtr tempClauseToImport;
Implements the different interfaces to interact with the Cadical CDCL solver.
Definition Cadical.hpp:29
ClauseBuffer clausesToAdd
Buffer used to add permanent clauses.
Definition Cadical.hpp:115
void setSolverInterrupt() override
Interrupt resolution, solving cannot continue until interrupt is unset.
std::unique_ptr< CaDiCaL::Solver > solver
Pointer to a Cadical solver.
Definition Cadical.hpp:112
bool importClause(const ClauseExchangePtr &clause) override
Add a learned clause to the formula.
std::atomic< bool > stopSolver
Used to stop or continue the resolution.
Definition Cadical.hpp:118
void initCadicalOptions()
Initializes the map CadicalOptions with the default configuration.
void addClause(ClauseExchangePtr clause) override
Add a permanent clause to the formula.
void printWinningLog() override
Print the winning log.
int getDivisionVariable() override
Get a variable suitable for search splitting.
void addInitialClauses(const std::vector< simpleClause > &clauses, unsigned int nbVars) override
Add a list of initial clauses to the formula.
void diversify(const SeedGenerator &getSeed) override
Native diversification.
void unsetSolverInterrupt() override
Remove the SAT solving interrupt request.
SatResult solve(const std::vector< int > &cube) override
Solve the formula with a given cube.
void addClauses(const std::vector< ClauseExchangePtr > &clauses) override
Add a list of permanent clauses to the formula.
void setPhase(const unsigned int var, const bool phase) override
Set initial phase for a given variable.
unsigned int getVariablesCount() override
Get the number of variables of the current resolution.
void getClauseToImport(std::vector< int > &clause, int &glue) override
Loads the clause to import data in the parameters.
Cadical(int id, const std::shared_ptr< ClauseDatabase > &clauseDB)
Constructor.
virtual ~Cadical()
Destructor.
bool learning(int size, int glue) override
Tells if CaDiCaL should export a clause.
std::vector< int > getSatAssumptions() override
Get current assumptions.
void bumpVariableActivity(const int var, const int times) override
Bump activity of a given variable.
std::vector< int > getFinalAnalysis() override
Get the final analysis in case of UNSAT result.
std::unordered_map< std::string, int > cadicalOptions
A map mapping a Cadical option name to its value.
Definition Cadical.hpp:108
void importClauses(const std::vector< ClauseExchangePtr > &clauses) override
Add a list of learned clauses to the formula.
void learn(int lit) override
Used by the base solver to export a clause.
void printStatistics() override
Get solver statistics.
void loadFormula(const char *filename) override
Load formula from a given dimacs file, return false if failed.
std::vector< int > getModel() override
Return the model in case of SAT result.
bool hasClauseToImport() override
Tells if CaDiCaL has a clause to import.
Wrapper for boost::lockfree::queue to manage ClauseExchange objects.
Definition ClauseBuffer.hpp:26
Interface for CDCL (Conflict-Driven Clause Learning) solvers This class provides a common interface f...
Definition SolverCdclInterface.hpp:58
SatResult
Enumeration for SAT solver results.
Definition SolverInterface.hpp:39