ACADO Toolkit  1.2.0beta
Toolkit for Automatic Control and Dynamic Optimization
Public Member Functions | Protected Member Functions | Protected Attributes

Generates pseudo-random Gaussian noise for simulating the Process. More...

#include <gaussian_noise.hpp>

Inheritance diagram for GaussianNoise:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 GaussianNoise ()
 Default constructor.
 GaussianNoise (const Vector &_mean, const Vector &_variance)
 Constructor which takes mean value and variance of the random variable.
 GaussianNoise (uint _dim, double _mean, double _variance)
 Constructor which takes the dimension of the random variable as well as as common values for the mean value and variance of the random variable.
 GaussianNoise (const GaussianNoise &rhs)
 Copy constructor (deep copy).
virtual ~GaussianNoise ()
 Destructor.
GaussianNoiseoperator= (const GaussianNoise &rhs)
 Assignment Operator (deep copy)
virtual GaussianNoiseclone () const
 Clone constructor (deep copy).
virtual GaussianNoiseclone (uint idx) const
 Clone constructor for a given noise component (deep copy).
returnValue setMeans (const Vector &_mean)
 Assigns new mean values to the random variable.
returnValue setMeans (double _mean)
 Assigns new mean values to the random variable.
returnValue setMean (uint idx, double _mean)
 Assigns new mean value on the component of the random variable with given index.
returnValue setVariances (const Vector &_variance)
 Assigns new variances to the random variable.
returnValue setVariances (double _variance)
 Assigns new variances to the random variable.
returnValue setVariance (uint idx, double _variance)
 Assigns new variance on the component of the random variable with given index.
virtual returnValue init (uint seed=0)
 Initializes noise generation and performs a couple of consistency checks.
virtual returnValue step (Vector &_w)
 Generates a single noise vector based on current internal settings.
virtual returnValue step (VariablesGrid &_w)
 Generates a noise vector sequence based on current internal settings.
const VectorgetMean () const
 Returns mean values of the random variable.
const VectorgetVariance () const
 Returns variances of the random variable.
uint getDim () const
 Returns dimension of noise vector.
BooleanType isEmpty () const
 Returns whether noise vector is empty (i.e.
BlockStatus getStatus () const
 Returns current status of noise block, see documentation of BlockStatus for details.

Protected Member Functions

double getGaussianRandomNumber (double _mean, double _variance) const
 Returns a pseudo-random number based on a Gaussian distribution with given mean and variance.
returnValue setStatus (BlockStatus _status)
 Assigns new status to noise block.
double getUniformRandomNumber (double _lowerLimit, double _upperLimit) const
 Returns a pseudo-random number based on a uniform distribution with given lower and upper limits.

Protected Attributes

Vector mean
 Mean value for each component.
Vector variance
 Variance for each component.
BlockStatus status
 Current status of the noise.
VariablesGrid w
 Sequence of most recently generated noise.

Detailed Description

The class GaussiaNoise generates pseudo-random Gaussian noise for simulating the Process within the SimulationEnvironment.

Author:
Hans Joachim Ferreau, Boris Houska

Constructor & Destructor Documentation

Referenced by clone().

GaussianNoise::GaussianNoise ( const Vector _mean,
const Vector _variance 
)

The dimension of these limit vector determine the dimension of the random variable.

Parameters:
[in]_meanMean value for each component.
[in]_varianceVariance for each component.

References ACADOERROR, VectorspaceElement::getDim(), VariablesGrid::init(), mean, RET_INVALID_NOISE_SETTINGS, variance, and Noise::w.

GaussianNoise::GaussianNoise ( uint  _dim,
double  _mean,
double  _variance 
)
Parameters:
[in]_dimDimension of random variable.
[in]_meanMean value for each component.
[in]_varianceVariance for each component.

References VectorspaceElement::init(), VariablesGrid::init(), mean, uint, variance, and Noise::w.

Parameters:
[in]rhsRight-hand side object.

References mean, and variance.


Member Function Documentation

GaussianNoise * GaussianNoise::clone ( ) const [virtual]
Returns:
Pointer to deep copy of base class type

Implements Noise.

References GaussianNoise().

GaussianNoise * GaussianNoise::clone ( uint  idx) const [virtual]
Parameters:
[in]idxRight-hand side object.
Returns:
Pointer to deep copy of base class type

Implements Noise.

References GaussianNoise(), Noise::getDim(), VariablesGrid::init(), mean, variance, and Noise::w.

BEGIN_NAMESPACE_ACADO uint Noise::getDim ( ) const [inline, inherited]
double GaussianNoise::getGaussianRandomNumber ( double  _mean,
double  _variance 
) const [protected]
Parameters:
[in]_meanMean value of Gaussian distribution.
[in]_varianceVariance of Gaussian distribution.
Returns:
Gaussian distributed pseudo-random number

References Noise::getUniformRandomNumber(), log(), norm(), and sqrt().

Referenced by step().

const Vector & GaussianNoise::getMean ( ) const [inline]
Returns:
Mean values of the random variable

References mean.

BlockStatus Noise::getStatus ( ) const [inline, inherited]
Returns:
Current status of noise block

References Noise::status.

Referenced by UniformNoise::step(), and step().

double Noise::getUniformRandomNumber ( double  _lowerLimit,
double  _upperLimit 
) const [inline, protected, inherited]
Parameters:
[in]_lowerLimitLower limit of random variable.
[in]_upperLimitLower limit of random variable.
Returns:
Uniformly distributed pseudo-random number

Referenced by getGaussianRandomNumber(), and UniformNoise::step().

const Vector & GaussianNoise::getVariance ( ) const [inline]
Returns:
Variances of the random variable

References variance.

returnValue GaussianNoise::init ( uint  seed = 0) [virtual]

Initialization of the pseudo-random number generator can be based on a seed in order to allow exact reproduction of generated noise. If seed is not specified (i.e. 0), a seed is obtain from the system clock.

Parameters:
[in]seedSeed for pseudo-random number generator.
Returns:
SUCCESSFUL_RETURN,
RET_INVALID_NOISE_SETTINGS,
RET_NO_NOISE_SETTINGS

Implements Noise.

References ACADOERROR, BS_READY, VectorspaceElement::getDim(), mean, RET_INVALID_NOISE_SETTINGS, RET_NO_NOISE_SETTINGS, Noise::setStatus(), SUCCESSFUL_RETURN, and variance.

BooleanType Noise::isEmpty ( ) const [inline, inherited]

has dimension zero).

Returns:
BT_TRUE iff noise vector is empty,
BT_FALSE otherwise

References BT_FALSE, BT_TRUE, and Noise::getDim().

GaussianNoise & GaussianNoise::operator= ( const GaussianNoise rhs)
Parameters:
[in]rhsRight-hand side object.

References mean, and variance.

returnValue GaussianNoise::setMean ( uint  idx,
double  _mean 
) [inline]
Parameters:
[in]idxIndex of component.
[in]_meanNew mean value.
Returns:
SUCCESSFUL_RETURN,
RET_INDEX_OUT_OF_BOUNDS

References ACADOERROR, Noise::getDim(), mean, RET_INDEX_OUT_OF_BOUNDS, and SUCCESSFUL_RETURN.

Parameters:
[in]_meanNew mean value for each component.
Returns:
SUCCESSFUL_RETURN,
RET_VECTOR_DIMENSION_MISMATCH

References ACADOERROR, VectorspaceElement::getDim(), mean, RET_VECTOR_DIMENSION_MISMATCH, and SUCCESSFUL_RETURN.

returnValue GaussianNoise::setMeans ( double  _mean) [inline]
Parameters:
[in]_meanNew common mean value for all components.
Returns:
SUCCESSFUL_RETURN,
RET_INVALID_ARGUMENTS

References Noise::getDim(), mean, SUCCESSFUL_RETURN, and uint.

returnValue Noise::setStatus ( BlockStatus  _status) [inline, protected, inherited]
Parameters:
[in]_statusNew status.
Returns:
SUCCESSFUL_RETURN

References Noise::status, and SUCCESSFUL_RETURN.

Referenced by ColoredNoise::init(), UniformNoise::init(), and init().

returnValue GaussianNoise::setVariance ( uint  idx,
double  _variance 
) [inline]
Parameters:
[in]idxIndex of component.
[in]_varianceNew variance.
Returns:
SUCCESSFUL_RETURN,
RET_INDEX_OUT_OF_BOUNDS

References ACADOERROR, Noise::getDim(), RET_INDEX_OUT_OF_BOUNDS, SUCCESSFUL_RETURN, and variance.

returnValue GaussianNoise::setVariances ( const Vector _variance) [inline]
Parameters:
[in]_varianceNew variances for each component.
Returns:
SUCCESSFUL_RETURN,
RET_VECTOR_DIMENSION_MISMATCH

References ACADOERROR, ASSERT, VectorspaceElement::getDim(), VectorspaceElement::isGreaterThan(), RET_VECTOR_DIMENSION_MISMATCH, SUCCESSFUL_RETURN, and variance.

returnValue GaussianNoise::setVariances ( double  _variance) [inline]
Parameters:
[in]_varianceNew common variance for all components.
Returns:
SUCCESSFUL_RETURN,
RET_INVALID_ARGUMENTS

References Noise::getDim(), SUCCESSFUL_RETURN, uint, and variance.

returnValue GaussianNoise::step ( Vector _w) [virtual]
Parameters:
[out]_wGenerated noise vector.
Returns:
SUCCESSFUL_RETURN,
RET_BLOCK_NOT_READY,
RET_VECTOR_DIMENSION_MISMATCH

Implements Noise.

References ACADOERROR, BS_READY, Noise::getDim(), VectorspaceElement::getDim(), getGaussianRandomNumber(), Grid::getNumPoints(), Noise::getStatus(), VariablesGrid::getVector(), VariablesGrid::init(), mean, RET_BLOCK_NOT_READY, RET_VECTOR_DIMENSION_MISMATCH, SUCCESSFUL_RETURN, uint, variance, and Noise::w.

Noise is generated for each grid point of the VariablesGrid passed.

Parameters:
[in,out]_wGenerated noise vector sequence.
Returns:
SUCCESSFUL_RETURN,
RET_BLOCK_NOT_READY,
RET_VECTOR_DIMENSION_MISMATCH

Implements Noise.

References ACADOERROR, BS_READY, Noise::getDim(), getGaussianRandomNumber(), Grid::getNumPoints(), MatrixVariablesGrid::getNumValues(), Noise::getStatus(), VariablesGrid::init(), mean, RET_BLOCK_NOT_READY, RET_VECTOR_DIMENSION_MISMATCH, SUCCESSFUL_RETURN, uint, variance, and Noise::w.


Member Data Documentation

BlockStatus Noise::status [protected, inherited]
VariablesGrid Noise::w [protected, inherited]

The documentation for this class was generated from the following files:
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines