Painless
A framework to ease parallelization of sequential CDCL SAT solvers
Loading...
Searching...
No Matches
SolverCdclInterface.hpp
1#pragma once
2
3#include "containers/ClauseDatabase.hpp"
4#include "sharing/SharingEntity.hpp"
5#include "solvers/SolverInterface.hpp"
6
18{
19 GLUCOSE = 0,
20 LINGELING = 1,
21 CADICAL = 2,
22 MINISAT = 3,
23 KISSAT = 4,
24 MAPLECOMSPS = 5,
25 KISSATMAB = 6,
26 KISSATINC = 7
27};
28
31{
34 {
35 propagations = 0;
36 decisions = 0;
37 conflicts = 0;
38 restarts = 0;
39 memPeak = 0;
40 }
41
42 unsigned long propagations;
43 unsigned long decisions;
44 unsigned long conflicts;
45 unsigned long restarts;
46 double memPeak;
47};
48
56 : public SolverInterface
57 , public SharingEntity
58{
59 public:
65 virtual void setPhase(const unsigned int var, const bool phase) = 0;
66
72 virtual void bumpVariableActivity(const int var, const int times) = 0;
73
78 virtual std::vector<int> getFinalAnalysis() = 0;
79
84 virtual std::vector<int> getSatAssumptions() = 0;
85
90
95
101 SolverCdclInterface(int solverId, const std::shared_ptr<ClauseDatabase>& clauseDB, SolverCdclType solverCdclType)
103 , m_clausesToImport(clauseDB)
104 , m_cdclType(solverCdclType)
105 , SharingEntity()
106 {
107 }
108
112 virtual ~SolverCdclInterface() { LOGDEBUG2("Destroying solver %d", this->getSolverId()); }
113
116
117 protected:
119 std::shared_ptr<ClauseDatabase> m_clausesToImport;
120};
121
#define LOGDEBUG2(...)
Log a debug message with verbosity level 2 and magenta color.
Definition Logger.hpp:221
A base class representing entities that can exchange clauses between themselves.
Definition SharingEntity.hpp:29
Interface for CDCL (Conflict-Driven Clause Learning) solvers This class provides a common interface f...
Definition SolverCdclInterface.hpp:58
std::shared_ptr< ClauseDatabase > m_clausesToImport
Database used to import clauses. Can be common with other solvers.
Definition SolverCdclInterface.hpp:119
virtual std::vector< int > getSatAssumptions()=0
Get current assumptions.
virtual std::vector< int > getFinalAnalysis()=0
Get the final analysis in case of UNSAT result.
virtual ~SolverCdclInterface()
Virtual destructor.
Definition SolverCdclInterface.hpp:112
virtual void bumpVariableActivity(const int var, const int times)=0
Bump activity of a given variable.
SolverCdclType m_cdclType
Type of this CDCL solver.
Definition SolverCdclInterface.hpp:115
virtual void setPhase(const unsigned int var, const bool phase)=0
Set initial phase for a given variable.
SolverCdclInterface(int solverId, const std::shared_ptr< ClauseDatabase > &clauseDB, SolverCdclType solverCdclType)
Constructor for SolverCdclInterface.
Definition SolverCdclInterface.hpp:101
void printWinningLog()
Print winning log information.
Definition SolverCdclInterface.hpp:89
SolverCdclType getSolverType()
Returns solver type for static cast.
Definition SolverCdclInterface.hpp:94
Interface for a SAT solver with standard features.
Definition SolverInterface.hpp:62
virtual void printWinningLog()
Print the winning log.
unsigned int getSolverId()
Get the solver ID.
Definition SolverInterface.hpp:178
SolverCdclType
Code for the type of solvers.
Definition SolverCdclInterface.hpp:18
SolverAlgorithmType
Enumeration for types of solver algorithms.
Definition SolverInterface.hpp:50
Structure for solver statistics.
Definition SolverCdclInterface.hpp:31
unsigned long restarts
Number of restarts.
Definition SolverCdclInterface.hpp:45
SolvingCdclStatistics()
Constructor.
Definition SolverCdclInterface.hpp:33
double memPeak
Maximum memory used in Ko.
Definition SolverCdclInterface.hpp:46
unsigned long propagations
Number of propagations.
Definition SolverCdclInterface.hpp:42
unsigned long conflicts
Number of reached conflicts.
Definition SolverCdclInterface.hpp:44
unsigned long decisions
Number of decisions taken.
Definition SolverCdclInterface.hpp:43