Loading...
Searching...
No Matches
stats.hh
#pragma once
/*
Copyright (c) 2003-2021 Tommi Junttila
Released under the GNU Lesser General Public License version 3.
This file is part of bliss.
bliss is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, version 3 of the License.
bliss is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with bliss. If not, see <http://www.gnu.org/licenses/>.
*/
#include <cstdio>
#include <bliss/abstractgraph.hh>
#include <bliss/bignum.hh>
namespace bliss {
class Stats
{
friend class AbstractGraph;
BigNum group_size;
long double group_size_approx;
long unsigned int nof_nodes;
long unsigned int nof_leaf_nodes;
long unsigned int nof_bad_nodes;
long unsigned int nof_canupdates;
long unsigned int nof_generators;
unsigned long int max_level;
void reset()
{
group_size.assign(1);
group_size_approx = 1.0;
nof_nodes = 0;
nof_leaf_nodes = 0;
nof_bad_nodes = 0;
nof_canupdates = 0;
nof_generators = 0;
max_level = 0;
}
public:
Stats() { reset(); }
size_t print(FILE* const fp) const
{
size_t r = 0;
r += fprintf(fp, "Nodes: %lu\n", nof_nodes);
r += fprintf(fp, "Leaf nodes: %lu\n", nof_leaf_nodes);
r += fprintf(fp, "Bad nodes: %lu\n", nof_bad_nodes);
r += fprintf(fp, "Canrep updates: %lu\n", nof_canupdates);
r += fprintf(fp, "Generators: %lu\n", nof_generators);
r += fprintf(fp, "Max level: %lu\n", max_level);
r += fprintf(fp, "|Aut|: ")+group_size.print(fp)+fprintf(fp, "\n");
fflush(fp);
return r;
}
const BigNum& get_group_size() const {return group_size;}
long double get_group_size_approx() const {return group_size_approx;}
long unsigned int get_nof_nodes() const {return nof_nodes;}
long unsigned int get_nof_leaf_nodes() const {return nof_leaf_nodes;}
long unsigned int get_nof_bad_nodes() const {return nof_bad_nodes;}
long unsigned int get_nof_canupdates() const {return nof_canupdates;}
long unsigned int get_nof_generators() const {return nof_generators;}
unsigned long int get_max_level() const {return max_level;}
};
} // namespace bliss
bliss::BigNum
A simple wrapper class for non-negative big integers (or approximation of them).
Definition bignum.hh:118
bliss::BigNum::assign
void assign(unsigned int n)
Definition bignum.hh:139
bliss::Stats::print
size_t print(FILE *const fp) const
Definition stats.hh:66
bliss::Stats::get_nof_bad_nodes
long unsigned int get_nof_bad_nodes() const
Definition stats.hh:89
bliss::Stats::get_group_size
const BigNum & get_group_size() const
Definition stats.hh:80
bliss::Stats::get_nof_generators
long unsigned int get_nof_generators() const
Definition stats.hh:93
bliss::Stats::get_group_size_approx
long double get_group_size_approx() const
Definition stats.hh:83
bliss::Stats::get_nof_nodes
long unsigned int get_nof_nodes() const
Definition stats.hh:85
bliss::Stats::get_nof_leaf_nodes
long unsigned int get_nof_leaf_nodes() const
Definition stats.hh:87
bliss::Stats::get_nof_canupdates
long unsigned int get_nof_canupdates() const
Definition stats.hh:91
bliss::Stats::get_max_level
unsigned long int get_max_level() const
Definition stats.hh:95
bliss
Definition abstractgraph.cc:35