gen_random.hh

00001 // gen_random.hh: this file is part of the Vaucanson project.
00002 //
00003 // Vaucanson, a generic library for finite state machines.
00004 //
00005 // Copyright (C) 2001, 2002, 2003, 2004 The Vaucanson Group.
00006 //
00007 // This program is free software; you can redistribute it and/or
00008 // modify it under the terms of the GNU General Public License
00009 // as published by the Free Software Foundation; either version 2
00010 // of the License, or (at your option) any later version.
00011 //
00012 // The complete GNU General Public Licence Notice can be found as the
00013 // `COPYING' file in the root directory.
00014 //
00015 // The Vaucanson Group consists of people listed in the `AUTHORS' file.
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   | GenRandomAutomataSet |
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   | GenRandomAutomata |
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 } // vcsn
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

Generated on Sat Jul 29 17:12:59 2006 for Vaucanson by  doxygen 1.4.6