Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/28/13 17:54:46 (12 years ago)
Author:
sforsten
Message:

#1980:

  • added necessary interface ICondition, IAction, IInput
  • removed not used class MatchSelector and interface IMatchSelector
  • added constructors to ItemDictionary
  • added new encoding
Location:
branches/LearningClassifierSystems/HeuristicLab.Problems.ConditionActionClassification/3.3/Implementation
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/LearningClassifierSystems/HeuristicLab.Problems.ConditionActionClassification/3.3/Implementation/ConditionActionClassificationProblem.cs

    r9175 r9194  
    6969      get { return (IFixedValueParameter<DoubleValue>)Parameters["InitialFitness"]; }
    7070    }
    71     public IFixedValueParameter<ItemSet<IClassifier>> PossibleActionsParameter {
    72       get { return (IFixedValueParameter<ItemSet<IClassifier>>)Parameters["PossibleActions"]; }
     71    public IFixedValueParameter<ItemSet<IAction>> PossibleActionsParameter {
     72      get { return (IFixedValueParameter<ItemSet<IAction>>)Parameters["PossibleActions"]; }
    7373    }
    7474    public IFixedValueParameter<ItemSet<CombinedIntegerVector>> PossibleActionsConcreteClassParameter {
     
    7777    public IFixedValueParameter<IntValue> ThetaMinimalNumberOfActionsParameter {
    7878      get { return (IFixedValueParameter<IntValue>)Parameters["ThetaMinimalNumberOfActions"]; }
     79    }
     80    public IFixedValueParameter<HeuristicLab.Encodings.CombinedIntegerVectorEncoding.CombinedIntegerVector.CombinedIntegerVectorComparer> ClassifierComparerParameter {
     81      get { return (IFixedValueParameter<HeuristicLab.Encodings.CombinedIntegerVectorEncoding.CombinedIntegerVector.CombinedIntegerVectorComparer>)Parameters["ClassifierComparer"]; }
    7982    }
    8083    #endregion
     
    108111    //  get { return PossibleActions; }
    109112    //}
    110     public ItemSet<IClassifier> PossibleActions {
     113    public ItemSet<IAction> PossibleActions {
    111114      get { return PossibleActionsParameter.Value; }
    112115    }
     
    148151    IParameter IConditionActionProblem.CoveringSolutionCreatorParameter {
    149152      get { return CoveringSolutionCreatorParameter; }
     153    }
     154    public IClassifierComparer ClassifierComparer {
     155      get { return ClassifierComparerParameter.Value; }
     156    }
     157    IParameter IConditionActionProblem.ClassifierComparerParameter {
     158      get { return ClassifierComparerParameter; }
    150159    }
    151160    #endregion
     
    177186      Parameters.Add(new ValueParameter<IActionExecuter>(ActionExecuterParameterName, "", new ActionExecuter()));
    178187      Parameters.Add(new ValueParameter<ClassifierFetcher>(ClassifierFetcherParameterName, "", new ClassifierFetcher()));
    179       Parameters.Add(new FixedValueParameter<ItemSet<IClassifier>>("PossibleActions"));
    180       Parameters.Add(new FixedValueParameter<ItemSet<CombinedIntegerVector>>("PossibleActionsConcreteClass"));
     188      Parameters.Add(new FixedValueParameter<HeuristicLab.Encodings.CombinedIntegerVectorEncoding.CombinedIntegerVector.CombinedIntegerVectorComparer>("ClassifierComparer", new HeuristicLab.Encodings.CombinedIntegerVectorEncoding.CombinedIntegerVector.CombinedIntegerVectorComparer()));
     189      Parameters.Add(new FixedValueParameter<ItemSet<IAction>>("PossibleActions", new ItemSet<IAction>(ClassifierComparer)));
     190      Parameters.Add(new FixedValueParameter<ItemSet<CombinedIntegerVector>>("PossibleActionsConcreteClass", new ItemSet<CombinedIntegerVector>(ClassifierComparer)));
    181191      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)));
    182192
     
    191201
    192202      coveringSolutionCreator.ChangeSymbolProbabilityParameter.ActualName = ChangeSymbolProbabilityInCoveringParameter.Name;
    193       coveringSolutionCreator.CoverClassifierParameter.ActualName = ClassifierFetcher.CurrentClassifierToMatchParameter.ActualName;
     203      coveringSolutionCreator.CoverInputParameter.ActualName = ClassifierFetcher.CurrentInputToMatchParameter.ActualName;
    194204      coveringSolutionCreator.CreatedClassifierParameter.ActualName = "CombinedIntegerVector";
    195205
    196206      ClassifierFetcher.ProblemDataParameter.ActualName = ProblemDataParameter.Name;
    197207
    198       ActionExecuter.CurrentClassifierToMatchParameter.ActualName = ClassifierFetcher.CurrentClassifierToMatchParameter.ActualName;
     208      ActionExecuter.CurrentActionToMatchParameter.ActualName = ClassifierFetcher.CurrentActionToMatchParameter.ActualName;
    199209      ActionExecuter.NegativeRewardParameter.ActualName = NegativeRewardParameter.Name;
    200210      ActionExecuter.PositiveRewardParameter.ActualName = PositiveRewardParameter.Name;
     
    241251        xcsAnalyzer.ProblemDataParameter.ActualName = ProblemDataParameter.Name;
    242252        xcsAnalyzer.ResultsParameter.ActualName = "Results";
     253        xcsAnalyzer.ClassifierComparerParameter.ActualName = ClassifierComparerParameter.Name;
    243254      }
    244255    }
  • branches/LearningClassifierSystems/HeuristicLab.Problems.ConditionActionClassification/3.3/Implementation/ConditionActionClassificationProblemData.cs

    r9167 r9194  
    119119    #endregion
    120120
    121     private IDictionary<int, IClassifier> fetchClassifiersCache = new Dictionary<int, IClassifier>();
    122 
    123 
    124121    [StorableConstructor]
    125122    protected ConditionActionClassificationProblemData(bool deserializing) : base(deserializing) { }
     
    201198    }
    202199
    203     public IEnumerable<IClassifier> FetchClassifier(IEnumerable<int> rows) {
     200    public IEnumerable<IInput> FetchInput(IEnumerable<int> rows) {
    204201      foreach (var row in rows) {
    205         yield return FetchClassifier(row);
    206       }
    207     }
    208 
    209     public IClassifier FetchClassifier(int rowNumber) {
     202        yield return FetchInput(row);
     203      }
     204    }
     205    public IInput FetchInput(int rowNumber) {
     206      return FetchClassifier(rowNumber).Condition as IInput;
     207    }
     208    public IEnumerable<IAction> FetchAction(IEnumerable<int> rows) {
     209      foreach (var row in rows) {
     210        yield return FetchAction(row);
     211      }
     212    }
     213    public IAction FetchAction(int rowNumber) {
     214      return FetchClassifier(rowNumber).Action;
     215    }
     216    #region fetchHelper
     217    private IDictionary<int, IClassifier> fetchClassifiersCache = new Dictionary<int, IClassifier>();
     218
     219    private IClassifier FetchClassifier(int rowNumber) {
    210220      if (!fetchClassifiersCache.ContainsKey(rowNumber)) {
    211221        int[] elements = new int[Length.Value];
     
    231241      return fetchClassifiersCache[rowNumber];
    232242    }
     243    #endregion
    233244  }
    234245}
Note: See TracChangeset for help on using the changeset viewer.