SMT-RAT  24.02
Toolbox for Strategic and Parallel Satisfiability-Modulo-Theories Solving
formula_types.cpp
Go to the documentation of this file.
1 #include "formula_types.h"
2 
3 #include "utils.h"
4 
5 namespace smtrat::analyzer {
6 
8  std::size_t num_formulas = 0;
9  std::size_t num_or = 0;
10  std::size_t num_constraints = 0;
11  std::size_t num_equalities = 0;
12  std::size_t num_disequalities = 0;
13  std::size_t num_weak_inequalities = 0;
14  std::size_t num_strict_inequalities = 0;
15  std::size_t num_variable_occurrences = 0;
16  DegreeCollector dc;
17 
18 
19  carl::visit(f, [&](const FormulaT& f){
20  ++num_formulas;
21  if (f.type() == carl::FormulaType::OR) {
22  ++num_or;
23  } else if (f.type() == carl::FormulaType::CONSTRAINT) {
24  ++num_constraints;
25  num_variable_occurrences += f.variables().size();
26  dc(f.constraint());
27  switch (f.constraint().relation()) {
28  case carl::Relation::LESS: ++num_strict_inequalities; break;
29  case carl::Relation::LEQ: ++num_weak_inequalities; break;
30  case carl::Relation::EQ: ++num_equalities; break;
31  case carl::Relation::NEQ: ++num_equalities; break;
32  case carl::Relation::GEQ: ++num_weak_inequalities; break;
33  case carl::Relation::GREATER: ++num_strict_inequalities; break;
34  }
35  }
36  });
37 
38  stats.add("num_formulas", num_formulas);
39  stats.add("num_or", num_or);
40  stats.add("num_constraints", num_constraints);
41  stats.add("num_equalities", num_equalities);
42  stats.add("num_disequalities", num_disequalities);
43  stats.add("num_weak_inequalities", num_weak_inequalities);
44  stats.add("num_strict_inequalities", num_strict_inequalities);
45 
46  stats.add("num_variable_occurrences", num_variable_occurrences);
47 
48  stats.add("constraint_deg_max", dc.degree_max);
49  stats.add("constraint_deg_sum", dc.degree_sum);
50 }
51 
52 }
void analyze_formula_types(const FormulaT &f, AnalyzerStatistics &stats)
carl::Formula< Poly > FormulaT
Definition: types.h:37