GCC Code Coverage Report
Directory: . Exec Total Coverage
File: src/theory/difficulty_manager.h Lines: 1 1 100.0 %
Date: 2021-09-17 Branches: 0 0 0.0 %

Line Exec Source
1
/******************************************************************************
2
 * Top contributors (to current version):
3
 *   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
 * Relevance manager.
14
 */
15
16
#include "cvc5_private.h"
17
18
#ifndef CVC5__THEORY__DIFFICULTY_MANAGER__H
19
#define CVC5__THEORY__DIFFICULTY_MANAGER__H
20
21
#include "context/cdhashmap.h"
22
#include "context/cdlist.h"
23
#include "expr/node.h"
24
#include "theory/valuation.h"
25
26
namespace cvc5 {
27
namespace theory {
28
29
class TheoryModel;
30
31
/**
32
 * Difficulty manager, which tracks an estimate of the difficulty of each
33
 * preprocessed assertion during solving.
34
 */
35
4
class DifficultyManager
36
{
37
  typedef context::CDList<Node> NodeList;
38
  typedef context::CDHashMap<Node, uint64_t> NodeUIntMap;
39
40
 public:
41
  DifficultyManager(context::Context* c, Valuation val);
42
  /**
43
   * Get difficulty map, which populates dmap mapping preprocessed assertions
44
   * to a difficulty measure (a constant integer).
45
   */
46
  void getDifficultyMap(std::map<Node, Node>& dmap);
47
  /**
48
   * Notify lemma, for difficulty measurements. This increments the difficulty
49
   * of assertions that share literals with that lemma if the difficulty mode
50
   * is LEMMA_LITERAL. In particular, for each literal lit in the lemma lem, we
51
   * increment the difficulty of the assertion res[lit], which corresponds to
52
   * the assertion that was the reason why the literal is relevant in the
53
   * current context.
54
   *
55
   * @param rse Mapping from literals to the preprocessed assertion that was
56
   * the reason why that literal was relevant in the current context
57
   * @param lem The lemma
58
   */
59
  void notifyLemma(const std::map<TNode, TNode>& rse, Node lem);
60
  /**
61
   * Notify that `m` is a (candidate) model. This increments the difficulty
62
   * of assertions that are not satisfied by that model.
63
   *
64
   * @param input The list of preprocessed assertions
65
   * @param m The candidate model.
66
   */
67
  void notifyCandidateModel(const NodeList& input, TheoryModel* m);
68
69
 private:
70
  /** Increment difficulty on assertion a */
71
  void incrementDifficulty(TNode a, uint64_t amount = 1);
72
  /** The valuation object, used to query current value of theory literals */
73
  Valuation d_val;
74
  /**
75
   * User-context dependent mapping from input assertions to difficulty measure
76
   */
77
  NodeUIntMap d_dfmap;
78
};
79
80
}  // namespace theory
81
}  // namespace cvc5
82
83
#endif /* CVC5__THEORY__DIFFICULTY_MANAGER__H */