Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/23/13 13:31:29 (11 years ago)
Author:
sforsten
Message:

#1980:

  • several small bug fixes
  • added windowing technique ILAS to GAssist
  • GAssist and XCS work now with real-valued features
  • severely improved the performance of XCS
Location:
branches/LearningClassifierSystems/HeuristicLab.Encodings.VariableVector/3.3
Files:
7 edited

Legend:

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

    r9242 r9392  
    6262      IList<IVariable> newCondition = new List<IVariable>(parent1Condition.VariableDictionary.Count);
    6363
    64       var keyEnumerator = parent1Condition.Order.GetEnumerator();
     64      var keyEnumerator = parent1Condition.VariableDictionary.Keys.GetEnumerator();
    6565
    6666      int index = 0;
  • branches/LearningClassifierSystems/HeuristicLab.Encodings.VariableVector/3.3/Manipulator/UniformOnePositionInConditionManipulator.cs

    r9242 r9392  
    5454        throw new ArgumentOutOfRangeException();
    5555      }
    56       var keyEnumerator = condition.Order.GetEnumerator();
     56      var keyEnumerator = condition.VariableDictionary.Keys.GetEnumerator();
    5757      int count = 0;
    5858      keyEnumerator.MoveNext();
  • branches/LearningClassifierSystems/HeuristicLab.Encodings.VariableVector/3.3/Variable/DoubleVariable.cs

    r9242 r9392  
    130130      var targetCast = target as DoubleVariable;
    131131      if (targetCast == null) { 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; }
     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; }
    135135
    136136      return true;
  • branches/LearningClassifierSystems/HeuristicLab.Encodings.VariableVector/3.3/Variable/IntVariable.cs

    r9242 r9392  
    133133        || currentValue != targetCast.currentValue) { return false; }
    134134
    135       if (possibleFeatures.Except(targetCast.possibleFeatures).Count() != 0
    136         || targetCast.possibleFeatures.Except(possibleFeatures).Count() != 0) { return false; }
     135      var thisEnumerator = possibleFeatures.GetEnumerator();
     136      var castEnumerator = targetCast.possibleFeatures.GetEnumerator();
     137      while (thisEnumerator.MoveNext() && castEnumerator.MoveNext()) {
     138        if (thisEnumerator.Current != castEnumerator.Current)
     139          return false;
     140      }
    137141
    138       return true;
     142      return !thisEnumerator.MoveNext() && !castEnumerator.MoveNext();
    139143    }
    140144
  • branches/LearningClassifierSystems/HeuristicLab.Encodings.VariableVector/3.3/Variable/StringVariable.cs

    r9242 r9392  
    8787      featureMapping = new Dictionary<int, string>();
    8888      var distinctValuesEnumerator = variableValues.Distinct().GetEnumerator();
    89       possibleFeatures = Enumerable.Range(0, featureMapping.Count());
     89      possibleFeatures = Enumerable.Range(0, variableValues.Count());
    9090      var possibleFeaturesEnumerator = possibleFeatures.GetEnumerator();
    9191      while (possibleFeaturesEnumerator.MoveNext() && distinctValuesEnumerator.MoveNext()) {
     
    178178        || currentValue != targetCast.currentValue) { return false; }
    179179
    180       if (featureMapping.Keys.Except(targetCast.featureMapping.Keys).Count() != 0
    181         || targetCast.featureMapping.Keys.Except(featureMapping.Keys).Count() != 0) { return false; }
    182 
    183       foreach (var keyValuePair in targetCast.featureMapping) {
    184         if (!featureMapping[keyValuePair.Key].Equals(keyValuePair.Value)) { return false; }
    185       }
    186 
    187       return true;
     180      var thisEnumerator = featureMapping.GetEnumerator();
     181      var castEnumerator = targetCast.featureMapping.GetEnumerator();
     182      while (thisEnumerator.MoveNext() && castEnumerator.MoveNext()) {
     183        if (thisEnumerator.Current.Key != castEnumerator.Current.Key ||
     184          thisEnumerator.Current.Value != castEnumerator.Current.Value)
     185          return false;
     186      }
     187
     188      return !thisEnumerator.MoveNext() && !castEnumerator.MoveNext();
    188189    }
    189190
  • branches/LearningClassifierSystems/HeuristicLab.Encodings.VariableVector/3.3/VariableVectorActionComparer.cs

    r9242 r9392  
    2121
    2222using System.Collections.Generic;
    23 using System.Linq;
    2423using HeuristicLab.Common;
    2524using HeuristicLab.Core;
     
    4342
    4443    public bool Equals(VariableVectorAction x, VariableVectorAction y) {
    45       if (!x.Order.SequenceEqual(y.Order)) return false;
    46       foreach (var key in x.VariableDictionary.Keys) {
    47         if (!x.VariableDictionary[key].Identical(y.VariableDictionary[key])) {
    48           return false;
     44      //if (!x.Order.SequenceEqual(y.Order)) return false;
     45      var xEnumerator = x.VariableDictionary.Keys.GetEnumerator();
     46      var yEnumerator = y.VariableDictionary.Keys.GetEnumerator();
     47      while (xEnumerator.MoveNext() && yEnumerator.MoveNext())
     48        foreach (var key in x.VariableDictionary.Keys) {
     49          if (xEnumerator.Current != yEnumerator.Current ||
     50            !x.VariableDictionary[xEnumerator.Current].Identical(y.VariableDictionary[yEnumerator.Current])) {
     51            return false;
     52          }
    4953        }
    50       }
    51       return true;
     54      return !xEnumerator.MoveNext() && !yEnumerator.MoveNext();
    5255    }
    5356
  • branches/LearningClassifierSystems/HeuristicLab.Encodings.VariableVector/3.3/VariableVectorCondition.cs

    r9242 r9392  
    3939      protected set { variableDictionary = value; }
    4040    }
    41 
    42     public IOrderedEnumerable<string> Order { get { return VariableDictionary.Keys.OrderBy(x => x); } }
    4341
    4442    public int VirtualLength { get { return VariableDictionary.Values.Sum(x => x.VirtualLength); } }
     
    110108
    111109    public bool Identical(VariableVectorCondition target) {
    112       if (!this.Order.SequenceEqual(target.Order)) { return false; }
    113       foreach (var keyValuePair in target.VariableDictionary) {
    114         if (!VariableDictionary[keyValuePair.Key].Identical(keyValuePair.Value)) {
     110      var thisEnumerator = VariableDictionary.GetEnumerator();
     111      var targetEnumerator = target.VariableDictionary.GetEnumerator();
     112
     113      while (thisEnumerator.MoveNext() && targetEnumerator.MoveNext()) {
     114        if (thisEnumerator.Current.Key != targetEnumerator.Current.Key ||
     115          !thisEnumerator.Current.Value.Identical(targetEnumerator.Current.Value)) {
    115116          return false;
    116117        }
    117118      }
    118       return true;
     119
     120      return !thisEnumerator.MoveNext() && !targetEnumerator.MoveNext();
    119121    }
    120122  }
Note: See TracChangeset for help on using the changeset viewer.