Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/16/09 11:24:03 (16 years ago)
Author:
vdorfer
Message:

Created API documentation for HeuristicLab.Random, HeuristicLab.SGA and HeuristicLab.Selection.OffspringSelection namespace (#331)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Random/UniformRandomAdder.cs

    r763 r1153  
    2828
    2929namespace HeuristicLab.Random {
     30  /// <summary>
     31  /// Uniformly distributed random number generator that adds the generated value to the existing one.
     32  /// </summary>
    3033  public class UniformRandomAdder : OperatorBase {
    3134
    3235    private static int MAX_NUMBER_OF_TRIES = 100;
    3336
     37    /// <inheritdoc select="summary"/>
    3438    public override string Description {
    3539      get {
     
    4347    }
    4448
     49    /// <summary>
     50    /// Initializes a new instance of <see cref="UniformRandomAdder"/> with five variable infos
     51    /// (<c>Value</c>, <c>ShakingFactor</c>, <c>Random</c>, <c>Min</c> and <c>Max</c>), having an interval
     52    /// of -1.0 to 1.0.
     53    /// </summary>
    4554    public UniformRandomAdder() {
    4655      AddVariableInfo(new VariableInfo("Value", "The value to manipulate (type is one of: IntData, ConstrainedIntData, DoubleData, ConstrainedDoubleData)", typeof(IObjectData), VariableKind.In));
     
    5665    }
    5766
     67    /// <summary>
     68    /// Generates a new uniformly distributed random number and adds it to the value in the given
     69    /// <paramref name="scope"/>.
     70    /// </summary>
     71    /// <param name="scope">The current scope where to add the generated random number.</param>
     72    /// <returns>null.</returns>
    5873    public override IOperation Apply(IScope scope) {
    5974      IObjectData value = GetVariableValue<IObjectData>("Value", scope, false);
     
    85100    }
    86101
    87 
     102    /// <summary>
     103    /// Adds a new double random variable being restricted to some constraints to the value of the given
     104    /// <paramref name="data"/>.
     105    /// </summary>
     106    /// <exception cref="InvalidProgramException">Thrown when no valid value can be found.</exception>
     107    /// <param name="data">The data where to add the new variable and where to assign the new value to.</param>
     108    /// <param name="mt">The random number generator.</param>
     109    /// <param name="min">The left border of the interval in which the next random number has to lie.</param>
     110    /// <param name="max">The right border (exclusive) of the interval in which the next random number
     111    /// has to lie.</param>
    88112    public void AddUniform(ConstrainedDoubleData data, MersenneTwister mt, double min, double max) {
    89113      for (int tries = MAX_NUMBER_OF_TRIES; tries >= 0; tries--) {
     
    99123    }
    100124
     125    /// <summary>
     126    /// Adds a new int random variable being restricted to some constraints to the value of the given
     127    /// <paramref name="data"/>.
     128    /// </summary>
     129    /// <exception cref="InvalidProgramException">Thrown when no valid value could be found.</exception>
     130    /// <param name="data">The data where to add the random value and where to assign the new value to.</param>
     131    /// <param name="mt">The random number generator.</param>
     132    /// <param name="min">The left border of the interval in which the next random number has to lie.</param>
     133    /// <param name="max">The right border (exclusive) of the interval in which the next random number
     134    /// has to lie.</param>
    101135    public void AddUniform(ConstrainedIntData data, MersenneTwister mt, double min, double max) {
    102136      for (int tries = MAX_NUMBER_OF_TRIES; tries >= 0; tries--) {
     
    109143    }
    110144
     145    /// <summary>
     146    /// Generates a new double random variable and adds it to the value of
     147    /// the given <paramref name="data"/>.
     148    /// </summary>
     149    /// <param name="data">The double object where to add the random value.</param>
     150    /// <param name="mt">The random number generator.</param>
     151    /// <param name="min">The left border of the interval in which the next random number has to lie.</param>
     152    /// <param name="max">The right border (exclusive) of the interval in which the next random number
     153    /// has to lie.</param>
    111154    public void AddUniform(DoubleData data, MersenneTwister mt, double min, double max) {
    112155      data.Data = data.Data + mt.NextDouble() * (max - min) + min;
    113156    }
    114157
     158    /// <summary>
     159    /// Generates a new int random variable and adds it to the value of the given
     160    /// <paramref name="data"/>.
     161    /// </summary>
     162    /// <param name="data">The int object where to add the random value.</param>
     163    /// <param name="mt">The random number generator.</param>
     164    /// <param name="min">The left border of the interval in which the next random number has to lie.</param>
     165    /// <param name="max">The right border (exclusive) of the interval in which the next random number
     166    /// has to lie.</param>
    115167    public void AddUniform(IntData data, MersenneTwister mt, double min, double max) {
    116168      data.Data = (int)Math.Floor(data.Data + mt.NextDouble() * (max - min) + min);
Note: See TracChangeset for help on using the changeset viewer.