SMT-RAT  24.02
Toolbox for Strategic and Parallel Satisfiability-Modulo-Theories Solving
Statistics.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <carl-arith/core/Variable.h>
4 #include <chrono>
7 
8 #ifdef SMTRAT_DEVOPTION_Statistics
10 
11 namespace smtrat {
12 
13 class QeCoveringsStatistics : public Statistics {
14 private:
15  size_t parameter_true_cell = 0;
16  size_t parameter_false_cell = 0 ;
17  size_t output_amount_atoms = 0 ;
18  size_t output_amount_or = 0 ;
19  size_t output_amount_and = 0 ;
20  size_t output_max_var_degree = 0 ;
21  size_t output_amount_ire = 0 ;
22  std::string mVariableOrderingHeuristic;
23  std::vector<carl::Variable> mVariableOrdering;
24 
25 public:
26  void collect() override {
27  Statistics::addKeyValuePair("parameter_amount_true_cells", parameter_true_cell);
28  Statistics::addKeyValuePair("parameter_amount_false_cells", parameter_false_cell);
29  Statistics::addKeyValuePair("output_amount_atoms", output_amount_atoms);
30  Statistics::addKeyValuePair("output_amount_or", output_amount_or);
31  Statistics::addKeyValuePair("output_amount_and", output_amount_and);
32  Statistics::addKeyValuePair("output_max_var_degree", output_max_var_degree);
33  Statistics::addKeyValuePair("output_amount_ire", output_amount_ire);
34  // Statistics::addKeyValuePair("variable_ordering_heuristic", mVariableOrderingHeuristic);
35  // Statistics::addKeyValuePair("variable_ordering", mVariableOrdering);
36 
37  }
38 
39  void true_cell() {
40  ++parameter_true_cell;
41  }
42  void false_cell() {
43  ++parameter_false_cell;
44  }
45 
46  void process_output_formula(const FormulaT& output_formula) {
47  carl::visit(output_formula, [&](const FormulaT& f){
48  if(f.is_atom() && f.type() != carl::FormulaType::FALSE && f.type() != carl::FormulaType::TRUE){
49  ++output_amount_atoms;
50  if(f.type() == carl::FormulaType::VARCOMPARE && std::holds_alternative<typename VariableComparisonT::MR>(f.variable_comparison().value())){
51  output_amount_ire++;
52  output_max_var_degree = std::max(output_max_var_degree, std::get<typename VariableComparisonT::MR>(f.variable_comparison().value()).poly().total_degree());
53 
54  }else if(f.type() == carl::FormulaType::CONSTRAINT){
55  output_max_var_degree = std::max(output_max_var_degree, f.constraint().lhs().total_degree());
56  }
57  }else if(f.type() == carl::FormulaType::OR) {
58  output_amount_or += f.subformulas().size() - 1;
59  }else if(f.type() == carl::FormulaType::AND) {
60  output_amount_and += f.subformulas().size() - 1;
61  }
62  });
63  }
64 
65  void set_variable_ordering(const covering_ng::variables::VariableOrderingHeuristics& vo) {
66  mVariableOrderingHeuristic = get_name(vo);
67  }
68 
69  void set_variable_ordering(const std::vector<carl::Variable>& vo) {
70  mVariableOrdering = vo;
71  }
72 
73  static QeCoveringsStatistics& get_instance() {
74  static QeCoveringsStatistics& statistics = statistics_get<QeCoveringsStatistics>("qe_coverings");
75  return statistics;
76  }
77 };
78 
79 } // namespace smtrat
80 
81 #endif
VariableOrderingHeuristics
Possible heuristics for variable ordering.
Class to create the formulas for axioms.
carl::Formula< Poly > FormulaT
Definition: types.h:37
std::string get_name(SamplingAlgorithm samplingAlgorithm)
Definition: Sampling.h:25
carl::statistics::Statistics Statistics
Definition: Statistics.h:7