00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
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
00039
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
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
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
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
00167
00168
00169
00170
00171
00172 bool is_terminal(const spot::state* s,
00173 int n = -1);
00174
00175
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
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