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