- Timestamp:
- 03/08/10 11:37:24 (15 years ago)
- Location:
- trunk/sources/HeuristicLab.Encodings.RealVector/3.3/Crossovers
- Files:
-
- 3 added
- 2 deleted
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Encodings.RealVector/3.3/Crossovers/HeuristicCrossover.cs
r2936 r2964 30 30 namespace HeuristicLab.Encodings.RealVector { 31 31 /// <summary> 32 /// Heuristic crossover for real vectors: Takes for each position the better parent and adds the difference33 /// of the two parents times a randomly chosen factor.32 /// Heuristic crossover for real vectors: Calculates the vector from the worse to the better parent and adds that to the better parent weighted with a factor in the interval [0;1). 33 /// The idea is that going further in direction from the worse to the better leads to even better solutions (naturally this depends on the fitness landscape). 34 34 /// </summary> 35 35 /// <remarks> 36 36 /// It is implemented as described in Wright, A.H. (1994), Genetic algorithms for real parameter optimization, Foundations of Genetic Algorithms, G.J.E. Rawlins (Ed.), Morgan Kaufmann, San Mateo, CA, 205-218. 37 37 /// </remarks> 38 [Item("HeuristicCrossover", " Heuristic crossover for real vectors: Takes for each position the better parent and adds the difference. It is implemented as described in Wright, A.H. (1994), Genetic algorithms for real parameter optimization, Foundations of Genetic Algorithms, G.J.E. Rawlins (Ed.), Morgan Kaufmann, San Mateo, CA, 205-218.")]38 [Item("HeuristicCrossover", "The heuristic crossover produces offspring that extend the better parent in direction from the worse to the better parent. It is implemented as described in Wright, A.H. (1994), Genetic algorithms for real parameter optimization, Foundations of Genetic Algorithms, G.J.E. Rawlins (Ed.), Morgan Kaufmann, San Mateo, CA, 205-218.")] 39 39 [EmptyStorableClass] 40 40 public class HeuristicCrossover : RealVectorCrossover { … … 72 72 public static DoubleArrayData Apply(IRandom random, DoubleArrayData betterParent, DoubleArrayData worseParent) { 73 73 if (betterParent.Length != worseParent.Length) 74 throw new ArgumentException(" ERROR inHeuristicCrossover: the two parents are not of the same length");74 throw new ArgumentException("HeuristicCrossover: the two parents are not of the same length"); 75 75 76 76 int length = betterParent.Length; … … 99 99 /// <returns>The newly created real vector, resulting from the crossover operation.</returns> 100 100 protected override DoubleArrayData Cross(IRandom random, ItemArray<DoubleArrayData> parents) { 101 if (parents.Length != 2) throw new ArgumentException(" ERROR inHeuristicCrossover: The number of parents is not equal to 2");101 if (parents.Length != 2) throw new ArgumentException("HeuristicCrossover: The number of parents is not equal to 2"); 102 102 103 103 if (MaximizationParameter.ActualValue == null) throw new InvalidOperationException("HeuristicCrossover: Parameter " + MaximizationParameter.ActualName + " could not be found."); -
trunk/sources/HeuristicLab.Encodings.RealVector/3.3/Crossovers/LocalCrossover.cs
r2936 r2964 29 29 namespace HeuristicLab.Encodings.RealVector { 30 30 /// <summary> 31 /// Local crossover for real vectors: Takes for each element the allele of the first parent times a 32 /// always newly created randomly chosen factor and adds the allele of the second parent times (1 - the randomly chosen factor). 31 /// The local crossover for real vectors is similar to the <see cref="UniformAllPositionsArithmeticCrossover"/>, but where the factor alpha is chosen randomly in the interval [0;1) for each position. 33 32 /// </summary> 34 33 /// <remarks> 35 34 /// It is implemented as described in Dumitrescu, D. et al. (2000), Evolutionary computation, CRC Press, Boca Raton, FL, p. 194. 36 35 /// </remarks> 37 [Item("LocalCrossover", "Local crossover for real vectors: Takes for each element the allele of the first parent times a always newly created randomly chosen factor and adds the allele of the second parent times (1 - the randomly chosen factor. " + 38 "It is implemented as described in Dumitrescu, D. et al. (2000), Evolutionary computation, CRC Press, Boca Raton, FL., p. 194.")] 36 [Item("LocalCrossover", @"The local crossover is similar to the arithmetic all positions crossover, but uses a random alpha for each position x = alpha * p1 + (1-alpha) * p2. It is implemented as described in Dumitrescu, D. et al. (2000), Evolutionary computation, CRC Press, Boca Raton, FL., p. 194.")] 39 37 [EmptyStorableClass] 40 38 public class LocalCrossover : RealVectorCrossover { … … 49 47 public static DoubleArrayData Apply(IRandom random, DoubleArrayData parent1, DoubleArrayData parent2) { 50 48 if (parent1.Length != parent2.Length) 51 throw new ArgumentException(" ERROR inLocalCrossover: the two parents are not of the same length");49 throw new ArgumentException("LocalCrossover: the two parents are not of the same length"); 52 50 53 51 double factor; … … 70 68 /// <returns>The newly created real vector, resulting from the crossover operation.</returns> 71 69 protected override DoubleArrayData Cross(IRandom random, ItemArray<DoubleArrayData> parents) { 72 if (parents.Length != 2) throw new ArgumentException(" ERROR inLocalCrossover: The number of parents is not equal to 2");70 if (parents.Length != 2) throw new ArgumentException("LocalCrossover: The number of parents is not equal to 2"); 73 71 return Apply(random, parents[0], parents[1]); 74 72 } -
trunk/sources/HeuristicLab.Encodings.RealVector/3.3/Crossovers/RandomConvexCrossover.cs
r2936 r2964 29 29 namespace HeuristicLab.Encodings.RealVector { 30 30 /// <summary> 31 /// Random convex crossover for real vectors: Takes for each element the allele of the first parent times a 32 /// once created randomly chosen factor and adds the allele of the second parent times 33 /// (1 - the randomly chosen factor). 31 /// The random convex crossover is similar to the <see cref="LocalCrossover"/>, but chooses just one random alpha for all positions. 34 32 /// </summary> 35 33 /// <remarks> 36 34 /// It is implemented as described in Dumitrescu, D. et al. (2000), Evolutionary computation, CRC Press, Boca Raton, FL, pp. 193 - 194. 37 35 /// </remarks> 38 [Item("RandomConvexCrossover", "Random convex crossover for real vectors: Takes for each element the allele of the first parent times a once created randomly chosen factor and adds the allele of the second parent times (1 - the randomly chosen factor). " + 39 "It is implementes as described in Dumitrescu, D. et al. (2000), Evolutionary computation, CRC Press, Boca Raton, FL, pp. 193 - 194.")] 36 [Item("RandomConvexCrossover", "The random convex crossover acts like the local crossover, but with just one randomly chosen alpha for all crossed positions. It is implementes as described in Dumitrescu, D. et al. (2000), Evolutionary computation, CRC Press, Boca Raton, FL, pp. 193 - 194.")] 40 37 [EmptyStorableClass] 41 38 public class RandomConvexCrossover : RealVectorCrossover {
Note: See TracChangeset
for help on using the changeset viewer.