namespace bv {
TLazyBitblaster::TLazyBitblaster(context::Context* c, bv::TheoryBV* bv, const std::string name, bool emptyNotify)
- : TBitblaster()
+ : TBitblaster<Node>()
, d_bv(bv)
, d_ctx(c)
- , d_assertedAtoms(c)
- , d_explanations(c)
+ , d_assertedAtoms(new(true) context::CDList<prop::SatLiteral>(c))
+ , d_explanations(new(true) ExplanationMap(c))
, d_variables()
, d_bbAtoms()
, d_abstraction(NULL)
++(d_statistics.d_numExplainedPropagations);
if (options::bvEagerExplanations()) {
- Assert (d_explanations.find(lit) != d_explanations.end());
- const std::vector<prop::SatLiteral>& literal_explanation = d_explanations[lit].get();
+ Assert (d_explanations->find(lit) != d_explanations->end());
+ const std::vector<prop::SatLiteral>& literal_explanation = (*d_explanations)[lit].get();
for (unsigned i = 0; i < literal_explanation.size(); ++i) {
explanation.push_back(d_cnfStream->getNode(literal_explanation[i]));
}
prop::SatValue ret = d_satSolver->assertAssumption(markerLit, propagate);
- d_assertedAtoms.push_back(markerLit);
+ d_assertedAtoms->push_back(markerLit);
return ret == prop::SAT_VALUE_TRUE || ret == prop::SAT_VALUE_UNKNOWN;
}
bool TLazyBitblaster::solve() {
if (Trace.isOn("bitvector")) {
Trace("bitvector") << "TLazyBitblaster::solve() asserted atoms ";
- context::CDList<prop::SatLiteral>::const_iterator it = d_assertedAtoms.begin();
- for (; it != d_assertedAtoms.end(); ++it) {
+ context::CDList<prop::SatLiteral>::const_iterator it = d_assertedAtoms->begin();
+ for (; it != d_assertedAtoms->end(); ++it) {
Trace("bitvector") << " " << d_cnfStream->getNode(*it) << "\n";
}
}
- Debug("bitvector") << "TLazyBitblaster::solve() asserted atoms " << d_assertedAtoms.size() <<"\n";
+ Debug("bitvector") << "TLazyBitblaster::solve() asserted atoms " << d_assertedAtoms->size() <<"\n";
return prop::SAT_VALUE_TRUE == d_satSolver->solve();
}
prop::SatValue TLazyBitblaster::solveWithBudget(unsigned long budget) {
if (Trace.isOn("bitvector")) {
Trace("bitvector") << "TLazyBitblaster::solveWithBudget() asserted atoms ";
- context::CDList<prop::SatLiteral>::const_iterator it = d_assertedAtoms.begin();
- for (; it != d_assertedAtoms.end(); ++it) {
+ context::CDList<prop::SatLiteral>::const_iterator it = d_assertedAtoms->begin();
+ for (; it != d_assertedAtoms->end(); ++it) {
Trace("bitvector") << " " << d_cnfStream->getNode(*it) << "\n";
}
}
- Debug("bitvector") << "TLazyBitblaster::solveWithBudget() asserted atoms " << d_assertedAtoms.size() <<"\n";
+ Debug("bitvector") << "TLazyBitblaster::solveWithBudget() asserted atoms " << d_assertedAtoms->size() <<"\n";
return d_satSolver->solve(budget);
}
bool TLazyBitblaster::MinisatNotify::notify(prop::SatLiteral lit) {
if(options::bvEagerExplanations()) {
// compute explanation
- if (d_lazyBB->d_explanations.find(lit) == d_lazyBB->d_explanations.end()) {
+ if (d_lazyBB->d_explanations->find(lit) == d_lazyBB->d_explanations->end()) {
std::vector<prop::SatLiteral> literal_explanation;
d_lazyBB->d_satSolver->explain(lit, literal_explanation);
- d_lazyBB->d_explanations.insert(lit, literal_explanation);
+ d_lazyBB->d_explanations->insert(lit, literal_explanation);
} else {
// we propagated it at a lower level
return true;
Assert (d_ctx->getLevel() == 0);
delete d_satSolver;
delete d_cnfStream;
- d_assertedAtoms = context::CDList<prop::SatLiteral>(d_ctx);
- d_explanations = ExplanationMap(d_ctx);
+ d_assertedAtoms->deleteSelf();
+ d_assertedAtoms = new(true) context::CDList<prop::SatLiteral>(d_ctx);
+ d_explanations->deleteSelf();
+ d_explanations = new(true) ExplanationMap(d_ctx);
d_bbAtoms.clear();
d_variables.clear();
d_termCache.clear();