GCC Code Coverage Report
Directory: . Exec Total Coverage
File: src/decision/decision_engine.cpp Lines: 27 32 84.4 %
Date: 2021-05-21 Branches: 11 26 42.3 %

Line Exec Source
1
/******************************************************************************
2
 * Top contributors (to current version):
3
 *   Kshitij Bansal, Aina Niemetz, Andrew Reynolds
4
 *
5
 * This file is part of the cvc5 project.
6
 *
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
 * ****************************************************************************
12
 *
13
 * Decision engine.
14
 */
15
#include "decision/decision_engine.h"
16
17
#include "decision/decision_engine_old.h"
18
#include "options/decision_options.h"
19
#include "prop/sat_solver.h"
20
#include "util/resource_manager.h"
21
22
namespace cvc5 {
23
namespace decision {
24
25
8988
DecisionEngine::DecisionEngine(context::Context* c,
26
                               context::UserContext* u,
27
                               prop::SkolemDefManager* skdm,
28
8988
                               ResourceManager* rm)
29
8988
    : d_decEngineOld(new DecisionEngineOld(c, u)),
30
      d_resourceManager(rm),
31
17976
      d_useOld(true)
32
{
33
8988
}
34
35
8988
void DecisionEngine::finishInit(prop::CDCLTSatSolverInterface* ss,
36
                                prop::CnfStream* cs)
37
{
38
8988
  if (d_useOld)
39
  {
40
8988
    d_decEngineOld->setSatSolver(ss);
41
8988
    d_decEngineOld->setCnfStream(cs);
42
8988
    return;
43
  }
44
}
45
46
12748
void DecisionEngine::presolve() {}
47
48
1941586
prop::SatLiteral DecisionEngine::getNext(bool& stopSearch)
49
{
50
1941586
  d_resourceManager->spendResource(Resource::DecisionStep);
51
1941586
  if (d_useOld)
52
  {
53
1941586
    return d_decEngineOld->getNext(stopSearch);
54
  }
55
  return undefSatLiteral;
56
}
57
58
53928
bool DecisionEngine::isDone()
59
{
60
53928
  if (d_useOld)
61
  {
62
53928
    return d_decEngineOld->isDone();
63
  }
64
  return false;
65
}
66
67
390957
void DecisionEngine::addAssertion(TNode assertion)
68
{
69
390957
  if (d_useOld)
70
  {
71
390957
    d_decEngineOld->addAssertion(assertion);
72
390957
    return;
73
  }
74
}
75
76
28511
void DecisionEngine::addSkolemDefinition(TNode lem, TNode skolem)
77
{
78
28511
  if (d_useOld)
79
  {
80
28511
    d_decEngineOld->addSkolemDefinition(lem, skolem);
81
  }
82
28511
}
83
84
void DecisionEngine::notifyAsserted(TNode n)
85
{
86
  if (d_useOld)
87
  {
88
    return;
89
  }
90
}
91
92
}  // namespace decision
93
27735
}  // namespace cvc5