The bliss C++ API
stats.hh
1 #pragma once
2 
3 /*
4  Copyright (c) 2003-2021 Tommi Junttila
5  Released under the GNU Lesser General Public License version 3.
6 
7  This file is part of bliss.
8 
9  bliss is free software: you can redistribute it and/or modify
10  it under the terms of the GNU Lesser General Public License as published by
11  the Free Software Foundation, version 3 of the License.
12 
13  bliss is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU Lesser General Public License for more details.
17 
18  You should have received a copy of the GNU Lesser General Public License
19  along with bliss. If not, see <http://www.gnu.org/licenses/>.
20 */
21 
22 #include <cstdio>
23 #include "abstractgraph.hh"
24 #include "bignum.hh"
25 
26 namespace bliss {
27 
31 class Stats
32 {
33  friend class AbstractGraph;
35  BigNum group_size;
38  long double group_size_approx;
40  long unsigned int nof_nodes;
42  long unsigned int nof_leaf_nodes;
44  long unsigned int nof_bad_nodes;
46  long unsigned int nof_canupdates;
48  long unsigned int nof_generators;
50  unsigned long int max_level;
52  void reset()
53  {
54  group_size.assign(1);
55  group_size_approx = 1.0;
56  nof_nodes = 0;
57  nof_leaf_nodes = 0;
58  nof_bad_nodes = 0;
59  nof_canupdates = 0;
60  nof_generators = 0;
61  max_level = 0;
62  }
63 public:
64  Stats() { reset(); }
66  size_t print(FILE* const fp) const
67  {
68  size_t r = 0;
69  r += fprintf(fp, "Nodes: %lu\n", nof_nodes);
70  r += fprintf(fp, "Leaf nodes: %lu\n", nof_leaf_nodes);
71  r += fprintf(fp, "Bad nodes: %lu\n", nof_bad_nodes);
72  r += fprintf(fp, "Canrep updates: %lu\n", nof_canupdates);
73  r += fprintf(fp, "Generators: %lu\n", nof_generators);
74  r += fprintf(fp, "Max level: %lu\n", max_level);
75  r += fprintf(fp, "|Aut|: ")+group_size.print(fp)+fprintf(fp, "\n");
76  fflush(fp);
77  return r;
78  }
80  const BigNum& get_group_size() const {return group_size;}
83  long double get_group_size_approx() const {return group_size_approx;}
85  long unsigned int get_nof_nodes() const {return nof_nodes;}
87  long unsigned int get_nof_leaf_nodes() const {return nof_leaf_nodes;}
89  long unsigned int get_nof_bad_nodes() const {return nof_bad_nodes;}
91  long unsigned int get_nof_canupdates() const {return nof_canupdates;}
93  long unsigned int get_nof_generators() const {return nof_generators;}
95  unsigned long int get_max_level() const {return max_level;}
96 };
97 
98 } // namespace bliss
long unsigned int get_nof_nodes() const
Definition: stats.hh:85
long double get_group_size_approx() const
Definition: stats.hh:83
A simple wrapper class for non-negative big integers (or approximation of them).
Definition: bignum.hh:117
Definition: abstractgraph.cc:35
long unsigned int get_nof_leaf_nodes() const
Definition: stats.hh:87
Statistics returned by the bliss search algorithm.
Definition: stats.hh:31
long unsigned int get_nof_bad_nodes() const
Definition: stats.hh:89
long unsigned int get_nof_canupdates() const
Definition: stats.hh:91
void assign(unsigned int n)
Definition: bignum.hh:139
size_t print(FILE *const fp) const
Definition: stats.hh:66
An abstract base class for different types of graphs.
Definition: abstractgraph.hh:47
long unsigned int get_nof_generators() const
Definition: stats.hh:93
size_t print(FILE *const fp) const
Definition: bignum.hh:156
const BigNum & get_group_size() const
Definition: stats.hh:80
unsigned long int get_max_level() const
Definition: stats.hh:95