spot  1.2.1a
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
dead_share.hh
1 // Copyright (C) 2012 Laboratoire de Recherche et Développement
2 // de l'Epita (LRDE).
3 //
4 // This file is part of Spot, a model checking library.
5 //
6 // Spot is free software; you can redistribute it and/or modify it
7 // under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 3 of the License, or
9 // (at your option) any later version.
10 //
11 // Spot is distributed in the hope that it will be useful, but WITHOUT
12 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 // or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
14 // License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with this program. If not, see <http://www.gnu.org/licenses/>.
18 
19 #ifndef SPOT_FASTTGBAALGOS_EC_CONCUREC_DEAD_SHARE_HH
20 # define SPOT_FASTTGBAALGOS_EC_CONCUREC_DEAD_SHARE_HH
21 
22 #include <tuple>
23 
24 #include <stack>
25 #include <map>
26 
27 #include "fasttgbaalgos/ec/ec.hh"
28 #include "fasttgbaalgos/ec/deadstore.hh"
29 #include "fasttgbaalgos/ec/lowlink_stack.hh"
30 #include "fasttgbaalgos/ec/lazycheck.hh"
31 
32 #include "fasttgbaalgos/ec/concur/uf.hh"
33 #include "concur_ec_stat.hh"
34 
35 #include "fasttgbaalgos/ec/opt/opt_tarjan_scc.hh"
36 #include "fasttgbaalgos/ec/opt/opt_dijkstra_scc.hh"
37 
38 #include <sstream>
39 
40 namespace spot
41 {
42  // ----------------------------------------------------------------------
43  // Tarjan Concurrent SCC Computation
44  // ======================================================================
45 
52  {
53  public:
55  spot::uf* uf,
56  int thread_number,
57  int *stop,
58  bool swarming,
59  std::string option = "");
60 
61  virtual bool check();
62 
63  virtual void dfs_push(fasttgba_state* q);
64 
65  virtual color get_color(const fasttgba_state* state);
66 
67  virtual void dfs_pop();
68 
69  virtual bool dfs_update (fasttgba_state* s);
70 
71  virtual void main ();
72 
73  virtual bool has_counterexample();
74 
75  virtual std::string csv();
76 
77  virtual std::chrono::milliseconds::rep get_elapsed_time();
78 
79  virtual int nb_inserted();
80 
81  protected:
82  spot::uf* uf_;
83  int tn_;
84  int * stop_;
85  std::chrono::time_point<std::chrono::system_clock> start;
86  std::chrono::time_point<std::chrono::system_clock> end;
87  int make_cpt_;
88  };
89 
90  // ----------------------------------------------------------------------
91  // Disjkstra Concurrent SCC Computation
92  // ======================================================================
93 
100  {
101  public:
103  spot::uf* uf,
104  int thread_number,
105  int *stop,
106  bool swarming,
107  std::string option = "");
108 
109  virtual bool check();
110 
111  virtual void dfs_push(fasttgba_state* q);
112 
113  virtual color get_color(const fasttgba_state* state);
114 
115  virtual bool merge(fasttgba_state* d);
116 
117  virtual void dfs_pop();
118 
119  virtual void main ();
120 
121  virtual bool has_counterexample();
122 
123  virtual std::string csv()
124  {
125  return "dijkstra," + extra_info_csv();
126  }
127 
128  virtual std::chrono::milliseconds::rep
129  get_elapsed_time()
130  {
131  auto elapsed_seconds = std::chrono::duration_cast
132  <std::chrono::milliseconds>(end-start).count();
133  return elapsed_seconds;
134  }
135 
136  virtual int nb_inserted()
137  {
138  return make_cpt_;
139  }
140 
141  protected:
142  spot::uf* uf_;
143  int tn_;
144  int * stop_;
145  std::chrono::time_point<std::chrono::system_clock> start;
146  std::chrono::time_point<std::chrono::system_clock> end;
147  int make_cpt_;
148  };
149 
150  // ----------------------------------------------------------------------
151  // Tarjan Concurrent Emptiness Check
152  // ======================================================================
153 
157  {
158  public:
161  spot::uf* uf,
162  int thread_number,
163  int *stop,
164  bool swarming,
165  std::string option = "-cs")
166  : concur_opt_tarjan_scc(i, uf, thread_number, stop, swarming, option)
167  {
168  fastb_cpt_ = 0;
169  }
170 
172  virtual void dfs_pop();
173 
175  virtual bool dfs_update (fasttgba_state* s);
176 
179  virtual void fastbacktrack();
180 
182  virtual std::string csv();
183 
184  private:
185  int fastb_cpt_;
186  };
187 
188 
190  class SPOT_API dead_share: public ec
191  {
192  public:
193 
196  {
197  FULL_TARJAN = 0,
198  FULL_DIJKSTRA = 1,
199  MIXED = 2,
200  FULL_TARJAN_EC = 3
201  };
202 
210  int thread_number = 1,
211  DeadSharePolicy policy = FULL_TARJAN,
212  std::string option = "");
213 
215  virtual ~dead_share();
216 
219  bool check();
220 
225  virtual std::string csv();
226 
228  void dump_threads();
229 
230  protected:
233  int tn_;
235  std::chrono::milliseconds::rep max_diff;
236  std::vector<spot::concur_ec_stat*> chk;
237  int stop;
238  };
239 }
240 
241 #endif // SPOT_FASTTGBAALGOS_EC_CONCUREC_DEAD_SHARE_HH
std::chrono::time_point< std::chrono::system_clock > end
start!
Definition: dead_share.hh:86
The class that will be used by thread performing a Tarjan SCC.
Definition: dead_share.hh:51
int stop
Stop the world variable.
Definition: dead_share.hh:237
int * stop_
the thread identifier
Definition: dead_share.hh:84
Definition: concur_ec_stat.hh:28
Definition: uf.hh:99
virtual void dfs_pop()
Pop states already explored.
This class act as an interface for all classes.
Definition: fasttgba_state.hh:30
int tn_
a reference to shared union find
Definition: dead_share.hh:83
instanciator * itor_
The instanciator.
Definition: dead_share.hh:232
concur_opt_tarjan_ec(instanciator *i, spot::uf *uf, int thread_number, int *stop, bool swarming, std::string option="-cs")
A constuctor.
Definition: dead_share.hh:160
virtual bool merge(fasttgba_state *d)
merge multiple states
Abstract class for states.
Definition: state.hh:40
virtual bool check()
Launch the emptiness check.
virtual bool check()
Launch the emptiness check.
Wrapper Launch all threads.
Definition: dead_share.hh:190
Compute the SCCs of a TGBA.
Definition: opt_tarjan_scc.hh:39
Definition: ec.hh:64
This is the Dijkstra SCC computation algorithm This class also include the optimisation for the live ...
Definition: opt_dijkstra_scc.hh:37
int tn_
The number of threads.
Definition: dead_share.hh:233
DeadSharePolicy policy_
The current policy to use.
Definition: dead_share.hh:234
DeadSharePolicy
The walk policy to be used by threads.
Definition: dead_share.hh:195
virtual bool dfs_update(fasttgba_state *s)
the update for backedges
virtual color get_color(const fasttgba_state *state)
Storage for counterexample found or not.
The class that will be used by thread performing a Dijkstra SCC.
Definition: dead_share.hh:99
std::vector< spot::concur_ec_stat * > chk
Local data for each threads.
Definition: dead_share.hh:236
std::chrono::time_point< std::chrono::system_clock > start
stop the world varibale
Definition: dead_share.hh:145
virtual void fastbacktrack()
Speed up the backtrack when the current state as been already marked dead by another thread...
virtual void dfs_pop()
Pop states already explored.
std::string extra_info_csv()
Get extra informations.
virtual void dfs_pop()
Pop states already explored.
virtual void dfs_push(fasttgba_state *q)
Push a new state to explore.
int make_cpt_
stop!
Definition: dead_share.hh:87
virtual void main()
the main procedure
spot::uf * uf_
The shared Union Find.
Definition: dead_share.hh:231
An emptiness based on the tarjan parallel computation algorithm above.
Definition: dead_share.hh:156
std::chrono::time_point< std::chrono::system_clock > start
stop the world varibale
Definition: dead_share.hh:85
virtual void dfs_push(fasttgba_state *q)
Push a new state to explore.
color
The color for a new State.
Definition: opt_dijkstra_scc.hh:72
virtual std::string csv()
Display the csv of for this thread.
virtual void main()
the main procedure
virtual bool dfs_update(fasttgba_state *s)
the update for backedges
int tn_
a reference to shared union find
Definition: dead_share.hh:143
std::chrono::milliseconds::rep max_diff
Elapse time between 2 stops.
Definition: dead_share.hh:235
virtual color get_color(const fasttgba_state *state)
Access the color of a state.
color
The color for a new State.
Definition: opt_tarjan_scc.hh:81
Definition: ec.hh:28

Please direct any question, comment, or bug report to the Spot mailing list at spot@lrde.epita.fr.
Generated on Tue Jan 21 2014 16:52:01 for spot by doxygen 1.8.5