blob: 7c8718370efe60d40d81c1b19241c90264e4e067 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
/********************* */
/*! \file decision_engine.cpp
** \verbatim
** Original author: kshitij
** Major contributors: none
** Minor contributors (to current version): none
** This file is part of the CVC4 prototype.
** Copyright (c) 2012 The Analysis of Computer Systems Group (ACSys)
** Courant Institute of Mathematical Sciences
** New York University
** See the file COPYING in the top-level source directory for licensing
** information.\endverbatim
**
** \brief Decision engine
**
** Decision engine
**/
#include "decision/decision_engine.h"
#include "decision/justification_heuristic.h"
#include "expr/node.h"
#include "util/options.h"
using namespace std;
namespace CVC4 {
DecisionEngine::DecisionEngine(context::Context *c) :
d_enabledStrategies(),
d_needSimplifiedPreITEAssertions(),
d_assertions(),
d_cnfStream(NULL),
d_satSolver(NULL),
d_satContext(c),
d_result(SAT_VALUE_UNKNOWN)
{
const Options* options = Options::current();
Trace("decision") << "Creating decision engine" << std::endl;
if(options->incrementalSolving) return;
if(options->decisionMode == Options::DECISION_STRATEGY_INTERNAL) { }
if(options->decisionMode == Options::DECISION_STRATEGY_JUSTIFICATION) {
DecisionStrategy* ds = new decision::JustificationHeuristic(this, d_satContext);
enableStrategy(ds);
}
}
void DecisionEngine::enableStrategy(DecisionStrategy* ds)
{
d_enabledStrategies.push_back(ds);
if( ds->needSimplifiedPreITEAssertions() )
d_needSimplifiedPreITEAssertions.push_back(ds);
}
void DecisionEngine::informSimplifiedPreITEAssertions(const vector<Node> &assertions)
{
d_result = SAT_VALUE_UNKNOWN;
d_assertions.reserve(assertions.size());
for(unsigned i = 0; i < assertions.size(); ++i)
d_assertions.push_back(assertions[i]);
for(unsigned i = 0; i < d_needSimplifiedPreITEAssertions.size(); ++i)
d_needSimplifiedPreITEAssertions[i]->notifyAssertionsAvailable();
}
void DecisionEngine::addAssertion(Node n)
{
d_result = SAT_VALUE_UNKNOWN;
if(needSimplifiedPreITEAssertions()) {
d_assertions.push_back(n);
}
for(unsigned i = 0; i < d_needSimplifiedPreITEAssertions.size(); ++i)
d_needSimplifiedPreITEAssertions[i]->notifyAssertionsAvailable();
}
}/* CVC4 namespace */
|