Interface for a SAT solver with standard features. More...
#include <SolverInterface.hpp>
Public Member Functions | |
virtual unsigned int | getVariablesCount ()=0 |
Get the current number of variables. | |
virtual int | getDivisionVariable ()=0 |
Get a variable suitable for search splitting. | |
virtual void | setSolverInterrupt ()=0 |
Interrupt resolution, solving cannot continue until interrupt is unset. | |
virtual void | unsetSolverInterrupt ()=0 |
Remove the SAT solving interrupt request. | |
virtual void | printWinningLog () |
Print the winning log. | |
virtual SatResult | solve (const std::vector< int > &cube)=0 |
Solve the formula with a given cube. | |
virtual void | addClause (ClauseExchangePtr clause)=0 |
Add a permanent clause to the formula. | |
virtual void | addClauses (const std::vector< ClauseExchangePtr > &clauses)=0 |
Add a list of permanent clauses to the formula. | |
virtual void | addInitialClauses (const std::vector< simpleClause > &clauses, unsigned int nbVars)=0 |
Add a list of initial clauses to the formula. | |
virtual void | loadFormula (const char *filename)=0 |
Load formula from a given dimacs file. | |
virtual void | printStatistics () |
Print solver statistics. | |
virtual std::vector< int > | getModel ()=0 |
Return the model in case of SAT result. | |
virtual void | printParameters () |
Print the parameters set for a solver. | |
virtual void | diversify (const SeedGenerator &getSeed=[](SolverInterface *s) { return s->getSolverId();})=0 |
Perform native diversification. The Default lambda returns the solver ID. | |
bool | isInitialized () |
Check if the solver is initialized. | |
void | setInitialized (bool value) |
Set the initialization status of the solver. | |
SolverAlgorithmType | getAlgoType () |
Get the algorithm type of the solver. | |
unsigned int | getSolverTypeId () |
Get the solver type ID. | |
void | setSolverTypeId (unsigned int typeId) |
Set the solver type ID. | |
unsigned int | getSolverId () |
Get the solver ID. | |
void | setSolverId (unsigned int id) |
Set the solver ID. | |
unsigned int | getSolverTypeCount () const |
Get the current count of instances of this object's most-derived type. | |
SolverInterface (SolverAlgorithmType algoType, int solverId) | |
Constructor for SolverInterface. | |
virtual | ~SolverInterface () |
Virtual destructor for SolverInterface. | |
Protected Member Functions | |
template<typename Derived > | |
void | initializeTypeId () |
Initialize the type ID for a derived class. | |
Static Protected Member Functions | |
template<typename Derived > | |
static unsigned int | getAndIncrementTypeCount () |
Get and increment the instance count for a specific derived type. | |
Protected Attributes | |
SolverAlgorithmType | m_algoType |
std::atomic< bool > | m_initialized |
unsigned int | m_solverTypeId |
int | m_solverId |
Static Protected Attributes | |
static std::unordered_map< std::type_index, std::atomic< unsigned int > > | s_instanceCounts |
Number of existing instances of derived classes. | |
Interface for a SAT solver with standard features.
SolverInterface::SolverInterface | ( | SolverAlgorithmType | algoType, |
int | solverId ) |
Constructor for SolverInterface.
algoType | The algorithm type. |
solverId | The solver ID. |
|
pure virtual |
Add a permanent clause to the formula.
clause | The clause to add. |
Implemented in Cadical, GlucoseSyrup, Kissat, KissatINCSolver, KissatMABSolver, Lingeling, MapleCOMSPSSolver, MiniSat, preprocess, StructuredBVA, and YalSat.
|
pure virtual |
Add a list of permanent clauses to the formula.
clauses | The list of clauses to add. |
Implemented in Cadical, GlucoseSyrup, Kissat, KissatINCSolver, KissatMABSolver, Lingeling, MapleCOMSPSSolver, MiniSat, preprocess, StructuredBVA, and YalSat.
|
pure virtual |
Add a list of initial clauses to the formula.
clauses | The list of initial clauses. |
nbVars | The number of variables. |
Implemented in Cadical, GlucoseSyrup, Kissat, KissatINCSolver, KissatMABSolver, Lingeling, MapleCOMSPSSolver, MiniSat, preprocess, StructuredBVA, and YalSat.
|
pure virtual |
Perform native diversification. The Default lambda returns the solver ID.
Implemented in Cadical, GlucoseSyrup, Kissat, KissatINCSolver, KissatMABSolver, Lingeling, MapleCOMSPSSolver, MiniSat, preprocess, StructuredBVA, and YalSat.
|
inline |
Get the algorithm type of the solver.
|
inlinestaticprotected |
Get and increment the instance count for a specific derived type.
Derived | The type of the derived class. |
|
pure virtual |
Get a variable suitable for search splitting.
Implemented in Cadical, GlucoseSyrup, Kissat, KissatINCSolver, KissatMABSolver, Lingeling, MapleCOMSPSSolver, MiniSat, preprocess, StructuredBVA, and YalSat.
|
pure virtual |
Return the model in case of SAT result.
Implemented in Cadical, GlucoseSyrup, Kissat, KissatINCSolver, KissatMABSolver, Lingeling, MapleCOMSPSSolver, MiniSat, preprocess, StructuredBVA, and YalSat.
|
inline |
Get the solver ID.
|
inline |
Get the current count of instances of this object's most-derived type.
|
inline |
Get the solver type ID.
|
pure virtual |
Get the current number of variables.
Implemented in Cadical, GlucoseSyrup, Kissat, KissatINCSolver, KissatMABSolver, Lingeling, MapleCOMSPSSolver, MiniSat, preprocess, StructuredBVA, and YalSat.
|
inlineprotected |
Initialize the type ID for a derived class.
This method should be called in the constructor of each derived class to properly initialize the type-specific instance count.
Derived | The type of the derived class. |
|
inline |
Check if the solver is initialized.
|
pure virtual |
Load formula from a given dimacs file.
filename | The name of the file to load from. |
Implemented in Cadical, GlucoseSyrup, Kissat, KissatINCSolver, KissatMABSolver, Lingeling, MapleCOMSPSSolver, MiniSat, preprocess, StructuredBVA, and YalSat.
|
virtual |
Print the parameters set for a solver.
Reimplemented in YalSat.
|
virtual |
Print solver statistics.
Reimplemented in Cadical, GlucoseSyrup, Kissat, KissatINCSolver, KissatMABSolver, Lingeling, MapleCOMSPSSolver, MiniSat, preprocess, StructuredBVA, and YalSat.
|
virtual |
Print the winning log.
Reimplemented in Cadical, GlucoseSyrup, Kissat, KissatINCSolver, KissatMABSolver, Lingeling, LocalSearchInterface, MapleCOMSPSSolver, MiniSat, and SolverCdclInterface.
|
inline |
Set the initialization status of the solver.
value | The initialization status to set. |
|
inline |
Set the solver ID.
id | The solver ID to set. |
|
pure virtual |
Interrupt resolution, solving cannot continue until interrupt is unset.
Implemented in Cadical, GlucoseSyrup, Kissat, KissatINCSolver, KissatMABSolver, Lingeling, MapleCOMSPSSolver, MiniSat, preprocess, StructuredBVA, and YalSat.
|
inline |
Set the solver type ID.
typeId | The solver type ID to set. |
|
pure virtual |
Solve the formula with a given cube.
cube | The cube to solve with. |
Implemented in Cadical, GlucoseSyrup, Kissat, KissatINCSolver, KissatMABSolver, Lingeling, MapleCOMSPSSolver, MiniSat, preprocess, StructuredBVA, and YalSat.
|
pure virtual |
Remove the SAT solving interrupt request.
Implemented in Cadical, GlucoseSyrup, Kissat, KissatINCSolver, KissatMABSolver, Lingeling, MapleCOMSPSSolver, MiniSat, preprocess, StructuredBVA, and YalSat.
|
protected |
Algorithm family of this solver.
|
protected |
Initialization status.
|
protected |
Main ID of the solver.
|
protected |
ID local to the solver type.