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
00025
00026
00027
00028
00029 class GenRandomAutomataSet
00030 {
00031 public:
00032
00033 template <class AutoSet>
00034 static AutoSet generate(SELECTOR(AutomataBase<AutoSet>),
00035 unsigned nb_letter = 0);
00036
00037 template <class AutoSet>
00038 static AutoSet generate(SELECTOR(TransducerBase<AutoSet>),
00039 unsigned input_nb_letter = 0,
00040 unsigned output_nb_letter = 0);
00041 };
00042
00043
00044
00045
00046
00047
00048 template <class TAutomata, class AutomataSetGenerator = GenRandomAutomataSet>
00049 class GenRandomAutomata
00050 {
00051 public:
00052 typedef typename TAutomata::set_t automata_set_t;
00053
00054 public:
00055 GenRandomAutomata();
00056 GenRandomAutomata(unsigned init);
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 # ifndef VCSN_USE_INTERFACE_ONLY
00101 # include <vaucanson/tools/gen_random.hxx>
00102 # endif // VCSN_USE_INTERFACE_ONLY
00103
00104
00105 #endif // ! VCSN_TOOLS_GEN_RANDOM_HH