spot 2.16
Loading...
Searching...
No Matches
emptiness_stats.hh
1// -*- coding: utf-8 -*-
2// Copyright (C) by the Spot authors, see the AUTHORS file for details.
3//
4// This file is part of Spot, a model checking library.
5//
6// Spot is free software; you can redistribute it and/or modify it
7// under the terms of the GNU General Public License as published by
8// the Free Software Foundation; either version 3 of the License, or
9// (at your option) any later version.
10//
11// Spot is distributed in the hope that it will be useful, but WITHOUT
12// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
14// License for more details.
15//
16// You should have received a copy of the GNU General Public License
17// along with this program. If not, see <http://www.gnu.org/licenses/>.
18
19#pragma once
20
21#include <spot/misc/common.hh>
22#include <spot/misc/ltstr.hh>
23#include <map>
24
25namespace spot
26{
27
30
34 {
35 virtual
37 {
38 }
39
41 unsigned
42 get(const char* str) const
43 {
44 auto i = stats.find(str);
45 SPOT_ASSERT(i != stats.end());
46 return (this->*i->second)();
47 }
48
50 typedef unsigned (unsigned_statistics::*unsigned_fun)() const;
52 typedef std::map<const char*, unsigned_fun, char_ptr_less_than> stats_map;
54 };
55
62 {
63 public :
65 : states_(0), transitions_(0), depth_(0), max_depth_(0)
66 {
67 stats["states"] =
69 stats["transitions"] =
72 stats["max. depth"] =
75 }
76
78 void
79 set_states(unsigned n)
80 {
81 states_ = n;
82 }
83
85 void
87 {
88 ++states_;
89 }
90
92 void
94 {
95 ++transitions_;
96 }
97
99 void
100 inc_depth(unsigned n = 1)
101 {
102 depth_ += n;
103 if (depth_ > max_depth_)
104 max_depth_ = depth_;
105 }
106
108 void
109 dec_depth(unsigned n = 1)
110 {
111 SPOT_ASSERT(depth_ >= n);
112 depth_ -= n;
113 }
114
116 unsigned
117 states() const
118 {
119 return states_;
120 }
121
123 unsigned
125 {
126 return transitions_;
127 }
128
130 unsigned
131 max_depth() const
132 {
133 return max_depth_;
134 }
135
137 unsigned
138 depth() const
139 {
140 return depth_;
141 }
142
143 private :
144 unsigned states_;
145 unsigned transitions_;
146 unsigned depth_;
147 unsigned max_depth_;
148 };
149
156 {
157 public:
159 : prefix_states_(0), cycle_states_(0)
160 {
161 stats["(non unique) states for prefix"] =
164 stats["(non unique) states for cycle"] =
167 }
168
170 void
172 {
173 ++prefix_states_;
174 }
175
177 unsigned
179 {
180 return prefix_states_;
181 }
182
184 void
186 {
187 ++cycle_states_;
188 }
189
191 unsigned
193 {
194 return cycle_states_;
195 }
196
197 private:
198 unsigned prefix_states_;
199 unsigned cycle_states_;
200 };
201
208 {
209 public:
211 {
212 stats["search space states"] =
215 }
216
217 virtual
219 {
220 }
221
223 virtual unsigned acss_states() const = 0;
224 };
226}
Accepting Cycle Search Space statistics.
Definition emptiness_stats.hh:208
virtual unsigned acss_states() const =0
Number of states in the search space for the accepting cycle.
Accepting Run Search statistics.
Definition emptiness_stats.hh:156
unsigned ars_prefix_states() const
Return the number of prefix states visited.
Definition emptiness_stats.hh:178
void inc_ars_prefix_states()
Increment the count of prefix states visited.
Definition emptiness_stats.hh:171
unsigned ars_cycle_states() const
Return the number of cycle states visited.
Definition emptiness_stats.hh:192
void inc_ars_cycle_states()
Increment the count of cycle states visited.
Definition emptiness_stats.hh:185
Emptiness-check statistics.
Definition emptiness_stats.hh:62
unsigned transitions() const
Return the number of visited transitions.
Definition emptiness_stats.hh:124
void inc_transitions()
Increment the number of visited transitions.
Definition emptiness_stats.hh:93
unsigned depth() const
Return the current DFS depth.
Definition emptiness_stats.hh:138
void inc_states()
Increment the number of visited states.
Definition emptiness_stats.hh:86
void set_states(unsigned n)
Set the number of visited states.
Definition emptiness_stats.hh:79
unsigned max_depth() const
Return the maximum DFS depth reached.
Definition emptiness_stats.hh:131
unsigned states() const
Return the number of visited states.
Definition emptiness_stats.hh:117
void dec_depth(unsigned n=1)
Decrease the current DFS depth by n.
Definition emptiness_stats.hh:109
void inc_depth(unsigned n=1)
Increase the current DFS depth by n.
Definition emptiness_stats.hh:100
Definition automata.hh:26
Interface for retrieving unsigned integer statistics from an emptiness check.
Definition emptiness_stats.hh:34
unsigned get(const char *str) const
Retrieve a named statistic by its key.
Definition emptiness_stats.hh:42
std::map< const char *, unsigned_fun, char_ptr_less_than > stats_map
Map from statistic names to getter function pointers.
Definition emptiness_stats.hh:52
stats_map stats
Map of available statistics.
Definition emptiness_stats.hh:53
unsigned(unsigned_statistics::* unsigned_fun)() const
Function pointer type for unsigned statistics getters.
Definition emptiness_stats.hh:50

Please direct any question, comment, or bug report to the Spot mailing list at spot@lrde.epita.fr.
Generated on Fri Feb 27 2015 10:00:07 for spot by doxygen 1.9.8