return d_theoryProxy->getLearnedZeroLevelLiterals(ltype);
}
+std::vector<Node> PropEngine::getLearnedZeroLevelLiteralsForRestart() const
+{
+ return d_theoryProxy->getLearnedZeroLevelLiteralsForRestart();
+}
+
} // namespace prop
} // namespace cvc5::internal
#include "expr/node.h"
#include "proof/proof.h"
#include "proof/trust_node.h"
+#include "prop/learned_db.h"
#include "prop/skolem_def_manager.h"
#include "smt/env_obj.h"
#include "theory/output_channel.h"
std::vector<Node> getLearnedZeroLevelLiterals(
modes::LearnedLitType ltype) const;
+ /** Get the zero-level assertions that should be used on deep restart */
+ std::vector<Node> getLearnedZeroLevelLiteralsForRestart() const;
+
private:
/** Dump out the satisfying assignment (after SAT result) */
void printSatisfyingAssignment();
d_queue(context()),
d_tpp(env, *theoryEngine),
d_skdm(skdm),
- d_zll(nullptr)
+ d_zll(nullptr),
+ d_stopSearch(false, userContext())
{
bool trackZeroLevel = isOutputOn(OutputTag::LEARNED_LITS)
|| options().smt.produceLearnedLiterals;
{
d_decisionEngine->presolve();
d_theoryEngine->presolve();
+ d_stopSearch = false;
}
void TheoryProxy::notifyTopLevelSubstitution(const Node& lhs,
d_queue.pop();
if (d_zll != nullptr)
{
+ if (d_stopSearch.get())
+ {
+ break;
+ }
int32_t alevel = d_propEngine->getDecisionLevel(assertion);
d_zll->notifyAsserted(assertion, alevel);
}
d_decisionEngine->notifyActiveSkolemDefs(activeSkolemDefs);
}
}
- d_theoryEngine->check(effort);
+ if (!d_stopSearch.get())
+ {
+ d_theoryEngine->check(effort);
+ }
}
void TheoryProxy::theoryPropagate(std::vector<SatLiteral>& output) {
SatLiteral TheoryProxy::getNextDecisionEngineRequest(bool &stopSearch) {
Assert(d_decisionEngine != NULL);
Assert(stopSearch != true);
+ if (d_stopSearch.get())
+ {
+ stopSearch = true;
+ return undefSatLiteral;
+ }
SatLiteral ret = d_decisionEngine->getNext(stopSearch);
if(stopSearch) {
Trace("decision") << " *** Decision Engine stopped search *** " << std::endl;
}
bool TheoryProxy::theoryNeedCheck() const {
+ if (d_stopSearch.get())
+ {
+ return false;
+ }
return d_theoryEngine->needCheck();
}
bool TheoryProxy::isIncomplete() const
{
- return d_theoryEngine->isIncomplete();
+ return d_stopSearch.get() || d_theoryEngine->isIncomplete();
}
TNode TheoryProxy::getNode(SatLiteral lit) {
bool TheoryProxy::isDecisionRelevant(SatVariable var) { return true; }
bool TheoryProxy::isDecisionEngineDone() {
- return d_decisionEngine->isDone();
+ return d_decisionEngine->isDone() || d_stopSearch.get();
}
SatValue TheoryProxy::getDecisionPolarity(SatVariable var) {
return {};
}
+std::vector<Node> TheoryProxy::getLearnedZeroLevelLiteralsForRestart() const
+{
+ if (d_zll != nullptr)
+ {
+ return d_zll->getLearnedZeroLevelLiteralsForRestart();
+ }
+ return {};
+}
+
} // namespace prop
} // namespace cvc5::internal
/** Get the zero-level assertions */
std::vector<Node> getLearnedZeroLevelLiterals(
modes::LearnedLitType ltype) const;
+ /** Get the zero-level assertions that should be used on deep restart */
+ std::vector<Node> getLearnedZeroLevelLiteralsForRestart() const;
private:
/** The prop engine we are using. */
/** The zero level learner */
std::unique_ptr<ZeroLevelLearner> d_zll;
+ /** Whether we have been requested to stop the search */
+ context::CDO<bool> d_stopSearch;
}; /* class TheoryProxy */
} // namespace prop
return ret;
}
+std::vector<Node> ZeroLevelLearner::getLearnedZeroLevelLiteralsForRestart()
+ const
+{
+ std::vector<Node> ret;
+ for (modes::LearnedLitType ltype : d_learnedTypes)
+ {
+ std::vector<Node> rett = getLearnedZeroLevelLiterals(ltype);
+ ret.insert(ret.end(), rett.begin(), rett.end());
+ }
+ return ret;
+}
+
+bool ZeroLevelLearner::hasLearnedLiteralForRestart() const
+{
+ for (modes::LearnedLitType ltype : d_learnedTypes)
+ {
+ if (d_ldb.getNumLearnedLiterals(ltype) > 0)
+ {
+ return true;
+ }
+ }
+ return false;
+}
+
bool ZeroLevelLearner::isLearnable(modes::LearnedLitType ltype) const
{
return d_learnedTypes.find(ltype) != d_learnedTypes.end();
/** Get the zero-level assertions */
std::vector<Node> getLearnedZeroLevelLiterals(
modes::LearnedLitType ltype) const;
+ /** Get the zero-level assertions that should be used on deep restart */
+ std::vector<Node> getLearnedZeroLevelLiteralsForRestart() const;
private:
static void getAtoms(TNode a,
bool isLearnable(modes::LearnedLitType ltype) const;
/** get solved */
bool getSolved(const Node& lit, Subs& subs);
+ /** has learned literal */
+ bool hasLearnedLiteralForRestart() const;
/** The theory engine we are using */
TheoryEngine* d_theoryEngine;