spot  2.9
powerset.hh
1 // -*- coding: utf-8 -*-
2 // Copyright (C) 2011, 2013-2015, 2019 Laboratoire de Recherche et
3 // Développement de l'Epita.
4 // Copyright (C) 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
5 // département Systèmes Répartis Coopératifs (SRC), Université Pierre
6 // et Marie Curie.
7 //
8 // This file is part of Spot, a model checking library.
9 //
10 // Spot is free software; you can redistribute it and/or modify it
11 // under the terms of the GNU General Public License as published by
12 // the Free Software Foundation; either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // Spot is distributed in the hope that it will be useful, but WITHOUT
16 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
17 // or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
18 // License for more details.
19 //
20 // You should have received a copy of the GNU General Public License
21 // along with this program. If not, see <http://www.gnu.org/licenses/>.
22 
23 #pragma once
24 
25 #include <set>
26 #include <vector>
27 #include <iosfwd>
28 #include <spot/twa/twagraph.hh>
29 
30 namespace spot
31 {
32 
33  struct SPOT_API power_map
34  {
35  typedef std::set<unsigned> power_state;
36  std::vector<power_state> map_;
37 
38  const power_state&
39  states_of(unsigned s) const
40  {
41  return map_.at(s);
42  }
43  };
44 
47  class SPOT_API output_aborter
48  {
49  unsigned max_states_;
50  unsigned max_edges_;
51  mutable bool reason_is_states_;
52  public:
53  output_aborter(unsigned max_states,
54  unsigned max_edges = ~0U)
55  : max_states_(max_states), max_edges_(max_edges)
56  {
57  }
58 
59  unsigned max_states() const
60  {
61  return max_states_;
62  }
63 
64  unsigned max_edges() const
65  {
66  return max_edges_;
67  }
68 
69  bool too_large(const const_twa_graph_ptr& aut) const
70  {
71  bool too_many_states = aut->num_states() > max_states_;
72  if (!too_many_states && (aut->num_edges() <= max_edges_))
73  return false;
74  // Only update the reason if we return true;
75  reason_is_states_ = too_many_states;
76  return true;
77  }
78 
79  std::ostream& print_reason(std::ostream&) const;
80  };
81 
82 
97 
98  SPOT_API twa_graph_ptr
99  tgba_powerset(const const_twa_graph_ptr& aut,
100  power_map& pm, bool merge = true,
101  const output_aborter* aborter = nullptr);
102  SPOT_API twa_graph_ptr
103  tgba_powerset(const const_twa_graph_ptr& aut,
104  const output_aborter* aborter = nullptr);
106 
107 
127  SPOT_API twa_graph_ptr
128  tba_determinize(const const_twa_graph_ptr& aut,
129  unsigned threshold_states = 0,
130  unsigned threshold_cycles = 0);
131 
159  SPOT_API twa_graph_ptr
160  tba_determinize_check(const twa_graph_ptr& aut,
161  unsigned threshold_states = 0,
162  unsigned threshold_cycles = 0,
163  formula f = nullptr,
164  const_twa_graph_ptr neg_aut = nullptr);
165 
166 }
Definition: automata.hh:26
Main class for temporal logic formula.
Definition: formula.hh:704
twa_graph_ptr tgba_powerset(const const_twa_graph_ptr &aut, const output_aborter *aborter=nullptr)
Build a deterministic automaton, ignoring acceptance conditions.
Helper object to specify when an algorithm should abort its construction.
Definition: powerset.hh:47
Definition: powerset.hh:33

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.8.13