Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/06/12 14:45:59 (12 years ago)
Author:
jkarder
Message:

#1853:

  • added MultiDoubleValueCrossover
  • fixed bug in AverageDoubleValueCrossover
  • minor code improvements
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/ParameterConfigurationEncoding/HeuristicLab.Encodings.ParameterConfigurationEncoding/3.3/Operators/Crossovers/IntValue/NormalIntValueCrossover.cs

    r8574 r8590  
    5353
    5454    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);
    5656    }
    5757
    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;
    6162      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;
    6668    }
    6769  }
Note: See TracChangeset for help on using the changeset viewer.