Painless
A framework to ease parallelization of sequential CDCL SAT solvers
Loading...
Searching...
No Matches
MapleCOMSPSSolver.hpp
1#pragma once
2
3#include "containers/ClauseBuffer.hpp"
4#include "containers/ClauseDatabase.hpp"
5#include "utils/Threading.hpp"
6
7#include "SolverCdclInterface.hpp"
8
9#define MAPLECOMSPS_
10
11#define ID_SYM 0
12#define ID_XOR 1
13
15{
16 int tier1;
17 int chrono;
18 int stable;
19 int walkinitially;
20 int target;
21 int phase;
22 int heuristic;
23 int margin;
24 int ccanr;
25 int targetinc;
26};
27
28// Some forward declatarations for MapleCOMSPS
29namespace MapleCOMSPS {
30class SimpSolver;
31class Lit;
32template<class T>
33class vec;
34}
35
39{
40 public:
42 unsigned int getVariablesCount();
43
46
48 void setPhase(const unsigned int var, const bool phase);
49
51 void bumpVariableActivity(const int var, const int times);
52
55
58
60 SatResult solve(const std::vector<int>& cube);
61
63 void addClause(ClauseExchangePtr clause);
64
66 void addClauses(const std::vector<ClauseExchangePtr>& clauses);
67
69 void addInitialClauses(const std::vector<simpleClause>& clauses, unsigned int nbVars) override;
70
72 void loadFormula(const char* filename) override;
73
75 bool importClause(const ClauseExchangePtr& clause);
76
78 void importClauses(const std::vector<ClauseExchangePtr>& clauses);
79
82
83 void printWinningLog() override;
84
86 std::vector<int> getModel();
87
91 void diversify(const SeedGenerator& getSeed);
92
94 MapleCOMSPSSolver(int id, const std::shared_ptr<ClauseDatabase>& clauseDB);
95
97 MapleCOMSPSSolver(const MapleCOMSPSSolver& other, int id, const std::shared_ptr<ClauseDatabase>& clauseDB);
100
101 std::vector<int> getFinalAnalysis();
102
103 std::vector<int> getSatAssumptions();
104
105 void setStrengthening(bool b);
106
107 void setParameter(parameter p) {};
108
109 void initshuffle(int id) {};
110
111 protected:
113 MapleCOMSPS::SimpSolver* solver;
114
116
117 std::unique_ptr<ClauseDatabase> unitsToImport;
118
121
123 std::atomic<bool> stopSolver;
124
126 friend MapleCOMSPS::Lit cbkMapleCOMSPSImportUnit(void*);
127 friend bool cbkMapleCOMSPSImportClause(void*, unsigned int*, MapleCOMSPS::vec<MapleCOMSPS::Lit>&);
128 friend void cbkMapleCOMSPSExportClause(void*, unsigned int, MapleCOMSPS::vec<MapleCOMSPS::Lit>&);
129
130 public:
131 ;
132};
Wrapper for boost::lockfree::queue to manage ClauseExchange objects.
Definition ClauseBuffer.hpp:26
Instance of a MapleCOMSPS solver.
Definition MapleCOMSPSSolver.hpp:39
void bumpVariableActivity(const int var, const int times)
Bump activity of a given variable.
int getDivisionVariable()
Get a variable suitable for search splitting.
void setPhase(const unsigned int var, const bool phase)
Set initial phase for a given variable.
void addClauses(const std::vector< ClauseExchangePtr > &clauses)
Add a list of permanent clauses to the formula.
void addInitialClauses(const std::vector< simpleClause > &clauses, unsigned int nbVars) override
Add a list of initial clauses to the formula.
MapleCOMSPSSolver(const MapleCOMSPSSolver &other, int id, const std::shared_ptr< ClauseDatabase > &clauseDB)
Copy constructor.
void printWinningLog() override
Print the winning log.
void loadFormula(const char *filename) override
Load formula from a given dimacs file, return false if failed.
void importClauses(const std::vector< ClauseExchangePtr > &clauses)
Add a list of learned clauses to the formula.
std::unique_ptr< ClauseDatabase > unitsToImport
Buffer used to import clauses (units included).
Definition MapleCOMSPSSolver.hpp:117
std::atomic< bool > stopSolver
Used to stop or continue the resolution.
Definition MapleCOMSPSSolver.hpp:123
ClauseBuffer clausesToAdd
Buffer used to add permanent clauses.
Definition MapleCOMSPSSolver.hpp:120
void setSolverInterrupt()
Interrupt resolution, solving cannot continue until interrupt is unset.
void unsetSolverInterrupt()
Remove the SAT solving interrupt request.
unsigned int getVariablesCount()
Get the number of variables of the current resolution.
friend MapleCOMSPS::Lit cbkMapleCOMSPSImportUnit(void *)
Callback to export/import clauses.
void addClause(ClauseExchangePtr clause)
Add a permanent clause to the formula.
MapleCOMSPSSolver(int id, const std::shared_ptr< ClauseDatabase > &clauseDB)
Constructor.
void printStatistics()
Get solver statistics.
std::vector< int > getFinalAnalysis()
Get the final analysis in case of UNSAT result.
virtual ~MapleCOMSPSSolver()
Destructor.
std::vector< int > getModel()
Return the model in case of SAT result.
SatResult solve(const std::vector< int > &cube)
Solve the formula with a given cube.
bool importClause(const ClauseExchangePtr &clause)
Add a learned clause to the formula.
MapleCOMSPS::SimpSolver * solver
Pointer to a MapleCOMSPS solver.
Definition MapleCOMSPSSolver.hpp:113
std::vector< int > getSatAssumptions()
Get current assumptions.
void diversify(const SeedGenerator &getSeed)
Native diversification.
Definition MapleCOMSPSSolver.hpp:33
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
Definition MapleCOMSPSSolver.hpp:15