Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/23/13 13:31:29 (12 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/Variable
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • 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
Note: See TracChangeset for help on using the changeset viewer.