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

Generated on Wed Jun 13 17:00:22 2007 for Vaucanson by  doxygen 1.5.1