spot  1.99.7
gtec.hh
1 // -*- coding: utf-8 -*-
2 // Copyright (C) 2008, 2013, 2014, 2015 Laboratoire de Recherche et
3 // Développement de l'Epita (LRDE).
4 // Copyright (C) 2003, 2004, 2005, 2006 Laboratoire d'Informatique de
5 // Paris 6 (LIP6), département Systèmes Répartis Coopératifs (SRC),
6 // Université Pierre 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 <stack>
26 #include <spot/twaalgos/gtec/status.hh>
27 #include <spot/twaalgos/emptiness.hh>
28 #include <spot/twaalgos/emptiness_stats.hh>
29 
30 namespace spot
31 {
34 
38 
55 
93  SPOT_API emptiness_check_ptr
139  couvreur99(const const_twa_ptr& a, option_map options = option_map());
140 
141 #ifndef SWIG
142  class SPOT_API couvreur99_check: public emptiness_check, public ec_statistics
146  {
147  public:
148  couvreur99_check(const const_twa_ptr& a, option_map o = option_map());
149  virtual ~couvreur99_check();
150 
152  virtual emptiness_check_result_ptr check();
153 
154  virtual std::ostream& print_stats(std::ostream& os) const;
155 
164  std::shared_ptr<const couvreur99_check_status> result() const;
165 
166  protected:
167  std::shared_ptr<couvreur99_check_status> ecs_;
173  void remove_component(const state* start_delete);
174 
176  bool poprem_;
179  unsigned get_removed_components() const;
180  unsigned get_vmsize() const;
181  };
182 
187  class SPOT_API couvreur99_check_shy final: public couvreur99_check
188  {
189  public:
190  couvreur99_check_shy(const const_twa_ptr& a, option_map o = option_map());
191  virtual ~couvreur99_check_shy();
192 
193  virtual emptiness_check_result_ptr check();
194 
195  protected:
196  struct successor {
197  acc_cond::mark_t acc;
198  const spot::state* s;
199  successor(acc_cond::mark_t acc, const spot::state* s): acc(acc), s(s) {}
200  };
201 
202  // We use five main data in this algorithm:
203  // * couvreur99_check::root, a stack of strongly connected components (SCC),
204  // * couvreur99_check::h, a hash of all visited nodes, with their order,
205  // (it is called "Hash" in Couvreur's paper)
206  // * arc, a stack of acceptance conditions between each of these SCC,
207  std::stack<acc_cond::mark_t> arc;
208  // * num, the number of visited nodes. Used to set the order of each
209  // visited node,
210  int num;
211  // * todo, the depth-first search stack. This holds pairs of the
212  // form (STATE, SUCCESSORS) where SUCCESSORS is a list of
213  // (ACCEPTANCE_CONDITIONS, STATE) pairs.
214  typedef std::list<successor> succ_queue;
215 
216  // Position in the loop seeking known successors.
217  succ_queue::iterator pos;
218 
219  struct todo_item
220  {
221  const state* s;
222  int n;
223  succ_queue q; // Unprocessed successors of S
224  todo_item(const state* s, int n, couvreur99_check_shy* shy);
225  };
226 
227  typedef std::list<todo_item> todo_list;
228  todo_list todo;
229 
230  void clear_todo();
231 
233  void dump_queue(std::ostream& os = std::cerr);
234 
236  bool group_;
237  // If the "group2" option is set (it implies "group"), we
238  // reprocess the successor states of SCC that have been merged.
239  bool group2_;
240  };
241 #endif
242 
244 }
Definition: graph.hh:32
Manage a map of options.
Definition: optionmap.hh:36
A version of spot::couvreur99_check that tries to visit known states first.
Definition: gtec.hh:187
An implementation of the Couvreur99 emptiness-check algorithm.
Definition: gtec.hh:145
Abstract class for states.
Definition: twa.hh:43
unsigned removed_components
Number of dead SCC removed by the algorithm.
Definition: gtec.hh:178
bool poprem_
Whether to store the state to be removed.
Definition: gtec.hh:176
emptiness_check_ptr couvreur99(const const_twa_ptr &a, option_map options=option_map())
Check whether the language of an automate is empty.
bool group_
Whether successors should be grouped for states in the same SCC.
Definition: gtec.hh:236
Definition: acc.hh:34

Please direct any question, comment, or bug report to the Spot mailing list at spot@lrde.epita.fr.
Generated on Fri Jan 15 2016 13:01:50 for spot by doxygen 1.8.9.1