summaryrefslogtreecommitdiff
path: root/src/theory/model_manager_distributed.cpp
diff options
context:
space:
mode:
authorAndrew Reynolds <andrew.j.reynolds@gmail.com>2020-09-20 10:59:36 -0500
committerGitHub <noreply@github.com>2020-09-20 10:59:36 -0500
commit63e7c6bb6d9c99a5282241be8b32a04ea67dfb8d (patch)
tree8841b287b35143ff7470811ae164f74c71bc2cad /src/theory/model_manager_distributed.cpp
parent5f04a78336d648b02bc5cfdaaf734b6b350ee805 (diff)
More flexible design for model manager distributed (#4976)
This PR makes it so that the distributed model manager can be used independently of the architecture for equality engine management for theories, meaning the choice of using a separate equality engine for the model can be done in both the current distributed architecture, or the proposed central architecture (where there would be 2 equality engines, the central one and the model one). The "central model manager" on the other hand will only be combined with the central architecture. This will make it easier to test the centralized equality engine manager, since all things related to model construction can be preserved when using a central architecture. This PR moves some of the responsibilities from the (distributed) equality engine manager to the distributed model manager, including the management of the context of the model equality engine and the allocation of its equality engine. This PR is not intended to make any behavior changes to the current architecture.
Diffstat (limited to 'src/theory/model_manager_distributed.cpp')
-rw-r--r--src/theory/model_manager_distributed.cpp37
1 files changed, 30 insertions, 7 deletions
diff --git a/src/theory/model_manager_distributed.cpp b/src/theory/model_manager_distributed.cpp
index c2e1d6521..4d47329b5 100644
--- a/src/theory/model_manager_distributed.cpp
+++ b/src/theory/model_manager_distributed.cpp
@@ -20,13 +20,36 @@
namespace CVC4 {
namespace theory {
-ModelManagerDistributed::ModelManagerDistributed(
- TheoryEngine& te, EqEngineManagerDistributed& eem)
- : ModelManager(te), d_eem(eem)
+ModelManagerDistributed::ModelManagerDistributed(TheoryEngine& te,
+ EqEngineManager& eem)
+ : ModelManager(te, eem)
{
}
-ModelManagerDistributed::~ModelManagerDistributed() {}
+ModelManagerDistributed::~ModelManagerDistributed()
+{
+ // pop the model context which we pushed on initialization
+ d_modelEeContext.pop();
+}
+
+void ModelManagerDistributed::initializeModelEqEngine(
+ eq::EqualityEngineNotify* notify)
+{
+ // initialize the model equality engine, use the provided notification object,
+ // which belongs e.g. to CombinationModelBased
+ EeSetupInfo esim;
+ esim.d_notify = notify;
+ esim.d_name = d_model->getName() + "::ee";
+ esim.d_constantsAreTriggers = false;
+ d_modelEqualityEngineAlloc.reset(
+ d_eem.allocateEqualityEngine(esim, &d_modelEeContext));
+ d_modelEqualityEngine = d_modelEqualityEngineAlloc.get();
+ // finish initializing the model
+ d_model->finishInit(d_modelEqualityEngine);
+ // We push a context during initialization since the model is cleared during
+ // collectModelInfo using pop/push.
+ d_modelEeContext.push();
+}
bool ModelManagerDistributed::prepareModel()
{
@@ -34,9 +57,8 @@ bool ModelManagerDistributed::prepareModel()
<< std::endl;
// push/pop to clear the equality engine of the model
- context::Context* meec = d_eem.getModelEqualityEngineContext();
- meec->pop();
- meec->push();
+ d_modelEeContext.pop();
+ d_modelEeContext.push();
// Collect model info from the theories
Trace("model-builder") << "ModelManagerDistributed: Collect model info..."
@@ -76,6 +98,7 @@ bool ModelManagerDistributed::prepareModel()
bool ModelManagerDistributed::finishBuildModel() const
{
+ // do not use relevant terms
if (!d_modelBuilder->buildModel(d_model))
{
Trace("model-builder") << "ModelManager: fail build model" << std::endl;
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback