Vcsn  2.4
Be Rational
vcsn::detail::random_weight_base< WeightSet, RandomGenerator > Class Template Referenceabstract

Abstract class for random weight generation. More...

#include <weightset.hh>

Inheritance diagram for vcsn::detail::random_weight_base< WeightSet, RandomGenerator >:
Collaboration diagram for vcsn::detail::random_weight_base< WeightSet, RandomGenerator >:

Public Types

using weight_weight_t = std::vector< float >
 
using weight_map_t = std::map< typename WeightSet::value_t, float, vcsn::less< WeightSet >>
 
using randomGenerator_t = RandomGenerator
 
using weight_t = typename WeightSet::value_t
 

Public Member Functions

 random_weight_base (RandomGenerator &gen, const WeightSet &ws)
 
void parse_param (const std::string &param)
 
weight_t generate_random_weight () const
 

Protected Member Functions

virtual void parse_param_ (const std::string &weights)
 
virtual weight_t pick_value_ () const =0
 
weight_t print_random_weight_ () const
 A random weight. More...
 

Protected Attributes

WeightSet ws_
 
weight_t min_
 The min and the max given by the user. More...
 
weight_t max_
 
RandomGenerator & gen_
 
weight_map_t weight_
 Elements given by the user and their associated probabilities (weight_weight_). More...
 
weight_weight_t weight_weight_
 
discrete_chooser< RandomGenerator > chooser_it_ {gen_}
 

Detailed Description

template<typename WeightSet, typename RandomGenerator = std::default_random_engine>
class vcsn::detail::random_weight_base< WeightSet, RandomGenerator >

Abstract class for random weight generation.

It contains the parsing of the arguments (which can be overridden), the map of probabilities, the min and the max.

Definition at line 112 of file weightset.hh.

Member Typedef Documentation

template<typename WeightSet, typename RandomGenerator = std::default_random_engine>
using vcsn::detail::random_weight_base< WeightSet, RandomGenerator >::randomGenerator_t = RandomGenerator

Definition at line 118 of file weightset.hh.

template<typename WeightSet, typename RandomGenerator = std::default_random_engine>
using vcsn::detail::random_weight_base< WeightSet, RandomGenerator >::weight_map_t = std::map<typename WeightSet::value_t, float, vcsn::less<WeightSet>>

Definition at line 117 of file weightset.hh.

template<typename WeightSet, typename RandomGenerator = std::default_random_engine>
using vcsn::detail::random_weight_base< WeightSet, RandomGenerator >::weight_t = typename WeightSet::value_t

Definition at line 119 of file weightset.hh.

template<typename WeightSet, typename RandomGenerator = std::default_random_engine>
using vcsn::detail::random_weight_base< WeightSet, RandomGenerator >::weight_weight_t = std::vector<float>

Definition at line 115 of file weightset.hh.

Constructor & Destructor Documentation

template<typename WeightSet, typename RandomGenerator = std::default_random_engine>
vcsn::detail::random_weight_base< WeightSet, RandomGenerator >::random_weight_base ( RandomGenerator &  gen,
const WeightSet ws 
)
inline

Definition at line 121 of file weightset.hh.

Member Function Documentation

template<typename WeightSet, typename RandomGenerator = std::default_random_engine>
weight_t vcsn::detail::random_weight_base< WeightSet, RandomGenerator >::generate_random_weight ( ) const
inline

Definition at line 134 of file weightset.hh.

template<typename WeightSet, typename RandomGenerator = std::default_random_engine>
void vcsn::detail::random_weight_base< WeightSet, RandomGenerator >::parse_param ( const std::string &  param)
inline

Definition at line 128 of file weightset.hh.

template<typename WeightSet, typename RandomGenerator = std::default_random_engine>
virtual void vcsn::detail::random_weight_base< WeightSet, RandomGenerator >::parse_param_ ( const std::string &  weights)
inlineprotectedvirtual
template<typename WeightSet, typename RandomGenerator = std::default_random_engine>
weight_t vcsn::detail::random_weight_base< WeightSet, RandomGenerator >::print_random_weight_ ( ) const
inlineprotected

A random weight.

There is a probability to choose a value specified on the parameters.

If not, then choose a random value from the WeightSet.

Definition at line 172 of file weightset.hh.

Referenced by vcsn::detail::random_weight_base< zmin, RandomGenerator >::generate_random_weight().

Member Data Documentation

template<typename WeightSet, typename RandomGenerator = std::default_random_engine>
discrete_chooser<RandomGenerator> vcsn::detail::random_weight_base< WeightSet, RandomGenerator >::chooser_it_ {gen_}
protected
template<typename WeightSet, typename RandomGenerator = std::default_random_engine>
RandomGenerator& vcsn::detail::random_weight_base< WeightSet, RandomGenerator >::gen_
protected
template<typename WeightSet, typename RandomGenerator = std::default_random_engine>
weight_t vcsn::detail::random_weight_base< WeightSet, RandomGenerator >::max_
protected
template<typename WeightSet, typename RandomGenerator = std::default_random_engine>
weight_t vcsn::detail::random_weight_base< WeightSet, RandomGenerator >::min_
protected

The min and the max given by the user.

If not precised, then it takes the min and max of the weighset by default.

Definition at line 192 of file weightset.hh.

Referenced by vcsn::detail::random_weight_base< zmin, RandomGenerator >::parse_param_().

template<typename WeightSet, typename RandomGenerator = std::default_random_engine>
weight_map_t vcsn::detail::random_weight_base< WeightSet, RandomGenerator >::weight_
protected

Elements given by the user and their associated probabilities (weight_weight_).

Definition at line 197 of file weightset.hh.

Referenced by vcsn::detail::random_weight_base< zmin, RandomGenerator >::parse_param_(), and vcsn::detail::random_weight_base< zmin, RandomGenerator >::print_random_weight_().

template<typename WeightSet, typename RandomGenerator = std::default_random_engine>
weight_weight_t vcsn::detail::random_weight_base< WeightSet, RandomGenerator >::weight_weight_
protected
template<typename WeightSet, typename RandomGenerator = std::default_random_engine>
WeightSet vcsn::detail::random_weight_base< WeightSet, RandomGenerator >::ws_
protected

The documentation for this class was generated from the following file: