Changeset 8790 for trunk/sources/HeuristicLab.Encodings.IntegerVectorEncoding/3.3/Crossovers/RoundedBlendAlphaCrossover.cs
- Timestamp:
- 10/11/12 13:37:56 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Encodings.IntegerVectorEncoding/3.3/Crossovers/RoundedBlendAlphaCrossover.cs
r8019 r8790 85 85 var result = new IntegerVector(length); 86 86 double max = 0, min = 0, d = 0, resMin = 0, resMax = 0; 87 int minBound s, maxBounds, step = 1;87 int minBound, maxBound, step = 1; 88 88 89 89 for (int i = 0; i < length; i++) { 90 minBound s= bounds[i % bounds.Rows, 0];91 maxBound s= bounds[i % bounds.Rows, 1];90 minBound = bounds[i % bounds.Rows, 0]; 91 maxBound = bounds[i % bounds.Rows, 1]; 92 92 if (bounds.Columns > 2) step = bounds[i % bounds.Rows, 2]; 93 maxBound = FloorFeasible(minBound, maxBound, step, maxBound - 1); 94 93 95 max = Math.Max(parent1[i], parent2[i]); 94 96 min = Math.Min(parent1[i], parent2[i]); 95 97 d = Math.Abs(max - min); 96 resMin = FloorFeasible(minBound s, maxBounds, step, min - d * alpha.Value);97 resMax = CeilingFeasible(minBound s, maxBounds, step, max + d * alpha.Value);98 resMin = FloorFeasible(minBound, maxBound, step, min - d * alpha.Value); 99 resMax = CeilingFeasible(minBound, maxBound, step, max + d * alpha.Value); 98 100 99 result[i] = RoundFeasible(minBound s, maxBounds, step, resMin + random.NextDouble() * Math.Abs(resMax - resMin));101 result[i] = RoundFeasible(minBound, maxBound, step, resMin + random.NextDouble() * Math.Abs(resMax - resMin)); 100 102 } 101 103 return result;
Note: See TracChangeset
for help on using the changeset viewer.