- Timestamp:
- 05/06/10 16:41:51 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/Crossovers/SinglePointCrossover.cs ΒΆ
r3376 r3675 49 49 public static RealVector Apply(IRandom random, RealVector parent1, RealVector parent2) { 50 50 if (parent1.Length != parent2.Length) throw new ArgumentException("SinglePointCrossover: Parents are of unequal length"); 51 if (parent1.Length < 2) throw new ArgumentException("SinglePointCrossover: Cannot be applied to vectors with just one dimension."); 51 52 int length = parent1.Length; 52 53 RealVector result = new RealVector(length); 53 int breakPoint = random.Next(1, length - 1); 54 int breakPoint; 55 if (length == 2) breakPoint = 1; 56 else breakPoint = random.Next(1, length - 1); 54 57 55 58 for (int i = 0; i < breakPoint; i++)
Note: See TracChangeset
for help on using the changeset viewer.