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
00055 public:
00056 GenRandomAutomata();
00057
00058 TAutomata empty(unsigned nb_letter = 0);
00059 TAutomata empty(const automata_set_t& set);
00060
00061 TAutomata generate(unsigned nb_state, unsigned nb_transition,
00062 unsigned istate = 1, unsigned fstate = 1,
00063 unsigned nb_letter = 0);
00064 TAutomata generate(const automata_set_t& set,
00065 unsigned nb_state, unsigned nb_transition,
00066 unsigned istate = 1, unsigned fstate = 1);
00067
00068 TAutomata generate_dfa(unsigned nb_state,
00069 unsigned size_alphabet = 0,
00070 unsigned fstate = 1);
00071 TAutomata generate_dfa(const automata_set_t& set,
00072 unsigned nb_state,
00073 unsigned fstate = 1);
00074
00075 TAutomata generate_with_epsilon(unsigned nb_state, unsigned nb_transition,
00076 unsigned nb_epsilon_min,
00077 unsigned nb_epsilon_max);
00078 TAutomata generate_with_epsilon(const automata_set_t& set,
00079 unsigned nb_state, unsigned nb_transition,
00080 unsigned nb_epsilon_min,
00081 unsigned nb_epsilon_max);
00082
00083 TAutomata generate_normalized(unsigned nb_state, unsigned density = 3);
00084 TAutomata generate_normalized(const automata_set_t& set,
00085 unsigned nb_state, unsigned density = 3);
00086
00087
00088 private:
00089
00090 unsigned nb_transition_circle(TAutomata work, hstate_t state);
00091 void del_transition_circle(TAutomata& work, hstate_t state);
00092
00093 };
00094
00095 static unsigned alea(unsigned max);
00096
00097 }
00098 }
00099
00100
00101 # if !defined VCSN_USE_INTERFACE_ONLY || defined VCSN_USE_LIB
00102 # include <vaucanson/tools/gen_random.hxx>
00103 # endif // VCSN_USE_INTERFACE_ONLY
00104
00105 #endif // ! VCSN_TOOLS_GEN_RANDOM_HH