SMT-RAT  24.02
Toolbox for Strategic and Parallel Satisfiability-Modulo-Theories Solving
VSStatistics.h
Go to the documentation of this file.
1 /**
2  * @file VSStatistics.h
3  * @author: Florian Corzilius
4  *
5  *
6  */
7 
8 #pragma once
9 
11 #ifdef SMTRAT_DEVOPTION_Statistics
13 
14 namespace smtrat
15 {
16  class VSStatistics : public Statistics
17  {
18  private:
19  // Members.
20  carl::uint mChecks = 0;
21  carl::uint mConflicts = 0;
22  carl::uint mCoveringSets = 0;
23  double mCoveringSetSavings = 0;
24  double mInfSubsetsSavings = 0;
25  carl::uint mCreatedTCs = 0;
26  carl::uint mConsideredStates = 0;
27  carl::uint mConsideredCases = 0;
28  carl::uint mLocalConflicts = 0;
29  carl::uint mLCOmittedConstraints = 0;
30  carl::uint mVBOmittedConstraints = 0;
31  carl::uint mBackjumpings = 0;
32  carl::uint mBJOmittedConstraints = 0;
33  carl::uint mVBOmittedTCs = 0;
34  carl::uint mBranchingLemmas = 0;
35 
36  public:
37  void collect()
38  {
39  addKeyValuePair( "check-calls", mChecks );
40  addKeyValuePair( "created-test-candidates", mCreatedTCs );
41  addKeyValuePair( "considered-states", mConsideredStates );
42  addKeyValuePair( "considered-cases", mConsideredCases );
43  addKeyValuePair( "omitted-test-candidates-by-variable-bounds", mVBOmittedTCs );
44  addKeyValuePair( "omitted-constraints-by-variable-bounds", mVBOmittedConstraints );
45  addKeyValuePair( "created-covering-sets", mCoveringSets );
46  addKeyValuePair( "average-covering-set-gain", mCoveringSets == 0 ? 0 : (mCoveringSetSavings/(double)mCoveringSets) );
47  addKeyValuePair( "average-infeasible-subset-gain", mConflicts == 0 ? 0 : (mInfSubsetsSavings/(double)mConflicts) );
48  addKeyValuePair( "local-conflicts", mLocalConflicts );
49  addKeyValuePair( "omitted-constraints-by-local-conflicts", mLCOmittedConstraints );
50  addKeyValuePair( "backjumpings", mBackjumpings );
51  addKeyValuePair( "omitted-constraints-by-backjumping", mBJOmittedConstraints );
52  addKeyValuePair( "branching-lemmas", mBranchingLemmas );
53  }
54 
55  void check()
56  {
57  ++mChecks;
58  }
59 
60  template<typename ModuleInput>
61  void addConflict( const ModuleInput& _formula, const std::vector<FormulaSetT>& _infSubSets )
62  {
63  assert( !_formula.empty() );
64  for( const auto& iss : _infSubSets )
65  {
66  ++mConflicts;
67  mInfSubsetsSavings += (double)(_formula.size()-iss.size())/(double)_formula.size();
68  }
69  }
70 
71  void branch()
72  {
73  ++mBranchingLemmas;
74  }
75 
76  void createTestCandidate()
77  {
78  ++mCreatedTCs;
79  }
80 
81  void omittedConstraintByVB( carl::uint _numberOfOmittedConstraints = 1 )
82  {
83  mVBOmittedConstraints += _numberOfOmittedConstraints;
84  }
85 
86  void localConflict( carl::uint _numberOfOmittedConstraints )
87  {
88  mBranchingLemmas += _numberOfOmittedConstraints;
89  ++mLocalConflicts;
90  }
91 
92  void backjumping( carl::uint _numberOfOmittedConstraints )
93  {
94  ++mBackjumpings;
95  mBJOmittedConstraints += _numberOfOmittedConstraints;
96  }
97 
98  void coveringSet( carl::uint _coveringSetSize, carl::uint _numberOfConstraintsToSolve )
99  {
100  ++mCoveringSets;
101  if( _numberOfConstraintsToSolve > 0 )
102  mCoveringSetSavings += (double)(_numberOfConstraintsToSolve-_coveringSetSize)/(double)_numberOfConstraintsToSolve;
103  }
104 
105  void considerState()
106  {
107  ++mConsideredStates;
108  }
109 
110  void considerCase()
111  {
112  ++mConsideredCases;
113  }
114 
115  void omittedConstraintsWithVB( carl::uint _numberOfOmittedConstraints = 1 )
116  {
117  mVBOmittedConstraints += _numberOfOmittedConstraints;
118  }
119 
120  void omittedTestCandidateWithVB( carl::uint _numberOfOmittedConstraints )
121  {
122  ++mVBOmittedTCs;
123  mVBOmittedConstraints += _numberOfOmittedConstraints;
124  }
125  };
126 
127 }
128 #endif
Class to create the formulas for axioms.
carl::statistics::Statistics Statistics
Definition: Statistics.h:7