Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/08/13 14:12:00 (12 years ago)
Author:
sforsten
Message:

#1980:

  • added ProportionalTournamentSelector for XCS
  • fixed bug: if an initial population is created in XCS, the initial population also creates general classifier, not only specific ones
  • merged r9204:9466 HeuristicLab.Core from trunk to branch
Location:
branches/LearningClassifierSystems
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • branches/LearningClassifierSystems

  • branches/LearningClassifierSystems/HeuristicLab.Encodings.VariableVector/3.3/Creators/UniformRandomVariableVectorCreator.cs

    r9226 r9467  
    2222using HeuristicLab.Common;
    2323using HeuristicLab.Core;
     24using HeuristicLab.Data;
     25using HeuristicLab.Parameters;
    2426using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2527
     
    3032
    3133    #region Parameter Properties
     34    public ILookupParameter<PercentValue> ChangeSymbolProbabilityParameter {
     35      get { return (ILookupParameter<PercentValue>)Parameters["ChangeSymbolProbability"]; }
     36    }
    3237    #endregion
    3338
     
    3944    public UniformRandomVariableVectorCreator()
    4045      : base() {
     46        Parameters.Add(new LookupParameter<PercentValue>("ChangeSymbolProbability"));
    4147    }
    4248    public override IDeepCloneable Clone(Cloner cloner) {
     
    4652    protected override VariableVector Create(IRandom random, VariableVector sampleVariableVector, double spreadPercentage) {
    4753      var result = sampleVariableVector.GetEmptyCopy();
    48       result.Randomize(random, spreadPercentage);
     54      result.Randomize(random, ChangeSymbolProbabilityParameter.ActualValue.Value, spreadPercentage);
    4955      return result;
    5056    }
  • branches/LearningClassifierSystems/HeuristicLab.Encodings.VariableVector/3.3/Variable/DoubleVariable.cs

    r9392 r9467  
    112112    }
    113113
    114     // Important! If this mehtod is called instead of the more concrete "Randomize(IRandom random, double spreadPercentage)"
    115     // spread percentage is 50%
    116     public override void Randomize(IRandom random) {
    117       Randomize(random, 50);
     114    // this method is not implemented on purpose, because it may lead to confusion or errors if the wrong parameter would be used (changeSymbolProbability instead of spreadPercentage)
     115    public override void Randomize(IRandom random, double changeSymbolProbability) {
     116      throw new NotImplementedException("The method DoubleVariable.Randomize(IRandom, double) should not be used. Use DoubleVariable.Randomize(IRandom, double, double) instead.");
    118117    }
    119118
    120     public void Randomize(IRandom random, double spreadPercentage) {
     119    // changeSymbolProbability is not used on purpose
     120    public void Randomize(IRandom random, double changeSymbolProbability, double spreadPercentage) {
    121121      if (spreadPercentage < 0 || spreadPercentage > 100) {
    122122        throw new ArgumentException("Spread percentage has to be between 0 and 100.");
  • branches/LearningClassifierSystems/HeuristicLab.Encodings.VariableVector/3.3/Variable/IActionVariable.cs

    r9226 r9467  
    2121
    2222using System.Collections.Generic;
     23using HeuristicLab.Core;
    2324
    2425namespace HeuristicLab.Encodings.VariableVector {
     
    3031    void SetTo(string value);
    3132    IEnumerable<string> GetAllPossibleActions();
     33
     34    void RandomizeAction(IRandom random);
    3235  }
    3336}
  • branches/LearningClassifierSystems/HeuristicLab.Encodings.VariableVector/3.3/Variable/IVariable.cs

    r9242 r9467  
    3333    IVariable GetSetCopy();
    3434
    35     void Randomize(IRandom random);
     35    void Randomize(IRandom random, double changeSymbolProbability);
    3636    bool MatchInput(string target);
    3737    bool MatchVariable(IVariable target);
  • branches/LearningClassifierSystems/HeuristicLab.Encodings.VariableVector/3.3/Variable/IntVariable.cs

    r9392 r9467  
    122122    }
    123123
    124     public override void Randomize(IRandom random) {
     124    public void RandomizeAction(IRandom random) {
     125      int index = random.Next(possibleFeatures.Count());
     126      currentValue = possibleFeatures.ElementAt(index);
     127    }
     128
     129    public override void Randomize(IRandom random, double changeSymbolProbability) {
     130      Wildcard = random.NextDouble() < changeSymbolProbability;
    125131      int index = random.Next(possibleFeatures.Count());
    126132      currentValue = possibleFeatures.ElementAt(index);
  • branches/LearningClassifierSystems/HeuristicLab.Encodings.VariableVector/3.3/Variable/StringVariable.cs

    r9392 r9467  
    167167    }
    168168
    169     public override void Randomize(IRandom random) {
     169    public void RandomizeAction(IRandom random) {
     170      int index = random.Next(possibleFeatures.Count());
     171      currentValue = possibleFeatures.ElementAt(index);
     172    }
     173
     174    public override void Randomize(IRandom random, double changeSymbolProbability) {
     175      Wildcard = random.NextDouble() < changeSymbolProbability;
    170176      int index = random.Next(possibleFeatures.Count());
    171177      currentValue = possibleFeatures.ElementAt(index);
  • branches/LearningClassifierSystems/HeuristicLab.Encodings.VariableVector/3.3/Variable/Variable.cs

    r9242 r9467  
    5555    public abstract IVariable GetSetCopy();
    5656
    57     public abstract void Randomize(IRandom random);
     57    public abstract void Randomize(IRandom random, double changeSymbolProbability);
    5858
    5959    public virtual bool MatchVariable(IVariable target) { throw new NotSupportedException("This method is not supported by this kind of Variable."); }
  • branches/LearningClassifierSystems/HeuristicLab.Encodings.VariableVector/3.3/VariableVector.cs

    r9242 r9467  
    8686    }
    8787
    88     public void Randomize(IRandom random, double spreadPercentage) {
    89       condition.Randomize(random, spreadPercentage);
     88    public void Randomize(IRandom random, double changeSymbolProbability, double spreadPercentage) {
     89      condition.Randomize(random, changeSymbolProbability, spreadPercentage);
    9090      action.Randomize(random);
    9191    }
  • branches/LearningClassifierSystems/HeuristicLab.Encodings.VariableVector/3.3/VariableVectorAction.cs

    r9411 r9467  
    113113    public void Randomize(IRandom random) {
    114114      foreach (var variable in VariableDictionary.Values) {
    115         variable.Randomize(random);
     115        variable.RandomizeAction(random);
    116116      }
    117117    }
  • branches/LearningClassifierSystems/HeuristicLab.Encodings.VariableVector/3.3/VariableVectorCondition.cs

    r9392 r9467  
    9797    }
    9898
    99     public void Randomize(IRandom random, double spreadPercentage) {
     99    public void Randomize(IRandom random, double changeSymbolProbability, double spreadPercentage) {
    100100      foreach (var variable in VariableDictionary.Values) {
    101101        if (variable is DoubleVariable) {
    102           ((DoubleVariable)variable).Randomize(random, spreadPercentage);
     102          ((DoubleVariable)variable).Randomize(random, changeSymbolProbability, spreadPercentage);
    103103        } else {
    104           variable.Randomize(random);
     104          variable.Randomize(random, changeSymbolProbability);
    105105        }
    106106      }
Note: See TracChangeset for help on using the changeset viewer.