17#include <core/Solver.h>
18#include <simp/SimpSolver.h>
21#error "Expected HAVE_GLUCOSE"
24void convert(
const bvt &bv, Glucose::vec<Glucose::Lit> &dest)
26 dest.capacity(bv.size());
28 for(
const auto &literal : bv)
30 if(!literal.is_false())
31 dest.push(Glucose::mkLit(literal.var_no(), literal.sign()));
37 dest.capacity(bv.size());
39 for(
const auto &literal : bv)
41 if(!literal.is_true())
42 dest.push(Glucose::mkLit(literal.var_no(), literal.sign()));
84 catch(Glucose::OutOfMemoryException)
86 log.error() <<
"SAT checker ran out of memory" <<
messaget::eom;
87 status = statust::ERROR;
88 throw std::bad_alloc();
94 return "Glucose Syrup without simplifier";
99 return "Glucose Syrup with simplifier";
105 while((
unsigned)
solver->nVars()<no_variables())
116 for(
const auto &literal : bv)
118 if(literal.is_true())
120 else if(!literal.is_false())
123 literal.var_no() < (
unsigned)
solver->nVars(),
124 "variable not added yet");
128 Glucose::vec<Glucose::Lit> c;
145 static size_t cnf_clause_index = 0;
147 bool clause_removed = process_clause(bv, cnf);
152 solver_hardness->register_clause(
153 bv, cnf, cnf_clause_index, !clause_removed);
158 catch(Glucose::OutOfMemoryException)
160 log.error() <<
"SAT checker ran out of memory" <<
messaget::eom;
161 status = statust::ERROR;
162 throw std::bad_alloc();
172 log.statistics() << (no_variables() - 1) <<
" variables, "
181 log.status() <<
"SAT checker inconsistent: instance is UNSATISFIABLE"
187 bool has_false =
false;
189 for(
const auto &literal : assumptions)
191 if(literal.is_false())
197 log.status() <<
"got FALSE as assumption: instance is UNSATISFIABLE"
202 Glucose::vec<Glucose::Lit> solver_assumptions;
205 if(
solver->solve(solver_assumptions))
207 log.status() <<
"SAT checker: instance is SATISFIABLE"
209 status = statust::SAT;
210 return resultt::P_SATISFIABLE;
214 log.status() <<
"SAT checker: instance is UNSATISFIABLE"
220 status = statust::UNSAT;
221 return resultt::P_UNSATISFIABLE;
223 catch(Glucose::OutOfMemoryException)
225 log.error() <<
"SAT checker ran out of memory" <<
messaget::eom;
226 status = statust::ERROR;
227 throw std::bad_alloc();
239 bool sign = a.
sign();
242 solver->model.growTo(v + 1);
244 solver->model[v] = Glucose::lbool(value);
246 catch(Glucose::OutOfMemoryException)
248 log.error() <<
"SAT checker ran out of memory" <<
messaget::eom;
249 status = statust::ERROR;
250 throw std::bad_alloc();
269 for(
int i=0; i<
solver->conflict.size(); i++)
270 if(var(
solver->conflict[i])==v)
289 catch(Glucose::OutOfMemoryException)
293 throw std::bad_alloc();
bool is_in_conflict(literalt a) const override
Returns true if an assumption is in the final conflict.
~satcheck_glucose_baset() override
A default destructor defined in the .cpp is used to ensure the unique_ptr to the solver is correctly ...
void lcnf(const bvt &bv) override
std::unique_ptr< Glucose::SimpSolver > solver
void set_polarity(literalt a, bool value)
satcheck_glucose_baset(message_handlert &message_handler)
tvt l_get(literalt a) const override
resultt do_prop_solve(const bvt &assumptions) override
void set_assignment(literalt a, bool value) override
std::string solver_text() const override
void set_frozen(literalt a) override
std::string solver_text() const override
bool is_eliminated(literalt a) const
std::vector< literalt > bvt
std::unique_ptr< T > util_make_unique(Ts &&... ts)
void convert(const bvt &bv, Glucose::vec< Glucose::Lit > &dest)
void convert_assumptions(const bvt &bv, Glucose::vec< Glucose::Lit > &dest)
void solver(std::vector< framet > &frames, const std::unordered_set< symbol_exprt, irep_hash > &address_taken, const solver_optionst &solver_options, const namespacet &ns, std::vector< propertyt > &properties, std::size_t property_index)
#define PRECONDITION(CONDITION)
#define INVARIANT(CONDITION, REASON)
This macro uses the wrapper function 'invariant_violated_string'.