Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/10/13 15:15:13 (12 years ago)
Author:
sforsten
Message:

#1980:

  • added DecisionListView
  • added event handlers in *ProblemData
  • renamed project Problems.XCS.Views to Problems.lCS.Views and Problems.Instances.ConditionActionClassification to Problems.Instances.LCS
  • integrated niching in GAssist and added NichingTournamentSelector
  • minor code improvements and property changes
Location:
branches/LearningClassifierSystems/HeuristicLab.Optimization.Operators.LCS/3.3
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/LearningClassifierSystems/HeuristicLab.Optimization.Operators.LCS/3.3

    • Property svn:ignore set to
      obj
      Plugin.cs
  • branches/LearningClassifierSystems/HeuristicLab.Optimization.Operators.LCS/3.3/DefaultRule/AutoDefaultRule.cs

    r9342 r9352  
    4444      get { return (ILookupParameter<ItemArray<DoubleValue>>)Parameters["Quality"]; }
    4545    }
    46     public ILookupParameter<ItemArray<IGAssistIndividual>> IndividualParameter {
    47       get { return (ILookupParameter<ItemArray<IGAssistIndividual>>)Parameters["Individual"]; }
    48     }
    4946    public IValueLookupParameter<IntValue> AccuraciesCountParameter {
    5047      get { return (IValueLookupParameter<IntValue>)Parameters["AccuraciesCount"]; }
     
    7067      Parameters.Add(new ValueLookupParameter<ItemDictionary<IGAssistNiche, ItemList<DoubleValue>>>("AverageAccuracies"));
    7168      Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Quality"));
    72       Parameters.Add(new ScopeTreeLookupParameter<IGAssistIndividual>("Individual"));
    7369      Parameters.Add(new LookupParameter<IRandom>("Random"));
    74       Parameters.Add(new ValueLookupParameter<IntValue>("AccuraciesCount"));
     70      Parameters.Add(new ValueLookupParameter<IntValue>("AccuraciesCount", new IntValue(15)));
    7571      Parameters.Add(new ValueLookupParameter<IGAssistNicheEqualityComparer>("NicheComparer"));
    76       Parameters.Add(new ValueLookupParameter<DoubleValue>("NicheStandardDeviation"));
     72      Parameters.Add(new ValueLookupParameter<DoubleValue>("NicheStandardDeviation", new DoubleValue(0.005)));
    7773    }
    7874    public override IDeepCloneable Clone(Cloner cloner) {
     
    8278    public override IOperation Apply() {
    8379      if (NichingParameter.ActualValue == null) {
     80        IList<IGAssistNiche> niches = GAssistNichesProblemDataParameter.ActualValue.GetPossibleNiches().ToList();
    8481        NichingParameter.ActualValue = new BoolValue(true);
    85         NichesParameter.ActualValue = new IntValue(PossibleDefaultClassesParameter.ActualValue.Count);
    86         AverageAccuraciesParameter.ActualValue = new ItemDictionary<IGAssistNiche, ItemList<DoubleValue>>(NicheComparerParameter.ActualValue);
    87         foreach (var niche in PossibleDefaultClassesParameter.ActualValue) {
     82        NichesParameter.ActualValue = new IntValue(niches.Count);
     83        AverageAccuraciesParameter.ActualValue = new ItemDictionary<IGAssistNiche, ItemList<DoubleValue>>(NicheComparerParameter.ActualValue as IEqualityComparer<IGAssistNiche>);
     84        foreach (var niche in GAssistNichesProblemDataParameter.ActualValue.GetPossibleNiches()) {
    8885          AverageAccuracies.Add(niche, new ItemList<DoubleValue>(AccuraciesCount));
    8986        }
     87
     88        int i = 0;
     89        foreach (var individual in IndividualParameter.ActualValue) {
     90          individual.SetNiche(RandomParameter.ActualValue, niches[i]);
     91          i++;
     92          i %= niches.Count;
     93        }
     94
     95        OperationCollection next = new OperationCollection();
     96        next.Add(EvaluateSubScopes());
     97        next.Add(base.Apply());
     98        return next;
    9099      } else {
    91100        var nicheFitness = new Dictionary<IGAssistNiche, double>(NicheComparerParameter.ActualValue);
    92         foreach (var niche in PossibleDefaultClassesParameter.ActualValue) {
     101        foreach (var niche in GAssistNichesProblemDataParameter.ActualValue.GetPossibleNiches()) {
    93102          nicheFitness[niche] = 0.0;
    94103          while (AverageAccuracies[niche].Count >= AccuraciesCount) {
     
    105114        }
    106115
    107         foreach (var niche in PossibleDefaultClassesParameter.ActualValue) {
     116        foreach (var niche in GAssistNichesProblemDataParameter.ActualValue.GetPossibleNiches()) {
    108117          AverageAccuracies[niche].Insert(0, new DoubleValue(nicheFitness[niche]));
    109118        }
    110119
    111         var averages = new List<double>(PossibleDefaultClassesParameter.ActualValue.Count);
     120        var averages = new List<double>(GAssistNichesProblemDataParameter.ActualValue.GetPossibleNiches().Count());
    112121        if (AverageAccuracies.Values.First().Count >= AccuraciesCount) {
    113122          foreach (var averageAccuracy in AverageAccuracies.Values) {
  • branches/LearningClassifierSystems/HeuristicLab.Optimization.Operators.LCS/3.3/DefaultRule/DefaultRuleOperator.cs

    r9342 r9352  
    4242      get { return (IValueLookupParameter<IGAssistNiche>)Parameters["DefaultClass"]; }
    4343    }
    44     public ILookupParameter<ItemCollection<IGAssistNiche>> PossibleDefaultClassesParameter {
    45       get { return (ILookupParameter<ItemCollection<IGAssistNiche>>)Parameters["PossibleDefaultClasses"]; }
     44    public ILookupParameter<IGAssistNichesProblemData> GAssistNichesProblemDataParameter {
     45      get { return (ILookupParameter<IGAssistNichesProblemData>)Parameters["GAssistNichesProblemData"]; }
     46    }
     47    public ILookupParameter<ItemArray<IGAssistIndividual>> IndividualParameter {
     48      get { return (ILookupParameter<ItemArray<IGAssistIndividual>>)Parameters["Individual"]; }
     49    }
     50    public IValueLookupParameter<IOperator> EvaluatorParameter {
     51      get { return (IValueLookupParameter<IOperator>)Parameters["Evaluator"]; }
    4652    }
    4753    #endregion
     
    5763      Parameters.Add(new ValueLookupParameter<IntValue>("Niches"));
    5864      Parameters.Add(new ValueLookupParameter<IGAssistNiche>("DefaultClass"));
    59       Parameters.Add(new LookupParameter<ItemCollection<IGAssistNiche>>("PossibleDefaultClasses"));
     65      Parameters.Add(new LookupParameter<IGAssistNichesProblemData>("GAssistNichesProblemData"));
     66      Parameters.Add(new ScopeTreeLookupParameter<IGAssistIndividual>("Individual"));
     67      Parameters.Add(new ValueLookupParameter<IOperator>("Evaluator"));
     68    }
     69
     70    protected OperationCollection EvaluateSubScopes() {
     71      IOperator evaluator = EvaluatorParameter.ActualValue;
     72      OperationCollection evaluation = new OperationCollection();
     73      if (evaluator != null) {
     74        foreach (var subScope in ExecutionContext.Scope.SubScopes) {
     75          evaluation.Add(ExecutionContext.CreateOperation(evaluator, subScope));
     76        }
     77      }
     78      return evaluation;
    6079    }
    6180  }
  • branches/LearningClassifierSystems/HeuristicLab.Optimization.Operators.LCS/3.3/DefaultRule/IDefaultRuleOperator.cs

    r9342 r9352  
    2626  public interface IDefaultRuleOperator : IOperator {
    2727    IValueLookupParameter<BoolValue> NichingParameter { get; }
    28     ILookupParameter<IntValue> NichesParameter { get; }
    29     IValueLookupParameter<Item> DefaultClassParameter { get; }
    30     ILookupParameter<ItemCollection<IGAssistNiche>> PossibleDefaultClassesParameter { get; }
     28    IValueLookupParameter<IntValue> NichesParameter { get; }
     29    IValueLookupParameter<IGAssistNiche> DefaultClassParameter { get; }
     30    ILookupParameter<IGAssistNichesProblemData> GAssistNichesProblemDataParameter { get; }
     31    ILookupParameter<ItemArray<IGAssistIndividual>> IndividualParameter { get; }
     32    IValueLookupParameter<IOperator> EvaluatorParameter { get; }
    3133  }
    3234}
  • branches/LearningClassifierSystems/HeuristicLab.Optimization.Operators.LCS/3.3/DefaultRule/MajorDefaultRule.cs

    r9342 r9352  
    7777          index = indices[0];
    7878        }
    79         DefaultClassParameter.ActualValue = PossibleDefaultClassesParameter.ActualValue.ElementAt(index);
     79        IGAssistNiche niche = GAssistNichesProblemDataParameter.ActualValue.GetPossibleNiches().ElementAt(index);
     80        DefaultClassParameter.ActualValue = niche;
     81
     82        foreach (var individual in IndividualParameter.ActualValue) {
     83          individual.SetNiche(RandomParameter.ActualValue, niche);
     84        }
     85
     86        OperationCollection next = new OperationCollection();
     87        next.Add(EvaluateSubScopes());
     88        next.Add(base.Apply());
     89        return next;
    8090      }
    8191      return base.Apply();
  • branches/LearningClassifierSystems/HeuristicLab.Optimization.Operators.LCS/3.3/DefaultRule/MinorDefaultRule.cs

    r9342 r9352  
    7777          index = indices[0];
    7878        }
    79         DefaultClassParameter.ActualValue = PossibleDefaultClassesParameter.ActualValue.ElementAt(index);
     79        IGAssistNiche niche = GAssistNichesProblemDataParameter.ActualValue.GetPossibleNiches().ElementAt(index);
     80        DefaultClassParameter.ActualValue = niche;
     81
     82        foreach (var individual in IndividualParameter.ActualValue) {
     83          individual.SetNiche(RandomParameter.ActualValue, niche);
     84        }
     85
     86        OperationCollection next = new OperationCollection();
     87        next.Add(EvaluateSubScopes());
     88        next.Add(base.Apply());
     89        return next;
    8090      }
    8191      return base.Apply();
Note: See TracChangeset for help on using the changeset viewer.