Changeset 9105


Ignore:
Timestamp:
01/03/13 20:19:00 (5 years ago)
Author:
sforsten
Message:

#1980:

  • included an adapted version of GA correctly
  • added action set subsumption
  • added deletion after GA and before covering
Location:
branches/LearningClassifierSystems
Files:
11 added
12 edited

Legend:

Unmodified
Added
Removed
  • branches/LearningClassifierSystems/HeuristicLab.Algorithms.LearningClassifierSystems/3.3/LCSAdaptedGeneticAlgorithm.cs

    r9089 r9105  
    5252      get { return (ValueLookupParameter<IOperator>)Parameters["Crossover"]; }
    5353    }
     54    public ValueLookupParameter<IOperator> AfterCrossoverParameter {
     55      get { return (ValueLookupParameter<IOperator>)Parameters["AfterCrossover"]; }
     56    }
    5457    public ValueLookupParameter<PercentValue> MutationProbabilityParameter {
    5558      get { return (ValueLookupParameter<PercentValue>)Parameters["MutationProbability"]; }
     
    102105      Parameters.Add(new ValueLookupParameter<IOperator>("Selector", "The operator used to select solutions for reproduction."));
    103106      Parameters.Add(new ValueLookupParameter<IOperator>("Crossover", "The operator used to cross solutions."));
     107      Parameters.Add(new ValueLookupParameter<IOperator>("AfterCrossover", "The operator executed after crossing the solutions."));
    104108      Parameters.Add(new ValueLookupParameter<PercentValue>("MutationProbability", "The probability that the mutation operator is applied on a solution."));
    105109      Parameters.Add(new ValueLookupParameter<IOperator>("Mutator", "The operator used to mutate solutions."));
     
    121125      UniformSubScopesProcessor uniformSubScopesProcessor1 = new UniformSubScopesProcessor();
    122126      Placeholder crossover = new Placeholder();
    123       DataReducer dataReducer = new DataReducer();
     127      Placeholder afterCrossover = new Placeholder();
    124128      StochasticBranch stochasticBranch = new StochasticBranch();
    125129      Placeholder mutator = new Placeholder();
    126130      SubScopesRemover subScopesRemover = new SubScopesRemover();
    127131      SubScopesCounter subScopesCounter = new SubScopesCounter();
    128       SubScopesProcessor subScopesProcessor2 = new SubScopesProcessor();
    129       BestSelector bestSelector = new BestSelector();
    130       RightReducer rightReducer = new RightReducer();
    131132      MergingReducer mergingReducer = new MergingReducer();
    132133      IntCounter intCounter = new IntCounter();
     
    151152      crossover.OperatorParameter.ActualName = "Crossover";
    152153
    153       dataReducer.Name = "Average Fitness of Parents";
    154       dataReducer.ParameterToReduce.ActualName = "Fitness";
    155       dataReducer.ReductionOperation.Value = new ReductionOperation(ReductionOperations.Avg);
    156       dataReducer.TargetParameter.ActualName = "Fitness";
    157       dataReducer.TargetOperation.Value = new ReductionOperation(ReductionOperations.Assign);
     154      afterCrossover.Name = "AfterCrossover";
     155      afterCrossover.OperatorParameter.ActualName = "AfterCrossover";
    158156
    159157      stochasticBranch.ProbabilityParameter.ActualName = "MutationProbability";
     
    167165      subScopesCounter.Name = "Increment EvaluatedSolutions";
    168166      subScopesCounter.ValueParameter.ActualName = EvaluatedSolutionsParameter.Name;
    169 
    170       bestSelector.CopySelected = new BoolValue(false);
    171       bestSelector.MaximizationParameter.ActualName = "Maximization";
    172       bestSelector.NumberOfSelectedSubScopesParameter.ActualName = "N";
    173       bestSelector.QualityParameter.ActualName = "Fitness";
    174167
    175168      intCounter.Increment = new IntValue(1);
     
    195188      subScopesProcessor1.Operators.Add(new EmptyOperator());
    196189      subScopesProcessor1.Operators.Add(childrenCreator);
    197       subScopesProcessor1.Successor = subScopesProcessor2;
     190      subScopesProcessor1.Successor = mergingReducer;
    198191      childrenCreator.Successor = uniformSubScopesProcessor1;
    199192      uniformSubScopesProcessor1.Operator = crossover;
    200193      uniformSubScopesProcessor1.Successor = subScopesCounter;
    201       crossover.Successor = dataReducer;
    202       dataReducer.Successor = stochasticBranch;
     194      crossover.Successor = afterCrossover;
     195      afterCrossover.Successor = stochasticBranch;
    203196      stochasticBranch.FirstBranch = mutator;
    204197      stochasticBranch.SecondBranch = null;
     
    207200      subScopesRemover.Successor = null;
    208201      subScopesCounter.Successor = null;
    209       subScopesProcessor2.Operators.Add(bestSelector);
    210       subScopesProcessor2.Operators.Add(new EmptyOperator());
    211       subScopesProcessor2.Successor = mergingReducer;
    212       bestSelector.Successor = rightReducer;
    213       rightReducer.Successor = null;
    214202      mergingReducer.Successor = intCounter;
    215203      intCounter.Successor = comparator;
  • branches/LearningClassifierSystems/HeuristicLab.Algorithms.LearningClassifierSystems/3.3/LearningClassifierSystemMainLoop.cs

    r9090 r9105  
    5050      get { return (IConstrainedValueParameter<IManipulator>)Parameters["Mutator"]; }
    5151    }
     52    public IConstrainedValueParameter<IOperator> AfterCrossoverParameter {
     53      get { return (IConstrainedValueParameter<IOperator>)Parameters["AfterCrossover"]; }
     54    }
    5255    #endregion
    5356
     
    5760    private PredictionArrayCalculator predictionArrayCalculator;
    5861    private ActionSelector actionSelector;
     62    private DoDeletionBeforeCoveringOperator doDeletionBeforeCovering;
    5963    private CoveringOperator covering;
     64    private ConditionalSelector subsumptionSelector;
    6065
    6166    private Placeholder evaluator;
    6267    private Placeholder actionExecuter;
    6368    private Placeholder classifierFetcher;
     69    private Placeholder actionSetSubsumption;
    6470    #endregion
    6571
     
    8591      test.IntegerVectorParameter.ActualName = "CombinedIntegerVector";
    8692      Parameters.Add(new OptionalConstrainedValueParameter<IManipulator>("Mutator", "The operator used to mutate solutions.", new ItemSet<IManipulator>() { new UniformOnePositionManipulator() }, test));
     93      XCSAfterCrossoverOperator afterCrossover = new XCSAfterCrossoverOperator();
     94      Parameters.Add(new ConstrainedValueParameter<IOperator>("AfterCrossover", "The operator used to select solutions for reproduction.", new ItemSet<IOperator>() { new XCSAfterCrossoverOperator() }, afterCrossover));
    8795      #endregion
    8896
     
    9199      ConditionalBranch initialPopulationConditionalBranch = new ConditionalBranch();
    92100      initialSolutionsCreator = new SolutionsCreator();
     101      Assigner initialPopulationSizeAssigner = new Assigner();
    93102      IntCounter iterationCounter = new IntCounter();
    94103      UniformSubScopesProcessor matchCondtionSubScopesProcessor = new UniformSubScopesProcessor();
     
    102111      SubScopesProcessor matchSetSubScopesProcessor = new SubScopesProcessor();
    103112      CountNumberOfUniqueActions countNumberOfUniqueActions = new CountNumberOfUniqueActions();
     113      doDeletionBeforeCovering = new DoDeletionBeforeCoveringOperator();
     114      ConditionalBranch doDeletionBeforeCoveringConditionalBranch = new ConditionalBranch();
     115      MergingReducer matchSetMergingReducerForDeletion = new MergingReducer();
     116      SubScopeVariableCopier subscopeVariableCopier = new SubScopeVariableCopier();
     117      XCSDeletionOperator deletionOperator = new XCSDeletionOperator();
     118      ConditionalSelector deletionSelector = new ConditionalSelector();
     119      LeftReducer leftReducerAfterDeletionSelection = new LeftReducer();
     120      UniformSubScopesProcessor matchConditionAfterDeletionSubScopesProcessor = new UniformSubScopesProcessor();
     121      ConditionalSelector conditionMatchSelectorAfterDeletion = new ConditionalSelector();
     122      SubScopesProcessor matchSetAfterDeletionSubScopesProcessor = new SubScopesProcessor();
     123      CountNumberOfUniqueActions countNumberOfUniqueActionsAfterDeletion = new CountNumberOfUniqueActions();
     124      SubScopesProcessor coveringAfterDeletionSubScopesProcessor = new SubScopesProcessor();
    104125      covering = new CoveringOperator();
    105       MergingReducer mergingReducer = new MergingReducer();
    106       MergingReducer mergingReducerWithSuccessor = new MergingReducer();
     126      MergingReducer actionSetMergingReducer = new MergingReducer();
     127      MergingReducer matchSetMergingReducer = new MergingReducer();
    107128      evaluator = new Placeholder();
    108129      SubScopesProcessor actionSetSubScopesProcessor = new SubScopesProcessor();
     
    112133      SumAccuracy sumAccuracy = new SumAccuracy();
    113134      UniformSubScopesProcessor updateParametersSubScopesProcessor = new UniformSubScopesProcessor();
     135      ConditionalBranch actionSetSubsumptionBranch = new ConditionalBranch();
     136      subsumptionSelector = new ConditionalSelector();
     137      LeftReducer leftReducer = new LeftReducer();
     138      XCSCheckIfGAShouldBeApplied checkIfGAShouldRun = new XCSCheckIfGAShouldBeApplied();
     139      ConditionalBranch runGAConditionalBranch = new ConditionalBranch();
     140      UniformSubScopesProcessor timestampAssignerSubscopeProcessor = new UniformSubScopesProcessor();
     141      Assigner timestampAssigner = new Assigner();
    114142      LCSAdaptedGeneticAlgorithm adaptedGeneticAlgorithmMainLoop = new LCSAdaptedGeneticAlgorithm();
     143      IntCounter currentPopulationSizeCounter = new IntCounter();
     144      CalculateNumberOfDeletionsOperator calculateNumberOfDeletions = new CalculateNumberOfDeletionsOperator();
     145      XCSDeletionOperator deletionOperatorAfterGA = new XCSDeletionOperator();
     146      ConditionalSelector deletionSelectorAfterGA = new ConditionalSelector();
     147      LeftReducer leftReducerAfterGA = new LeftReducer();
    115148
    116149      classifierFetcher = new Placeholder();
    117150      actionExecuter = new Placeholder();
     151      actionSetSubsumption = new Placeholder();
    118152
    119153      variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("ZeroIntValue", new IntValue(0)));
    120154      variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("OneIntValue", new IntValue(1)));
    121155      variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Iteration", new IntValue(0)));
     156      variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("CurrentPopulationSize", new IntValue(0)));
    122157
    123158      initialPopulationConditionalBranch.ConditionParameter.ActualName = "CreateInitialPopulation";
    124159
    125160      initialSolutionsCreator.NumberOfSolutionsParameter.ActualName = "N";
     161
     162      initialPopulationSizeAssigner.LeftSideParameter.ActualName = "CurrentPopulationSize";
     163      initialPopulationSizeAssigner.RightSideParameter.ActualName = "N";
    126164
    127165      iterationCounter.ValueParameter.ActualName = "Iteration";
    128166      iterationCounter.IncrementParameter.ActualName = "OneIntValue";
    129167
    130       matchCondtionSubScopesProcessor.Operator = matchConditionOperator;
    131 
    132168      matchConditionOperator.MatchParameter.ActualName = "CombinedIntegerVector";
    133169
     
    135171      conditionMatchSelector.ConditionParameter.ActualName = "MatchCondition";
    136172
     173      conditionMatchSelectorAfterDeletion.CopySelected = new BoolValue(false);
     174      conditionMatchSelectorAfterDeletion.ConditionParameter.ActualName = "MatchCondition";
     175
    137176      countNumberOfUniqueActions.ClassifiersParameter.ActualName = "CombinedIntegerVector";
     177
     178      countNumberOfUniqueActionsAfterDeletion.ClassifiersParameter.ActualName = "CombinedIntegerVector";
     179
     180      subscopeVariableCopier.SubScopeIndexParameter.Value = new IntValue(1);
     181
     182      doDeletionBeforeCovering.CurrentPopulationSizeParameter.ActualName = "CurrentPopulationSize";
     183      doDeletionBeforeCovering.NumberOfUniqueActionsParameter.ActualName = countNumberOfUniqueActions.NumberOfUniqueActionsParameter.ActualName;
     184      doDeletionBeforeCovering.PopulationSizeParameter.ActualName = "N";
     185
     186      doDeletionBeforeCoveringConditionalBranch.ConditionParameter.ActualName = doDeletionBeforeCovering.DoDeletionParameter.ActualName;
     187
     188      deletionOperator.NumberToDeleteParameter.ActualName = doDeletionBeforeCovering.NumberToDeleteParameter.ActualName;
     189      deletionOperator.AverageActionSetSizesParameter.ActualName = "AverageActionSetSize";
     190      deletionOperator.FitnessesParameter.ActualName = "Fitness";
     191      deletionOperator.NumerositiesParameter.ActualName = "Numerosity";
     192      deletionOperator.ExperiencesParameter.ActualName = "Experience";
     193      deletionOperator.ThetaDeletionParameter.ActualName = "ThetaDeletion";
     194      deletionOperator.DeltaParameter.ActualName = "Delta";
     195      deletionOperator.RandomParameter.ActualName = "Random";
     196
     197      deletionSelector.ConditionParameter.ActualName = deletionOperator.HasToBeDeletedVariableName;
     198      deletionSelector.CopySelected = new BoolValue(false);
    138199
    139200      covering.ActionsInMatchSetParameter.ActualName = countNumberOfUniqueActions.UniqueActionsParameter.ActualName;
    140201      covering.ParallelParameter.Value.Value = true;
    141202      covering.RandomParameter.ActualName = "Random";
     203      covering.CurrentPopulationSizeParameter.ActualName = "CurrentPopulationSize";
    142204
    143205      matchActionSubScopesProcessor.Operator = matchActionOperator;
     
    155217      actionMatchSelector.ConditionParameter.ActualName = "MatchAction";
    156218
     219      actionSetSubsumptionBranch.ConditionParameter.ActualName = "DoActionSetSubsumption";
     220
     221      subsumptionSelector.CopySelected = new BoolValue(false);
     222
    157223      SelectorParameter.Value.CopySelected = new BoolValue(true);
    158       SelectorParameter.Value.NumberOfSelectedSubScopesParameter.Value = new IntValue(200);
     224      SelectorParameter.Value.NumberOfSelectedSubScopesParameter.Value = new IntValue(4);
    159225
    160226      evaluator.Name = "Evaluator";
     
    176242      sumAccuracy.AccuracyParameter.ActualName = calculateAccuracy.AccuracyParameter.ActualName;
    177243      sumAccuracy.NumerosityParameter.ActualName = "Numerosity";
     244
     245      //BEGIN parameters have to be set differently
     246      checkIfGAShouldRun.TimeStampsParameter.ActualName = "Timestamp";
     247      checkIfGAShouldRun.NumerositiesParameter.ActualName = "Numerosity";
     248      checkIfGAShouldRun.ThetaGAParameter.ActualName = "ThetaGA";
     249      //END
     250      checkIfGAShouldRun.IterationParameter.ActualName = iterationCounter.ValueParameter.ActualName;
     251
     252      runGAConditionalBranch.ConditionParameter.ActualName = checkIfGAShouldRun.RunGAParameter.ActualName;
     253
     254      timestampAssigner.LeftSideParameter.ActualName = "Timestamp";
     255      timestampAssigner.RightSideParameter.ActualName = iterationCounter.ValueParameter.ActualName;
     256
     257      afterCrossover.NumerosityParameter.ActualName = "Numerosity";
     258      afterCrossover.ExperienceParameter.ActualName = "Experience";
     259      afterCrossover.TimestampParameter.ActualName = "Timestamp";
     260      afterCrossover.CurrentIterationParameter.ActualName = "Iteration";
     261      afterCrossover.FitnessParameter.ActualName = "Fitness";
     262      afterCrossover.AverageActionSetSizeParameter.ActualName = "AverageActionSetSize";
     263      afterCrossover.PredictionParameter.ActualName = "Prediction";
     264      afterCrossover.ErrorParameter.ActualName = "Error";
     265      afterCrossover.ParentFitnessParameter.ActualName = "Fitness";
     266      afterCrossover.ParentErrorParameter.ActualName = "Error";
     267      afterCrossover.ParentPredictionParameter.ActualName = "Prediction";
     268      afterCrossover.ParentAverageActionSetSizeParameter.ActualName = "AverageActionSetSize";
    178269
    179270      adaptedGeneticAlgorithmMainLoop.SelectorParameter.ActualName = SelectorParameter.Name;
     
    183274      adaptedGeneticAlgorithmMainLoop.MaximumGenerationsParameter.ActualName = "ZeroIntValue";
    184275      adaptedGeneticAlgorithmMainLoop.QualityParameter.ActualName = "Fitness";
    185       //needed?
    186276      adaptedGeneticAlgorithmMainLoop.MutationProbabilityParameter.Value = new PercentValue(10);
    187277      adaptedGeneticAlgorithmMainLoop.MaximizationParameter.Value = new BoolValue(true);
     278      adaptedGeneticAlgorithmMainLoop.AfterCrossoverParameter.ActualName = AfterCrossoverParameter.Name;
     279
     280      currentPopulationSizeCounter.ValueParameter.ActualName = "CurrentPopulationSize";
     281      currentPopulationSizeCounter.Increment = new IntValue(2);
     282
     283      calculateNumberOfDeletions.CurrentPopulationSizeParameter.ActualName = "CurrentPopulationSize";
     284      calculateNumberOfDeletions.PopulationSizeParameter.ActualName = "N";
     285
     286      deletionOperatorAfterGA.NumberToDeleteParameter.ActualName = calculateNumberOfDeletions.NumberOfDeletionsParameter.ActualName;
     287      deletionOperatorAfterGA.AverageActionSetSizesParameter.ActualName = "AverageActionSetSize";
     288      deletionOperatorAfterGA.FitnessesParameter.ActualName = "Fitness";
     289      deletionOperatorAfterGA.NumerositiesParameter.ActualName = "Numerosity";
     290      deletionOperatorAfterGA.ExperiencesParameter.ActualName = "Experience";
     291      deletionOperatorAfterGA.ThetaDeletionParameter.ActualName = "ThetaDeletion";
     292      deletionOperatorAfterGA.DeltaParameter.ActualName = "Delta";
     293      deletionOperatorAfterGA.RandomParameter.ActualName = "Random";
     294
     295      deletionSelectorAfterGA.ConditionParameter.ActualName = deletionOperatorAfterGA.HasToBeDeletedVariableName;
     296      deletionSelectorAfterGA.CopySelected = new BoolValue(false);
    188297      #endregion
    189298
     
    193302      variableCreator.Successor = initialPopulationConditionalBranch;
    194303      initialPopulationConditionalBranch.TrueBranch = initialSolutionsCreator;
     304      initialSolutionsCreator.Successor = initialPopulationSizeAssigner;
    195305      initialPopulationConditionalBranch.FalseBranch = new EmptyOperator();
    196306      initialPopulationConditionalBranch.Successor = classifierFetcher;
    197307      classifierFetcher.Successor = matchCondtionSubScopesProcessor;
     308      matchCondtionSubScopesProcessor.Operator = matchConditionOperator;
    198309      matchCondtionSubScopesProcessor.Successor = conditionMatchSelector;
    199       //variableCreator.Successor = adaptedGeneticAlgorithmMainLoop;
    200       //adaptedGeneticAlgorithmMainLoop.Successor = conditionMatchSelector;
    201 
    202310      conditionMatchSelector.Successor = matchSetSubScopesProcessor;
    203311      matchSetSubScopesProcessor.Operators.Add(new EmptyOperator());
    204312      matchSetSubScopesProcessor.Operators.Add(countNumberOfUniqueActions);
    205       matchSetSubScopesProcessor.Successor = mergingReducerWithSuccessor;
    206       countNumberOfUniqueActions.Successor = covering;
     313      matchSetSubScopesProcessor.Successor = subscopeVariableCopier;
     314      subscopeVariableCopier.Successor = doDeletionBeforeCovering;
     315      doDeletionBeforeCovering.Successor = doDeletionBeforeCoveringConditionalBranch;
     316      doDeletionBeforeCoveringConditionalBranch.TrueBranch = matchSetMergingReducerForDeletion;
     317      matchSetMergingReducerForDeletion.Successor = deletionOperator;
     318      deletionOperator.Successor = deletionSelector;
     319      deletionSelector.Successor = leftReducerAfterDeletionSelection;
     320      leftReducerAfterDeletionSelection.Successor = matchConditionAfterDeletionSubScopesProcessor;
     321      doDeletionBeforeCoveringConditionalBranch.FalseBranch = coveringAfterDeletionSubScopesProcessor;
     322      coveringAfterDeletionSubScopesProcessor.Operators.Add(new EmptyOperator());
     323      coveringAfterDeletionSubScopesProcessor.Operators.Add(covering);
     324      coveringAfterDeletionSubScopesProcessor.Successor = matchSetMergingReducer;
     325      matchConditionAfterDeletionSubScopesProcessor.Operator = matchConditionOperator;
     326      matchConditionAfterDeletionSubScopesProcessor.Successor = conditionMatchSelectorAfterDeletion;
     327      conditionMatchSelectorAfterDeletion.Successor = matchSetAfterDeletionSubScopesProcessor;
     328      matchSetAfterDeletionSubScopesProcessor.Operators.Add(new EmptyOperator());
     329      matchSetAfterDeletionSubScopesProcessor.Operators.Add(countNumberOfUniqueActionsAfterDeletion);
     330      matchSetAfterDeletionSubScopesProcessor.Successor = matchSetMergingReducer;
     331      countNumberOfUniqueActionsAfterDeletion.Successor = covering;
     332
    207333      covering.Successor = predictionArrayCalculator;
    208334      predictionArrayCalculator.Successor = actionSelector;
     
    218344      sumAccuracy.Successor = updateParametersSubScopesProcessor;
    219345      updateParametersSubScopesProcessor.Operator = evaluator;
    220 
    221       actionSetSubScopesProcessor.Successor = mergingReducer;
    222 
    223       mergingReducerWithSuccessor.Successor = iterationCounter;
     346      updateParametersSubScopesProcessor.Successor = actionSetSubsumptionBranch;
     347      actionSetSubsumptionBranch.TrueBranch = actionSetSubsumption;
     348      actionSetSubsumption.Successor = subsumptionSelector;
     349      subsumptionSelector.Successor = leftReducer;
     350      actionSetSubsumptionBranch.FalseBranch = new EmptyOperator();
     351      actionSetSubsumptionBranch.Successor = checkIfGAShouldRun;
     352      checkIfGAShouldRun.Successor = runGAConditionalBranch;
     353      runGAConditionalBranch.TrueBranch = timestampAssignerSubscopeProcessor;
     354      runGAConditionalBranch.FalseBranch = new EmptyOperator();
     355      timestampAssignerSubscopeProcessor.Operator = timestampAssigner;
     356      timestampAssignerSubscopeProcessor.Successor = adaptedGeneticAlgorithmMainLoop;
     357      adaptedGeneticAlgorithmMainLoop.Successor = currentPopulationSizeCounter;
     358
     359      actionSetSubScopesProcessor.Successor = actionSetMergingReducer;
     360
     361      matchSetMergingReducer.Successor = calculateNumberOfDeletions;
     362      calculateNumberOfDeletions.Successor = deletionOperatorAfterGA;
     363      deletionOperatorAfterGA.Successor = deletionSelectorAfterGA;
     364      deletionSelectorAfterGA.Successor = leftReducerAfterGA;
     365      leftReducerAfterGA.Successor = iterationCounter;
    224366      iterationCounter.Successor = classifierFetcher;
    225       //mergingReducer.Successor = adaptedGeneticAlgorithmMainLoop;
    226367      #endregion
    227368    }
     
    249390      actionExecuter.OperatorParameter.ActualName = problem.ActionExecuterParameter.Name;
    250391
     392      problem.ActionSetSubsumptionOperator.ThetaSubsumptionParameter.ActualName = "ThetaSubsumption";
     393      problem.ActionSetSubsumptionOperator.ErrorsParameter.ActualName = "Error";
     394      problem.ActionSetSubsumptionOperator.ErrorZeroParameter.ActualName = "ErrorZero";
     395      problem.ActionSetSubsumptionOperator.ExperiencesParameter.ActualName = "Experience";
     396      problem.ActionSetSubsumptionOperator.NumerositiesParameter.ActualName = "Numerosity";
     397
     398      subsumptionSelector.ConditionParameter.ActualName = problem.ActionSetSubsumptionOperator.HasBeenSubsumedParameterName;
     399
     400      actionSetSubsumption.OperatorParameter.ActualName = problem.ActionSetSubsumptionOperatorParameter.Name;
     401
    251402      matchConditionOperator.TargetMatchParameter.ActualName = problem.ClassifierFetcher.CurrentClassifierToMatchParameter.ActualName;
     403
     404      doDeletionBeforeCovering.MinimalNumberOfUniqueActionsParameter.ActualName = problem.ThetaMinimalNumberOfActionsParameter.Name;
    252405
    253406      covering.SolutionCreatorParameter.ActualName = problem.CoveringSolutionCreatorParameter.Name;
  • branches/LearningClassifierSystems/HeuristicLab.Encodings.CombinedIntegerVectorEncoding/3.3/CombinedIntegerVector.cs

    r9089 r9105  
    4848    public IntMatrix Bounds { get { return (IntMatrix)bounds.Clone(); } }
    4949
     50    public int ConditionLength { get { return Length - actionLength; } }
     51
    5052    [StorableConstructor]
    5153    protected CombinedIntegerVector(bool deserializing) : base(deserializing) { }
     
    184186    }
    185187
     188    public bool IsMoreGeneral(IClassifier target) {
     189      var targetVector = target as CombinedIntegerVector;
     190      int curbounds;
     191
     192      if (this.NumberOfGeneralSymbols() <= targetVector.NumberOfGeneralSymbols()) return false;
     193
     194      for (int i = 0; i < ConditionLength; i++) {
     195        curbounds = i % bounds.Rows;
     196        if (this[i] != bounds[curbounds, 1] - 1 && this[i] != targetVector[i]) {
     197          return false;
     198        }
     199      }
     200      return true;
     201    }
     202
     203    private int NumberOfGeneralSymbols() {
     204      int numberOfGeneralSymbols = 0;
     205      int curbounds;
     206
     207      for (int i = 0; i < ConditionLength; i++) {
     208        curbounds = i % bounds.Rows;
     209        numberOfGeneralSymbols += this[i] == bounds[curbounds, 1] - 1 ? 1 : 0;
     210      }
     211
     212      return numberOfGeneralSymbols;
     213    }
     214
    186215    public override string ToString() {
    187216      StringBuilder strBuilder = new StringBuilder(this.Length);
  • branches/LearningClassifierSystems/HeuristicLab.Encodings.CombinedIntegerVectorEncoding/3.3/HeuristicLab.Encodings.CombinedIntegerVectorEncoding-3.3.csproj

    r9090 r9105  
    9595    <Reference Include="System" />
    9696    <Reference Include="System.Core" />
     97    <Reference Include="System.Drawing" />
    9798    <Reference Include="System.Xml.Linq" />
    9899    <Reference Include="System.Data.DataSetExtensions" />
  • branches/LearningClassifierSystems/HeuristicLab.Encodings.ConditionActionEncoding/3.3

    • Property svn:ignore
      •  

        old new  
        11obj
        22Plugin.cs
         3*.user
  • branches/LearningClassifierSystems/HeuristicLab.Encodings.ConditionActionEncoding/3.3/Covering/CoveringOperator.cs

    r9090 r9105  
    5353      get { return (ILookupParameter<IRandom>)Parameters["Random"]; }
    5454    }
     55    public ILookupParameter<IntValue> CurrentPopulationSizeParameter {
     56      get { return (ILookupParameter<IntValue>)Parameters["CurrentPopulationSize"]; }
     57    }
    5558    public IValueLookupParameter<BoolValue> ParallelParameter {
    5659      get { return (IValueLookupParameter<BoolValue>)Parameters["Parallel"]; }
     
    8386      Parameters.Add(new ValueLookupParameter<BoolValue>("Parallel", "True if the operator should be applied in parallel on all sub-scopes, otherwise false.", new BoolValue(true)));
    8487      Parameters.Add(new ScopeParameter("CurrentScope", "The current scope to which the new solutions are added as sub-scopes."));
     88      Parameters.Add(new LookupParameter<IntValue>("CurrentPopulationSize"));
    8589    }
    8690
     
    97101        throw new ArgumentException("More classifiers with unique actions shall be created than unique actions are available.");
    98102      }
     103
     104      CurrentPopulationSizeParameter.ActualValue.Value += count;
    99105
    100106      int current = CurrentScope.SubScopes.Count;
  • branches/LearningClassifierSystems/HeuristicLab.Encodings.ConditionActionEncoding/3.3/Covering/ICovering.cs

    r9090 r9105  
    3333    IValueLookupParameter<ICoveringSolutionCreator> SolutionCreatorParameter { get; }
    3434    IValueLookupParameter<BoolValue> ParallelParameter { get; }
     35
     36    ILookupParameter<IntValue> CurrentPopulationSizeParameter { get; }
    3537  }
    3638}
  • branches/LearningClassifierSystems/HeuristicLab.Encodings.ConditionActionEncoding/3.3/HeuristicLab.Encodings.ConditionActionEncoding-3.3.csproj

    r9089 r9105  
    7171    <Reference Include="System" />
    7272    <Reference Include="System.Core" />
     73    <Reference Include="System.Drawing" />
    7374    <Reference Include="System.Xml.Linq" />
    7475    <Reference Include="System.Data.DataSetExtensions" />
     
    8384    <Compile Include="ActionSelection\RandomActionSelector.cs" />
    8485    <Compile Include="Covering\CoveringOperator.cs" />
     86    <Compile Include="Covering\DoDeletionBeforeCovering.cs" />
    8587    <Compile Include="Covering\ICovering.cs" />
    8688    <Compile Include="Covering\ICoveringSolutionCreator.cs" />
     89    <Compile Include="Deletion\CalculateNumberOfDeletionsOperator.cs" />
     90    <Compile Include="Deletion\XCSDeletionOperator.cs" />
    8791    <Compile Include="Evaluators\XCSEvaluator.cs" />
    8892    <Compile Include="Evaluators\IConditionActionEvaluator.cs" />
    8993    <Compile Include="Evaluators\IXCSEvaluator.cs" />
     94    <Compile Include="GA\XCSAfterCrossoverOperator.cs" />
    9095    <Compile Include="IClassifier.cs" />
    9196    <Compile Include="Interfaces\IConditionActionProblem.cs" />
    9297    <Compile Include="Interfaces\IConditionActionProblemData.cs" />
    9398    <Compile Include="Operator\CalculateAccuracy.cs" />
     99    <Compile Include="GA\XCSCheckIfGAShouldBeApplied.cs" />
    94100    <Compile Include="Operator\CountNumberOfUniqueActions.cs" />
    95101    <Compile Include="Operator\PredictionArrayCalculator.cs" />
    96102    <Compile Include="Operator\MatchActionOperator.cs" />
    97103    <Compile Include="Operator\MatchConditionOperator.cs" />
     104    <Compile Include="Operator\SubScopeVariableCopier.cs" />
    98105    <Compile Include="Operator\SumAccuracy.cs" />
    99106    <Compile Include="Properties\AssemblyInfo.cs" />
     
    104111    <Compile Include="Selectors\IMatchSelector.cs" />
    105112    <Compile Include="Selectors\MatchSelector.cs" />
     113    <Compile Include="Subsumption\ActionSetSubsumptionoperator.cs" />
     114    <Compile Include="Subsumption\IActionSetSubsumption.cs" />
    106115    <None Include="Properties\AssemblyInfo.cs.frame" />
    107116  </ItemGroup>
     
    112121  <ItemGroup />
    113122  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
     123  <PropertyGroup>
     124    <PreBuildEvent>set Path=%25Path%25;$(ProjectDir);$(SolutionDir)
     125set ProjectDir=$(ProjectDir)
     126set SolutionDir=$(SolutionDir)
     127set Outdir=$(Outdir)
     128
     129call PreBuildEvent.cmd
     130</PreBuildEvent>
     131  </PropertyGroup>
    114132  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
    115133       Other similar extension points exist, see Microsoft.Common.targets.
  • branches/LearningClassifierSystems/HeuristicLab.Encodings.ConditionActionEncoding/3.3/IClassifier.cs

    r9089 r9105  
    3535    bool MatchCondition(IClassifier target);
    3636    bool MatchAction(IClassifier target);
     37    bool IsMoreGeneral(IClassifier target);
    3738
    3839    //to use IMatching as key in a dictionary, Equals and GetHashCode have to be override.
  • branches/LearningClassifierSystems/HeuristicLab.Encodings.ConditionActionEncoding/3.3/Interfaces/IConditionActionProblem.cs

    r9090 r9105  
    3939    IParameter CoveringSolutionCreatorParameter { get; }
    4040
     41    IParameter ActionSetSubsumptionOperatorParameter { get; }
     42    IActionSetSubsumption ActionSetSubsumptionOperator { get; }
     43
    4144    new IXCSEvaluator Evaluator { get; }
    4245  }
  • branches/LearningClassifierSystems/HeuristicLab.Problems.ConditionActionClassification/3.3/HeuristicLab.Problems.ConditionActionClassification-3.3.csproj

    r9089 r9105  
    6565    <Reference Include="System" />
    6666    <Reference Include="System.Core" />
     67    <Reference Include="System.Drawing" />
    6768    <Reference Include="System.Xml.Linq" />
    6869    <Reference Include="System.Data.DataSetExtensions" />
     
    9495  </ItemGroup>
    9596  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
     97  <PropertyGroup>
     98    <PreBuildEvent>set Path=%25Path%25;$(ProjectDir);$(SolutionDir)
     99set ProjectDir=$(ProjectDir)
     100set SolutionDir=$(SolutionDir)
     101set Outdir=$(Outdir)
     102
     103call PreBuildEvent.cmd
     104</PreBuildEvent>
     105  </PropertyGroup>
    96106  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
    97107       Other similar extension points exist, see Microsoft.Common.targets.
  • branches/LearningClassifierSystems/HeuristicLab.Problems.ConditionActionClassification/3.3/Implementation/ConditionActionClassificationProblem.cs

    r9090 r9105  
    3636    private const string ClassifierFetcherParameterName = "ClassifierFetcher";
    3737    private const string ActionExecuterParameterName = "ActionExecuter";
     38    private const string ActionSetSubsumptionOperatorParameterName = "ActionSetSubsumption";
    3839
    3940    IXCSEvaluator IConditionActionProblem.Evaluator {
     
    118119    IClassifierFetcher IConditionActionProblem.ClassifierFetcher { get { return ClassifierFetcher; } }
    119120    IParameter IConditionActionProblem.ClassifierFetcherParameter { get { return ClassifierFetcherParameter; } }
     121
     122
     123    public ActionSetSubsumptionoperator ActionSetSubsumptionOperator {
     124      get { return ActionSetSubsumptionOperatorParameter.Value; }
     125    }
     126    public ValueParameter<ActionSetSubsumptionoperator> ActionSetSubsumptionOperatorParameter {
     127      get { return (ValueParameter<ActionSetSubsumptionoperator>)Parameters[ActionSetSubsumptionOperatorParameterName]; }
     128    }
     129    IActionSetSubsumption IConditionActionProblem.ActionSetSubsumptionOperator { get { return ActionSetSubsumptionOperator; } }
     130    IParameter IConditionActionProblem.ActionSetSubsumptionOperatorParameter { get { return ActionSetSubsumptionOperatorParameter; } }
    120131
    121132    private IntValue ThetaMinimalNumberOfActions {
     
    164175      Parameters.Add(new ValueParameter<CombinedIntegerVectorClassifierFetcher>(ClassifierFetcherParameterName, "", new CombinedIntegerVectorClassifierFetcher()));
    165176      Parameters.Add(new FixedValueParameter<ItemSet<IClassifier>>("PossibleActions"));
    166       Parameters.Add(new FixedValueParameter<IntValue>("ThetaMinimalNumberOfActions", "Minimal number of actions, which have to be present in the match set, or else covering will occure."));
     177      Parameters.Add(new FixedValueParameter<IntValue>("ThetaMinimalNumberOfActions", "Minimal number of actions, which have to be present in the match set, or else covering will occure.", new IntValue(1)));
    167178
    168179      Parameters.Add(new ValueParameter<ICoveringSolutionCreator>("CoveringSolutionCreator", "", coveringSolutionCreator));
    169180      Parameters.Add(new FixedValueParameter<PercentValue>("ChangeSymbolProbabilityInCovering", "", new PercentValue(0.5)));
     181
     182      Parameters.Add(new ValueParameter<ActionSetSubsumptionoperator>(ActionSetSubsumptionOperatorParameterName, "", new ActionSetSubsumptionoperator()));
    170183
    171184      Evaluator.InitialErrorParameter.ActualName = "InitialError";
     
    188201      ActionExecuter.NegativeRewardParameter.ActualName = NegativeRewardParameter.Name;
    189202      ActionExecuter.PositiveRewardParameter.ActualName = PositiveRewardParameter.Name;
     203
     204      ActionSetSubsumptionOperator.ClassifiersParameter.ActualName = "CombinedIntegerVector";
    190205
    191206      SetPossibleActions();
Note: See TracChangeset for help on using the changeset viewer.