00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef VCSN_TOOLS_GEN_RANDOM_HH
00018 # define VCSN_TOOLS_GEN_RANDOM_HH
00019
00020 #include <vaucanson/misc/selectors.hh>
00021 #include <vaucanson/automata/concept/transducer.hh>
00022
00023 namespace vcsn {
00024 namespace tools {
00025
00026
00027
00028
00029
00030 class GenRandomAutomataSet
00031 {
00032 public:
00033
00034 template <class AutoSet>
00035 static AutoSet generate(SELECTOR(AutomataBase<AutoSet>),
00036 unsigned nb_letter = 0);
00037
00038 template <class AutoSet>
00039 static AutoSet generate(SELECTOR(TransducerBase<AutoSet>),
00040 unsigned input_nb_letter = 0,
00041 unsigned output_nb_letter = 0);
00042 };
00043
00044
00045
00046
00047
00048
00049 template <class TAutomata, class AutomataSetGenerator = GenRandomAutomataSet>
00050 class GenRandomAutomata
00051 {
00052 public:
00053 typedef typename TAutomata::set_t automata_set_t;
00054 typedef typename TAutomata::hstate_t hstate_t;
00055
00056 public:
00057 GenRandomAutomata();
00058
00059 TAutomata empty(unsigned nb_letter = 0);
00060 TAutomata empty(const automata_set_t& set);
00061
00062 TAutomata generate(unsigned nb_state, unsigned nb_transition,
00063 unsigned istate = 1, unsigned fstate = 1,
00064 unsigned nb_letter = 0);
00065 TAutomata generate(const automata_set_t& set,
00066 unsigned nb_state, unsigned nb_transition,
00067 unsigned istate = 1, unsigned fstate = 1);
00068
00069 TAutomata generate_dfa(unsigned nb_state,
00070 unsigned size_alphabet = 0,
00071 unsigned fstate = 1);
00072 TAutomata generate_dfa(const automata_set_t& set,
00073 unsigned nb_state,
00074 unsigned fstate = 1);
00075
00076 TAutomata generate_with_epsilon(unsigned nb_state, unsigned nb_transition,
00077 unsigned nb_epsilon_min,
00078 unsigned nb_epsilon_max);
00079 TAutomata generate_with_epsilon(const automata_set_t& set,
00080 unsigned nb_state, unsigned nb_transition,
00081 unsigned nb_epsilon_min,
00082 unsigned nb_epsilon_max);
00083
00084 TAutomata generate_normalized(unsigned nb_state, unsigned density = 3);
00085 TAutomata generate_normalized(const automata_set_t& set,
00086 unsigned nb_state, unsigned density = 3);
00087
00088
00089 private:
00090
00091 unsigned nb_transition_circle(TAutomata work, hstate_t state);
00092 void del_transition_circle(TAutomata& work, hstate_t state);
00093
00094 };
00095
00096 static unsigned alea(unsigned max);
00097
00098 }
00099 }
00100
00101
00102 # if !defined VCSN_USE_INTERFACE_ONLY || defined VCSN_USE_LIB
00103 # include <vaucanson/tools/gen_random.hxx>
00104 # endif // VCSN_USE_INTERFACE_ONLY
00105
00106 #endif // ! VCSN_TOOLS_GEN_RANDOM_HH