Trace("pf::tp") << "requirePhase " << n << " " << b << std::endl;
}
-bool ProofOutputChannel::flipDecision() {
- Debug("pf::tp") << "ProofOutputChannel::flipDecision called" << std::endl;
- AlwaysAssert(false);
- return false;
-}
-
void ProofOutputChannel::setIncomplete() {
Debug("pf::tp") << "ProofOutputChannel::setIncomplete called" << std::endl;
AlwaysAssert(false);
theory::LemmaStatus lemma(TNode n, ProofRule rule, bool, bool, bool) override;
theory::LemmaStatus splitLemma(TNode, bool) override;
void requirePhase(TNode n, bool b) override;
- bool flipDecision() override;
void setIncomplete() override;
/** Has conflict() has been called? */
trail_ok.pop();
}
-bool Solver::flipDecision() {
- Debug("flipdec") << "FLIP: decision level is " << decisionLevel() << std::endl;
- if(decisionLevel() == 0) {
- Debug("flipdec") << "FLIP: no decisions, returning false" << std::endl;
- return false;
- }
-
- // find the level to cancel until
- int level = trail_lim.size() - 1;
- Debug("flipdec") << "FLIP: looking at level " << level << " dec is " << trail[trail_lim[level]] << " flippable?" << ((polarity[var(trail[trail_lim[level]])] & 0x2) == 0 ? 1 : 0) << " flipped?" << flipped[level] << std::endl;
- while(level > 0 && (flipped[level] || /* phase-locked */ (polarity[var(trail[trail_lim[level]])] & 0x2) != 0)) {
- --level;
- Debug("flipdec") << "FLIP: looking at level " << level << " dec is " << trail[trail_lim[level]] << " flippable?" << ((polarity[var(trail[trail_lim[level]])] & 0x2) == 0 ? 2 : 0) << " flipped?" << flipped[level] << std::endl;
- }
- if(level < 0) {
- Lit l = trail[trail_lim[0]];
- Debug("flipdec") << "FLIP: canceling everything, flipping root decision " << l << std::endl;
- cancelUntil(0);
- newDecisionLevel();
- Debug("flipdec") << "FLIP: enqueuing " << ~l << std::endl;
- uncheckedEnqueue(~l);
- flipped[0] = true;
- Debug("flipdec") << "FLIP: returning false" << std::endl;
- return false;
- }
- Lit l = trail[trail_lim[level]];
- Debug("flipdec") << "FLIP: canceling to level " << level << ", flipping decision " << l << std::endl;
- cancelUntil(level);
- newDecisionLevel();
- Debug("flipdec") << "FLIP: enqueuing " << ~l << std::endl;
- uncheckedEnqueue(~l);
- flipped[level] = true;
- Debug("flipdec") << "FLIP: returning true" << std::endl;
- return true;
-}
-
-
CRef Solver::updateLemmas() {
Debug("minisat::lemmas") << "Solver::updateLemmas() begin" << std::endl;
void setPolarity (Var v, bool b); // Declare which polarity the decision heuristic should use for a variable. Requires mode 'polarity_user'.
void freezePolarity (Var v, bool b); // Declare which polarity the decision heuristic MUST ALWAYS use for a variable. Requires mode 'polarity_user'.
void setDecisionVar (Var v, bool b); // Declare if a variable should be eligible for selection in the decision heuristic.
- bool flipDecision (); // Backtrack and flip most recent decision
// Read state:
//
d_minisat->freezePolarity(v, lit.isNegated());
}
-bool MinisatSatSolver::flipDecision() {
- Debug("minisat") << "flipDecision()" << std::endl;
- return d_minisat->flipDecision();
-}
-
bool MinisatSatSolver::isDecision(SatVariable decn) const {
return d_minisat->isDecision( decn );
}
void requirePhase(SatLiteral lit) override;
- bool flipDecision() override;
-
bool isDecision(SatVariable decn) const override;
private:
d_satSolver->requirePhase(phase ? lit : ~lit);
}
-bool PropEngine::flipDecision() {
- Debug("prop") << "flipDecision()" << endl;
- return d_satSolver->flipDecision();
-}
-
bool PropEngine::isDecision(Node lit) const {
Assert(isSatLiteral(lit));
return d_satSolver->isDecision(d_cnfStream->getLiteral(lit).getSatVariable());
*/
void requirePhase(TNode n, bool phase);
- /**
- * Backtracks to and flips the most recent unflipped decision, and
- * returns TRUE. If the decision stack is nonempty but all
- * decisions have been flipped already, the state is backtracked to
- * the root decision, which is re-flipped to the original phase (and
- * FALSE is returned). If the decision stack is empty, the state is
- * unchanged and FALSE is returned.
- *
- * @return true if a decision was flipped as requested; false if the
- * root decision was reflipped, or if no decisions are on the stack.
- */
- bool flipDecision();
-
/**
* Return whether the given literal is a SAT decision. Either phase
* is permitted; that is, if "lit" is a SAT decision, this function
virtual void requirePhase(SatLiteral lit) = 0;
- virtual bool flipDecision() = 0;
-
virtual bool isDecision(SatVariable decn) const = 0;
};/* class DPLLSatSolverInterface */
*/
virtual void requirePhase(TNode n, bool phase) = 0;
- /**
- * Flips the most recent unflipped decision to the other phase and
- * returns true. If all decisions have been flipped, the root
- * decision is re-flipped and flipDecision() returns false. If no
- * decisions (flipped nor unflipped) are on the decision stack, the
- * state is not affected and flipDecision() returns false.
- *
- * For example, if l1, l2, and l3 are all decision literals, and
- * have been decided in positive phase, a series of flipDecision()
- * calls has the following effects:
- *
- * l1 l2 l3 <br/>
- * l1 l2 ~l3 <br/>
- * l1 ~l2 <br/>
- * ~l1 <br/>
- * l1 (and flipDecision() returns false)
- *
- * Naturally, flipDecision() might be interleaved with search. For example:
- *
- * l1 l2 l3 <br/>
- * flipDecision() <br/>
- * l1 l2 ~l3 <br/>
- * flipDecision() <br/>
- * l1 ~l2 <br/>
- * SAT decides l3 <br/>
- * l1 ~l2 l3 <br/>
- * flipDecision() <br/>
- * l1 ~l2 ~l3 <br/>
- * flipDecision() <br/>
- * ~l1 <br/>
- * SAT decides l2 <br/>
- * ~l1 l2 <br/>
- * flipDecision() <br/>
- * ~l1 ~l2 <br/>
- * flipDecision() returns FALSE<br/>
- * l1
- *
- * @return true if a decision was flipped; false if no decision
- * could be flipped, or if the root decision was re-flipped
- */
- virtual bool flipDecision() = 0;
-
/**
* Notification from a theory that it realizes it is incomplete at
* this context level. If SAT is later determined by the
propagations(getStatsPrefix(theory) + "::propagations", 0),
lemmas(getStatsPrefix(theory) + "::lemmas", 0),
requirePhase(getStatsPrefix(theory) + "::requirePhase", 0),
- flipDecision(getStatsPrefix(theory) + "::flipDecision", 0),
restartDemands(getStatsPrefix(theory) + "::restartDemands", 0)
{
smtStatisticsRegistry()->registerStat(&conflicts);
smtStatisticsRegistry()->registerStat(&propagations);
smtStatisticsRegistry()->registerStat(&lemmas);
smtStatisticsRegistry()->registerStat(&requirePhase);
- smtStatisticsRegistry()->registerStat(&flipDecision);
smtStatisticsRegistry()->registerStat(&restartDemands);
}
smtStatisticsRegistry()->unregisterStat(&propagations);
smtStatisticsRegistry()->unregisterStat(&lemmas);
smtStatisticsRegistry()->unregisterStat(&requirePhase);
- smtStatisticsRegistry()->unregisterStat(&flipDecision);
smtStatisticsRegistry()->unregisterStat(&restartDemands);
}
return ss.str();
}
- public:
-
- IntStat conflicts, propagations, lemmas, requirePhase, flipDecision, restartDemands;
+ public:
+ IntStat conflicts, propagations, lemmas, requirePhase, restartDemands;
Statistics(theory::TheoryId theory);
~Statistics();
d_engine->d_propEngine->requirePhase(n, phase);
}
- bool flipDecision() override {
- Debug("theory") << "EngineOutputChannel::flipDecision()" << std::endl;
- ++d_statistics.flipDecision;
- return d_engine->d_propEngine->flipDecision();
- }
-
void setIncomplete() override {
Trace("theory") << "TheoryEngine::setIncomplete()" << std::endl;
d_engine->setIncomplete(d_theory);
}
void requirePhase(TNode, bool) override {}
- bool flipDecision() override { return true; }
void setIncomplete() override {}
void handleUserAttribute(const char* attr, theory::Theory* t) override {}
Unimplemented();
}
void requirePhase(TNode, bool) override { Unimplemented(); }
- bool flipDecision() override { Unimplemented(); }
void setIncomplete() override { Unimplemented(); }
void handleUserAttribute(const char* attr, Theory* t) override {
Unimplemented();
}
void requirePhase(TNode, bool) override { Unreachable(); }
- bool flipDecision() override { Unreachable(); }
void setIncomplete() override { Unreachable(); }
void clear() { d_callHistory.clear(); }