Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/25/13 12:37:18 (11 years ago)
Author:
sforsten
Message:

#1980:

  • fixed several bugs (crossover, subsumption, serialization etc.)
  • added ModuloOperator
  • CombinedIntegerVectorClassificationProblem\Data and VariableVectorClassificationProblem\Data inherit from ConditionActionClassificationProblem\Data
  • it can now be set how often the analyzers have to be executed
  • VariableVectorAction, VariableVectorCondition and VariableVectorInput now inherit from Item
Location:
branches/LearningClassifierSystems/HeuristicLab.Encodings.VariableVector/3.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/LearningClassifierSystems/HeuristicLab.Encodings.VariableVector/3.3

    • Property svn:ignore
      •  

        old new  
        11obj
         2Plugin.cs
  • branches/LearningClassifierSystems/HeuristicLab.Encodings.VariableVector/3.3/Variable/DoubleVariable.cs

    r9226 r9242  
    6666      min = original.min;
    6767      max = original.max;
     68      currentSpread = original.currentSpread;
     69      currentCenter = original.currentCenter;
    6870    }
    6971    public DoubleVariable() : base() { }
     
    8991
    9092    public override string ToString() {
    91       return (currentCenter - currentCenter) + " - " + (currentCenter + currentSpread);
     93      return (currentCenter - currentSpread) + " - " + (currentCenter + currentSpread);
    9294    }
    9395
     
    9799
    98100    public override bool Match(double target) {
    99       return currentCenter - currentSpread < target && target < currentCenter + currentSpread;
     101      return currentCenter - currentSpread <= target && target <= currentCenter + currentSpread;
    100102    }
    101103
     
    128130      var targetCast = target as DoubleVariable;
    129131      if (targetCast == null) { return false; }
    130       if (variableName != targetCast.variableName || currentCenter != targetCast.currentCenter
    131         || currentSpread != targetCast.currentSpread || max != targetCast.max
    132         || min != targetCast.min) { return false; }
     132      if (variableName != targetCast.variableName || currentCenter.IsAlmost(targetCast.currentCenter)
     133        || currentSpread.IsAlmost(targetCast.currentSpread) || max.IsAlmost(targetCast.max)
     134        || min.IsAlmost(targetCast.min)) { return false; }
    133135
    134136      return true;
     
    149151    }
    150152
    151     public new DoubleVariable CrossParentsAtPosition(IVariable parent2, int pos) {
    152       var parent2Cast = parent2 as DoubleVariable;
     153    public override IVariable CrossParentsAtPosition(IVariable parent2, int pos) {
     154      DoubleVariable parent2Cast = parent2 as DoubleVariable;
    153155      if (parent2Cast == null) { throw new ArgumentException("Argument is not of the correct type."); }
    154156      if (pos > 1 || pos < 0) { throw new ArgumentOutOfRangeException(); }
    155157      DoubleVariable crossed = (DoubleVariable)this.GetSetCopy();
    156       if (pos == 0) {
     158      if (pos == 1) {
    157159        crossed.CurrentSpread = parent2Cast.CurrentSpread;
    158160      }
     
    180182
    181183    public override void Cover(IRandom random, string stringValue, double changeSymbolProbability) {
    182       Cover(random, stringValue, 50);
     184      CoverWithSpreadPercentage(random, stringValue, changeSymbolProbability);
    183185    }
    184186
     
    186188      currentCenter = double.Parse(stringValue);
    187189      double delta = max - min;
    188       currentSpread = random.NextDouble() * (delta * (spreadPercentage / 100));
     190      currentSpread = random.NextDouble() * (delta * spreadPercentage);
    189191    }
    190192  }
Note: See TracChangeset for help on using the changeset viewer.