/** A circuit propagator for non-clausal propositional deduction */
booleans::CircuitPropagator d_propagator;
- bool d_propagatorNeedsFinish;
std::vector<Node> d_boolVars;
/** Assertions in the preprocessing pipeline */
d_listenerRegistrations(new ListenerRegistrationList()),
d_nonClausalLearnedLiterals(),
d_propagator(d_nonClausalLearnedLiterals, true, true),
- d_propagatorNeedsFinish(false),
d_assertions(d_smt.d_userContext),
d_assertionsProcessed(smt.d_userContext, false),
d_fakeContext(),
{
delete d_listenerRegistrations;
- if(d_propagatorNeedsFinish) {
+ if(d_propagator.getNeedsFinish()) {
d_propagator.finish();
- d_propagatorNeedsFinish = false;
+ d_propagator.setNeedsFinish(false);
}
d_smt.d_nodeManager->unsubscribeEvents(this);
}
Trace("simplify") << "Assertion #" << i << " : " << d_assertions[i] << std::endl;
}
- if(d_propagatorNeedsFinish) {
+ if (d_propagator.getNeedsFinish())
+ {
d_propagator.finish();
- d_propagatorNeedsFinish = false;
+ d_propagator.setNeedsFinish(false);
}
d_propagator.initialize();
Assert(!options::unsatCores() && !options::fewerPreprocessingHoles());
d_assertions.clear();
addFormula(falseNode, false, false);
- d_propagatorNeedsFinish = true;
+ d_propagator.setNeedsFinish(true);
return false;
}
Assert(!options::unsatCores());
d_assertions.clear();
addFormula(NodeManager::currentNM()->mkConst<bool>(false), false, false);
- d_propagatorNeedsFinish = true;
+ d_propagator.setNeedsFinish(true);
return false;
}
}
Assert(!options::unsatCores());
d_assertions.clear();
addFormula(NodeManager::currentNM()->mkConst<bool>(false), false, false);
- d_propagatorNeedsFinish = true;
+ d_propagator.setNeedsFinish(true);
return false;
default:
if (d_doConstantProp && learnedLiteral.getKind() == kind::EQUAL && (learnedLiteral[0].isConst() || learnedLiteral[1].isConst())) {
Rewriter::rewrite(Node(learnedBuilder)));
}
- d_propagatorNeedsFinish = true;
+ d_propagator.setNeedsFinish(true);
return true;
}
/** Whether to perform backward propagation */
const bool d_backwardPropagation;
+ /* Does the current state require a call to finish()? */
+ bool d_needsFinish;
+
public:
/**
* Construct a new CircuitPropagator.
*/
- CircuitPropagator(std::vector<Node>& outLearnedLiterals,
- bool enableForward = true, bool enableBackward = true) :
- d_context(),
- d_propagationQueue(),
- d_propagationQueueClearer(&d_context, d_propagationQueue),
- d_conflict(&d_context, false),
- d_learnedLiterals(outLearnedLiterals),
- d_learnedLiteralClearer(&d_context, outLearnedLiterals),
- d_backEdges(),
- d_backEdgesClearer(&d_context, d_backEdges),
- d_seen(&d_context),
- d_state(&d_context),
- d_forwardPropagation(enableForward),
- d_backwardPropagation(enableBackward) {
- }
+ CircuitPropagator(std::vector<Node>& outLearnedLiterals,
+ bool enableForward = true,
+ bool enableBackward = true)
+ : d_context(),
+ d_propagationQueue(),
+ d_propagationQueueClearer(&d_context, d_propagationQueue),
+ d_conflict(&d_context, false),
+ d_learnedLiterals(outLearnedLiterals),
+ d_learnedLiteralClearer(&d_context, outLearnedLiterals),
+ d_backEdges(),
+ d_backEdgesClearer(&d_context, d_backEdges),
+ d_seen(&d_context),
+ d_state(&d_context),
+ d_forwardPropagation(enableForward),
+ d_backwardPropagation(enableBackward),
+ d_needsFinish(false)
+ {
+ }
// Use custom context to ensure propagator is reset after use
void initialize()
{ d_context.push(); }
+ void setNeedsFinish(bool value) { d_needsFinish = value; }
+
+ bool getNeedsFinish() { return d_needsFinish; }
+
void finish()
{ d_context.pop(); }