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.Encodings.ConditionActionEncoding/3.3/Operator
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/LearningClassifierSystems/HeuristicLab.Encodings.ConditionActionEncoding/3.3/Operator/CountNumberOfUniqueActions.cs

    r9090 r9194  
    3535      get { return (ILookupParameter<ItemArray<IClassifier>>)Parameters["Classifiers"]; }
    3636    }
    37     public IValueLookupParameter<IItemSet<IClassifier>> UniqueActionsParameter {
    38       get { return (IValueLookupParameter<IItemSet<IClassifier>>)Parameters["UniqueActions"]; }
     37    public ILookupParameter<IClassifierComparer> ClassifierComparerParameter {
     38      get { return (ILookupParameter<IClassifierComparer>)Parameters["ClassifierComparer"]; }
     39    }
     40    public IValueLookupParameter<IItemSet<IAction>> UniqueActionsParameter {
     41      get { return (IValueLookupParameter<IItemSet<IAction>>)Parameters["UniqueActions"]; }
    3942    }
    4043    public IValueLookupParameter<IntValue> NumberOfUniqueActionsParameter {
     
    5356      : base() {
    5457      Parameters.Add(new ScopeTreeLookupParameter<IClassifier>("Classifiers"));
    55       Parameters.Add(new ValueLookupParameter<IItemSet<IClassifier>>("UniqueActions"));
     58      Parameters.Add(new LookupParameter<IClassifierComparer>("ClassifierComparer"));
     59      Parameters.Add(new ValueLookupParameter<IItemSet<IAction>>("UniqueActions"));
    5660      Parameters.Add(new ValueLookupParameter<IntValue>("NumberOfUniqueActions"));
    5761    }
    5862
    5963    public override IOperation Apply() {
    60       ItemSet<IClassifier> actions = new ItemSet<IClassifier>();
     64      ItemSet<IAction> actions = new ItemSet<IAction>(ClassifierComparerParameter.ActualValue);
    6165      foreach (var classifier in ClassifiersParameter.ActualValue) {
    6266        actions.Add(classifier.Action);
  • branches/LearningClassifierSystems/HeuristicLab.Encodings.ConditionActionEncoding/3.3/Operator/MatchActionOperator.cs

    r9089 r9194  
    3434      get { return (ILookupParameter<BoolValue>)Parameters["MatchAction"]; }
    3535    }
    36     public ILookupParameter<IClassifier> TargetMatchParameter {
    37       get { return (ILookupParameter<IClassifier>)Parameters["TargetMatchParameter"]; }
     36    public ILookupParameter<IAction> TargetMatchParameter {
     37      get { return (ILookupParameter<IAction>)Parameters["TargetMatchParameter"]; }
    3838    }
    3939    public ILookupParameter<IClassifier> MatchParameter {
     
    4949      : base() {
    5050      Parameters.Add(new LookupParameter<BoolValue>("MatchAction", "True if the action matches."));
    51       Parameters.Add(new ValueLookupParameter<IClassifier>("TargetMatchParameter", "Target that has to be matched by the match parameter."));
     51      Parameters.Add(new ValueLookupParameter<IAction>("TargetMatchParameter", "Target that has to be matched by the match parameter."));
    5252      Parameters.Add(new ValueLookupParameter<IClassifier>("MatchParameter", "The matching encoding contained in each sub-scope which is used for selection."));
    5353    }
     
    5757
    5858    public override IOperation Apply() {
    59       IClassifier target = TargetMatchParameter.ActualValue;
     59      IAction target = TargetMatchParameter.ActualValue;
    6060      IClassifier match = MatchParameter.ActualValue;
    6161      MatchActionParameter.ActualValue = new BoolValue(match.MatchAction(target));
  • branches/LearningClassifierSystems/HeuristicLab.Encodings.ConditionActionEncoding/3.3/Operator/MatchConditionOperator.cs

    r9110 r9194  
    3434      get { return (ILookupParameter<BoolValue>)Parameters["MatchCondition"]; }
    3535    }
    36     public ILookupParameter<IClassifier> TargetMatchParameter {
    37       get { return (ILookupParameter<IClassifier>)Parameters["TargetMatchParameter"]; }
     36    public ILookupParameter<IInput> TargetMatchParameter {
     37      get { return (ILookupParameter<IInput>)Parameters["TargetMatchParameter"]; }
    3838    }
    3939    public ILookupParameter<IClassifier> MatchParameter {
     
    4949      : base() {
    5050      Parameters.Add(new LookupParameter<BoolValue>("MatchCondition", "True if the condition matches."));
    51       Parameters.Add(new ValueLookupParameter<IClassifier>("TargetMatchParameter", "Target that has to be matched by the match parameter."));
     51      Parameters.Add(new ValueLookupParameter<IInput>("TargetMatchParameter", "Target that has to be matched by the match parameter."));
    5252      Parameters.Add(new ValueLookupParameter<IClassifier>("MatchParameter", "The matching encoding contained in each sub-scope which is used for selection."));
    5353    }
     
    5757
    5858    public override IOperation Apply() {
    59       IClassifier target = TargetMatchParameter.ActualValue;
     59      IInput target = TargetMatchParameter.ActualValue;
    6060      IClassifier match = MatchParameter.ActualValue;
    61       MatchConditionParameter.ActualValue = new BoolValue(match.MatchCondition(target));
     61      MatchConditionParameter.ActualValue = new BoolValue(match.MatchInput(target));
    6262      return base.Apply();
    6363    }
  • branches/LearningClassifierSystems/HeuristicLab.Encodings.ConditionActionEncoding/3.3/Operator/PredictionArrayCalculator.cs

    r9089 r9194  
    3333  public class PredictionArrayCalculator : SingleSuccessorOperator {
    3434
     35    public ILookupParameter<IClassifierComparer> ClassifierComparerParameter {
     36      get { return (ILookupParameter<IClassifierComparer>)Parameters["ClassifierComparer"]; }
     37    }
    3538    public ILookupParameter<ItemArray<DoubleValue>> FitnessParameter {
    3639      get { return (ILookupParameter<ItemArray<DoubleValue>>)Parameters["Fitness"]; }
     
    3942      get { return (ILookupParameter<ItemArray<DoubleValue>>)Parameters["Prediction"]; }
    4043    }
    41     public IValueParameter<IItemDictionary<IClassifier, DoubleValue>> PredictionArrayParameter {
    42       get { return (IValueParameter<IItemDictionary<IClassifier, DoubleValue>>)Parameters["PredictionArray"]; }
     44    public IValueParameter<IItemDictionary<IAction, DoubleValue>> PredictionArrayParameter {
     45      get { return (IValueParameter<IItemDictionary<IAction, DoubleValue>>)Parameters["PredictionArray"]; }
    4346    }
    4447    public ILookupParameter<ItemArray<IClassifier>> MatchParameter {
     
    5356    public PredictionArrayCalculator()
    5457      : base() {
     58      Parameters.Add(new LookupParameter<IClassifierComparer>("ClassifierComparer"));
    5559      Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Fitness"));
    5660      Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Prediction"));
    57       Parameters.Add(new ValueLookupParameter<IItemDictionary<IClassifier, DoubleValue>>("PredictionArray"));
     61      Parameters.Add(new ValueLookupParameter<IItemDictionary<IAction, DoubleValue>>("PredictionArray"));
    5862      Parameters.Add(new ScopeParameter("CurrentScope", "The current scope from which sub-scopes should be selected."));
    5963      Parameters.Add(new ScopeTreeLookupParameter<IClassifier>("MatchParameter", "The matching encoding contained in each sub-scope which is used for selection."));
     
    6468
    6569    public sealed override IOperation Apply() {
    66       IItemDictionary<IClassifier, DoubleValue> predictionArray = new ItemDictionary<IClassifier, DoubleValue>();
    67       IDictionary<IClassifier, double> fitnessSumPerAction = new Dictionary<IClassifier, double>();
     70      IItemDictionary<IAction, DoubleValue> predictionArray = new ItemDictionary<IAction, DoubleValue>(ClassifierComparerParameter.ActualValue);
     71      IDictionary<IAction, double> fitnessSumPerAction = new Dictionary<IAction, double>(ClassifierComparerParameter.ActualValue);
    6872      ItemArray<DoubleValue> fitnesses = FitnessParameter.ActualValue;
    6973      ItemArray<DoubleValue> predictions = PredictionParameter.ActualValue;
Note: See TracChangeset for help on using the changeset viewer.