Changeset 1184
- Timestamp:
- 01/28/09 10:20:40 (16 years ago)
- Location:
- trunk/sources/HeuristicLab.RealVector
- Files:
-
- 26 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.RealVector/BlendAlphaBetaCrossover.cs
r104 r1184 28 28 29 29 namespace HeuristicLab.RealVector { 30 /// <summary> 31 /// Blend alpha-beta crossover for real vectors. Creates a new offspring by selecting a 32 /// random value from the interval between the two alleles of the parent solutions. 33 /// The interval is increased in both directions as follows: Into the direction of the 'better' 34 /// solution by the factor alpha, into the direction of the 'worse' solution by the factor beta. 35 /// </summary> 30 36 public class BlendAlphaBetaCrossover : CrossoverBase { 37 /// <inheritdoc select="summary"/> 31 38 public override string Description { 32 39 get { return … … 36 43 } 37 44 45 /// <summary> 46 /// Initializes a new instance of <see cref="BlendAlphaBetaCrossover"/> with five variable infos 47 /// (<c>Maximization</c>, <c>Quality</c>, <c>RealVector</c>, <c>Alpha</c> and <c>Beta</c>). 48 /// </summary> 38 49 public BlendAlphaBetaCrossover() 39 50 : base() { … … 51 62 } 52 63 64 /// <summary> 65 /// Performs a blend alpha beta crossover of two real vectors. 66 /// </summary> 67 /// <param name="random">The random number generator.</param> 68 /// <param name="maximization">Boolean flag whether it is a maximization problem.</param> 69 /// <param name="parent1">The first parent for the crossover.</param> 70 /// <param name="quality1">The quality of the first parent.</param> 71 /// <param name="parent2">The second parent for the crossover.</param> 72 /// <param name="quality2">The quality of the second parent.</param> 73 /// <param name="alpha">The alpha value for the crossover.</param> 74 /// <param name="beta">The beta value for the crossover operation.</param> 75 /// <returns>The newly created real vector resulting from the crossover.</returns> 53 76 public static double[] Apply(IRandom random, bool maximization, double[] parent1, double quality1, double[] parent2, double quality2, double alpha, double beta) { 54 77 int length = parent1.Length; … … 86 109 } 87 110 111 /// <summary> 112 /// Performs a blend alpha beta crossover of two real vectors. 113 /// </summary> 114 /// <param name="scope">The current scope.</param> 115 /// <param name="random">The random number generator.</param> 116 /// <param name="parent1">The first parent for the crossover.</param> 117 /// <param name="parent2">The second parent for the crossover.</param> 118 /// <param name="child">The created child generated through the blend alpha beta crossover.</param> 88 119 protected sealed override void Cross(IScope scope, IRandom random, IScope parent1, IScope parent2, IScope child) { 89 120 bool maximization = GetVariableValue<BoolData>("Maximization", scope, true).Data; -
trunk/sources/HeuristicLab.RealVector/BlendAlphaCrossover.cs
r104 r1184 27 27 28 28 namespace HeuristicLab.RealVector { 29 /// <summary> 30 /// Blend alpha crossover for real vectors. Creates a new offspring by selecting a random value 31 /// from the interval between the two alleles of the parent solutions. The interval is increased 32 /// in both directions by the factor alpha. 33 /// </summary> 29 34 public class BlendAlphaCrossover : RealVectorCrossoverBase { 35 /// <inheritdoc select="summary"/> 30 36 public override string Description { 31 37 get { return … … 35 41 } 36 42 43 /// <summary> 44 /// Initializes a new instance of <see cref="BlendAlphaCrossover"/> with one variable info (<c>Alpha</c>). 45 /// </summary> 37 46 public BlendAlphaCrossover() 38 47 : base() { … … 43 52 } 44 53 54 /// <summary> 55 /// Performs a blend alpha crossover of two real vectors. 56 /// </summary> 57 /// <param name="random">The random number generator.</param> 58 /// <param name="parent1">The first parent for the crossover operation.</param> 59 /// <param name="parent2">The second parent for the crossover operation.</param> 60 /// <param name="alpha">The alpha value for the crossover.</param> 61 /// <returns>The newly created real vector resulting from the crossover operation.</returns> 45 62 public static double[] Apply(IRandom random, double[] parent1, double[] parent2, double alpha) { 46 63 int length = parent1.Length; … … 60 77 } 61 78 79 /// <summary> 80 /// Performs a blend alpha crossover of two real vectors. 81 /// </summary> 82 /// <remarks>Calls <see cref="Apply"/>.</remarks> 83 /// <param name="scope">The current scope.</param> 84 /// <param name="random">The random number generator.</param> 85 /// <param name="parent1">The first parent for the crossover operation.</param> 86 /// <param name="parent2">The second parent for the crossover operation.</param> 87 /// <returns>The newly created real vector, resulting from the blend alpha crossover.</returns> 62 88 protected override double[] Cross(IScope scope, IRandom random, double[] parent1, double[] parent2) { 63 89 double alpha = GetVariableValue<DoubleData>("Alpha", scope, true).Data; -
trunk/sources/HeuristicLab.RealVector/BoundsChecker.cs
r102 r1184 27 27 28 28 namespace HeuristicLab.RealVector { 29 /// <summary> 30 /// Checks if all elements of a real vector are inside a given minimum and maximum value. 31 /// If not, the elements are corrected. 32 /// </summary> 29 33 public class BoundsChecker : OperatorBase { 34 /// <inheritdoc select="summary"/> 30 35 public override string Description { 31 36 get { return "Checks if all elements of a real vector are inside a given minimum and maximum value. If not, elements are corrected."; } 32 37 } 33 38 39 /// <summary> 40 /// Initializes a new instance of <see cref="BoundsChecker"/> with three variable infos 41 /// (<c>RealVector</c>, <c>Minimum</c> and <c>Maximum</c>). 42 /// </summary> 34 43 public BoundsChecker() 35 44 : base() { … … 39 48 } 40 49 50 /// <summary> 51 /// Checks if all elements of the given <paramref name="vector"/> are inside the given minimum 52 /// and maximum value and if not they are corrected. 53 /// </summary> 54 /// <param name="min">The minimum value of the range (inclusive).</param> 55 /// <param name="max">The maximum value of the range (inclusive).</param> 56 /// <param name="vector">The vector to check.</param> 57 /// <returns>The corrected real vector.</returns> 41 58 public static double[] Apply(double min, double max, double[] vector) { 42 59 int length = vector.Length; … … 50 67 } 51 68 69 /// <summary> 70 /// Checks if all elements of the given <paramref name="vector"/> are inside the given minimum 71 /// and maximum value and if not they are corrected. 72 /// </summary> 73 /// <remarks>Calls <see cref="Apply(double, double, double[])"/>.</remarks> 74 /// <param name="scope">The current scope.</param> 75 /// <returns><c>null</c>.</returns> 52 76 public override IOperation Apply(IScope scope) { 53 77 DoubleArrayData vector = GetVariableValue<DoubleArrayData>("RealVector", scope, false); -
trunk/sources/HeuristicLab.RealVector/BreederGeneticAlgorithmManipulator.cs
r104 r1184 29 29 /// <summary> 30 30 /// Mühlenbein, Schlierkamp-Voosen (1993) 31 /// Predictive Models for the Breeder Genetic Algorithm I. Continuous Parameter Optimization 31 /// Predictive Models for the Breeder Genetic Algorithm I. Continuous Parameter Optimization<br/> 32 /// Changes one position of a real vector by adding/substracting a value of the interval [(2^-15)*range, ..., (2^0)*range], where range is SearchIntervalFactor * (max - min). 32 33 /// </summary> 33 34 public class BreederGeneticAlgorithmManipulator : RealVectorManipulatorBase { 35 /// <inheritdoc select="summary"/> 34 36 public override string Description { 35 37 get { … … 41 43 } 42 44 45 /// <summary> 46 /// Initializes a new instance of <see cref="BreederGeneticAlgorithmManipulator"/> with three variable 47 /// infos (<c>Minimum</c>, <c>Maximum</c> and <c>SearchIntervalFactor</c>). 48 /// </summary> 43 49 public BreederGeneticAlgorithmManipulator() 44 50 : base() { … … 51 57 } 52 58 59 /// <summary> 60 /// Performs a Breeder Genetic Algorithm Manipulation on the given <paramref name="vector"/>. 61 /// </summary> 62 /// <param name="scope">The current scope.</param> 63 /// <param name="random">A random number generator.</param> 64 /// <param name="vector">The real vector to manipulate.</param> 65 /// <param name="min">The minimum number of the sampling range for the vector element (inclusive).</param> 66 /// <param name="max">The maximum number of the sampling range for the vector element (exclusive).</param> 67 /// <param name="searchIntervalFactor">The factor determining the size of the search interval.</param> 68 /// <returns>The manipulated real vector.</returns> 53 69 public static double[] Apply(IScope scope, IRandom random, double[] vector, double min, double max, double searchIntervalFactor) { 54 70 int length = vector.Length; … … 80 96 } 81 97 98 /// <summary> 99 /// Performs a Breeder Genetic Algorithm Manipulation on the given <paramref name="vector"/>. 100 /// </summary> 101 /// <remarks>Calls <see cref="Apply"/>.</remarks> 102 /// <param name="scope">The current scope.</param> 103 /// <param name="random">The random number generator.</param> 104 /// <param name="vector">The real vector to manipulate.</param> 105 /// <returns>The manipulated real vector</returns> 82 106 protected override double[] Manipulate(IScope scope, IRandom random, double[] vector) { 83 107 double min = GetVariableValue<DoubleData>("Minimum", scope, true).Data; -
trunk/sources/HeuristicLab.RealVector/CompleteContinuousCrossover.cs
r102 r1184 27 27 28 28 namespace HeuristicLab.RealVector { 29 /// <summary> 30 /// Complete continuous crossover for real vectors: for each element of the new vector the average 31 /// of both parents is calculated. 32 /// </summary> 29 33 public class CompleteContinuousCrossover : RealVectorCrossoverBase { 34 /// <inheritdoc select="summary"/> 30 35 public override string Description { 31 36 get { return "Complete continuous crossover for real vectors."; } 32 37 } 33 38 39 /// <summary> 40 /// Performs a complete continuous crossover of the two given real vectors. 41 /// </summary> 42 /// <param name="random">The random number generator.</param> 43 /// <param name="parent1">The first parent for the crossover.</param> 44 /// <param name="parent2">The second parent for the crossover.</param> 45 /// <returns>The newly created real vector, resulting from the complete continuous crossover.</returns> 34 46 public static double[] Apply(IRandom random, double[] parent1, double[] parent2) { 35 47 int length = parent1.Length; … … 41 53 } 42 54 55 /// <summary> 56 /// Performs a complete continuous crossover of the two given real vectors. 57 /// </summary> 58 /// <remarks>Calls <see cref="Apply"/>.</remarks> 59 /// <param name="scope">The current scope.</param> 60 /// <param name="random">The random number generator.</param> 61 /// <param name="parent1">The first parent for the crossover.</param> 62 /// <param name="parent2">The second parent for the crossover.</param> 63 /// <returns>The newly created real vector, resulting from the complete continuous crossover.</returns> 43 64 protected override double[] Cross(IScope scope, IRandom random, double[] parent1, double[] parent2) { 44 65 return Apply(random, parent1, parent2); -
trunk/sources/HeuristicLab.RealVector/ContinuousCrossover.cs
r102 r1184 27 27 28 28 namespace HeuristicLab.RealVector { 29 /// <summary> 30 /// Continuous crossover for real vectors: for each element randomly either the element of the first 31 /// parent or the average of both parents is selected. 32 /// </summary> 29 33 public class ContinuousCrossover : RealVectorCrossoverBase { 34 /// <inheritdoc select="summary"/> 30 35 public override string Description { 31 36 get { return "Continuous crossover for real vectors."; } 32 37 } 33 38 39 /// <summary> 40 /// Performs a continuous crossover of the two given real vectors. 41 /// </summary> 42 /// <param name="random">The random number generator.</param> 43 /// <param name="parent1">The first parent for the crossover.</param> 44 /// <param name="parent2">The second parent for the crossover.</param> 45 /// <returns>The newly created real vector, resulting from the continuous crossover.</returns> 34 46 public static double[] Apply(IRandom random, double[] parent1, double[] parent2) { 35 47 int length = parent1.Length; … … 46 58 } 47 59 60 /// <summary> 61 /// Performs a continuous crossover of the two given real vectors. 62 /// </summary> 63 /// <remarks>Calls <see cref="Apply"/>.</remarks> 64 /// <param name="scope">The current scope.</param> 65 /// <param name="random">The random number generator.</param> 66 /// <param name="parent1">The first parent for the crossover.</param> 67 /// <param name="parent2">The second parent for the crossover.</param> 68 /// <returns>The newly created real vector, resulting from the continuous crossover.</returns> 48 69 protected override double[] Cross(IScope scope, IRandom random, double[] parent1, double[] parent2) { 49 70 return Apply(random, parent1, parent2); -
trunk/sources/HeuristicLab.RealVector/ContinuousManipulator.cs
r293 r1184 26 26 27 27 namespace HeuristicLab.RealVector { 28 /// <summary> 29 /// Continuous manipulator for real vectors: selects randomly two elements of the vector, 30 /// calculates its average value and replaces the first selected element with the new value. 31 /// </summary> 28 32 public class ContinuousManipulator : RealVectorManipulatorBase { 33 /// <inheritdoc select="summary"/> 29 34 public override string Description { 30 35 get { return "This operator randomly selects two elements of the vector, calculates its average value and replaces the first selected element with the new value."; } 31 36 } 32 37 38 /// <summary> 39 /// Performs a continuous manipulation of the given <paramref name="vector"/>. 40 /// </summary> 41 /// <param name="random">The random number generator.</param> 42 /// <param name="vector">The real vector to manipulate.</param> 43 /// <returns>The manipulated real vector.</returns> 33 44 public static double[] Apply(IRandom random, double[] vector) { 34 45 int length = vector.Length; … … 46 57 } 47 58 59 /// <summary> 60 /// Performs a continuous manipulation of the given <paramref name="vector"/>. 61 /// </summary> 62 /// <remarks>Calls <see cref="Apply"/>.</remarks> 63 /// <param name="scope">The current scope.</param> 64 /// <param name="random">The random number generator.</param> 65 /// <param name="vector">The real vector to manipulate.</param> 66 /// <returns>The manipulated real vector.</returns> 48 67 protected override double[] Manipulate(IScope scope, IRandom random, double[] vector) { 49 68 return Apply(random, vector); -
trunk/sources/HeuristicLab.RealVector/DiscreteCrossover.cs
r102 r1184 26 26 27 27 namespace HeuristicLab.RealVector { 28 /// <summary> 29 /// Discrete crossover for real vectors: Selects randomly either the value of the first or the 30 /// second parent. 31 /// </summary> 28 32 public class DiscreteCrossover : RealVectorCrossoverBase { 33 /// <inheritdoc select="summary"/> 29 34 public override string Description { 30 35 get { return "Discrete crossover for real vectors."; } 31 36 } 32 37 38 /// <summary> 39 /// Performs a discrete crossover operation of the two given parents. 40 /// </summary> 41 /// <param name="random">A random number generator.</param> 42 /// <param name="parent1">The first parent for the crossover operation.</param> 43 /// <param name="parent2">The second parent for the crossover operation.</param> 44 /// <returns>The newly created real vector, resulting from the crossover operation.</returns> 33 45 public static double[] Apply(IRandom random, double[] parent1, double[] parent2) { 34 46 int length = parent1.Length; … … 44 56 } 45 57 58 /// <summary> 59 /// Performs a discrete crossover operation of the two given parents. 60 /// </summary> 61 /// <param name="scope">The current scope.</param> 62 /// <param name="random">A random number generator.</param> 63 /// <param name="parent1">The first parent for the crossover operation.</param> 64 /// <param name="parent2">The second parent for the crossover operation.</param> 65 /// <returns>The newly created real vector, resulting from the crossover operation.</returns> 46 66 protected override double[] Cross(IScope scope, IRandom random, double[] parent1, double[] parent2) { 47 67 return Apply(random, parent1, parent2); -
trunk/sources/HeuristicLab.RealVector/DiscreteMultiCrossover.cs
r111 r1184 27 27 28 28 namespace HeuristicLab.RealVector { 29 /// <summary> 30 /// Discrete multiple crossover for real vectors: For each position in the new vector an allele 31 /// of one of the parents is randomly selected. 32 /// </summary> 29 33 public class DiscreteMultiCrossover : RealVectorMultiCrossoverBase { 34 /// <inheritdoc select="summary"/> 30 35 public override string Description { 31 36 get { … … 34 39 } 35 40 41 /// <summary> 42 /// Performs a discrete multiple crossover on the given <paramref name="parents"/>. 43 /// </summary> 44 /// <exception cref="InvalidOperationException">Thrown when the parents have different lengths.</exception> 45 /// <param name="random">The random number generator.</param> 46 /// <param name="parents">The list of parents for the multiple crossover.</param> 47 /// <returns>The newly created real vector, resulting from the discrete multiple crossover.</returns> 36 48 public static double[] Apply(IRandom random, IList<double[]> parents) { 37 49 int length = parents[0].Length; … … 47 59 } 48 60 61 /// <summary> 62 /// Performs a discrete multiple crossover on the given <paramref name="parents"/>. 63 /// </summary> 64 /// <remarks>Calls <see cref="Apply"/>.</remarks> 65 /// <param name="scope">The current scope.</param> 66 /// <param name="random">The random number generator.</param> 67 /// <param name="parents">The list of parents for the multiple crossover.</param> 68 /// <returns>The newly created real vector, resulting from the discrete multiple crossover.</returns> 49 69 protected override double[] Cross(IScope scope, IRandom random, IList<double[]> parents) { 50 70 return Apply(random, parents); -
trunk/sources/HeuristicLab.RealVector/HeuristicCrossover.cs
r102 r1184 28 28 29 29 namespace HeuristicLab.RealVector { 30 /// <summary> 31 /// Heuristic crossover for real vectors: Takes for each position the better parent and adds the difference 32 /// of the two parents times a randomly chosen factor. 33 /// </summary> 30 34 public class HeuristicCrossover : CrossoverBase { 35 /// <summary> 36 /// Initializes a new instance of <see cref="HeuristicCrossover"/> with three variable infos 37 /// (<c>Maximization</c>, <c>Quality</c> and <c>RealVector</c>). 38 /// </summary> 31 39 public HeuristicCrossover() 32 40 : base() { … … 36 44 } 37 45 46 /// <inheritdoc select="summary"/> 38 47 public override string Description { 39 48 get { return "Heuristic crossover for real vectors."; } 40 49 } 41 50 51 /// <summary> 52 /// Perfomrs a heuristic crossover on the two given parents. 53 /// </summary> 54 /// <param name="random">The random number generator.</param> 55 /// <param name="maximization">Boolean flag whether it is a maximization problem.</param> 56 /// <param name="parent1">The first parent for the crossover operation.</param> 57 /// <param name="quality1">The quality of the first parent.</param> 58 /// <param name="parent2">The second parent for the crossover operation.</param> 59 /// <param name="quality2">The quality of the second parent.</param> 60 /// <returns>The newly created real vector, resulting from the heuristic crossover.</returns> 42 61 public static double[] Apply(IRandom random, bool maximization, double[] parent1, double quality1, double[] parent2, double quality2) { 43 62 int length = parent1.Length; … … 54 73 } 55 74 75 /// <summary> 76 /// Perfomrs a heuristic crossover on the two given parents. 77 /// </summary> 78 /// <exception cref="InvalidOperationException">Thrown when the parent vectors have different lengths.</exception> 79 /// <param name="scope">The current scope.</param> 80 /// <param name="random">The random number generator.</param> 81 /// <param name="parent1">The first parent for the crossover operation.</param> 82 /// <param name="parent2">The second parent for the crossover operation.</param> 83 /// <param name="child">The newly created real vector, resulting from the heuristic crossover.</param> 56 84 protected sealed override void Cross(IScope scope, IRandom random, IScope parent1, IScope parent2, IScope child) { 57 85 bool maximization = GetVariableValue<BoolData>("Maximization", scope, true).Data; -
trunk/sources/HeuristicLab.RealVector/HeuristicLabRealVectorPlugin.cs
r1056 r1184 26 26 27 27 namespace HeuristicLab.RealVector { 28 /// <summary> 29 /// Plugin class for HeuristicLab.RealVector plugin. 30 /// </summary> 28 31 [ClassInfo(Name = "HeuristicLab.RealVector-3.2")] 29 32 [PluginFile(Filename = "HeuristicLab.RealVector-3.2.dll", Filetype = PluginFileType.Assembly)] -
trunk/sources/HeuristicLab.RealVector/IntermediateMultiCrossover.cs
r111 r1184 27 27 28 28 namespace HeuristicLab.RealVector { 29 /// <summary> 30 /// Intermediate multiple crossover: Creates a new offspring by computing the centroid of a list of 31 /// parents. 32 /// </summary> 29 33 public class IntermediateMultiCrossover : RealVectorMultiCrossoverBase { 34 /// <inheritdoc select="summary"/> 30 35 public override string Description { 31 36 get { … … 34 39 } 35 40 41 /// <summary> 42 /// Performs an intermediate multiple crossover of the given list of <paramref name="parents"/>. 43 /// </summary> 44 /// <param name="parents">The list of parents of which to perform the crossover.</param> 45 /// <returns>The newly created real vector, resulting from the intermediate multiple crossover.</returns> 36 46 public static double[] Apply(IList<double[]> parents) { 37 47 int length = parents[0].Length; … … 46 56 } 47 57 58 /// <summary> 59 /// Performs an intermediate multiple crossover of the given list of <paramref name="parents"/>. 60 /// </summary> 61 /// <remarks>Calls <see cref="Apply"/>.</remarks> 62 /// <param name="scope">The current scope.</param> 63 /// <param name="random">A random number generator.</param> 64 /// <param name="parents">The list of parents of which to perform the crossover.</param> 65 /// <returns>The newly created real vector, resulting from the intermediate multiple crossover.</returns> 48 66 protected override double[] Cross(IScope scope, IRandom random, IList<double[]> parents) { 49 67 return Apply(parents); -
trunk/sources/HeuristicLab.RealVector/LocalCrossover.cs
r102 r1184 27 27 28 28 namespace HeuristicLab.RealVector { 29 /// <summary> 30 /// Local crossover for real vectors: Takes for each element the allele of the first parent times a 31 /// always newly created randomly chosen factor and adds the allele of the second parent times (1 - the randomly chosen factor). 32 /// </summary> 29 33 public class LocalCrossover : RealVectorCrossoverBase { 34 /// <inheritdoc select="summary"/> 30 35 public override string Description { 31 36 get { return "Local crossover for real vectors."; } 32 37 } 33 38 39 /// <summary> 40 /// Performs a local crossover on the two given parent vectors. 41 /// </summary> 42 /// <param name="random">The random number generator.</param> 43 /// <param name="parent1">The first parent for the crossover operation.</param> 44 /// <param name="parent2">The second parent for the crossover operation.</param> 45 /// <returns>The newly created real vector, resulting from the local crossover.</returns> 34 46 public static double[] Apply(IRandom random, double[] parent1, double[] parent2) { 35 47 double factor; … … 44 56 } 45 57 58 /// <summary> 59 /// Performs a local crossover on the two given parent vectors. 60 /// </summary> 61 /// <remarks>Calls <see cref="Apply"/>.</remarks> 62 /// <param name="scope">The current scope.</param> 63 /// <param name="random">The random number generator.</param> 64 /// <param name="parent1">The first parent for the crossover operation.</param> 65 /// <param name="parent2">The second parent for the crossover operation.</param> 66 /// <returns>The newly created real vector, resulting from the local crossover.</returns> 46 67 protected override double[] Cross(IScope scope, IRandom random, double[] parent1, double[] parent2) { 47 68 return Apply(random, parent1, parent2); -
trunk/sources/HeuristicLab.RealVector/MichalewiczNonUniformAllPositionsManipulator.cs
r294 r1184 27 27 28 28 namespace HeuristicLab.RealVector { 29 /// <summary> 30 /// Michalewicz, Z. (1992). Genetic Algorithms + Data Structures = Evolution Programs <br/> 31 /// Non-uniformly distributed change of all positions of a real vector. 32 /// </summary> 29 33 public class MichalewiczNonUniformAllPositionsManipulator : RealVectorManipulatorBase { 34 /// <inheritdoc select="summary"/> 30 35 public override string Description { 31 36 get { return … … 37 42 } 38 43 44 /// <summary> 45 /// Initializes a new instance of <see cref="MichalewiczNonUniformAllPositionsManipulator"/> with 46 /// five variable infos (<c>Minimum</c>, <c>Maximum</c>, <c>CurrentGeneration</c>, 47 /// <c>MaximumGenerations</c> and <c>GenerationsDependency</c>). 48 /// </summary> 39 49 public MichalewiczNonUniformAllPositionsManipulator() 40 50 : base() { … … 49 59 } 50 60 61 /// <summary> 62 /// Performs a non uniformly distributed all position manipulation on the given 63 /// real <paramref name="vector"/>, published by Z. Michalewicz, 1992. 64 /// </summary> 65 /// <remarks>Calls <see cref="Apply"/>.</remarks> 66 /// <param name="scope">The current scope.</param> 67 /// <param name="random">The random number generator.</param> 68 /// <param name="vector">The real vector to manipulate.</param> 69 /// <returns>The manipulated real vector.</returns> 51 70 protected override double[] Manipulate(IScope scope, IRandom random, double[] vector) { 52 71 double min = GetVariableValue<DoubleData>("Minimum", scope, true).Data; … … 58 77 } 59 78 79 /// <summary> 80 /// Performs a non uniformly distributed all position manipulation on the given 81 /// real <paramref name="vector"/>, published by Z. Michalewicz, 1992. 82 /// </summary> 83 /// <param name="random">The random number generator.</param> 84 /// <param name="vector">The real vector to manipulate.</param> 85 /// <param name="min">The minimum value of the sampling range for the vector element (inclusive).</param> 86 /// <param name="max">The maximum value of the sampling range for the vector element (exclusive).</param> 87 /// <param name="currentGeneration">The current generation of the algorithm.</param> 88 /// <param name="maximumGenerations">Maximum number of generations.</param> 89 /// <param name="generationsDependency">Specifies the degree of dependency on the number of generations.</param> 90 /// <returns>The manipulated real vector.</returns> 60 91 public static double[] Apply(IRandom random, double[] vector, double min, double max, int currentGeneration, int maximumGenerations, int generationsDependency) { 61 92 int length = vector.Length; -
trunk/sources/HeuristicLab.RealVector/MichalewiczNonUniformOnePositionManipulator.cs
r294 r1184 27 27 28 28 namespace HeuristicLab.RealVector { 29 /// <summary> 30 /// Michalewicz, Z. (1992). Genetic Algorithms + Data Structures = Evolution Programs<br/> 31 /// Non-uniformly distributed change of one position of a real vector. 32 /// </summary> 29 33 public class MichalewiczNonUniformOnePositionManipulator : RealVectorManipulatorBase { 34 /// <inheritdoc select="summary"/> 30 35 public override string Description { 31 36 get { return … … 37 42 } 38 43 44 /// <summary> 45 /// Initializes a new instance of <see cref="MichalewiczNonUniformOnePositionManipulator"/> with five 46 /// variable infos (<c>Minimum</c>, <c>Maximum</c>, <c>CurrentGeneration</c>, <c>MaximumGenerations</c> 47 /// and <c>GenerationsDependency</c>). 48 /// </summary> 39 49 public MichalewiczNonUniformOnePositionManipulator() 40 50 : base() { … … 49 59 } 50 60 61 /// <summary> 62 /// Performs a non uniformly distributed one position manipulation on the given 63 /// real <paramref name="vector"/>, published by Z. Michalewicz, 1992. 64 /// </summary> 65 /// <remarks>Calls <see cref="Apply"/>.</remarks> 66 /// <param name="scope">The current scope.</param> 67 /// <param name="random">The random number generator.</param> 68 /// <param name="vector">The real vector to manipulate.</param> 69 /// <returns>The manipulated real vector.</returns> 51 70 protected override double[] Manipulate(IScope scope, IRandom random, double[] vector) { 52 71 double min = GetVariableValue<DoubleData>("Minimum", scope, true).Data; … … 58 77 } 59 78 79 /// <summary> 80 /// Performs a non uniformly distributed one position manipulation on the given 81 /// real <paramref name="vector"/>, published by Z. Michalewicz, 1992. 82 /// </summary> 83 /// <param name="random">The random number generator.</param> 84 /// <param name="vector">The real vector to manipulate.</param> 85 /// <param name="min">The minimum value of the sampling range for the vector element (inclusive).</param> 86 /// <param name="max">The maximum value of the sampling range for the vector element (exclusive).</param> 87 /// <param name="currentGeneration">The current generation of the algorithm.</param> 88 /// <param name="maximumGenerations">Maximum number of generations.</param> 89 /// <param name="generationsDependency">Specifies the degree of dependency on the number of generations.</param> 90 /// <returns>The manipulated real vector.</returns> 60 91 public static double[] Apply(IRandom random, double[] vector, double min, double max, int currentGeneration, int maximumGenerations, int generationsDependency) { 61 92 int length = vector.Length; -
trunk/sources/HeuristicLab.RealVector/RandomConvexCrossover.cs
r102 r1184 27 27 28 28 namespace HeuristicLab.RealVector { 29 /// <summary> 30 /// Random convex crossover for real vectors: Takes for each element the allele of the first parent times a 31 /// once created randomly chosen factor and adds the allele of the second parent times 32 /// (1 - the randomly chosen factor). 33 /// </summary> 29 34 public class RandomConvexCrossover : RealVectorCrossoverBase { 35 /// <inheritdoc select="summary"/> 30 36 public override string Description { 31 37 get { return "Random convex crossover for real vectors."; } 32 38 } 33 39 40 /// <summary> 41 /// Performs a random convex crossover on the two given parents. 42 /// </summary> 43 /// <param name="random">The random number generator.</param> 44 /// <param name="parent1">The first parent vector for the crossover.</param> 45 /// <param name="parent2">The second parent vector for the crossover.</param> 46 /// <returns>The newly created real vector, resulting from the random convex crossover.</returns> 34 47 public static double[] Apply(IRandom random, double[] parent1, double[] parent2) { 35 48 int length = parent1.Length; … … 42 55 } 43 56 57 /// <summary> 58 /// Performs a random convex crossover on the two given parents. 59 /// </summary> 60 /// <remarks>Calls <see cref="Apply"/>.</remarks> 61 /// <param name="scope">The current scope.</param> 62 /// <param name="random">The random number generator.</param> 63 /// <param name="parent1">The first parent vector for the crossover.</param> 64 /// <param name="parent2">The second parent vector for the crossover.</param> 65 /// <returns>The newly created real vector, resulting from the random convex crossover.</returns> 44 66 protected override double[] Cross(IScope scope, IRandom random, double[] parent1, double[] parent2) { 45 67 return Apply(random, parent1, parent2); -
trunk/sources/HeuristicLab.RealVector/RealVectorCrossoverBase.cs
r77 r1184 28 28 29 29 namespace HeuristicLab.RealVector { 30 /// <summary> 31 /// Base class for all real vector crossover operators. 32 /// </summary> 30 33 public abstract class RealVectorCrossoverBase : CrossoverBase { 34 /// <summary> 35 /// Initializes a new instance of <see cref="RealVectorCrossoverBase"/> with one variable info 36 /// (<c>RealVector</c>). 37 /// </summary> 31 38 public RealVectorCrossoverBase() 32 39 : base() { … … 34 41 } 35 42 43 /// <summary> 44 /// Performs a crossover of two given parents. 45 /// </summary> 46 /// <param name="scope">The current scope.</param> 47 /// <param name="random">A random number generator.</param> 48 /// <param name="parent1">The first parent for crossover.</param> 49 /// <param name="parent2">The second parent for crossover.</param> 50 /// <param name="child">The resulting child scope.</param> 36 51 protected sealed override void Cross(IScope scope, IRandom random, IScope parent1, IScope parent2, IScope child) { 37 52 DoubleArrayData vector1 = parent1.GetVariableValue<DoubleArrayData>("RealVector", false); … … 44 59 } 45 60 61 /// <summary> 62 /// Performs a crossover of two given parents. 63 /// </summary> 64 /// <param name="scope">The current scope.</param> 65 /// <param name="random">A random number generator.</param> 66 /// <param name="parent1">The first parent for crossover.</param> 67 /// <param name="parent2">The second parent for crossover.</param> 68 /// <returns>The newly created real vector, resulting from the crossover operation.</returns> 46 69 protected abstract double[] Cross(IScope scope, IRandom random, double[] parent1, double[] parent2); 47 70 } -
trunk/sources/HeuristicLab.RealVector/RealVectorManipulatorBase.cs
r2 r1184 27 27 28 28 namespace HeuristicLab.RealVector { 29 /// <summary> 30 /// Base class for all real vector manipulators. 31 /// </summary> 29 32 public abstract class RealVectorManipulatorBase : OperatorBase { 33 /// <summary> 34 /// Initializes a new instance of <see cref="RealVectorManipulatorBase"/> with two variable infos 35 /// (<c>Random</c> and <c>RealVector</c>). 36 /// </summary> 30 37 public RealVectorManipulatorBase() { 31 38 AddVariableInfo(new VariableInfo("Random", "Pseudo random number generator", typeof(IRandom), VariableKind.In)); … … 33 40 } 34 41 42 /// <summary> 43 /// Manipulates the real vector. 44 /// </summary> 45 /// <param name="scope">The current scope whose real vector to manipulate.</param> 46 /// <returns><c>null</c>.</returns> 35 47 public override IOperation Apply(IScope scope) { 36 48 IRandom random = GetVariableValue<IRandom>("Random", scope, true); … … 40 52 } 41 53 54 /// <summary> 55 /// Manipulates the given real <paramref name="vector"/> with the given random number generator. 56 /// </summary> 57 /// <param name="scope">The current scope.</param> 58 /// <param name="random">A random number generator.</param> 59 /// <param name="vector">The real vector to manipulate.</param> 60 /// <returns>The manipulated real vector.</returns> 42 61 protected abstract double[] Manipulate(IScope scope, IRandom random, double[] vector); 43 62 } -
trunk/sources/HeuristicLab.RealVector/RealVectorMultiCrossoverBase.cs
r111 r1184 28 28 29 29 namespace HeuristicLab.RealVector { 30 /// <summary> 31 /// Base class for all real vector multiple crossover operators. 32 /// </summary> 30 33 public abstract class RealVectorMultiCrossoverBase : MultiCrossoverBase { 34 /// <summary> 35 /// Initializes a new instance of <see cref="RealVectorMultiCrossoverBase"/> with one variable info 36 /// (<c>RealVector</c>). 37 /// </summary> 31 38 public RealVectorMultiCrossoverBase() 32 39 : base() { … … 34 41 } 35 42 43 /// <summary> 44 /// Performs a crossover of a number of given parents. 45 /// </summary> 46 /// <param name="scope">The current scope.</param> 47 /// <param name="random">A random number generator.</param> 48 /// <param name="parents">The parents for crossover.</param> 49 /// <param name="child">The resulting child scope.</param> 36 50 protected sealed override void Cross(IScope scope, IRandom random, IScope[] parents, IScope child) { 37 51 IList<double[]> parentsList = new List<double[]>(parents.Length); … … 44 58 } 45 59 60 /// <summary> 61 /// Performs a crossover of a number of given parents. 62 /// </summary> 63 /// <param name="scope">The current scope.</param> 64 /// <param name="random">A random number generator.</param> 65 /// <param name="parents">The parents for crossover.</param> 66 /// <returns>The newly created real vector, resulting from the crossover operation.</returns> 46 67 protected abstract double[] Cross(IScope scope, IRandom random, IList<double[]> parents); 47 68 } -
trunk/sources/HeuristicLab.RealVector/RealVectorSelfAdaptiveMultiCrossoverBase.cs
r111 r1184 28 28 29 29 namespace HeuristicLab.RealVector { 30 /// <summary> 31 /// Base class for self adaptive multiple crossovers for real vectors. 32 /// </summary> 30 33 public abstract class RealVectorSelfAdaptiveMultiCrossoverBase : MultiCrossoverBase { 34 /// <summary> 35 /// Initializes a new instance of <see cref="RealVectorSelfAdaptiveMultiCrossoverBase"/> with two 36 /// variable infos (<c>RealVector</c> and <c>StrategyVector</c>). 37 /// </summary> 31 38 public RealVectorSelfAdaptiveMultiCrossoverBase() 32 39 : base() { … … 35 42 } 36 43 44 /// <summary> 45 /// Performs a self adaptive multiple crossover on the given list of <paramref name="parents"/>. 46 /// </summary> 47 /// <param name="scope">The current scope.</param> 48 /// <param name="random">The random number generator.</param> 49 /// <param name="parents">The list of parents of which to perform the crossover.</param> 50 /// <param name="child">The newly generated real vector, resulting from the self adaptive multiple 51 /// crossover.</param> 37 52 protected sealed override void Cross(IScope scope, IRandom random, IScope[] parents, IScope child) { 38 53 IList<double[]> parentsList = new List<double[]>(parents.Length); … … 50 65 } 51 66 67 /// <summary> 68 /// Performs a self adaptive multiple crossover on the given list of <paramref name="parents"/>. 69 /// </summary> 70 /// <param name="scope">The current scope.</param> 71 /// <param name="random">The random number generator.</param> 72 /// <param name="parents">The list of parents of which to perform the crossover.</param> 73 /// <param name="strategyParametersList">The strategy parameter list.</param> 74 /// <param name="childIndividual">Output parameter; the created child.</param> 75 /// <param name="strategyParameters">Output parameter; endogenous strategy parameters.</param> 52 76 protected abstract void Cross(IScope scope, IRandom random, IList<double[]> parents, IList<double[]> strategyParametersList, out double[] childIndividual, out double[] strategyParameters); 53 77 } -
trunk/sources/HeuristicLab.RealVector/SelfAdaptiveDiscreteMultiCrossover.cs
r111 r1184 27 27 28 28 namespace HeuristicLab.RealVector { 29 /// <summary> 30 /// Creates a new offspring by combining the alleles in the parents such that each allele is 31 /// randomly selected from one parent. It will also use the same strategy to combine the endogenous 32 /// strategy parameter vector. 33 /// </summary> 29 34 public class SelfAdaptiveDiscreteMultiCrossover : RealVectorSelfAdaptiveMultiCrossoverBase { 35 /// <inheritdoc select="summary"/> 30 36 public override string Description { 31 37 get { … … 34 40 } 35 41 42 /// <summary> 43 /// Performs a self adaptive discrete multiple crossover on the given list of <paramref name="parents"/>. 44 /// </summary> 45 /// <exception cref="InvalidOperationException">Thrown when the parent vectors have different lengths.</exception> 46 /// <param name="random">The random number generator.</param> 47 /// <param name="parents">The list of parents to crossover.</param> 48 /// <param name="strategyParametersList">The strategy parameter list.</param> 49 /// <param name="childIndividual">Output parameter; the created child.</param> 50 /// <param name="strategyParameters">Output parameter; endogenous strategy parameters.</param> 36 51 public static void Apply(IRandom random, IList<double[]> parents, IList<double[]> strategyParametersList, out double[] childIndividual, out double[] strategyParameters) { 37 52 childIndividual = new double[parents[0].Length]; … … 48 63 } 49 64 65 /// <summary> 66 /// Performs a self adaptive discrete multiple crossover on the given list of <paramref name="parents"/>. 67 /// </summary> 68 /// <remarks>Calls <see cref="Apply"/>.</remarks> 69 /// <param name="scope">The current scope.</param> 70 /// <param name="random">The random number generator.</param> 71 /// <param name="parents">The list of parents to crossover.</param> 72 /// <param name="strategyParametersList">The strategy parameter list.</param> 73 /// <param name="childIndividual">Output parameter; the created child.</param> 74 /// <param name="strategyParameters">Output parameter; endogenous strategy parameters.</param> 50 75 protected override void Cross(IScope scope, IRandom random, IList<double[]> parents, IList<double[]> strategyParametersList, out double[] childIndividual, out double[] strategyParameters) { 51 76 Apply(random, parents, strategyParametersList, out childIndividual, out strategyParameters); -
trunk/sources/HeuristicLab.RealVector/SelfAdaptiveNormalAllPositionsManipulator.cs
r1180 r1184 28 28 29 29 namespace HeuristicLab.RealVector { 30 /// <summary> 31 /// Manipulates each dimension in the real vector with the mutation strength given 32 /// in the strategy parameter vector. 33 /// </summary> 30 34 public class SelfAdaptiveNormalAllPositionsManipulator : RealVectorManipulatorBase { 35 /// <inheritdoc select="summary"/> 31 36 public override string Description { 32 37 get { return @"Manipulates each dimension in the real vector with the mutation strength given in the strategy parameter vector"; } 33 38 } 34 39 40 /// <summary> 41 /// Initializes a new instance of <see cref="SelfAdaptiveNormalAllPositionsManipulator"/> with one 42 /// variable info (<c>StrategyVector</c>). 43 /// </summary> 35 44 public SelfAdaptiveNormalAllPositionsManipulator() 36 45 : base() { … … 38 47 } 39 48 49 /// <summary> 50 /// Performs a self adaptive normally distributed all position manipulation on the given 51 /// <paramref name="vector"/>. 52 /// </summary> 53 /// <exception cref="InvalidOperationException">Thrown when the strategy vector is not 54 /// as long as the vector to get manipulated.</exception> 55 /// <param name="strategyParameters">The strategy vector determining the strength of the mutation.</param> 56 /// <param name="random">A random number generator.</param> 57 /// <param name="vector">The real vector to manipulate.</param> 58 /// <returns>The manipulated real vector.</returns> 40 59 public static double[] Apply(double[] strategyParameters, IRandom random, double[] vector) { 41 60 NormalDistributedRandom N = new NormalDistributedRandom(random, 0.0, 1.0); … … 46 65 } 47 66 67 /// <summary> 68 /// Performs a self adaptive normally distributed all position manipulation on the given 69 /// <paramref name="vector"/>. 70 /// </summary> 71 /// <remarks>Calls <see cref="Apply"/>.</remarks> 72 /// <param name="scope">The current scope.</param> 73 /// <param name="random">A random number generator.</param> 74 /// <param name="vector">The real vector to manipulate.</param> 75 /// <returns>The manipulated real vector.</returns> 48 76 protected override double[] Manipulate(IScope scope, IRandom random, double[] vector) { 49 77 double[] strategyVector = scope.GetVariableValue<DoubleArrayData>("StrategyVector", true).Data; -
trunk/sources/HeuristicLab.RealVector/SinglePointCrossover.cs
r2 r1184 26 26 27 27 namespace HeuristicLab.RealVector { 28 /// <summary> 29 /// Single point crossover for real vectors. 30 /// </summary> 28 31 public class SinglePointCrossover : RealVectorCrossoverBase { 32 /// <inheritdoc select="summary"/> 29 33 public override string Description { 30 34 get { return "Single point crossover for real vectors."; } 31 35 } 32 36 37 /// <summary> 38 /// Performs a single point crossover at a randomly chosen position of the two 39 /// given parent real vectors. 40 /// </summary> 41 /// <param name="random">A random number generator.</param> 42 /// <param name="parent1">The first parent for crossover.</param> 43 /// <param name="parent2">The second parent for crossover.</param> 44 /// <returns>The newly created real vector, resulting from the single point crossover.</returns> 33 45 public static double[] Apply(IRandom random, double[] parent1, double[] parent2) { 34 46 int length = parent1.Length; … … 44 56 } 45 57 58 /// <summary> 59 /// Performs a single point crossover at a randomly chosen position of the two 60 /// given parent real vectors. 61 /// </summary> 62 /// <param name="scope">The current scope.</param> 63 /// <param name="random">A random number generator.</param> 64 /// <param name="parent1">The first parent for crossover.</param> 65 /// <param name="parent2">The second parent for crossover.</param> 66 /// <returns>The newly created real vector, resulting from the single point crossover.</returns> 46 67 protected override double[] Cross(IScope scope, IRandom random, double[] parent1, double[] parent2) { 47 68 return Apply(random, parent1, parent2); -
trunk/sources/HeuristicLab.RealVector/UniformAllPositionsManipulator.cs
r102 r1184 27 27 28 28 namespace HeuristicLab.RealVector { 29 /// <summary> 30 /// Uniformly distributed change of all positions of a real vector. 31 /// </summary> 29 32 public class UniformAllPositionsManipulator : RealVectorManipulatorBase { 33 /// <inheritdoc select="summary"/> 30 34 public override string Description { 31 35 get { return "Uniformly distributed change of all positions of a real vector."; } 32 36 } 33 37 38 /// <summary> 39 /// Initializes a new instance of <see cref="UniformAllPositionsManipulator"/> with two variable infos 40 /// (<c>Minimum</c> and <c>Maximum</c>). 41 /// </summary> 34 42 public UniformAllPositionsManipulator() { 35 43 AddVariableInfo(new VariableInfo("Minimum", "Minimum of the sampling range for the vector element (included)", typeof(DoubleData), VariableKind.In)); … … 37 45 } 38 46 47 /// <summary> 48 /// Changes all positions in the given real <paramref name="vector"/>. 49 /// </summary> 50 /// <param name="random">A random number generator.</param> 51 /// <param name="vector">The real vector to manipulate.</param> 52 /// <param name="min">The minimum value of the sampling range for each vector element (inclusive).</param> 53 /// <param name="max">The maximum value of the sampling range for each vector element (exclusive).</param> 54 /// <returns>The new real vector which has been manipulated.</returns> 39 55 public static double[] Apply(IRandom random, double[] vector, double min, double max) { 40 56 double[] result = (double[])vector.Clone(); … … 47 63 } 48 64 65 /// <summary> 66 /// Changes all positions in the given real <paramref name="vector"/>. 67 /// </summary> 68 /// <remarks>Calls <see cref="Apply"/>.</remarks> 69 /// <param name="scope">The current scope.</param> 70 /// <param name="random">A random number generator.</param> 71 /// <param name="vector">The real vector to manipulate.</param> 72 /// <returns>The new real vector which has been manipulated.</returns> 49 73 protected override double[] Manipulate(IScope scope, IRandom random, double[] vector) { 50 74 double min = GetVariableValue<DoubleData>("Minimum", scope, true).Data; -
trunk/sources/HeuristicLab.RealVector/UniformOnePositionManipulator.cs
r2 r1184 27 27 28 28 namespace HeuristicLab.RealVector { 29 /// <summary> 30 /// Uniformly distributed change of a single position of a real vector. 31 /// </summary> 29 32 public class UniformOnePositionManipulator : RealVectorManipulatorBase { 33 /// <inheritdoc select="summary"/> 30 34 public override string Description { 31 35 get { return "Uniformly distributed change of a single position of a real vector."; } 32 36 } 33 37 38 /// <summary> 39 /// Initializes a new instance of <see cref="UniformOnePositionManipulator"/> with two variable infos 40 /// (<c>Minimum</c> and <c>Maximum</c>). 41 /// </summary> 34 42 public UniformOnePositionManipulator() { 35 43 AddVariableInfo(new VariableInfo("Minimum", "Minimum of the sampling range for the vector element (included)", typeof(DoubleData), VariableKind.In)); … … 37 45 } 38 46 47 /// <summary> 48 /// Changes randomly a single position in the given real <paramref name="vector"/>. 49 /// </summary> 50 /// <param name="random">A random number generator.</param> 51 /// <param name="vector">The real vector to manipulate.</param> 52 /// <param name="min">The minimum value of the sampling range for 53 /// the vector element to change (inclusive).</param> 54 /// <param name="max">The maximum value of the sampling range for 55 /// the vector element to change (exclusive).</param> 56 /// <returns>The new real vector that has been manipulated.</returns> 39 57 public static double[] Apply(IRandom random, double[] vector, double min, double max) { 40 58 double[] result = (double[])vector.Clone(); … … 44 62 } 45 63 64 /// <summary> 65 /// Changes randomly a single position in the given real <paramref name="vector"/>. 66 /// </summary> 67 /// <remarks>Calls <see cref="Apply"/>.</remarks> 68 /// <param name="scope">The current scope.</param> 69 /// <param name="random">A random number generator.</param> 70 /// <param name="vector">The real vector to manipulate.</param> 71 /// <returns>The new real vector that has been manipulated.</returns> 46 72 protected override double[] Manipulate(IScope scope, IRandom random, double[] vector) { 47 73 double min = GetVariableValue<DoubleData>("Minimum", scope, true).Data; -
trunk/sources/HeuristicLab.RealVector/UniformRandomRealVectorGenerator.cs
r77 r1184 27 27 28 28 namespace HeuristicLab.RealVector { 29 /// <summary> 30 /// Generates a new random real vector with each element uniformly distributed in a specified range. 31 /// </summary> 29 32 public class UniformRandomRealVectorGenerator : OperatorBase { 33 /// <inheritdoc select="summary"/> 30 34 public override string Description { 31 35 get { return "Operator generating a new random real vector with each element uniformly distributed in a specified range."; } 32 36 } 33 37 38 /// <summary> 39 /// Initializes a new instance of <see cref="UniformRandomRealVectorGenerator"/> with five variable infos 40 /// (<c>Random</c>, <c>Length</c>, <c>Minimum</c>, <c>Maximum</c> and <c>RealVector</c>). 41 /// </summary> 34 42 public UniformRandomRealVectorGenerator() { 35 43 AddVariableInfo(new VariableInfo("Random", "Pseudo random number generator", typeof(IRandom), VariableKind.In)); … … 40 48 } 41 49 50 /// <summary> 51 /// Generates a new random real vector with the given <paramref name="length"/>. 52 /// </summary> 53 /// <param name="random">The random number generator.</param> 54 /// <param name="length">The length of the real vector.</param> 55 /// <param name="min">The minimum value of the sampling range for each vector element (inclusive).</param> 56 /// <param name="max">The maximum value of the sampling range for each vector element (exclusive).</param> 57 /// <returns>The newly created real vector.</returns> 42 58 public static double[] Apply(IRandom random, int length, double min, double max) { 43 59 double[] result = new double[length]; … … 47 63 } 48 64 65 /// <summary> 66 /// Generates a new random real vector and injects it in the given <paramref name="scope"/>. 67 /// </summary> 68 /// <param name="scope">The scope where to get the values from and where to inject the newly 69 /// created real vector.</param> 70 /// <returns><c>null</c>.</returns> 49 71 public override IOperation Apply(IScope scope) { 50 72 IRandom random = GetVariableValue<IRandom>("Random", scope, true);
Note: See TracChangeset
for help on using the changeset viewer.