Changeset 8590 for branches/ParameterConfigurationEncoding/HeuristicLab.Encodings.ParameterConfigurationEncoding/3.3/Operators/Crossovers/IntValue
- Timestamp:
- 09/06/12 14:45:59 (12 years ago)
- Location:
- branches/ParameterConfigurationEncoding/HeuristicLab.Encodings.ParameterConfigurationEncoding/3.3/Operators/Crossovers/IntValue
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ParameterConfigurationEncoding/HeuristicLab.Encodings.ParameterConfigurationEncoding/3.3/Operators/Crossovers/IntValue/DiscreteIntValueCrossover.cs
r8574 r8590 55 55 56 56 public static void ApplyStatic(IRandom random, IntValue value, IntValue other, IntValueRange 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/IntValue/MultiIntValueCrossover.cs
r8574 r8590 67 67 68 68 public void Apply(IRandom random, IntValue value, IntValue other, IntValueRange range) { 69 // TODO69 Operators[random.Next(Operators.Count)].Apply(random, value, other, range); 70 70 } 71 71 } -
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.