Free cookie consent management tool by TermsFeed Policy Generator

Changeset 9110


Ignore:
Timestamp:
01/04/13 20:46:18 (12 years ago)
Author:
sforsten
Message:

#1980:

  • added GA subsumption
  • simplified deletion before covering
  • simplified XCSDeletionOperator
Location:
branches/LearningClassifierSystems
Files:
4 added
1 deleted
16 edited
2 moved

Legend:

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

    r9105 r9110  
    2424using HeuristicLab.Core;
    2525using HeuristicLab.Data;
     26using HeuristicLab.Encodings.ConditionActionEncoding;
    2627using HeuristicLab.Operators;
    2728using HeuristicLab.Optimization.Operators;
     
    3637  [StorableClass]
    3738  public sealed class LCSAdaptedGeneticAlgorithm : AlgorithmOperator {
     39    private const string TEMPID = "TempID";
     40    private const string SUBSUMEDBY = "SubsumedBy";
     41    private const string SUBSUMED = "Subsumed";
     42
    3843    #region Parameter properties
    3944    public ValueLookupParameter<IRandom> RandomParameter {
     
    7580    public ValueLookupParameter<IntValue> PopulationSizeParameter {
    7681      get { return (ValueLookupParameter<IntValue>)Parameters["PopulationSize"]; }
     82    }
     83    public ValueLookupParameter<BoolValue> DoGASubsumptionParameter {
     84      get { return (ValueLookupParameter<BoolValue>)Parameters["DoGASubsumption"]; }
    7785    }
    7886    private ScopeParameter CurrentScopeParameter {
     
    113121      Parameters.Add(new ValueLookupParameter<IntValue>("EvaluatedSolutions", "The number of times solutions have been evaluated."));
    114122      Parameters.Add(new ValueLookupParameter<IntValue>("PopulationSize", "The size of the population."));
     123      Parameters.Add(new ValueLookupParameter<BoolValue>("DoGASubsumption", "Sets if GA subsumption is executed."));
    115124      Parameters.Add(new ScopeParameter("CurrentScope", "The current scope which represents a population of solutions on which the genetic algorithm should be applied."));
    116125      #endregion
     
    126135      Placeholder crossover = new Placeholder();
    127136      Placeholder afterCrossover = new Placeholder();
    128       StochasticBranch stochasticBranch = new StochasticBranch();
    129137      Placeholder mutator = new Placeholder();
    130138      SubScopesRemover subScopesRemover = new SubScopesRemover();
     
    136144      ConditionalBranch conditionalBranch = new ConditionalBranch();
    137145
     146      TempSubScopeIDAssigner tempIdAssigner = new TempSubScopeIDAssigner();
     147      ConditionalBranch doGASubsumptionBranch1 = new ConditionalBranch();
     148      UniformSubScopesProcessor setSubsumptionFalseSubScopesProcessor = new UniformSubScopesProcessor();
     149      Assigner setSubsumpByAssigner = new Assigner();
     150      Assigner setSubsumptionFalseAssigner = new Assigner();
     151      CheckGASubsumptionOperator checkGASubsumptionOperator = new CheckGASubsumptionOperator();
     152      ConditionalBranch doGASubsumptionBranch2 = new ConditionalBranch();
     153      ExecuteGASubsumptionOperator executeGAsubsumptionOperator = new ExecuteGASubsumptionOperator();
     154      ConditionalSelector subsumptionSelector = new ConditionalSelector();
     155      LeftReducer subsumptionLeftReducer = new LeftReducer();
     156
    138157      variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Generations", new IntValue(0))); // Class GeneticAlgorithm expects this to be called Generations
    139158
     
    144163      analyzer1.OperatorParameter.ActualName = "Analyzer";
    145164
     165      tempIdAssigner.LeftSideParameter.ActualName = TEMPID;
     166
     167      setSubsumpByAssigner.LeftSideParameter.ActualName = SUBSUMEDBY;
     168      setSubsumpByAssigner.RightSideParameter.Value = new IntValue(-1);
     169
     170      setSubsumptionFalseAssigner.LeftSideParameter.ActualName = SUBSUMED;
     171      setSubsumptionFalseAssigner.RightSideParameter.Value = new BoolValue(false);
     172
    146173      selector.Name = "Selector";
    147174      selector.OperatorParameter.ActualName = "Selector";
     
    155182      afterCrossover.OperatorParameter.ActualName = "AfterCrossover";
    156183
    157       stochasticBranch.ProbabilityParameter.ActualName = "MutationProbability";
    158       stochasticBranch.RandomParameter.ActualName = "Random";
    159 
    160184      mutator.Name = "Mutator";
    161185      mutator.OperatorParameter.ActualName = "Mutator";
    162186
     187      doGASubsumptionBranch1.ConditionParameter.ActualName = DoGASubsumptionParameter.ActualName;
     188
     189      checkGASubsumptionOperator.ChildClassifiersParameter.ActualName = "CombinedIntegerVector";
     190      checkGASubsumptionOperator.ParentsClassifiersParameter.ActualName = "CombinedIntegerVector";
     191      checkGASubsumptionOperator.NumerositiesParameter.ActualName = "Numerosity";
     192      checkGASubsumptionOperator.ExperiencesParameter.ActualName = "Experience";
     193      checkGASubsumptionOperator.ErrorsParameter.ActualName = "Error";
     194      checkGASubsumptionOperator.TempIDParameter.ActualName = TEMPID;
     195      checkGASubsumptionOperator.ErrorZeroParameter.ActualName = "ErrorZero";
     196      checkGASubsumptionOperator.ThetaSubsumptionParameter.ActualName = "ThetaSubsumption";
     197      checkGASubsumptionOperator.SubsumedByParameter.ActualName = SUBSUMEDBY;
     198      checkGASubsumptionOperator.SubsumedParameter.ActualName = SUBSUMED;
     199
    163200      subScopesRemover.RemoveAllSubScopes = true;
     201
     202      doGASubsumptionBranch2.ConditionParameter.ActualName = DoGASubsumptionParameter.ActualName;
     203
     204      executeGAsubsumptionOperator.NumerositiesParameter.ActualName = "Numerosity";
     205      executeGAsubsumptionOperator.TempIDParameter.ActualName = TEMPID;
     206      executeGAsubsumptionOperator.SubsumedByParameter.ActualName = SUBSUMEDBY;
     207
     208      subsumptionSelector.ConditionParameter.ActualName = SUBSUMED;
     209      subsumptionSelector.CopySelected = new BoolValue(false);
    164210
    165211      subScopesCounter.Name = "Increment EvaluatedSolutions";
     
    184230      variableCreator.Successor = resultsCollector1;
    185231      resultsCollector1.Successor = analyzer1;
    186       analyzer1.Successor = selector;
     232      analyzer1.Successor = tempIdAssigner;
     233      tempIdAssigner.Successor = setSubsumptionFalseSubScopesProcessor;
     234      setSubsumptionFalseSubScopesProcessor.Operator = setSubsumpByAssigner;
     235      setSubsumpByAssigner.Successor = setSubsumptionFalseAssigner;
     236      setSubsumptionFalseAssigner.Successor = null;
     237      setSubsumptionFalseSubScopesProcessor.Successor = selector;
    187238      selector.Successor = subScopesProcessor1;
    188239      subScopesProcessor1.Operators.Add(new EmptyOperator());
     
    193244      uniformSubScopesProcessor1.Successor = subScopesCounter;
    194245      crossover.Successor = afterCrossover;
    195       afterCrossover.Successor = stochasticBranch;
    196       stochasticBranch.FirstBranch = mutator;
    197       stochasticBranch.SecondBranch = null;
    198       stochasticBranch.Successor = subScopesRemover;
    199       mutator.Successor = null;
     246      afterCrossover.Successor = mutator;
     247      mutator.Successor = doGASubsumptionBranch1;
     248      doGASubsumptionBranch1.TrueBranch = checkGASubsumptionOperator;
     249      doGASubsumptionBranch1.FalseBranch = new EmptyOperator();
     250      doGASubsumptionBranch1.Successor = subScopesRemover;
    200251      subScopesRemover.Successor = null;
    201252      subScopesCounter.Successor = null;
    202       mergingReducer.Successor = intCounter;
     253      mergingReducer.Successor = doGASubsumptionBranch2;
     254      doGASubsumptionBranch2.TrueBranch = executeGAsubsumptionOperator;
     255      doGASubsumptionBranch2.FalseBranch = new EmptyOperator();
     256      executeGAsubsumptionOperator.Successor = subsumptionSelector;
     257      subsumptionSelector.Successor = subsumptionLeftReducer;
     258      subsumptionLeftReducer.Successor = null;
     259      doGASubsumptionBranch2.Successor = intCounter;
    203260      intCounter.Successor = comparator;
    204261      comparator.Successor = analyzer2;
  • branches/LearningClassifierSystems/HeuristicLab.Algorithms.LearningClassifierSystems/3.3/LearningClassifierSystemMainLoop.cs

    r9105 r9110  
    2323using HeuristicLab.Core;
    2424using HeuristicLab.Data;
     25using HeuristicLab.Encodings.CombinedIntegerVectorEncoding;
    2526using HeuristicLab.Encodings.ConditionActionEncoding;
    26 using HeuristicLab.Encodings.IntegerVectorEncoding;
    2727using HeuristicLab.Operators;
    2828using HeuristicLab.Optimization;
     
    3939  [StorableClass]
    4040  public sealed class LearningClassifierSystemMainLoop : AlgorithmOperator {
     41    private const string HASTOBEDELETED = "HasToBeDeleted";
     42    private const string HASBEENSUBSUMED = "HasBeenSubsumed";
    4143
    4244    #region Parameter Properties
     
    6264    private DoDeletionBeforeCoveringOperator doDeletionBeforeCovering;
    6365    private CoveringOperator covering;
    64     private ConditionalSelector subsumptionSelector;
     66
     67    private UniformSomePositionManipulator test;
    6568
    6669    private Placeholder evaluator;
     
    8891      Parameters.Add(new ConstrainedValueParameter<ICrossover>("Crossover", "The operator used to cross solutions.", new ItemSet<ICrossover>() { new HeuristicLab.Encodings.CombinedIntegerVectorEncoding.SinglePointCrossover() }, new HeuristicLab.Encodings.CombinedIntegerVectorEncoding.SinglePointCrossover()));
    8992      Parameters.Add(new ValueLookupParameter<IOperator>("Evaluator", "The operator used to evaluate solutions. This operator is executed in parallel, if an engine is used which supports parallelization."));
    90       UniformOnePositionManipulator test = new UniformOnePositionManipulator();
    91       test.IntegerVectorParameter.ActualName = "CombinedIntegerVector";
    92       Parameters.Add(new OptionalConstrainedValueParameter<IManipulator>("Mutator", "The operator used to mutate solutions.", new ItemSet<IManipulator>() { new UniformOnePositionManipulator() }, test));
     93      test = new UniformSomePositionManipulator();
     94      test.ProbabilityParameter.ActualName = "MutationProbability";
     95      test.ChildParameter.ActualName = "CombinedIntegerVector";
     96      Parameters.Add(new OptionalConstrainedValueParameter<IManipulator>("Mutator", "The operator used to mutate solutions.", new ItemSet<IManipulator>() { new UniformSomePositionManipulator() }, test));
    9397      XCSAfterCrossoverOperator afterCrossover = new XCSAfterCrossoverOperator();
    9498      Parameters.Add(new ConstrainedValueParameter<IOperator>("AfterCrossover", "The operator used to select solutions for reproduction.", new ItemSet<IOperator>() { new XCSAfterCrossoverOperator() }, afterCrossover));
     
    113117      doDeletionBeforeCovering = new DoDeletionBeforeCoveringOperator();
    114118      ConditionalBranch doDeletionBeforeCoveringConditionalBranch = new ConditionalBranch();
    115       MergingReducer matchSetMergingReducerForDeletion = new MergingReducer();
    116       SubScopeVariableCopier subscopeVariableCopier = new SubScopeVariableCopier();
    117119      XCSDeletionOperator deletionOperator = new XCSDeletionOperator();
    118120      ConditionalSelector deletionSelector = new ConditionalSelector();
    119121      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();
    125122      covering = new CoveringOperator();
    126123      MergingReducer actionSetMergingReducer = new MergingReducer();
     
    134131      UniformSubScopesProcessor updateParametersSubScopesProcessor = new UniformSubScopesProcessor();
    135132      ConditionalBranch actionSetSubsumptionBranch = new ConditionalBranch();
    136       subsumptionSelector = new ConditionalSelector();
     133      UniformSubScopesProcessor setSubsumedToFalseSubScopeProcessor = new UniformSubScopesProcessor();
     134      Assigner setSubsumedToFalseAssigner = new Assigner();
     135      ConditionalSelector subsumptionSelector = new ConditionalSelector();
    137136      LeftReducer leftReducer = new LeftReducer();
    138137      XCSCheckIfGAShouldBeApplied checkIfGAShouldRun = new XCSCheckIfGAShouldBeApplied();
     
    143142      IntCounter currentPopulationSizeCounter = new IntCounter();
    144143      CalculateNumberOfDeletionsOperator calculateNumberOfDeletions = new CalculateNumberOfDeletionsOperator();
     144      UniformSubScopesProcessor setDeletionFalseSubScopeProcessor1 = new UniformSubScopesProcessor();
     145      UniformSubScopesProcessor setDeletionFalseSubScopeProcessor2 = new UniformSubScopesProcessor();
     146      Assigner setDeletionFalseAssigner = new Assigner();
     147      InsertInPopulationOperator insertInPopulation = new InsertInPopulationOperator();
    145148      XCSDeletionOperator deletionOperatorAfterGA = new XCSDeletionOperator();
    146149      ConditionalSelector deletionSelectorAfterGA = new ConditionalSelector();
     
    169172
    170173      conditionMatchSelector.CopySelected = new BoolValue(false);
    171       conditionMatchSelector.ConditionParameter.ActualName = "MatchCondition";
    172 
    173       conditionMatchSelectorAfterDeletion.CopySelected = new BoolValue(false);
    174       conditionMatchSelectorAfterDeletion.ConditionParameter.ActualName = "MatchCondition";
     174      conditionMatchSelector.ConditionParameter.ActualName = matchConditionOperator.MatchConditionParameter.ActualName;
    175175
    176176      countNumberOfUniqueActions.ClassifiersParameter.ActualName = "CombinedIntegerVector";
    177177
    178       countNumberOfUniqueActionsAfterDeletion.ClassifiersParameter.ActualName = "CombinedIntegerVector";
    179 
    180       subscopeVariableCopier.SubScopeIndexParameter.Value = new IntValue(1);
    181 
     178      doDeletionBeforeCovering.ClassifiersParameter.ActualName = "CombinedIntegerVector";
     179      doDeletionBeforeCovering.MatchConditionParameter.ActualName = matchConditionOperator.MatchConditionParameter.ActualName;
    182180      doDeletionBeforeCovering.CurrentPopulationSizeParameter.ActualName = "CurrentPopulationSize";
    183       doDeletionBeforeCovering.NumberOfUniqueActionsParameter.ActualName = countNumberOfUniqueActions.NumberOfUniqueActionsParameter.ActualName;
    184181      doDeletionBeforeCovering.PopulationSizeParameter.ActualName = "N";
    185182
    186183      doDeletionBeforeCoveringConditionalBranch.ConditionParameter.ActualName = doDeletionBeforeCovering.DoDeletionParameter.ActualName;
    187184
     185      setDeletionFalseAssigner.LeftSideParameter.ActualName = HASTOBEDELETED;
     186      setDeletionFalseAssigner.RightSideParameter.Value = new BoolValue(false);
     187
    188188      deletionOperator.NumberToDeleteParameter.ActualName = doDeletionBeforeCovering.NumberToDeleteParameter.ActualName;
     189      deletionOperator.HasToBeDeletedParameter.ActualName = HASTOBEDELETED;
    189190      deletionOperator.AverageActionSetSizesParameter.ActualName = "AverageActionSetSize";
    190191      deletionOperator.FitnessesParameter.ActualName = "Fitness";
     
    195196      deletionOperator.RandomParameter.ActualName = "Random";
    196197
    197       deletionSelector.ConditionParameter.ActualName = deletionOperator.HasToBeDeletedVariableName;
     198      deletionSelector.ConditionParameter.ActualName = HASTOBEDELETED;
    198199      deletionSelector.CopySelected = new BoolValue(false);
    199200
     
    219220      actionSetSubsumptionBranch.ConditionParameter.ActualName = "DoActionSetSubsumption";
    220221
     222      setSubsumedToFalseAssigner.LeftSideParameter.ActualName = HASBEENSUBSUMED;
     223      setSubsumedToFalseAssigner.RightSideParameter.Value = new BoolValue(false);
     224
     225      subsumptionSelector.ConditionParameter.ActualName = HASBEENSUBSUMED;
    221226      subsumptionSelector.CopySelected = new BoolValue(false);
    222227
     
    274279      adaptedGeneticAlgorithmMainLoop.MaximumGenerationsParameter.ActualName = "ZeroIntValue";
    275280      adaptedGeneticAlgorithmMainLoop.QualityParameter.ActualName = "Fitness";
    276       adaptedGeneticAlgorithmMainLoop.MutationProbabilityParameter.Value = new PercentValue(10);
     281      adaptedGeneticAlgorithmMainLoop.MutationProbabilityParameter.ActualName = "MutationProbability";
    277282      adaptedGeneticAlgorithmMainLoop.MaximizationParameter.Value = new BoolValue(true);
    278283      adaptedGeneticAlgorithmMainLoop.AfterCrossoverParameter.ActualName = AfterCrossoverParameter.Name;
     
    281286      currentPopulationSizeCounter.Increment = new IntValue(2);
    282287
     288      insertInPopulation.ClassifiersParameter.ActualName = "CombinedIntegerVector";
     289      insertInPopulation.NumerositiesParameter.ActualName = "Numerosity";
     290      insertInPopulation.HasToBeDeletedParameter.ActualName = HASTOBEDELETED;
     291      insertInPopulation.InsertInPopulationParameter.ActualName = "InsertInPopulation";
     292
    283293      calculateNumberOfDeletions.CurrentPopulationSizeParameter.ActualName = "CurrentPopulationSize";
    284294      calculateNumberOfDeletions.PopulationSizeParameter.ActualName = "N";
    285295
    286296      deletionOperatorAfterGA.NumberToDeleteParameter.ActualName = calculateNumberOfDeletions.NumberOfDeletionsParameter.ActualName;
     297      deletionOperatorAfterGA.HasToBeDeletedParameter.ActualName = HASTOBEDELETED;
    287298      deletionOperatorAfterGA.AverageActionSetSizesParameter.ActualName = "AverageActionSetSize";
    288299      deletionOperatorAfterGA.FitnessesParameter.ActualName = "Fitness";
     
    293304      deletionOperatorAfterGA.RandomParameter.ActualName = "Random";
    294305
    295       deletionSelectorAfterGA.ConditionParameter.ActualName = deletionOperatorAfterGA.HasToBeDeletedVariableName;
     306      deletionSelectorAfterGA.ConditionParameter.ActualName = HASTOBEDELETED;
    296307      deletionSelectorAfterGA.CopySelected = new BoolValue(false);
    297308      #endregion
     
    307318      classifierFetcher.Successor = matchCondtionSubScopesProcessor;
    308319      matchCondtionSubScopesProcessor.Operator = matchConditionOperator;
    309       matchCondtionSubScopesProcessor.Successor = conditionMatchSelector;
     320      matchCondtionSubScopesProcessor.Successor = doDeletionBeforeCovering;
     321      doDeletionBeforeCovering.Successor = doDeletionBeforeCoveringConditionalBranch;
     322      doDeletionBeforeCoveringConditionalBranch.TrueBranch = setDeletionFalseSubScopeProcessor1;
     323      doDeletionBeforeCoveringConditionalBranch.FalseBranch = conditionMatchSelector;
     324      setDeletionFalseSubScopeProcessor1.Operator = setDeletionFalseAssigner;
     325      setDeletionFalseSubScopeProcessor1.Successor = deletionOperator;
     326      deletionOperator.Successor = deletionSelector;
     327      deletionSelector.Successor = leftReducerAfterDeletionSelection;
     328      //if a classifier with a unique action for the match set has been deleted, then there are still to many classifiers in the population
     329      leftReducerAfterDeletionSelection.Successor = doDeletionBeforeCovering;
    310330      conditionMatchSelector.Successor = matchSetSubScopesProcessor;
    311331      matchSetSubScopesProcessor.Operators.Add(new EmptyOperator());
    312332      matchSetSubScopesProcessor.Operators.Add(countNumberOfUniqueActions);
    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 
     333      countNumberOfUniqueActions.Successor = covering;
     334      matchSetSubScopesProcessor.Successor = matchSetMergingReducer;
    333335      covering.Successor = predictionArrayCalculator;
    334336      predictionArrayCalculator.Successor = actionSelector;
     
    345347      updateParametersSubScopesProcessor.Operator = evaluator;
    346348      updateParametersSubScopesProcessor.Successor = actionSetSubsumptionBranch;
    347       actionSetSubsumptionBranch.TrueBranch = actionSetSubsumption;
     349      actionSetSubsumptionBranch.TrueBranch = setSubsumedToFalseSubScopeProcessor;
     350      setSubsumedToFalseSubScopeProcessor.Operator = setSubsumedToFalseAssigner;
     351      setSubsumedToFalseSubScopeProcessor.Successor = actionSetSubsumption;
    348352      actionSetSubsumption.Successor = subsumptionSelector;
    349353      subsumptionSelector.Successor = leftReducer;
     
    359363      actionSetSubScopesProcessor.Successor = actionSetMergingReducer;
    360364
    361       matchSetMergingReducer.Successor = calculateNumberOfDeletions;
     365      matchSetMergingReducer.Successor = setDeletionFalseSubScopeProcessor2;
     366      setDeletionFalseSubScopeProcessor2.Operator = setDeletionFalseAssigner;
     367      setDeletionFalseSubScopeProcessor2.Successor = insertInPopulation;
     368      insertInPopulation.Successor = calculateNumberOfDeletions;
    362369      calculateNumberOfDeletions.Successor = deletionOperatorAfterGA;
    363370      deletionOperatorAfterGA.Successor = deletionSelectorAfterGA;
     
    388395      classifierFetcher.OperatorParameter.ActualName = problem.ClassifierFetcherParameter.Name;
    389396
     397      test.FetchedClassifierParameter.ActualName = problem.ClassifierFetcher.CurrentClassifierToMatchParameter.ActualName;
     398      test.PossibleActionsParameter.ActualName = problem.PossibleActionsConcreteClassParameter.Name;
     399
    390400      actionExecuter.OperatorParameter.ActualName = problem.ActionExecuterParameter.Name;
    391401
     
    396406      problem.ActionSetSubsumptionOperator.NumerositiesParameter.ActualName = "Numerosity";
    397407
    398       subsumptionSelector.ConditionParameter.ActualName = problem.ActionSetSubsumptionOperator.HasBeenSubsumedParameterName;
     408      problem.ActionSetSubsumptionOperator.HasBeenSubsumedParameter.ActualName = HASBEENSUBSUMED;
    399409
    400410      actionSetSubsumption.OperatorParameter.ActualName = problem.ActionSetSubsumptionOperatorParameter.Name;
  • branches/LearningClassifierSystems/HeuristicLab.Encodings.CombinedIntegerVectorEncoding/3.3/CombinedIntegerVectorManipulator.cs

    r9089 r9110  
    3939      get { return (ILookupParameter<CombinedIntegerVector>)Parameters["Child"]; }
    4040    }
    41     public ILookupParameter<CombinedIntegerVector> ParentParameter {
     41    public ILookupParameter<CombinedIntegerVector> FetchedClassifierParameter {
    4242      get { return (ILookupParameter<CombinedIntegerVector>)Parameters["Parent"]; }
    4343    }
     
    5757
    5858    public sealed override IOperation Apply() {
    59       ChildParameter.ActualValue = Manipulate(RandomParameter.ActualValue, ChildParameter.ActualValue, ParentParameter.ActualValue);
     59      ChildParameter.ActualValue = Manipulate(RandomParameter.ActualValue, FetchedClassifierParameter.ActualValue, ChildParameter.ActualValue);
    6060      return base.Apply();
    6161    }
  • branches/LearningClassifierSystems/HeuristicLab.Encodings.CombinedIntegerVectorEncoding/3.3/Covering/CombinedIntegerVectorCoveringCreator.cs

    r9090 r9110  
    7575      CombinedIntegerVector action = (CombinedIntegerVector)ActionParameter.ActualValue.Action;
    7676
    77       newCondition = UniformSomePositionInConditionManipulator.ManipulateCondition(RandomParameter.ActualValue, condition, newCondition, ChangeSymbolProbabilityParameter.ActualValue.Value);
     77      newCondition = UniformSomePositionManipulator.ManipulateCondition(RandomParameter.ActualValue, condition, newCondition, ChangeSymbolProbabilityParameter.ActualValue.Value);
    7878
    7979      CreatedClassifierParameter.ActualValue = new CombinedIntegerVector(newCondition, newCondition.Bounds, action, action.Bounds);
  • branches/LearningClassifierSystems/HeuristicLab.Encodings.CombinedIntegerVectorEncoding/3.3/HeuristicLab.Encodings.CombinedIntegerVectorEncoding-3.3.csproj

    r9105 r9110  
    119119    </Compile>
    120120    <Compile Include="Manipulator\UniformOnePositionInConditionManipulator.cs" />
    121     <Compile Include="Manipulator\UniformSomePositionInConditionManipulator.cs" />
     121    <Compile Include="Manipulator\UniformSomePositionManipulator.cs" />
    122122    <Compile Include="Plugin.cs" />
    123123    <None Include="Properties\AssemblyInfo.cs.frame" />
  • branches/LearningClassifierSystems/HeuristicLab.Encodings.CombinedIntegerVectorEncoding/3.3/Interfaces/ICombinedIntegerVectorManipulator.cs

    r9089 r9110  
    2929  public interface ICombinedIntegerVectorManipulator : IManipulator, ICombinedIntegerVectorOperator {
    3030    ILookupParameter<CombinedIntegerVector> ChildParameter { get; }
    31     ILookupParameter<CombinedIntegerVector> ParentParameter { get; }
     31    ILookupParameter<CombinedIntegerVector> FetchedClassifierParameter { get; }
    3232  }
    3333}
  • branches/LearningClassifierSystems/HeuristicLab.Encodings.CombinedIntegerVectorEncoding/3.3/Manipulator/UniformSomePositionManipulator.cs

    r9106 r9110  
    2727
    2828namespace HeuristicLab.Encodings.CombinedIntegerVectorEncoding {
    29   public class UniformSomePositionInConditionManipulator : CombinedIntegerVectorManipulator {
     29  public class UniformSomePositionManipulator : CombinedIntegerVectorManipulator {
    3030
    3131    public IValueLookupParameter<PercentValue> ProbabilityParameter {
     
    3737
    3838    [StorableConstructor]
    39     protected UniformSomePositionInConditionManipulator(bool deserializing) : base(deserializing) { }
    40     protected UniformSomePositionInConditionManipulator(UniformSomePositionInConditionManipulator original, Cloner cloner)
     39    protected UniformSomePositionManipulator(bool deserializing) : base(deserializing) { }
     40    protected UniformSomePositionManipulator(UniformSomePositionManipulator original, Cloner cloner)
    4141      : base(original, cloner) {
    4242    }
    4343    public override IDeepCloneable Clone(Cloner cloner) {
    44       return new UniformSomePositionInConditionManipulator(this, cloner);
     44      return new UniformSomePositionManipulator(this, cloner);
    4545    }
    46     public UniformSomePositionInConditionManipulator()
     46    public UniformSomePositionManipulator()
    4747      : base() {
    4848      Parameters.Add(new ValueLookupParameter<PercentValue>("Probability", "The probability for each dimension to be manipulated.", new PercentValue(0.5)));
  • branches/LearningClassifierSystems/HeuristicLab.Encodings.ConditionActionEncoding/3.3/Covering/CoveringOperator.cs

    r9105 r9110  
    101101        throw new ArgumentException("More classifiers with unique actions shall be created than unique actions are available.");
    102102      }
     103      if (count > 0) {
     104        CurrentPopulationSizeParameter.ActualValue.Value += count;
    103105
    104       CurrentPopulationSizeParameter.ActualValue.Value += count;
     106        int current = CurrentScope.SubScopes.Count;
     107        for (int i = 0; i < count; i++) {
     108          CurrentScope.SubScopes.Add(new Scope((current + i).ToString()));
     109        }
    105110
    106       int current = CurrentScope.SubScopes.Count;
    107       for (int i = 0; i < count; i++) {
    108         CurrentScope.SubScopes.Add(new Scope((current + i).ToString()));
     111        creator.ActionParameter.ActualName = "Action";
     112        OperationCollection variableCreation = new OperationCollection() { Parallel = parallel };
     113        OperationCollection creation = new OperationCollection();
     114        OperationCollection evaluation = new OperationCollection() { Parallel = parallel };
     115        for (int i = 0; i < count; i++) {
     116          VariableCreator variableCreator = new VariableCreator();
     117          int pos = RandomParameter.ActualValue.Next(clone.Count);
     118          IClassifier action = clone.ElementAt(pos);
     119          clone.Remove(action);
     120          variableCreator.CollectedValues.Add(new ValueParameter<IClassifier>("Action", action));
     121          variableCreation.Add(ExecutionContext.CreateOperation(variableCreator, CurrentScope.SubScopes[current + i]));
     122          creation.Add(ExecutionContext.CreateOperation(creator, CurrentScope.SubScopes[current + i]));
     123          evaluation.Add(ExecutionContext.CreateOperation(evaluator, CurrentScope.SubScopes[current + i]));
     124        }
     125        OperationCollection next = new OperationCollection();
     126        next.Add(variableCreation);
     127        next.Add(creation);
     128        next.Add(evaluation);
     129        next.Add(base.Apply());
     130        return next;
     131      } else {
     132        return base.Apply();
    109133      }
    110 
    111       creator.ActionParameter.ActualName = "Action";
    112       OperationCollection variableCreation = new OperationCollection() { Parallel = parallel };
    113       OperationCollection creation = new OperationCollection();
    114       OperationCollection evaluation = new OperationCollection() { Parallel = parallel };
    115       for (int i = 0; i < count; i++) {
    116         VariableCreator variableCreator = new VariableCreator();
    117         int pos = RandomParameter.ActualValue.Next(clone.Count);
    118         IClassifier action = clone.ElementAt(pos);
    119         clone.Remove(action);
    120         variableCreator.CollectedValues.Add(new ValueParameter<IClassifier>("Action", action));
    121         variableCreation.Add(ExecutionContext.CreateOperation(variableCreator, CurrentScope.SubScopes[current + i]));
    122         creation.Add(ExecutionContext.CreateOperation(creator, CurrentScope.SubScopes[current + i]));
    123         evaluation.Add(ExecutionContext.CreateOperation(evaluator, CurrentScope.SubScopes[current + i]));
    124       }
    125       OperationCollection next = new OperationCollection();
    126       next.Add(variableCreation);
    127       next.Add(creation);
    128       next.Add(evaluation);
    129       next.Add(base.Apply());
    130       return next;
    131134    }
    132135  }
  • branches/LearningClassifierSystems/HeuristicLab.Encodings.ConditionActionEncoding/3.3/Covering/DoDeletionBeforeCovering.cs

    r9105 r9110  
    2020#endregion
    2121
     22using System;
    2223using HeuristicLab.Common;
    2324using HeuristicLab.Core;
     
    3334
    3435    #region Parameter Properties
     36    public ILookupParameter<ItemArray<IClassifier>> ClassifiersParameter {
     37      get { return (ILookupParameter<ItemArray<IClassifier>>)Parameters["Classifiers"]; }
     38    }
     39    public ILookupParameter<ItemArray<BoolValue>> MatchConditionParameter {
     40      get { return (ILookupParameter<ItemArray<BoolValue>>)Parameters["MatchCondition"]; }
     41    }
    3542    public ILookupParameter<IntValue> MinimalNumberOfUniqueActionsParameter {
    3643      get { return (ILookupParameter<IntValue>)Parameters["MinimalNumberOfUniqueActions"]; }
    37     }
    38     public ILookupParameter<IntValue> NumberOfUniqueActionsParameter {
    39       get { return (ILookupParameter<IntValue>)Parameters["NumberOfUniqueActions"]; }
    4044    }
    4145    public ILookupParameter<IntValue> CurrentPopulationSizeParameter {
     
    6064    public DoDeletionBeforeCoveringOperator()
    6165      : base() {
     66      Parameters.Add(new ScopeTreeLookupParameter<IClassifier>("Classifiers"));
     67      Parameters.Add(new ScopeTreeLookupParameter<BoolValue>("MatchCondition"));
    6268      Parameters.Add(new LookupParameter<IntValue>("MinimalNumberOfUniqueActions"));
    63       Parameters.Add(new LookupParameter<IntValue>("NumberOfUniqueActions"));
    6469      Parameters.Add(new LookupParameter<IntValue>("CurrentPopulationSize"));
    6570      Parameters.Add(new LookupParameter<IntValue>("PopulationSize"));
     
    7277
    7378    public override IOperation Apply() {
     79      IItemSet<IClassifier> uniqueActions = new ItemSet<IClassifier>();
     80      var classifiers = ClassifiersParameter.ActualValue;
     81      var matchcondition = MatchConditionParameter.ActualValue;
     82
     83      if (classifiers.Length != matchcondition.Length) {
     84        throw new ArgumentException("Number of classifiers is not equal to the number of 'MatchCondition' variables.");
     85      }
     86
     87      for (int i = 0; i < classifiers.Length; i++) {
     88        if (matchcondition[i].Value) {
     89          uniqueActions.Add(classifiers[i].Action);
     90        }
     91      }
     92
    7493      int populationAfterCovering = MinimalNumberOfUniqueActionsParameter.ActualValue.Value
    75                                     - NumberOfUniqueActionsParameter.ActualValue.Value
     94                                    - uniqueActions.Count
    7695                                    + CurrentPopulationSizeParameter.ActualValue.Value;
    7796      BoolValue doDeletion = new BoolValue(populationAfterCovering > PopulationSizeParameter.ActualValue.Value);
  • branches/LearningClassifierSystems/HeuristicLab.Encodings.ConditionActionEncoding/3.3/Deletion/XCSDeletionOperator.cs

    r9105 r9110  
    5151      get { return (ILookupParameter<ItemArray<IntValue>>)Parameters["Experiences"]; }
    5252    }
     53    public ILookupParameter<ItemArray<BoolValue>> HasToBeDeletedParameter {
     54      get { return (ILookupParameter<ItemArray<BoolValue>>)Parameters["HasToBeDeleted"]; }
     55    }
    5356    public ILookupParameter<IntValue> ThetaDeletionParameter {
    5457      get { return (ILookupParameter<IntValue>)Parameters["ThetaDeletion"]; }
     
    6366      get { return (ILookupParameter<IntValue>)Parameters["CurrentPopulationSize"]; }
    6467    }
    65     protected ScopeParameter CurrentScopeParameter {
    66       get { return (ScopeParameter)Parameters["CurrentScope"]; }
    67     }
    68     public IScope CurrentScope {
    69       get { return CurrentScopeParameter.ActualValue; }
    70     }
    71     public string HasToBeDeletedVariableName { get { return "HasToBeDeleted"; } }
    7268    #endregion
    7369
     
    8985      Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Fitnesses"));
    9086      Parameters.Add(new ScopeTreeLookupParameter<IntValue>("Experiences"));
     87      Parameters.Add(new ScopeTreeLookupParameter<BoolValue>("HasToBeDeleted"));
    9188      Parameters.Add(new LookupParameter<IntValue>("ThetaDeletion"));
    9289      Parameters.Add(new LookupParameter<PercentValue>("Delta"));
    9390      Parameters.Add(new LookupParameter<IRandom>("Random"));
    94       Parameters.Add(new ScopeParameter("CurrentScope"));
    9591      Parameters.Add(new LookupParameter<IntValue>("CurrentPopulationSize"));
    9692    }
     
    104100      var experiences = ExperiencesParameter.ActualValue;
    105101      var averageActionSetSizes = AverageActionSetSizesParameter.ActualValue;
    106       var subscopes = CurrentScope.SubScopes;
     102      var hasToBeDeleted = HasToBeDeletedParameter.ActualValue;
    107103      double fitnessSum = fitnesses.Select(x => x.Value).Sum();
    108104      double numerositySum = numerosities.Select(x => x.Value).Sum();
    109105
    110       if (fitnesses.Length != numerosities.Length && fitnesses.Length != experiences.Length && fitnesses.Length != subscopes.Count) {
     106      if (fitnesses.Length != numerosities.Length && fitnesses.Length != experiences.Length) {
    111107        throw new ArgumentException("Different number of fitness, numerosity and experience values.");
    112       }
    113 
    114       for (int cl = 0; cl < fitnesses.Length; cl++) {
    115         if (subscopes[cl].Variables.ContainsKey(HasToBeDeletedVariableName)) {
    116           ((BoolValue)subscopes[cl].Variables[HasToBeDeletedVariableName].Value).Value = false;
    117         } else {
    118           subscopes[cl].Variables.Add(new Variable(HasToBeDeletedVariableName, new BoolValue(false)));
    119         }
    120108      }
    121109
     
    131119        voteSum = 0;
    132120        for (int cl = 0; cl < fitnesses.Length; cl++) {
    133           if (numerosities[cl].Value > 0) {
     121          if (numerosities[cl].Value > 0 && !hasToBeDeleted[cl].Value) {
    134122            voteSum += DeletionVote(averageFitnessInPopulation, averageActionSetSizes[cl].Value, numerosities[cl].Value, fitnesses[cl].Value, experiences[cl].Value);
    135123            if (voteSum > choicePoint) {
    136124              if (numerosities[cl].Value <= 1) {
    137                 ((BoolValue)subscopes[cl].Variables[HasToBeDeletedVariableName].Value).Value = true;
     125                hasToBeDeleted[cl].Value = true;
    138126                fitnessSum -= fitnesses[cl].Value;
    139127              }
  • branches/LearningClassifierSystems/HeuristicLab.Encodings.ConditionActionEncoding/3.3/Evaluators/XCSEvaluator.cs

    r9089 r9110  
    5656    public IValueLookupParameter<IntValue> NumerosityParameter {
    5757      get { return (IValueLookupParameter<IntValue>)Parameters["Numerosity"]; }
     58    }
     59    public IValueLookupParameter<BoolValue> InsertInPopulationParameter {
     60      get { return (IValueLookupParameter<BoolValue>)Parameters["InsertInPopulation"]; }
    5861    }
    5962    public ILookupParameter<DoubleValue> InitialPredictionParameter {
     
    156159      Parameters.Add(new LookupParameter<DoubleValue>("AccuracySum", ""));
    157160      Parameters.Add(new ValueLookupParameter<IntValue>("Numerosity", ""));
     161      Parameters.Add(new ValueLookupParameter<BoolValue>("InsertInPopulation", ""));
    158162
    159163      Parameters.Add(new LookupParameter<DoubleValue>("InitialPrediction"));
     
    178182        AverageActionSetSizeParameter.ActualValue = new DoubleValue(1);
    179183        NumerosityParameter.ActualValue = new IntValue(1);
     184        InsertInPopulationParameter.ActualValue = new BoolValue(false);
    180185      } else {
    181186        Experience += 1;
  • branches/LearningClassifierSystems/HeuristicLab.Encodings.ConditionActionEncoding/3.3/GA/XCSAfterCrossoverOperator.cs

    r9105 r9110  
    5555      get { return (IValueLookupParameter<DoubleValue>)Parameters["Fitness"]; }
    5656    }
     57    public IValueLookupParameter<BoolValue> InsertInPopulationParameter {
     58      get { return (IValueLookupParameter<BoolValue>)Parameters["InsertInPopulation"]; }
     59    }
     60    public IValueLookupParameter<IntValue> TempIDParameter {
     61      get { return (IValueLookupParameter<IntValue>)Parameters["TempID"]; }
     62    }
    5763    public ILookupParameter<IntValue> CurrentIterationParameter {
    5864      get { return (ILookupParameter<IntValue>)Parameters["CurrentIteration"]; }
     
    8692      Parameters.Add(new ValueLookupParameter<DoubleValue>("Error"));
    8793      Parameters.Add(new ValueLookupParameter<DoubleValue>("Fitness"));
     94      Parameters.Add(new ValueLookupParameter<BoolValue>("InsertInPopulation"));
     95      Parameters.Add(new ValueLookupParameter<IntValue>("TempID"));
    8896      Parameters.Add(new LookupParameter<IntValue>("CurrentIteration"));
    8997      Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("ParentAverageActionSetSize"));
     
    108116      ErrorParameter.ActualValue = new DoubleValue(0.25 * parentPrecisionError.Select(x => x.Value).Average());
    109117      FitnessParameter.ActualValue = new DoubleValue(0.1 * parentFitness.Select(x => x.Value).Average());
     118      InsertInPopulationParameter.ActualValue = new BoolValue(true);
     119      TempIDParameter.ActualValue = new IntValue(-1);
    110120      return base.Apply();
    111121    }
  • branches/LearningClassifierSystems/HeuristicLab.Encodings.ConditionActionEncoding/3.3/HeuristicLab.Encodings.ConditionActionEncoding-3.3.csproj

    r9105 r9110  
    9292    <Compile Include="Evaluators\IConditionActionEvaluator.cs" />
    9393    <Compile Include="Evaluators\IXCSEvaluator.cs" />
     94    <Compile Include="GA\InsertInPopulationOperator.cs" />
    9495    <Compile Include="GA\XCSAfterCrossoverOperator.cs" />
    9596    <Compile Include="IClassifier.cs" />
     
    102103    <Compile Include="Operator\MatchActionOperator.cs" />
    103104    <Compile Include="Operator\MatchConditionOperator.cs" />
    104     <Compile Include="Operator\SubScopeVariableCopier.cs" />
    105105    <Compile Include="Operator\SumAccuracy.cs" />
     106    <Compile Include="GA\TempSubScopeIDAssigner.cs" />
    106107    <Compile Include="Properties\AssemblyInfo.cs" />
    107108    <Compile Include="Plugin.cs" />
     
    111112    <Compile Include="Selectors\IMatchSelector.cs" />
    112113    <Compile Include="Selectors\MatchSelector.cs" />
    113     <Compile Include="Subsumption\ActionSetSubsumptionoperator.cs" />
     114    <Compile Include="Subsumption\ActionSetSubsumptionOperator.cs" />
     115    <Compile Include="Subsumption\CheckGASubsumptionOperator.cs" />
     116    <Compile Include="Subsumption\ExecuteGASubsumptionOperator.cs" />
    114117    <Compile Include="Subsumption\IActionSetSubsumption.cs" />
    115118    <None Include="Properties\AssemblyInfo.cs.frame" />
  • branches/LearningClassifierSystems/HeuristicLab.Encodings.ConditionActionEncoding/3.3/Interfaces/IConditionActionProblem.cs

    r9105 r9110  
    3333    IParameter ThetaMinimalNumberOfActionsParameter { get; }
    3434
     35    IParameter PossibleActionsConcreteClassParameter { get; }
    3536    IParameter PossibleActionsParameter { get; }
    36     IItemSet<IClassifier> PossibleActions { get; }
     37    //IItemSet<IClassifier> PossibleActions { get; }
    3738
    3839    ICoveringSolutionCreator CoveringSolutionCreator { get; }
  • branches/LearningClassifierSystems/HeuristicLab.Encodings.ConditionActionEncoding/3.3/Operator/MatchConditionOperator.cs

    r9089 r9110  
    3131  [StorableClass]
    3232  public class MatchConditionOperator : SingleSuccessorOperator {
    33     protected ILookupParameter<BoolValue> MatchConditionParameter {
     33    public ILookupParameter<BoolValue> MatchConditionParameter {
    3434      get { return (ILookupParameter<BoolValue>)Parameters["MatchCondition"]; }
    3535    }
  • branches/LearningClassifierSystems/HeuristicLab.Encodings.ConditionActionEncoding/3.3/Subsumption/ActionSetSubsumptionOperator.cs

    r9106 r9110  
    3131  [Item("ActionSetSubsumptionoperator", "Description missing")]
    3232  [StorableClass]
    33   public class ActionSetSubsumptionoperator : SingleSuccessorOperator, IActionSetSubsumption {
     33  public class ActionSetSubsumptionOperator : SingleSuccessorOperator, IActionSetSubsumption {
    3434
    3535    #region Parameter Properties
     
    4646      get { return (ILookupParameter<ItemArray<DoubleValue>>)Parameters["Errors"]; }
    4747    }
     48    public ILookupParameter<ItemArray<BoolValue>> HasBeenSubsumedParameter {
     49      get { return (ILookupParameter<ItemArray<BoolValue>>)Parameters["HasBeenSubsumed"]; }
     50    }
    4851    public ILookupParameter<DoubleValue> ErrorZeroParameter {
    4952      get { return (ILookupParameter<DoubleValue>)Parameters["ErrorZero"]; }
     
    5255      get { return (ILookupParameter<IntValue>)Parameters["ThetaSubsumption"]; }
    5356    }
    54     protected ScopeParameter CurrentScopeParameter {
    55       get { return (ScopeParameter)Parameters["CurrentScope"]; }
    56     }
    57     public IScope CurrentScope {
    58       get { return CurrentScopeParameter.ActualValue; }
    59     }
    60 
    61     public string HasBeenSubsumedParameterName {
    62       get { return "HasBeenSubsumed"; }
    63     }
    6457    #endregion
    6558
    6659    [StorableConstructor]
    67     protected ActionSetSubsumptionoperator(bool deserializing) : base(deserializing) { }
    68     protected ActionSetSubsumptionoperator(ActionSetSubsumptionoperator original, Cloner cloner)
     60    protected ActionSetSubsumptionOperator(bool deserializing) : base(deserializing) { }
     61    protected ActionSetSubsumptionOperator(ActionSetSubsumptionOperator original, Cloner cloner)
    6962      : base(original, cloner) {
    7063    }
    71     public ActionSetSubsumptionoperator()
     64    public ActionSetSubsumptionOperator()
    7265      : base() {
    7366      Parameters.Add(new ScopeTreeLookupParameter<IClassifier>("Classifiers"));
     
    7568      Parameters.Add(new ScopeTreeLookupParameter<IntValue>("Experiences"));
    7669      Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Errors"));
     70      Parameters.Add(new ScopeTreeLookupParameter<BoolValue>("HasBeenSubsumed"));
    7771      Parameters.Add(new LookupParameter<DoubleValue>("ErrorZero"));
    7872      Parameters.Add(new LookupParameter<IntValue>("ThetaSubsumption"));
    79       Parameters.Add(new ScopeParameter("CurrentScope"));
    8073    }
    8174    public override IDeepCloneable Clone(Cloner cloner) {
    82       return new ActionSetSubsumptionoperator(this, cloner);
     75      return new ActionSetSubsumptionOperator(this, cloner);
    8376    }
    8477
    8578    public override IOperation Apply() {
    86       var subscopes = CurrentScope.SubScopes;
    8779      var classifiers = ClassifiersParameter.ActualValue;
    8880      var numerosities = NumerositiesParameter.ActualValue;
    8981      var experiences = ExperiencesParameter.ActualValue;
     82      var hasBeenSubsumed = HasBeenSubsumedParameter.ActualValue;
    9083      var errors = ErrorsParameter.ActualValue;
    91       if (subscopes.Count != classifiers.Length || subscopes.Count != numerosities.Length
    92         || subscopes.Count != experiences.Length || subscopes.Count != errors.Length) {
    93         throw new ArgumentException("The number of subscopes is not equal to the number of classifiers.");
     84      if (errors.Length != classifiers.Length || errors.Length != numerosities.Length
     85        || errors.Length != experiences.Length || errors.Length != hasBeenSubsumed.Length) {
     86        throw new ArgumentException("The number of classifiers, error, numerosity, hasBeenSubsumed and experience values is not equal.");
    9487      }
    9588
     
    108101          if (classifiers[subsumptionClassifier].IsMoreGeneral(classifiers[i])) {
    109102            numerosities[subsumptionClassifier].Value += numerosities[i].Value;
    110             AddVariableToScope(subscopes[i], new BoolValue(true));
    111           } else {
    112             AddVariableToScope(subscopes[i], new BoolValue(false));
     103            hasBeenSubsumed[i].Value = true;
    113104          }
    114         }
    115       } else {
    116         for (int i = 0; i < classifiers.Length; i++) {
    117           AddVariableToScope(subscopes[i], new BoolValue(false));
    118105        }
    119106      }
    120107
    121108      return base.Apply();
    122     }
    123 
    124     private void AddVariableToScope(IScope scope, BoolValue boolValue) {
    125       if (scope.Variables.ContainsKey(HasBeenSubsumedParameterName)) {
    126         scope.Variables[HasBeenSubsumedParameterName].Value = boolValue;
    127       } else {
    128         scope.Variables.Add(new Variable(HasBeenSubsumedParameterName, boolValue));
    129       }
    130109    }
    131110
  • branches/LearningClassifierSystems/HeuristicLab.Encodings.ConditionActionEncoding/3.3/Subsumption/IActionSetSubsumption.cs

    r9105 r9110  
    3131    ILookupParameter<ItemArray<IntValue>> ExperiencesParameter { get; }
    3232    ILookupParameter<ItemArray<DoubleValue>> ErrorsParameter { get; }
     33    ILookupParameter<ItemArray<BoolValue>> HasBeenSubsumedParameter { get; }
    3334    ILookupParameter<DoubleValue> ErrorZeroParameter { get; }
    3435    ILookupParameter<IntValue> ThetaSubsumptionParameter { get; }
    35 
    36     string HasBeenSubsumedParameterName { get; }
    3736  }
    3837}
  • branches/LearningClassifierSystems/HeuristicLab.Problems.ConditionActionClassification/3.3/Implementation/ConditionActionClassificationProblem.cs

    r9105 r9110  
    7070      get { return (IFixedValueParameter<ItemSet<IClassifier>>)Parameters["PossibleActions"]; }
    7171    }
     72    public IFixedValueParameter<ItemSet<CombinedIntegerVector>> PossibleActionsConcreteClassParameter {
     73      get { return (IFixedValueParameter<ItemSet<CombinedIntegerVector>>)Parameters["PossibleActionsConcreteClass"]; }
     74    }
    7275    public IFixedValueParameter<IntValue> ThetaMinimalNumberOfActionsParameter {
    7376      get { return (IFixedValueParameter<IntValue>)Parameters["ThetaMinimalNumberOfActions"]; }
     
    9598      get { return ProblemDataParameter.Value; }
    9699    }
     100    IParameter IConditionActionProblem.PossibleActionsConcreteClassParameter {
     101      get { return PossibleActionsConcreteClassParameter; }
     102    }
     103    public ItemSet<CombinedIntegerVector> PossibleActionsConcreteClass {
     104      get { return PossibleActionsConcreteClassParameter.Value; }
     105    }
    97106    IParameter IConditionActionProblem.PossibleActionsParameter {
    98107      get { return PossibleActionsParameter; }
    99108    }
    100     IItemSet<IClassifier> IConditionActionProblem.PossibleActions {
    101       get { return PossibleActions; }
    102     }
     109    //IItemSet<IClassifier> IConditionActionProblem.PossibleActions {
     110    //  get { return PossibleActions; }
     111    //}
    103112    public ItemSet<IClassifier> PossibleActions {
    104113      get { return PossibleActionsParameter.Value; }
     
    121130
    122131
    123     public ActionSetSubsumptionoperator ActionSetSubsumptionOperator {
     132    public ActionSetSubsumptionOperator ActionSetSubsumptionOperator {
    124133      get { return ActionSetSubsumptionOperatorParameter.Value; }
    125134    }
    126     public ValueParameter<ActionSetSubsumptionoperator> ActionSetSubsumptionOperatorParameter {
    127       get { return (ValueParameter<ActionSetSubsumptionoperator>)Parameters[ActionSetSubsumptionOperatorParameterName]; }
     135    public ValueParameter<ActionSetSubsumptionOperator> ActionSetSubsumptionOperatorParameter {
     136      get { return (ValueParameter<ActionSetSubsumptionOperator>)Parameters[ActionSetSubsumptionOperatorParameterName]; }
    128137    }
    129138    IActionSetSubsumption IConditionActionProblem.ActionSetSubsumptionOperator { get { return ActionSetSubsumptionOperator; } }
     
    175184      Parameters.Add(new ValueParameter<CombinedIntegerVectorClassifierFetcher>(ClassifierFetcherParameterName, "", new CombinedIntegerVectorClassifierFetcher()));
    176185      Parameters.Add(new FixedValueParameter<ItemSet<IClassifier>>("PossibleActions"));
     186      Parameters.Add(new FixedValueParameter<ItemSet<CombinedIntegerVector>>("PossibleActionsConcreteClass"));
    177187      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)));
    178188
     
    180190      Parameters.Add(new FixedValueParameter<PercentValue>("ChangeSymbolProbabilityInCovering", "", new PercentValue(0.5)));
    181191
    182       Parameters.Add(new ValueParameter<ActionSetSubsumptionoperator>(ActionSetSubsumptionOperatorParameterName, "", new ActionSetSubsumptionoperator()));
     192      Parameters.Add(new ValueParameter<ActionSetSubsumptionOperator>(ActionSetSubsumptionOperatorParameterName, "", new ActionSetSubsumptionOperator()));
    183193
    184194      Evaluator.InitialErrorParameter.ActualName = "InitialError";
     
    237247      }
    238248      PossibleActions.Clear();
     249      PossibleActionsConcreteClass.Clear();
    239250      while (!done) {
    240251        PossibleActions.Add(new CombinedIntegerVector(curPos, actionLength, actionBounds));
     252        PossibleActionsConcreteClass.Add(new CombinedIntegerVector(curPos, actionLength, actionBounds));
    241253        curPos = GetNextAction(curPos, actionBounds, out done);
    242254      }
Note: See TracChangeset for help on using the changeset viewer.