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_REDUC_HH
00023
# define SPOT_TGBA_REDUC_HH
00024
00025
#include "tgbaexplicit.hh"
00026
#include "tgbaalgos/reachiter.hh"
00027
#include "tgbaalgos/gtec/explscc.hh"
00028
#include "tgbaalgos/gtec/status.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 class tgba_reduc:
public tgba_explicit,
00038
public tgba_reachable_iterator_breadth_first
00039 {
00040
public:
00041
tgba_reduc(
const tgba* a,
00042
const numbered_state_heap_factory* nshf
00043 = numbered_state_heap_hash_map_factory::instance());
00044
00045
~tgba_reduc();
00046
00049
void prune_automata(
simulation_relation* rel);
00050
00053
void quotient_state(
simulation_relation* rel);
00054
00056
void prune_scc();
00057
00059
void prune_acc();
00060
00062
void compute_scc();
00063
00065
virtual std::string
format_state(
const spot::state*
state)
const;
00066
00067
00068
void display_rel_sim(
simulation_relation* rel, std::ostream& os);
00069
void display_scc(std::ostream& os);
00070
00071
protected:
00072 bool scc_computed_;
00073 scc_stack root_;
00074 numbered_state_heap*
h_;
00075
00076 std::stack<const spot::state*>
state_scc_;
00077 Sgi::hash_map<int, const spot::state*>
state_scc_v_;
00078
00079
typedef Sgi::hash_map<
const tgba_explicit::state*,
00080 std::list<state*>*,
00081 ptr_hash<tgba_explicit::state> >
sp_map;
00082 sp_map state_predecessor_map_;
00083
00084
00085
typedef Sgi::hash_map<
const spot::state*,
int,
00086 state_ptr_hash,
state_ptr_equal>
seen_map;
00087 seen_map si_;
00088 seen_map*
seen_;
00089 bdd
acc_;
00090
00091
00092
void start();
00093
void end();
00094
void process_state(
const spot::state* s,
int n,
tgba_succ_iterator* si);
00095
void process_link(
int in,
int out,
const tgba_succ_iterator* si);
00096
00098 transition*
create_transition(
const spot::state* source,
00099
const spot::state* dest);
00100
00101
00104
void redirect_transition(
const spot::state* s,
00105
const spot::state* simul);
00106
00108
void remove_predecessor_state(
const state* s,
const state* p);
00109
00112
void remove_state(
const spot::state* s);
00113
00117
void merge_state(
const spot::state* s1,
00118
const spot::state* s2);
00119
00122
void delete_scc();
00123
00141
bool is_alpha_ball(
const spot::state* s,
00142 bdd label = bddfalse,
00143
int n = -1);
00144
00145
00146
00147
bool is_terminal(
const spot::state* s,
00148
int n = -1);
00149
00150
00151
bool is_not_accepting(
const spot::state* s,
00152
int n = -1);
00153
00156
void remove_acc(
const spot::state* s);
00157
00159
void remove_scc(
spot::state* s);
00160
00162
void remove_scc_depth_first(
spot::state* s,
int n = -1);
00163
00165
void remove_component(
const spot::state* from);
00166
00167 };
00168 }
00169
00170
#endif // SPOT_TGBA_REDUC_HH