Changeset 8590 for branches/ParameterConfigurationEncoding/HeuristicLab.Encodings.ParameterConfigurationEncoding/3.3/Operators/Crossovers/IntValue/NormalIntValueCrossover.cs
- Timestamp:
- 09/06/12 14:45:59 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ParameterConfigurationEncoding/HeuristicLab.Encodings.ParameterConfigurationEncoding/3.3/Operators/Crossovers/IntValue/NormalIntValueCrossover.cs
r8574 r8590 53 53 54 54 public void Apply(IRandom random, IntValue value, IntValue other, IntValueRange range) { 55 value.Value = ApplyStatic(random, value, other, range).Value;55 ApplyStatic(random, value, other, range); 56 56 } 57 57 58 public static IntValue ApplyStatic(IRandom random, IntValue better, IntValue worse, IntValueRange range) { 59 NormalDistributedRandom N = new NormalDistributedRandom(random, better.Value, Math.Abs(better.Value - worse.Value) / 3); 60 var offspring = new IntValue(); 58 public static void ApplyStatic(IRandom random, IntValue value, IntValue other, IntValueRange range) { 59 var N = new NormalDistributedRandom(random, value.Value, Math.Abs(value.Value - other.Value) / 3); 60 61 int offspring; 61 62 do { 62 offspring.Value = (int)N.NextDouble(); 63 offspring.Value = range.ApplyStepSize(offspring.Value); 64 } while (!range.IsInRange(offspring.Value)); 65 return offspring; 63 offspring = (int)N.NextDouble(); 64 offspring = range.ApplyStepSize(offspring); 65 } while (!range.IsInRange(offspring)); 66 67 value.Value = offspring; 66 68 } 67 69 }
Note: See TracChangeset
for help on using the changeset viewer.