GCC Code Coverage Report
Directory: . Exec Total Coverage
File: src/decision/decision_engine.cpp Lines: 27 32 84.4 %
Date: 2021-05-22 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
9494
DecisionEngine::DecisionEngine(context::Context* c,
26
                               context::UserContext* u,
27
                               prop::SkolemDefManager* skdm,
28
9494
                               ResourceManager* rm)
29
9494
    : d_decEngineOld(new DecisionEngineOld(c, u)),
30
      d_resourceManager(rm),
31
18988
      d_useOld(true)
32
{
33
9494
}
34
35
9494
void DecisionEngine::finishInit(prop::CDCLTSatSolverInterface* ss,
36
                                prop::CnfStream* cs)
37
{
38
9494
  if (d_useOld)
39
  {
40
9494
    d_decEngineOld->setSatSolver(ss);
41
9494
    d_decEngineOld->setCnfStream(cs);
42
9494
    return;
43
  }
44
}
45
46
14310
void DecisionEngine::presolve() {}
47
48
1962548
prop::SatLiteral DecisionEngine::getNext(bool& stopSearch)
49
{
50
1962548
  d_resourceManager->spendResource(Resource::DecisionStep);
51
1962548
  if (d_useOld)
52
  {
53
1962548
    return d_decEngineOld->getNext(stopSearch);
54
  }
55
  return undefSatLiteral;
56
}
57
58
55380
bool DecisionEngine::isDone()
59
{
60
55380
  if (d_useOld)
61
  {
62
55380
    return d_decEngineOld->isDone();
63
  }
64
  return false;
65
}
66
67
403559
void DecisionEngine::addAssertion(TNode assertion)
68
{
69
403559
  if (d_useOld)
70
  {
71
403559
    d_decEngineOld->addAssertion(assertion);
72
403559
    return;
73
  }
74
}
75
76
30870
void DecisionEngine::addSkolemDefinition(TNode lem, TNode skolem)
77
{
78
30870
  if (d_useOld)
79
  {
80
30870
    d_decEngineOld->addSkolemDefinition(lem, skolem);
81
  }
82
30870
}
83
84
void DecisionEngine::notifyAsserted(TNode n)
85
{
86
  if (d_useOld)
87
  {
88
    return;
89
  }
90
}
91
92
}  // namespace decision
93
28191
}  // namespace cvc5