{
ITEDecisionStrategy* ds =
new decision::JustificationHeuristic(this, d_userContext, d_satContext);
- d_enabledStrategies.push_back(ds);
+ enableStrategy(ds);
d_needIteSkolemMap.push_back(ds);
}
}
-void DecisionEngine::shutdown()
-{
- Trace("decision") << "Shutting down decision engine" << std::endl;
- Assert(d_engineState == 1);
- d_engineState = 2;
+void DecisionEngine::enableStrategy(DecisionStrategy* ds)
+{
+ d_enabledStrategies.push_back(ds);
+}
- for (DecisionStrategy* s : d_enabledStrategies)
- {
- delete s;
+void DecisionEngine::clearStrategies(){
+ for(unsigned i = 0; i < d_enabledStrategies.size(); ++i){
+ delete d_enabledStrategies[i];
}
d_enabledStrategies.clear();
d_needIteSkolemMap.clear();
/* enables decision stragies based on options */
void init();
+ /* clears all of the strategies */
+ void clearStrategies();
+
+
/**
* This is called by SmtEngine, at shutdown time, just before
* destruction. It is important because there are destruction
* ordering issues between some parts of the system.
*/
- void shutdown();
+ void shutdown() {
+ Assert(d_engineState == 1);
+ d_engineState = 2;
+
+ Trace("decision") << "Shutting down decision engine" << std::endl;
+ clearStrategies();
+ }
// Interface for External World to use our services
// External World helping us help the Strategies
+ /** If one of the enabled strategies needs them */
+ /* bool needIteSkolemMap() { */
+ /* return d_needIteSkolemMap.size() > 0; */
+ /* } */
+
/**
* Add a list of assertions from an AssertionPipeline.
*/
Node getNode(SatLiteral l) {
return d_cnfStream->getNode(l);
}
+
+private:
+ /**
+ * Enable a particular decision strategy, also updating
+ * corresponding vector<DecisionStrategy*>-s is the engine
+ */
+ void enableStrategy(DecisionStrategy* ds);
+
};/* DecisionEngine class */
}/* CVC4 namespace */
SmtEngine* getSmt() { return d_smt; }
TheoryEngine* getTheoryEngine() { return d_smt->d_theoryEngine; }
+ DecisionEngine* getDecisionEngine() { return d_smt->d_decisionEngine; }
prop::PropEngine* getPropEngine() { return d_smt->d_propEngine; }
context::Context* getUserContext() { return d_smt->d_userContext; }
context::Context* getDecisionContext() { return d_smt->d_context; }
};
PropEngine::PropEngine(TheoryEngine* te,
+ DecisionEngine* de,
Context* satContext,
- UserContext* userContext,
+ Context* userContext,
std::ostream* replayLog,
ExprStream* replayStream)
: d_inCheckSat(false),
d_theoryEngine(te),
+ d_decisionEngine(de),
d_context(satContext),
d_theoryProxy(NULL),
d_satSolver(NULL),
Debug("prop") << "Constructing the PropEngine" << endl;
- d_decisionEngine.reset(new DecisionEngine(satContext, userContext));
- d_decisionEngine->init(); // enable appropriate strategies
-
d_satSolver = SatSolverFactory::createDPLLMinisat(smtStatisticsRegistry());
d_registrar = new theory::TheoryRegistrar(d_theoryEngine);
d_theoryProxy = new TheoryProxy(this,
d_theoryEngine,
- d_decisionEngine.get(),
+ d_decisionEngine,
d_context,
d_cnfStream,
replayLog,
PropEngine::~PropEngine() {
Debug("prop") << "Destructing the PropEngine" << endl;
- d_decisionEngine->shutdown();
delete d_cnfStream;
delete d_registrar;
delete d_satSolver;
d_cnfStream->convertAndAssert(node, removable, negated, rule, from);
}
-void PropEngine::addAssertionsToDecisionEngine(
- const preprocessing::AssertionPipeline& assertions)
-{
- d_decisionEngine->addAssertions(assertions);
-}
-
void PropEngine::requirePhase(TNode n, bool phase) {
Debug("prop") << "requirePhase(" << n << ", " << phase << ")" << endl;
#include "expr/expr_stream.h"
#include "expr/node.h"
#include "options/options.h"
-#include "preprocessing/assertion_pipeline.h"
#include "proof/proof_manager.h"
#include "util/resource_manager.h"
#include "util/result.h"
* Create a PropEngine with a particular decision and theory engine.
*/
PropEngine(TheoryEngine*,
+ DecisionEngine*,
context::Context* satContext,
- context::UserContext* userContext,
+ context::Context* userContext,
std::ostream* replayLog,
ExprStream* replayStream);
ProofRule rule,
TNode from = TNode::null());
- /**
- * Pass a list of assertions from an AssertionPipeline to the decision engine.
- */
- void addAssertionsToDecisionEngine(
- const preprocessing::AssertionPipeline& assertions);
-
/**
* If ever n is decided upon, it must be in the given phase. This
* occurs *globally*, i.e., even if the literal is untranslated by
TheoryEngine* d_theoryEngine;
/** The decision engine we will be using */
- std::unique_ptr<DecisionEngine> d_decisionEngine;
+ DecisionEngine* d_decisionEngine;
/** The context */
context::Context* d_context;
d_userLevels(),
d_exprManager(em),
d_nodeManager(d_exprManager->getNodeManager()),
+ d_decisionEngine(NULL),
d_theoryEngine(NULL),
d_propEngine(NULL),
d_proofManager(NULL),
Trace("smt-debug") << "Making decision engine..." << std::endl;
+ d_decisionEngine = new DecisionEngine(d_context, d_userContext);
+ d_decisionEngine->init(); // enable appropriate strategies
+
Trace("smt-debug") << "Making prop engine..." << std::endl;
d_propEngine = new PropEngine(d_theoryEngine,
+ d_decisionEngine,
d_context,
d_userContext,
d_private->getReplayLog(),
Trace("smt-debug") << "Setting up theory engine..." << std::endl;
d_theoryEngine->setPropEngine(d_propEngine);
+ d_theoryEngine->setDecisionEngine(d_decisionEngine);
Trace("smt-debug") << "Finishing init for theory engine..." << std::endl;
d_theoryEngine->finishInit();
if(d_theoryEngine != NULL) {
d_theoryEngine->shutdown();
}
+ if(d_decisionEngine != NULL) {
+ d_decisionEngine->shutdown();
+ }
}
SmtEngine::~SmtEngine()
d_theoryEngine = NULL;
delete d_propEngine;
d_propEngine = NULL;
+ delete d_decisionEngine;
+ d_decisionEngine = NULL;
delete d_stats;
d_stats = NULL;
d_private->processAssertions();
Trace("smt") << "SmtEngine::check(): done processing assertions" << endl;
+ // Turn off stop only for QF_LRA
+ // TODO: Bring up in a meeting where to put this
+ if(options::decisionStopOnly() && !options::decisionMode.wasSetByUser() ){
+ if( // QF_LRA
+ (not d_logic.isQuantified() &&
+ d_logic.isPure(THEORY_ARITH) && d_logic.isLinear() && !d_logic.isDifferenceLogic() && !d_logic.areIntegersUsed()
+ )){
+ if (d_private->getIteSkolemMap().empty())
+ {
+ options::decisionStopOnly.set(false);
+ d_decisionEngine->clearStrategies();
+ Trace("smt") << "SmtEngine::check(): turning off stop only" << endl;
+ }
+ }
+ }
+
TimerStat::CodeTimer solveTimer(d_stats->d_solveTime);
Chat() << "solving..." << endl;
d_smt.d_theoryEngine->notifyPreprocessedAssertions( d_assertions.ref() );
// Push the formula to decision engine
- if (noConflict)
- {
+ if(noConflict) {
Chat() << "pushing to decision engine..." << endl;
Assert(iteRewriteAssertionsEnd == d_assertions.size());
- d_smt.d_propEngine->addAssertionsToDecisionEngine(d_assertions);
+ d_smt.d_decisionEngine->addAssertions(d_assertions);
}
// end: INVARIANT to maintain: no reordering of assertions or
ExprManager* d_exprManager;
/** Our internal expression/node manager */
NodeManager* d_nodeManager;
+ /** The decision engine */
+ DecisionEngine* d_decisionEngine;
/** The theory engine */
TheoryEngine* d_theoryEngine;
/** The propositional engine */
RemoveTermFormulas& iteRemover,
const LogicInfo& logicInfo)
: d_propEngine(nullptr),
+ d_decisionEngine(nullptr),
d_context(context),
d_userContext(userContext),
d_logicInfo(logicInfo),
}
// assert to decision engine
- if (!removable)
- {
- d_propEngine->addAssertionsToDecisionEngine(additionalLemmas);
+ if(!removable) {
+ d_decisionEngine->addAssertions(additionalLemmas);
}
// Mark that we added some lemmas
class EntailmentCheckSideEffects;
}/* CVC4::theory namespace */
+class DecisionEngine;
class RemoveTermFormulas;
/**
/** Associated PropEngine engine */
prop::PropEngine* d_propEngine;
+ /** Access to decision engine */
+ DecisionEngine* d_decisionEngine;
+
/** Our context */
context::Context* d_context;
d_propEngine = propEngine;
}
+ inline void setDecisionEngine(DecisionEngine* decisionEngine) {
+ Assert(d_decisionEngine == NULL);
+ d_decisionEngine = decisionEngine;
+ }
+
/** Called when all initialization of options/logic is done */
void finishInit();