spot  1.99.8
emptiness.hh
1 // -*- coding: utf-8 -*-
2 // Copyright (C) 2011, 2013, 2014, 2015, 2016 Laboratoire de Recherche et
3 // Developpement de l'Epita (LRDE).
4 // Copyright (C) 2004, 2005 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 <map>
26 #include <list>
27 #include <iosfwd>
28 #include <bddx.h>
29 #include <spot/misc/optionmap.hh>
30 #include <spot/twa/twagraph.hh>
31 #include <spot/twaalgos/emptiness_stats.hh>
32 
33 namespace spot
34 {
35  struct twa_run;
36  typedef std::shared_ptr<twa_run> twa_run_ptr;
37  typedef std::shared_ptr<const twa_run> const_twa_run_ptr;
38 
71 
77  class SPOT_API emptiness_check_result
78  {
79  public:
80  emptiness_check_result(const const_twa_ptr& a,
81  option_map o = option_map())
82  : a_(a), o_(o)
83  {
84  }
85 
86  virtual
88  {
89  }
90 
103  virtual twa_run_ptr accepting_run();
104 
106  const const_twa_ptr&
107  automaton() const
108  {
109  return a_;
110  }
111 
113  const option_map&
114  options() const
115  {
116  return o_;
117  }
118 
120  const char* parse_options(char* options);
121 
123  virtual const unsigned_statistics* statistics() const;
124 
125  protected:
127  virtual void options_updated(const option_map& old);
128 
129  const_twa_ptr a_;
131  };
132 
133  typedef std::shared_ptr<emptiness_check_result> emptiness_check_result_ptr;
134 
136  class SPOT_API emptiness_check:
137  public std::enable_shared_from_this<emptiness_check>
138  {
139  public:
140  emptiness_check(const const_twa_ptr& a, option_map o = option_map())
141  : a_(a), o_(o)
142  {
143  }
144  virtual ~emptiness_check();
145 
147  const const_twa_ptr&
148  automaton() const
149  {
150  return a_;
151  }
152 
154  const option_map&
155  options() const
156  {
157  return o_;
158  }
159 
161  const char* parse_options(char* options);
162 
164  virtual bool safe() const;
165 
180  virtual emptiness_check_result_ptr check() = 0;
181 
183  virtual const unsigned_statistics* statistics() const;
184 
186  virtual const ec_statistics* emptiness_check_statistics() const;
187 
189  virtual std::ostream& print_stats(std::ostream& os) const;
190 
192  virtual void options_updated(const option_map& old);
193 
194  protected:
195  const_twa_ptr a_;
197  };
198 
199  typedef std::shared_ptr<emptiness_check> emptiness_check_ptr;
200 
202  typedef std::shared_ptr<emptiness_check_instantiator>
203  emptiness_check_instantiator_ptr;
204 
205  // Dynamically create emptiness checks. Given their name and options.
207  {
208  public:
210  emptiness_check_ptr instantiate(const const_twa_ptr& a) const;
211 
214  const option_map&
215  options() const
216  {
217  return o_;
218  }
219 
220  option_map&
222  {
223  return o_;
224  }
226 
229  unsigned int min_acceptance_conditions() const;
230 
235  unsigned int max_acceptance_conditions() const;
236  protected:
238 
239  option_map o_;
240  void *info_;
241  };
243 
253  SPOT_API emptiness_check_instantiator_ptr
254  make_emptiness_check_instantiator(const char* name, const char** err);
255 
256 
259 
263 
265  struct SPOT_API twa_run final
266  {
267  struct step {
268  const state* s;
269  bdd label;
270  acc_cond::mark_t acc;
271 
272  step(const state* s, bdd label, acc_cond::mark_t acc)
273  : s(s), label(label), acc(acc)
274  {
275  }
276  step()
277  {
278  }
279  };
280 
281  typedef std::list<step> steps;
282 
283  steps prefix;
284  steps cycle;
285  const_twa_ptr aut;
286 
287  ~twa_run();
288  twa_run(const const_twa_ptr& aut)
289  : aut(aut)
290  {
291  }
292  twa_run(const twa_run& run);
293  twa_run& operator=(const twa_run& run);
294 
299  twa_run_ptr reduce() const;
300 
311  bool replay(std::ostream& os, bool debug = false) const;
312 
316  void highlight(unsigned color);
317 
321  twa_graph_ptr as_twa() const;
322 
337  SPOT_API
338  friend std::ostream& operator<<(std::ostream& os, const twa_run& run);
339  };
341 
344 }
Definition: graph.hh:32
Definition: emptiness.hh:267
Emptiness-check statistics.
Definition: emptiness_stats.hh:121
Common interface to emptiness check algorithms.
Definition: emptiness.hh:136
Manage a map of options.
Definition: optionmap.hh:36
Abstract class for states.
Definition: twa.hh:43
Definition: emptiness.hh:206
option_map o_
The options.
Definition: emptiness.hh:130
An accepted run, for a twa.
Definition: emptiness.hh:265
const const_twa_ptr & automaton() const
The automaton that this emptiness-check inspects.
Definition: emptiness.hh:148
const const_twa_ptr & automaton() const
The automaton on which an accepting_run() was found.
Definition: emptiness.hh:107
const_twa_ptr a_
The automaton.
Definition: emptiness.hh:129
The result of an emptiness check.
Definition: emptiness.hh:77
Definition: emptiness_stats.hh:35
option_map o_
The options.
Definition: emptiness.hh:196
const option_map & options() const
Return the options parametrizing how the accepting run is computed.
Definition: emptiness.hh:114
const option_map & options() const
Return the options parametrizing how the emptiness check is realized.
Definition: emptiness.hh:155
const_twa_ptr a_
The automaton.
Definition: emptiness.hh:195
option_map & options()
Definition: emptiness.hh:221
const option_map & options() const
Definition: emptiness.hh:215
Definition: acc.hh:34

Please direct any question, comment, or bug report to the Spot mailing list at spot@lrde.epita.fr.
Generated on Thu Feb 18 2016 13:37:05 for spot by doxygen 1.8.9.1