65#ifndef __ADS_SatSolvers
66 #define __ADS_SatSolvers
124inline std::optional< std::vector< bool > >
dpll(
const Cnf & F ,
int n );
136template<
class Heap = std::priority_queue< std::pair<
double ,
int > > >
229 [[nodiscard]]
const std::vector< bool > &
model(
void )
const;
232 [[nodiscard]]
long conflicts(
void )
const {
return( f_conflicts ); }
235 [[nodiscard]]
long decisions(
void )
const {
return( f_decisions ); }
240 static int code(
int lit ) {
241 return( 2 * ( std::abs( lit ) - 1 ) + ( lit < 0 ) );
245 [[nodiscard]]
int value(
int c )
const;
247 void enqueue(
int c ,
int reason );
248 [[nodiscard]]
int propagate(
void );
249 void analyze(
int confl , std::vector< int > & learnt ,
int & back );
250 void cancelUntil(
int level );
252 [[nodiscard]]
int pickBranch(
void );
253 [[nodiscard]]
int level(
void )
const {
return(
int( f_trailLim.size() ) ); }
254 int addClause( std::vector< int > c );
258 bool f_empty =
false;
260 std::vector< std::vector< int > > f_C;
261 std::vector< std::vector< int > > f_watch;
262 std::vector< int > f_assign , f_level , f_reason;
263 std::vector< bool > f_phase , f_seen , f_model;
264 std::vector< int > f_trail , f_trailLim;
265 std::size_t f_qhead = 0;
266 std::vector< double > f_act;
269 long f_conflicts = 0 , f_decisions = 0;
284#include "ADS/backtrack/impl/SatSolvers.tpp"
The contracts of ADS: the preconditions, the postconditions and the invariants of the operations,...
The problems in NP of chapter 18, each with its polynomial certificate, which checks a proposed solut...
conflict-driven clause learning with two watched literals, the free variables by activity in a Heap o...
Definition SatSolvers.h:138
long decisions(void) const
the decisions taken so far
Definition SatSolvers.h:235
BasicCdcl(const Cnf &F, int n)
the solver of the formula of variables, its clauses with the repeated literals merged and the tauto...
Result
the outcome of solve()
Definition SatSolvers.h:143
@ UNSAT
the formula is unsatisfiable
Definition SatSolvers.h:145
@ SAT
a model found, in model()
Definition SatSolvers.h:144
@ UNKNOWN
the conflicts allowed are over before an answer
Definition SatSolvers.h:146
const std::vector< bool > & model(void) const
the model found by solve()
long conflicts(void) const
the conflicts met so far
Definition SatSolvers.h:232
Result solve(long maxConflicts=-1)
the search, UNKNOWN after maxConflicts conflicts if that is
std::optional< std::vector< bool > > dpll(const Cnf &F, int n)
a model of the formula of variables by DPLL, the variables left free false, or nothing if is unsat...
BasicCdcl<> Cdcl
the clause learning on std::priority_queue
Definition SatSolvers.h:274
std::vector< Clause > Cnf
a formula
Definition Problems.h:85