spot
0.9.1
|
00001 // -*- coding: utf-8 -*- 00002 // Copyright (C) 2010, 2011, 2012 Laboratoire de Recherche et 00003 // Développement de l'Epita (LRDE). 00004 // Copyright (C) 2005 Laboratoire d'Informatique de Paris 6 (LIP6), 00005 // département Systèmes Répartis Coopératifs (SRC), Université Pierre 00006 // et Marie Curie. 00007 // 00008 // This file is part of Spot, a model checking library. 00009 // 00010 // Spot is free software; you can redistribute it and/or modify it 00011 // under the terms of the GNU General Public License as published by 00012 // the Free Software Foundation; either version 2 of the License, or 00013 // (at your option) any later version. 00014 // 00015 // Spot is distributed in the hope that it will be useful, but WITHOUT 00016 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 00017 // or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public 00018 // License for more details. 00019 // 00020 // You should have received a copy of the GNU General Public License 00021 // along with Spot; see the file COPYING. If not, write to the Free 00022 // Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 00023 // 02111-1307, USA. 00024 00025 #ifndef SPOT_LTLVISIT_RANDOMLTL_HH 00026 # define SPOT_LTLVISIT_RANDOMLTL_HH 00027 00028 #include "apcollect.hh" 00029 #include <iosfwd> 00030 00031 namespace spot 00032 { 00033 namespace ltl 00034 { 00035 00038 class random_formula 00039 { 00040 public: 00041 random_formula(unsigned proba_size, 00042 const atomic_prop_set* ap): 00043 proba_size_(proba_size), proba_(new op_proba[proba_size_]), ap_(ap) 00044 { 00045 } 00046 00047 virtual ~random_formula() 00048 { 00049 delete[] proba_; 00050 } 00051 00053 const atomic_prop_set* 00054 ap() const 00055 { 00056 return ap_; 00057 } 00058 00065 const formula* generate(int n) const; 00066 00069 std::ostream& dump_priorities(std::ostream& os) const; 00070 00078 const char* parse_options(char* options); 00079 00080 protected: 00081 void update_sums(); 00082 00083 struct op_proba 00084 { 00085 const char* name; 00086 int min_n; 00087 double proba; 00088 typedef const formula* (*builder)(const random_formula* rl, int n); 00089 builder build; 00090 void setup(const char* name, int min_n, builder build); 00091 }; 00092 unsigned proba_size_; 00093 op_proba* proba_; 00094 double total_1_; 00095 op_proba* proba_2_; 00096 double total_2_; 00097 op_proba* proba_2_or_more_; 00098 double total_2_and_more_; 00099 const atomic_prop_set* ap_; 00100 }; 00101 00102 00115 class random_ltl: public random_formula 00116 { 00117 public: 00149 random_ltl(const atomic_prop_set* ap); 00150 00151 protected: 00152 void setup_proba_(); 00153 random_ltl(int size, const atomic_prop_set* ap); 00154 }; 00155 00165 class random_boolean: public random_formula 00166 { 00167 public: 00193 random_boolean(const atomic_prop_set* ap); 00194 }; 00195 00205 class random_sere: public random_formula 00206 { 00207 public: 00234 random_sere(const atomic_prop_set* ap); 00235 00236 random_boolean rb; 00237 }; 00238 00246 class random_psl: public random_ltl 00247 { 00248 public: 00291 random_psl(const atomic_prop_set* ap); 00292 00294 random_sere rs; 00295 }; 00296 00297 00298 00299 } 00300 } 00301 00302 00303 #endif // SPOT_LTLVIST_RANDOMLTL_HH