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
00068
int get_nb_state();
00069
int get_nb_transition();
00070
00071
00072
void display_rel_sim(
simulation_relation* rel, std::ostream& os);
00073
void display_scc(std::ostream& os);
00074
00075
protected:
00076 bool scc_computed_;
00077 scc_stack root_;
00078 numbered_state_heap*
h_;
00079
00080 std::stack<const spot::state*>
state_scc_;
00081 Sgi::hash_map<int, const spot::state*>
state_scc_v_;
00082
00083
typedef Sgi::hash_map<
const tgba_explicit::state*,
00084 std::list<state*>*,
00085 ptr_hash<tgba_explicit::state> >
sp_map;
00086 sp_map state_predecessor_map_;
00087
00088
00089
typedef Sgi::hash_map<
const spot::state*,
int,
00090 state_ptr_hash,
state_ptr_equal>
seen_map;
00091 seen_map si_;
00092 seen_map*
seen_;
00093 bdd
acc_;
00094
00095
00096
void start();
00097
void end();
00098
void process_state(
const spot::state* s,
int n,
tgba_succ_iterator* si);
00099
void process_link(
int in,
int out,
const tgba_succ_iterator* si);
00100
00102 transition*
create_transition(
const spot::state* source,
00103
const spot::state* dest);
00104
00105
00108
void redirect_transition(
const spot::state* s,
00109
const spot::state* simul);
00110
00112
void remove_predecessor_state(
const state* s,
const state* p);
00113
00116
void remove_state(
const spot::state* s);
00117
00121
void merge_state(
const spot::state* s1,
00122
const spot::state* s2);
00123
00126
void delete_scc();
00127
00145
bool is_alpha_ball(
const spot::state* s,
00146 bdd label = bddfalse,
00147
int n = -1);
00148
00149
00150
00151
bool is_terminal(
const spot::state* s,
00152
int n = -1);
00153
00154
00155
bool is_not_accepting(
const spot::state* s,
00156
int n = -1);
00157
00160
void remove_acc(
const spot::state* s);
00161
00163
void remove_scc(
spot::state* s);
00164
00166
void remove_scc_depth_first(
spot::state* s,
int n = -1);
00167
00169
void remove_component(
const spot::state* from);
00170
00171 };
00172 }
00173
00174
#endif // SPOT_TGBA_REDUC_HH