spot  1.99.3
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
randomltl.hh
1 // -*- coding: utf-8 -*-
2 // Copyright (C) 2010, 2011, 2012, 2013, 2014, 2015 Laboratoire de
3 // Recherche et Développement de l'Epita (LRDE).
4 // Copyright (C) 2005 Laboratoire d'Informatique de Paris 6 (LIP6),
5 // département Systèmes Répartis Coopératifs (SRC), Université Pierre
6 // et Marie Curie.
7 //
8 // This file is part of Spot, a model checking library.
9 //
10 // Spot is free software; you can redistribute it and/or modify it
11 // under the terms of the GNU General Public License as published by
12 // the Free Software Foundation; either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // Spot is distributed in the hope that it will be useful, but WITHOUT
16 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
17 // or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
18 // License for more details.
19 //
20 // You should have received a copy of the GNU General Public License
21 // along with this program. If not, see <http://www.gnu.org/licenses/>.
22 
23 #pragma once
24 
25 #include "apcollect.hh"
26 #include <iosfwd>
27 
28 #include <unordered_set>
29 #include "misc/optionmap.hh"
30 #include "misc/hash.hh"
31 #include "simplify.hh"
32 
33 #define OUTPUTBOOL 1
34 #define OUTPUTLTL 2
35 #define OUTPUTSERE 3
36 #define OUTPUTPSL 4
37 #define MAX_TRIALS 100000
38 
39 namespace spot
40 {
41  namespace ltl
42  {
43 
46  class SPOT_API random_formula
47  {
48  public:
49  random_formula(unsigned proba_size,
50  const atomic_prop_set* ap):
51  proba_size_(proba_size), proba_(new op_proba[proba_size_]), ap_(ap)
52  {
53  }
54 
55  virtual ~random_formula()
56  {
57  delete[] proba_;
58  }
59 
61  const atomic_prop_set*
62  ap() const
63  {
64  return ap_;
65  }
66 
73  const formula* generate(int n) const;
74 
77  std::ostream& dump_priorities(std::ostream& os) const;
78 
86  const char* parse_options(char* options);
87 
88  protected:
89  void update_sums();
90 
91  struct op_proba
92  {
93  const char* name;
94  int min_n;
95  double proba;
96  typedef const formula* (*builder)(const random_formula* rl, int n);
97  builder build;
98  void setup(const char* name, int min_n, builder build);
99  };
100  unsigned proba_size_;
101  op_proba* proba_;
102  double total_1_;
103  op_proba* proba_2_;
104  double total_2_;
105  op_proba* proba_2_or_more_;
106  double total_2_and_more_;
107  const atomic_prop_set* ap_;
108  };
109 
110 
123  class SPOT_API random_ltl: public random_formula
124  {
125  public:
130 
148  random_ltl(const atomic_prop_set* ap);
158 
159  protected:
160  void setup_proba_();
161  random_ltl(int size, const atomic_prop_set* ap);
162  };
163 
173  class SPOT_API random_boolean: public random_formula
174  {
175  public:
181 
192  random_boolean(const atomic_prop_set* ap);
202  };
203 
213  class SPOT_API random_sere: public random_formula
214  {
215  public:
220 
233  random_sere(const atomic_prop_set* ap);
243 
244  random_boolean rb;
245  };
246 
254  class SPOT_API random_psl: public random_ltl
255  {
256  public:
265 
286  random_psl(const atomic_prop_set* ap);
300 
303  };
304 
305  class SPOT_API randltlgenerator
306  {
307  typedef
308  std::unordered_set<const spot::ltl::formula*,
310 
311 
312  public:
313  randltlgenerator(int aprops_n, const option_map& opts,
314  char* opt_pL = nullptr,
315  char* opt_pS = nullptr,
316  char* opt_pB = nullptr);
317 
318  randltlgenerator(atomic_prop_set aprops, const option_map& opts,
319  char* opt_pL = nullptr,
320  char* opt_pS = nullptr,
321  char* opt_pB = nullptr);
322 
323  ~randltlgenerator();
324 
325  const spot::ltl::formula* next();
326 
327  void dump_ltl_priorities(std::ostream& os);
328  void dump_bool_priorities(std::ostream& os);
329  void dump_psl_priorities(std::ostream& os);
330  void dump_sere_priorities(std::ostream& os);
331  void dump_sere_bool_priorities(std::ostream& os);
332  void remove_some_props(atomic_prop_set& s);
333 
334  const formula* GF_n();
335 
336  private:
337  fset_t unique_set_;
338  atomic_prop_set aprops_;
339 
340  int opt_seed_;
341  int opt_tree_size_min_;
342  int opt_tree_size_max_;
343  bool opt_unique_;
344  bool opt_wf_;
345  int opt_simpl_level_;
346  ltl_simplifier simpl_;
347 
348  int output_;
349 
350  random_formula* rf_ = 0;
351  random_psl* rp_ = 0;
352  random_sere* rs_ = 0;
353  };
354  }
355 }
Definition: public.hh:31
Manage a map of options.
Definition: optionmap.hh:36
Definition: randomltl.hh:305
Base class for random formula generators.
Definition: randomltl.hh:46
A hash function for pointers.
Definition: hash.hh:39
Generate random LTL formulae.
Definition: randomltl.hh:123
const atomic_prop_set * ap() const
Return the set of atomic proposition used to build formulae.
Definition: randomltl.hh:62
Rewrite or simplify f in various ways.
Definition: simplify.hh:99
Generate random SERE.
Definition: randomltl.hh:213
Definition: randomltl.hh:91
Generate random PSL formulae.
Definition: randomltl.hh:254
std::set< const atomic_prop *, formula_ptr_less_than > atomic_prop_set
Set of atomic propositions.
Definition: apcollect.hh:39
An LTL formula.
Definition: formula.hh:71
Generate random Boolean formulae.
Definition: randomltl.hh:173
random_sere rs
The SERE generator used to generate SERE subformulae.
Definition: randomltl.hh:302

Please direct any question, comment, or bug report to the Spot mailing list at spot@lrde.epita.fr.
Generated on Wed Aug 26 2015 08:42:37 for spot by doxygen 1.8.8