spot 2.16
Loading...
Searching...
No Matches
powerset.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 <set>
22#include <vector>
23#include <iosfwd>
24#include <spot/twa/twagraph.hh>
25
26namespace spot
27{
28
32 struct SPOT_API power_map
33 {
35 typedef std::set<unsigned> power_state;
36 std::vector<power_state> map_;
37
39 const power_state&
40 states_of(unsigned s) const
41 {
42 return map_.at(s);
43 }
44 };
45
49 class SPOT_API output_aborter
50 {
51 unsigned max_states_;
52 unsigned max_edges_;
53 mutable bool reason_is_states_;
54 public:
56 output_aborter(unsigned max_states,
57 unsigned max_edges = ~0U)
58 : max_states_(max_states), max_edges_(max_edges)
59 {
60 }
61
63 unsigned max_states() const
64 {
65 return max_states_;
66 }
67
69 unsigned max_edges() const
70 {
71 return max_edges_;
72 }
73
75 bool too_large(const const_twa_graph_ptr& aut) const
76 {
77 bool too_many_states = aut->num_states() > max_states_;
78 if (!too_many_states && (aut->num_edges() <= max_edges_))
79 return false;
80 // Only update the reason if we return true;
81 reason_is_states_ = too_many_states;
82 return true;
83 }
84
86 std::ostream& print_reason(std::ostream&) const;
87 };
88
89
109
110 SPOT_API twa_graph_ptr
112 power_map& pm, bool merge = true,
113 const output_aborter* aborter = nullptr,
114 std::vector<unsigned>* accepting_sinks = nullptr);
117 SPOT_API twa_graph_ptr
119 const output_aborter* aborter = nullptr,
120 std::vector<unsigned>* accepting_sinks = nullptr);
122
123
143 SPOT_API twa_graph_ptr
145 unsigned threshold_states = 0,
146 unsigned threshold_cycles = 0);
147
175 SPOT_API twa_graph_ptr
177 unsigned threshold_states = 0,
178 unsigned threshold_cycles = 0,
179 formula f = nullptr,
180 const_twa_graph_ptr neg_aut = nullptr);
181
182}
Main class for temporal logic formula.
Definition formula.hh:847
Helper object to specify when an algorithm should abort its construction.
Definition powerset.hh:50
std::ostream & print_reason(std::ostream &) const
Print the reason why the construction was aborted.
unsigned max_edges() const
Return the maximum number of edges allowed.
Definition powerset.hh:69
unsigned max_states() const
Return the maximum number of states allowed.
Definition powerset.hh:63
bool too_large(const const_twa_graph_ptr &aut) const
Check if the automaton exceeds the size limits.
Definition powerset.hh:75
output_aborter(unsigned max_states, unsigned max_edges=~0U)
Construct with max states and max edges limits.
Definition powerset.hh:56
twa_graph_ptr tgba_powerset(const const_twa_graph_ptr &aut, power_map &pm, bool merge=true, const output_aborter *aborter=nullptr, std::vector< unsigned > *accepting_sinks=nullptr)
Build a deterministic automaton, ignoring acceptance conditions.
std::shared_ptr< twa_graph > twa_graph_ptr
Shared pointer to a mutable twa_graph.
Definition fwd.hh:44
std::shared_ptr< const twa_graph > const_twa_graph_ptr
Shared pointer to a const twa_graph.
Definition fwd.hh:41
Definition automata.hh:26
twa_graph_ptr tba_determinize(const const_twa_graph_ptr &aut, unsigned threshold_states=0, unsigned threshold_cycles=0)
Determinize a TBA using the powerset construction.
twa_graph_ptr tba_determinize_check(const twa_graph_ptr &aut, unsigned threshold_states=0, unsigned threshold_cycles=0, formula f=nullptr, const_twa_graph_ptr neg_aut=nullptr)
Determinize a TBA and make sure it is correct.
Maps each powerset-construction state to the set of original states it represents.
Definition powerset.hh:33
std::set< unsigned > power_state
Set of NFA states in the powerset construction.
Definition powerset.hh:35
const power_state & states_of(unsigned s) const
Return the set of NFA states for DFA state s.
Definition powerset.hh:40
std::vector< power_state > map_
Map from DFA states to NFA state sets.
Definition powerset.hh:36

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