spot  1.2.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
gtec.hh
1 // -*- coding: utf-8 -*-
2 // Copyright (C) 2008, 2013 Laboratoire de Recherche et Développement
3 // 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 #ifndef SPOT_TGBAALGOS_GTEC_GTEC_HH
24 # define SPOT_TGBAALGOS_GTEC_GTEC_HH
25 
26 #include <stack>
27 #include "status.hh"
28 #include "tgbaalgos/emptiness.hh"
29 #include "tgbaalgos/emptiness_stats.hh"
30 
31 namespace spot
32 {
35 
39 
56 
94  SPOT_API emptiness_check*
140  couvreur99(const tgba* a,
141  option_map options = option_map(),
142  const numbered_state_heap_factory* nshf
144 
145 
149  class SPOT_API couvreur99_check: public emptiness_check, public ec_statistics
150  {
151  public:
152  couvreur99_check(const tgba* a,
153  option_map o = option_map(),
154  const numbered_state_heap_factory* nshf
156  virtual ~couvreur99_check();
157 
159  virtual emptiness_check_result* check();
160 
161  virtual std::ostream& print_stats(std::ostream& os) const;
162 
171  const couvreur99_check_status* result() const;
172 
173  protected:
180  void remove_component(const state* start_delete);
181 
183  bool poprem_;
186  unsigned get_removed_components() const;
187  unsigned get_vmsize() const;
188  };
189 
194  class SPOT_API couvreur99_check_shy : public couvreur99_check
195  {
196  public:
197  couvreur99_check_shy(const tgba* a,
198  option_map o = option_map(),
199  const numbered_state_heap_factory* nshf
201  virtual ~couvreur99_check_shy();
202 
203  virtual emptiness_check_result* check();
204 
205  protected:
206  struct successor {
207  bdd acc;
208  const spot::state* s;
209  successor(bdd acc, const spot::state* s): acc(acc), s(s) {}
210  };
211 
212  // We use five main data in this algorithm:
213  // * couvreur99_check::root, a stack of strongly connected components (SCC),
214  // * couvreur99_check::h, a hash of all visited nodes, with their order,
215  // (it is called "Hash" in Couvreur's paper)
216  // * arc, a stack of acceptance conditions between each of these SCC,
217  std::stack<bdd> arc;
218  // * num, the number of visited nodes. Used to set the order of each
219  // visited node,
220  int num;
221  // * todo, the depth-first search stack. This holds pairs of the
222  // form (STATE, SUCCESSORS) where SUCCESSORS is a list of
223  // (ACCEPTANCE_CONDITIONS, STATE) pairs.
224  typedef std::list<successor> succ_queue;
225 
226  // Position in the loop seeking known successors.
227  succ_queue::iterator pos;
228 
229  struct todo_item
230  {
231  const state* s;
232  int n;
233  succ_queue q; // Unprocessed successors of S
234  todo_item(const state* s, int n, couvreur99_check_shy* shy);
235  };
236 
237  typedef std::list<todo_item> todo_list;
238  todo_list todo;
239 
240  void clear_todo();
241 
243  void dump_queue(std::ostream& os = std::cerr);
244 
246  bool group_;
247  // If the "group2" option is set (it implies "group"), we
248  // reprocess the successor states of SCC that have been merged.
249  bool group2_;
250  // If the onepass option is true, do only one pass. This cancels
251  // all the "shyness" of the algorithm, but we need the framework
252  // of the implementation when working with GreatSPN.
253  bool onepass_;
254 
263  virtual numbered_state_heap::state_index_p find_state(const state* s);
264  };
265 
266 
268 }
269 
270 #endif // SPOT_TGBAALGOS_GTEC_GTEC_HH

Please direct any question, comment, or bug report to the Spot mailing list at spot@lrde.epita.fr.
Generated on Thu May 15 2014 11:04:11 for spot by doxygen 1.8.4