Main Page | Modules | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

tgbareduc.hh

Go to the documentation of this file.
00001 // Copyright (C) 2004, 2005  Laboratoire d'Informatique de Paris 6 (LIP6),
00002 // département Systèmes Répartis Coopératifs (SRC), Université Pierre
00003 // 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_TGBA_TGBAREDUC_HH
00023 # define SPOT_TGBA_TGBAREDUC_HH
00024 
00025 #include "tgbaexplicit.hh"
00026 #include "tgbaalgos/reachiter.hh"
00027 #include "tgbaalgos/gtec/explscc.hh"
00028 #include "tgbaalgos/gtec/nsheap.hh"
00029 
00030 #include <list>
00031 
00032 namespace spot
00033 {
00034   typedef Sgi::pair<const spot::state*, const spot::state*> state_couple;
00035   typedef Sgi::vector<state_couple*> simulation_relation;
00036 
00037   /*
00038     typedef Sgi::vector<state_couple*> direct_simulation_relation;
00039     typedef Sgi::vector<state_couple*> delayed_simulation_relation;
00040   */
00041 
00042   class direct_simulation_relation: public simulation_relation
00043   {
00044   };
00045   class delayed_simulation_relation: public simulation_relation
00046   {
00047   };
00048 
00049 
00052   class tgba_reduc:
00053     public tgba_explicit, public tgba_reachable_iterator_breadth_first
00054   {
00055   public:
00056     tgba_reduc(const tgba* a,
00057                const numbered_state_heap_factory* nshf
00058                = numbered_state_heap_hash_map_factory::instance());
00059 
00060     ~tgba_reduc();
00061 
00064     void quotient_state(direct_simulation_relation* rel);
00065 
00068     void quotient_state(delayed_simulation_relation* rel);
00069 
00072     void delete_transitions(simulation_relation* rel);
00073 
00075     void prune_scc();
00076 
00078     void prune_acc();
00079 
00081     void compute_scc();
00082 
00084     virtual std::string format_state(const spot::state* state) const;
00085 
00086     // For Debug
00087     void display_rel_sim(simulation_relation* rel, std::ostream& os);
00088     void display_scc(std::ostream& os);
00089 
00090   protected:
00091     bool scc_computed_;
00092     scc_stack root_;
00093     numbered_state_heap* h_;
00094 
00095     std::stack<const spot::state*> state_scc_;
00096     Sgi::hash_map<int, const spot::state*> state_scc_v_;
00097 
00098     typedef Sgi::hash_map<const tgba_explicit::state*,
00099                           std::list<state*>*,
00100                           ptr_hash<tgba_explicit::state> > sp_map;
00101     sp_map state_predecessor_map_;
00102 
00103     // For reduction using scc.
00104     typedef Sgi::hash_map<const spot::state*, int,
00105                           state_ptr_hash, state_ptr_equal> seen_map;
00106     seen_map si_;
00107     seen_map* seen_;
00108     bdd acc_;
00109 
00110     // Interface of tgba_reachable_iterator_breadth_first
00111     void start();
00112     void end();
00113     void process_state(const spot::state* s, int n, tgba_succ_iterator* si);
00114     void process_link(int in, int out, const tgba_succ_iterator* si);
00115 
00117     transition* create_transition(const spot::state* source,
00118                                   const spot::state* dest);
00119 
00120 
00123     void redirect_transition(const spot::state* s,
00124                              const spot::state* simul);
00125 
00127     void remove_predecessor_state(const state* s, const state* p);
00128 
00131     void remove_state(const spot::state* s);
00132 
00136     void merge_state(const spot::state* s1,
00137                      const spot::state* s2);
00138 
00142     void merge_state_delayed(const spot::state* s1,
00143                              const spot::state* s2);
00144 
00147     void delete_scc();
00148 
00166     // bool is_alpha_ball(const spot::state* s,
00167     // bdd label = bddfalse,
00168     // int n = -1);
00169 
00170     // Return true if we can't reach a state with
00171     // an other value of scc.
00172     bool is_terminal(const spot::state* s,
00173                      int n = -1);
00174 
00175     // Return false if the scc contains all the accepting condition.
00176     bool is_not_accepting(const spot::state* s,
00177                           int n = -1);
00178 
00181     void remove_acc(const spot::state* s);
00182 
00184     void remove_scc(spot::state* s);
00185 
00187     // void remove_scc_depth_first(spot::state* s, int n = -1);
00188 
00190     void remove_component(const spot::state* from);
00191 
00192     int tgba_reduc::nb_set_acc_cond() const;
00193 
00194   };
00195 }
00196 
00197 #endif // SPOT_TGBA_TGBAREDUC_HH

Please comment this page and report errors about it on the RefDocComments page.
Generated on Mon Jan 31 12:54:24 2005 for spot by doxygen 1.4.0