namespace CVC4 {
-DecisionEngine::DecisionEngine(context::Context *sc,
- context::UserContext *uc) :
- d_enabledStrategies(),
- d_needIteSkolemMap(),
- d_relevancyStrategy(NULL),
- d_assertions(uc),
- d_cnfStream(NULL),
- d_satSolver(NULL),
- d_satContext(sc),
- d_userContext(uc),
- d_result(sc, SAT_VALUE_UNKNOWN),
- d_engineState(0)
+DecisionEngine::DecisionEngine(context::Context* sc, context::UserContext* uc)
+ : d_enabledITEStrategies(),
+ d_needIteSkolemMap(),
+ d_relevancyStrategy(NULL),
+ d_assertions(uc),
+ d_cnfStream(NULL),
+ d_satSolver(NULL),
+ d_satContext(sc),
+ d_userContext(uc),
+ d_result(sc, SAT_VALUE_UNKNOWN),
+ d_engineState(0)
{
Trace("decision") << "Creating decision engine" << std::endl;
}
if (options::decisionMode() == options::DecisionMode::JUSTIFICATION)
{
- ITEDecisionStrategy* ds =
- new decision::JustificationHeuristic(this, d_userContext, d_satContext);
- d_enabledStrategies.push_back(ds);
- d_needIteSkolemMap.push_back(ds);
+ d_enabledITEStrategies.emplace_back(new decision::JustificationHeuristic(
+ this, d_userContext, d_satContext));
+ d_needIteSkolemMap.push_back(d_enabledITEStrategies.back().get());
}
}
Assert(d_engineState == 1);
d_engineState = 2;
- for (DecisionStrategy* s : d_enabledStrategies)
- {
- delete s;
- }
- d_enabledStrategies.clear();
+ d_enabledITEStrategies.clear();
d_needIteSkolemMap.clear();
}
namespace CVC4 {
class DecisionEngine {
-
- vector <DecisionStrategy* > d_enabledStrategies;
+ vector<std::unique_ptr<ITEDecisionStrategy>> d_enabledITEStrategies;
vector <ITEDecisionStrategy* > d_needIteSkolemMap;
RelevancyStrategy* d_relevancyStrategy;
Trace("decision") << "Destroying decision engine" << std::endl;
}
- // void setPropEngine(PropEngine* pe) {
- // // setPropEngine should not be called more than once
- // Assert(d_propEngine == NULL);
- // Assert(pe != NULL);
- // d_propEngine = pe;
- // }
-
void setSatSolver(DPLLSatSolverInterface* ss) {
// setPropEngine should not be called more than once
Assert(d_satSolver == NULL);
<< "Forgot to set satSolver for decision engine?";
SatLiteral ret = undefSatLiteral;
- for(unsigned i = 0;
- i < d_enabledStrategies.size()
- and ret == undefSatLiteral
- and stopSearch == false; ++i) {
- ret = d_enabledStrategies[i]->getNext(stopSearch);
+ for (unsigned i = 0; i < d_enabledITEStrategies.size()
+ and ret == undefSatLiteral and stopSearch == false;
+ ++i)
+ {
+ ret = d_enabledITEStrategies[i]->getNext(stopSearch);
}
return ret;
}