19 #ifndef SPOT_FASTTGBAALGOS_EC_UNION_FIND_HH
20 # define SPOT_FASTTGBAALGOS_EC_UNION_FIND_HH
22 #include "misc/hash.hh"
23 #include "fasttgba/fasttgba.hh"
24 #include "boost/tuple/tuple.hpp"
31 #include <unordered_map>
33 #include "deadstore.hh"
92 enum color {Alive, Dead, Unknown};
105 virtual unsigned int size ();
107 virtual unsigned int dead_size ();
118 virtual int root (
int i);
121 typedef Sgi::hash_map<
const fasttgba_state*, int,
122 fasttgba_state_ptr_hash,
123 fasttgba_state_ptr_equal> uf_map;
148 mutable std::vector<int> id;
149 mutable std::vector<int> rk;
153 virtual int root(
int i);
158 virtual bool add(
const fasttgba_state* e,
int* livenum);
160 virtual unsigned int size ();
162 virtual unsigned int dead_size ();
164 virtual void unite(
const fasttgba_state* e1,
const fasttgba_state* e2);
166 virtual void make_dead(
const fasttgba_state* e);
168 virtual bool contains(
const fasttgba_state* e);
171 const fasttgba_state* e2);
173 virtual bool is_dead(
const fasttgba_state* e);
177 int maxDepth()
const;
187 virtual color get_color(
const fasttgba_state*);
193 virtual int live_get(
const fasttgba_state*)
205 mutable std::vector<int> id;
209 virtual int root(
int i);
216 virtual bool add(
const fasttgba_state* e,
int* livenum);
218 virtual unsigned int size ();
220 virtual unsigned int dead_size ();
222 virtual void unite(
const fasttgba_state* e1,
const fasttgba_state* e2);
224 virtual void make_dead(
const fasttgba_state* e);
226 virtual bool contains(
const fasttgba_state* e);
229 const fasttgba_state* e2);
231 virtual bool is_dead(
const fasttgba_state* e);
235 int maxDepth()
const;
245 virtual color get_color(
const fasttgba_state*);
251 virtual int live_get(
const fasttgba_state*)
285 const fasttgba_state*
state;
288 mutable std::vector<idpair> id;
295 virtual int root(
int i);
302 virtual bool add(
const fasttgba_state* e,
int* livenum);
304 virtual unsigned int size ();
306 virtual unsigned int dead_size ();
308 virtual void unite(
const fasttgba_state* e1,
const fasttgba_state* e2);
310 virtual void make_dead(
const fasttgba_state* e);
312 virtual bool contains(
const fasttgba_state* e);
315 const fasttgba_state* e2);
317 virtual bool is_dead(
const fasttgba_state* e);
321 int maxDepth()
const;
331 virtual color get_color(
const fasttgba_state*);
337 virtual int live_get(
const fasttgba_state*);
340 unsigned int max_alive_;
344 #endif // SPOT_FASTTGBAALGOS_EC_UNION_FIND_HH
virtual bool is_dead(const fasttgba_state *e)
check wether the root of the set containing this scc is dead.
this class acts like a wrapper to the C code of the open_set.
Definition: public.hh:32
virtual unsigned int size()
The current size of the union find.
virtual markset get_acc(const fasttgba_state *)
return the acceptance set of the partition containing s
this class propose an union find based on a deadstore. The idea is to used a dedicated map for the st...
Definition: union_find.hh:273
virtual bool contains(const fasttgba_state *e)
Return wether a state belong to the Union-Find structure.
Definition: union_find.hh:142
virtual bool contains(const fasttgba_state *e)
Return wether a state belong to the Union-Find structure.
virtual unsigned int size()
The current size of the union find.
virtual bool add(const fasttgba_state *e, int *livenum)
Add a partition that contains only s Suppose a clone() has been done and the union-find is in charge ...
This class act as an interface for all classes.
Definition: fasttgba_state.hh:30
acc_dict & acc_
The acceptance dictionary.
Definition: union_find.hh:136
virtual void add_acc(const fasttgba_state *, markset)
Add the acceptance set to the partition that contains the state s.
virtual void make_dead(const fasttgba_state *s)
perform a union with dead
std::vector< int > idneg
For each element store the id of the parent.
Definition: union_find.hh:130
Abstract class for states.
Definition: state.hh:40
virtual void unite(const fasttgba_state *e1, const fasttgba_state *e2)
Perform the union of the two partition containing left and right. No assumptions over the resulting p...
uf_map el
the structure used to the storage An element is associated to an integer
Definition: union_find.hh:127
virtual bool add(const fasttgba_state *e, int *livenum)
Add a partition that contains only s Suppose a clone() has been done and the union-find is in charge ...
virtual markset get_acc(const fasttgba_state *)
return the acceptance set of the partition containing s
virtual void add_acc(const fasttgba_state *, markset)
Add the acceptance set to the partition that contains the state s.
color
The color for a new State.
Definition: union_find.hh:92
virtual unsigned int size()
The current size of the union find.
virtual void make_dead(const fasttgba_state *e)
perform a union with dead
virtual void unite(const fasttgba_state *e1, const fasttgba_state *e2)
Perform the union of the two partition containing left and right. No assumptions over the resulting p...
virtual int root(int i)
grab the id of the root associated to an element.
virtual ~union_find()
A simple destructor.
Definition: union_find.hh:200
virtual bool same_partition(const fasttgba_state *e1, const fasttgba_state *e2)
Return true if the partition of left is the same that the partition of right.
union_find(acc_dict &acc)
The constructor for the Union-Find structure acc the acceptance dictionary.
virtual void make_dead(const fasttgba_state *e)
perform a union with dead
virtual void add_acc(const fasttgba_state *, markset)
Add the acceptance set to the partition that contains the state s.
virtual bool contains(const fasttgba_state *e)
Return wether a state belong to the Union-Find structure.
virtual unsigned int size()
The current size of the union find.
Definition: fasttgba_state.hh:76
markset empty
Avoid to re-create some elements.
Definition: union_find.hh:139
virtual bool same_partition(const fasttgba_state *e1, const fasttgba_state *e2)
Return true if the partition of left is the same that the partition of right.
virtual markset get_acc(const fasttgba_state *)
return the acceptance set of the partition containing s
virtual bool same_partition(const fasttgba_state *left, const fasttgba_state *right)
Return true if the partition of left is the same that the partition of right.
virtual markset get_acc(const fasttgba_state *s)
return the acceptance set of the partition containing s
virtual bool is_dead(const fasttgba_state *e)
check wether the root of the set containing this scc is dead.
This class represents a set of acceptance marks.
Definition: markset.hh:35
This class represent a dead store. For now it's just a set but it can be combined with bitstate hasin...
Definition: deadstore.hh:41
virtual bool contains(const fasttgba_state *s)
Return wether a state belong to the Union-Find structure.
Definition: acc_dict.hh:31
Definition: fasttgba_state.hh:88
virtual void add_acc(const fasttgba_state *s, markset m)
Add the acceptance set to the partition that contains the state s.
Definition: union_find.hh:46
virtual void make_dead(const fasttgba_state *e)
perform a union with dead
virtual bool same_partition(const fasttgba_state *e1, const fasttgba_state *e2)
Return true if the partition of left is the same that the partition of right.
virtual bool is_dead(const fasttgba_state *e)
check wether the root of the set containing this scc is dead.
virtual bool add(const fasttgba_state *s, int *livenum)
Add a partition that contains only s Suppose a clone() has been done and the union-find is in charge ...
std::vector< markset * > accp
Acceptance associated to each element.
Definition: union_find.hh:133
virtual void unite(const fasttgba_state *left, const fasttgba_state *right)
Perform the union of the two partition containing left and right. No assumptions over the resulting p...
virtual bool add(const fasttgba_state *e, int *livenum)
Add a partition that contains only s Suppose a clone() has been done and the union-find is in charge ...
virtual bool is_dead(const fasttgba_state *s)
check wether the root of the set containing this scc is dead.
virtual void unite(const fasttgba_state *e1, const fasttgba_state *e2)
Perform the union of the two partition containing left and right. No assumptions over the resulting p...