120fc730be8bbee152770a785be22a389cbabcd2
1 /******************************************************************************
2 * Top contributors (to current version):
3 * Kshitij Bansal, Aina Niemetz, Andrew Reynolds
5 * This file is part of the cvc5 project.
7 * Copyright (c) 2009-2021 by the authors listed in the file AUTHORS
8 * in the top-level source directory and their institutional affiliations.
9 * All rights reserved. See the file COPYING in the top-level source
10 * directory for licensing information.
11 * ****************************************************************************
13 * Old implementation of the decision engine
15 #include "decision/decision_engine_old.h"
17 #include "decision/decision_attributes.h"
18 #include "decision/justification_heuristic.h"
19 #include "expr/node.h"
20 #include "options/decision_options.h"
21 #include "options/smt_options.h"
22 #include "util/resource_manager.h"
28 DecisionEngineOld::DecisionEngineOld(Env
& env
)
29 : DecisionEngine(env
),
30 d_result(context(), SAT_VALUE_UNKNOWN
),
32 d_enabledITEStrategy(nullptr),
33 d_decisionStopOnly(options::decisionMode()
34 == options::DecisionMode::STOPONLY_OLD
)
36 Trace("decision") << "Creating decision engine" << std::endl
;
37 Assert(d_engineState
== 0);
40 Trace("decision-init") << "DecisionEngineOld::init()" << std::endl
;
41 Trace("decision-init") << " * options->decisionMode: "
42 << options::decisionMode() << std::endl
;
43 Trace("decision-init") << " * decisionStopOnly: " << d_decisionStopOnly
46 if (options::decisionMode() == options::DecisionMode::JUSTIFICATION
)
48 d_enabledITEStrategy
.reset(new decision::JustificationHeuristic(env
, this));
52 void DecisionEngineOld::shutdown()
54 Trace("decision") << "Shutting down decision engine" << std::endl
;
56 Assert(d_engineState
== 1);
58 d_enabledITEStrategy
.reset(nullptr);
61 SatLiteral
DecisionEngineOld::getNextInternal(bool& stopSearch
)
63 Assert(d_cnfStream
!= nullptr)
64 << "Forgot to set cnfStream for decision engine?";
65 Assert(d_satSolver
!= nullptr)
66 << "Forgot to set satSolver for decision engine?";
68 SatLiteral ret
= d_enabledITEStrategy
== nullptr
70 : d_enabledITEStrategy
->getNext(stopSearch
);
71 // if we are doing stop only, we don't return the literal
72 return d_decisionStopOnly
? undefSatLiteral
: ret
;
75 void DecisionEngineOld::addAssertion(TNode assertion
, bool isLemma
)
77 // new assertions, reset whatever result we knew
78 d_result
= SAT_VALUE_UNKNOWN
;
79 if (d_enabledITEStrategy
!= nullptr)
81 d_enabledITEStrategy
->addAssertion(assertion
);
85 void DecisionEngineOld::addSkolemDefinition(TNode lem
,
89 // new assertions, reset whatever result we knew
90 d_result
= SAT_VALUE_UNKNOWN
;
91 if (d_enabledITEStrategy
!= nullptr)
93 d_enabledITEStrategy
->addSkolemDefinition(lem
, skolem
);