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   namespace tools {
00025 
00026     /*---------------------.
00027       | GenRandomAutomataSet |
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       | GenRandomAutomata |
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   } // tools
00098 } // vcsn
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

Generated on Thu Dec 13 16:02:59 2007 for Vaucanson by  doxygen 1.5.4