gtec.hh

Go to the documentation of this file.
00001 // Copyright (C) 2003, 2004, 2005, 2006 Laboratoire d'Informatique de
00002 // Paris 6 (LIP6), département Systèmes Répartis Coopératifs (SRC),
00003 // Université Pierre et Marie Curie.
00004 //
00005 // This file is part of Spot, a model checking library.
00006 //
00007 // Spot is free software; you can redistribute it and/or modify it
00008 // under the terms of the GNU General Public License as published by
00009 // the Free Software Foundation; either version 2 of the License, or
00010 // (at your option) any later version.
00011 //
00012 // Spot is distributed in the hope that it will be useful, but WITHOUT
00013 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
00014 // or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
00015 // License for more details.
00016 //
00017 // You should have received a copy of the GNU General Public License
00018 // along with Spot; see the file COPYING.  If not, write to the Free
00019 // Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
00020 // 02111-1307, USA.
00021 
00022 #ifndef SPOT_TGBAALGOS_GTEC_GTEC_HH
00023 # define SPOT_TGBAALGOS_GTEC_GTEC_HH
00024 
00025 #include <stack>
00026 #include "status.hh"
00027 #include "tgbaalgos/emptiness.hh"
00028 #include "tgbaalgos/emptiness_stats.hh"
00029 
00030 namespace spot
00031 {
00034 
00138   emptiness_check*
00139   couvreur99(const tgba* a,
00140              option_map options = option_map(),
00141              const numbered_state_heap_factory* nshf
00142              = numbered_state_heap_hash_map_factory::instance());
00143 
00144 
00148   class couvreur99_check: public emptiness_check, public ec_statistics
00149   {
00150   public:
00151     couvreur99_check(const tgba* a,
00152                      option_map o = option_map(),
00153                      const numbered_state_heap_factory* nshf
00154                      = numbered_state_heap_hash_map_factory::instance());
00155     virtual ~couvreur99_check();
00156 
00158     virtual emptiness_check_result* check();
00159 
00160     virtual std::ostream& print_stats(std::ostream& os) const;
00161 
00170     const couvreur99_check_status* result() const;
00171 
00172   protected:
00173     couvreur99_check_status* ecs_;
00179     void remove_component(const state* start_delete);
00180 
00182     bool poprem_;
00184     unsigned removed_components;
00185     unsigned get_removed_components() const;
00186     unsigned get_vmsize() const;
00187   };
00188 
00193   class couvreur99_check_shy : public couvreur99_check
00194   {
00195   public:
00196     couvreur99_check_shy(const tgba* a,
00197                          option_map o = option_map(),
00198                          const numbered_state_heap_factory* nshf
00199                          = numbered_state_heap_hash_map_factory::instance());
00200     virtual ~couvreur99_check_shy();
00201 
00202     virtual emptiness_check_result* check();
00203 
00204   protected:
00205     struct successor {
00206       bdd acc;
00207       const spot::state* s;
00208       successor(bdd acc, const spot::state* s): acc(acc), s(s) {}
00209     };
00210 
00211     // We use five main data in this algorithm:
00212     // * couvreur99_check::root, a stack of strongly connected components (SCC),
00213     // * couvreur99_check::h, a hash of all visited nodes, with their order,
00214     //   (it is called "Hash" in Couvreur's paper)
00215     // * arc, a stack of acceptance conditions between each of these SCC,
00216     std::stack<bdd> arc;
00217     // * num, the number of visited nodes.  Used to set the order of each
00218     //   visited node,
00219     int num;
00220     // * todo, the depth-first search stack.  This holds pairs of the
00221     //   form (STATE, SUCCESSORS) where SUCCESSORS is a list of
00222     //   (ACCEPTANCE_CONDITIONS, STATE) pairs.
00223     typedef std::list<successor> succ_queue;
00224 
00225     // Position in the loop seeking known successors.
00226     succ_queue::iterator pos;
00227 
00228     struct todo_item
00229     {
00230       const state* s;
00231       int n;
00232       succ_queue q;             // Unprocessed successors of S
00233       todo_item(const state* s, int n, couvreur99_check_shy* shy);
00234     };
00235 
00236     typedef std::list<todo_item> todo_list;
00237     todo_list todo;
00238 
00239     void clear_todo();
00240 
00242     bool group_;
00243     // If the "group2" option is set (it implies "group"), we
00244     // reprocess the successor states of SCC that have been merged.
00245     bool group2_;
00246     // If the onepass option is true, do only one pass.  This cancels
00247     // all the "shyness" of the algorithm, but we need the framework
00248     // of the implementation when working with GreatSPN.
00249     bool onepass_;
00250 
00259     virtual numbered_state_heap::state_index_p find_state(const state* s);
00260   };
00261 
00262 
00264 }
00265 
00266 #endif // SPOT_TGBAALGOS_GTEC_GTEC_HH

Please comment this page and report errors about it on the RefDocComments page.
Generated on Tue Jul 17 15:13:13 2007 for spot by doxygen 1.5.2