Painless
A framework to ease parallelization of sequential CDCL SAT solvers
Loading...
Searching...
No Matches
YalSat.hpp
1#pragma once
2
3#define YALSAT_
4
5#include "LocalSearchInterface.hpp"
6
7/* Includes not having any ifdef macro */
8extern "C"
9{
10#include "yalsat/yals.h"
11}
12
18{
19 public:
20 YalSat(int _id, unsigned long flipsLimit, unsigned long maxNoise);
21
22 ~YalSat();
23
24 unsigned int getVariablesCount();
25
27
29
31
32 void setPhase(const unsigned int var, const bool phase);
33
34 SatResult solve(const std::vector<int>& cube);
35
36 void addClause(ClauseExchangePtr clause);
37
38 void addClauses(const std::vector<ClauseExchangePtr>& clauses);
39
40 void addInitialClauses(const std::vector<simpleClause>& clauses, unsigned int nbVars);
41
42 void loadFormula(const char* filename);
43
44 std::vector<int> getModel();
45
47
49
50 void diversify(const SeedGenerator& getSeed);
51
52 friend int yalsat_terminate(void* p_YalSat);
53
54 private:
55 Yals* solver;
56
58 std::atomic<bool> terminateSolver;
59
61 unsigned long clausesCount;
62
64 unsigned long m_flipsLimit;
65
67 unsigned long m_maxNoise;
68};
Interface for Local Search solvers.
Definition LocalSearchInterface.hpp:32
Implements LocalSearchInterface to interact with the YalSAT local search solver.
Definition YalSat.hpp:18
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 loadFormula(const char *filename)
Load formula from a given dimacs file.
void addInitialClauses(const std::vector< simpleClause > &clauses, unsigned int nbVars)
Add a list of initial clauses to the formula.
void printStatistics()
Print solver statistics.
int getDivisionVariable()
Get a variable suitable for search splitting.
void unsetSolverInterrupt()
Remove the SAT solving interrupt request.
void addClause(ClauseExchangePtr clause)
Add a permanent clause to the formula.
void setSolverInterrupt()
Interrupt resolution, solving cannot continue until interrupt is unset.
unsigned int getVariablesCount()
Get the current number of variables.
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.
void diversify(const SeedGenerator &getSeed)
Perform native diversification. The Default lambda returns the solver ID.
void printParameters()
Print the parameters set for a solver.
SatResult
Enumeration for SAT solver results.
Definition SolverInterface.hpp:39