Changeset 9194 for branches/LearningClassifierSystems/HeuristicLab.Problems.ConditionActionClassification/3.3/Implementation
- Timestamp:
- 01/28/13 17:54:46 (12 years ago)
- 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 69 69 get { return (IFixedValueParameter<DoubleValue>)Parameters["InitialFitness"]; } 70 70 } 71 public IFixedValueParameter<ItemSet<I Classifier>> PossibleActionsParameter {72 get { return (IFixedValueParameter<ItemSet<I Classifier>>)Parameters["PossibleActions"]; }71 public IFixedValueParameter<ItemSet<IAction>> PossibleActionsParameter { 72 get { return (IFixedValueParameter<ItemSet<IAction>>)Parameters["PossibleActions"]; } 73 73 } 74 74 public IFixedValueParameter<ItemSet<CombinedIntegerVector>> PossibleActionsConcreteClassParameter { … … 77 77 public IFixedValueParameter<IntValue> ThetaMinimalNumberOfActionsParameter { 78 78 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"]; } 79 82 } 80 83 #endregion … … 108 111 // get { return PossibleActions; } 109 112 //} 110 public ItemSet<I Classifier> PossibleActions {113 public ItemSet<IAction> PossibleActions { 111 114 get { return PossibleActionsParameter.Value; } 112 115 } … … 148 151 IParameter IConditionActionProblem.CoveringSolutionCreatorParameter { 149 152 get { return CoveringSolutionCreatorParameter; } 153 } 154 public IClassifierComparer ClassifierComparer { 155 get { return ClassifierComparerParameter.Value; } 156 } 157 IParameter IConditionActionProblem.ClassifierComparerParameter { 158 get { return ClassifierComparerParameter; } 150 159 } 151 160 #endregion … … 177 186 Parameters.Add(new ValueParameter<IActionExecuter>(ActionExecuterParameterName, "", new ActionExecuter())); 178 187 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))); 181 191 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))); 182 192 … … 191 201 192 202 coveringSolutionCreator.ChangeSymbolProbabilityParameter.ActualName = ChangeSymbolProbabilityInCoveringParameter.Name; 193 coveringSolutionCreator.Cover ClassifierParameter.ActualName = ClassifierFetcher.CurrentClassifierToMatchParameter.ActualName;203 coveringSolutionCreator.CoverInputParameter.ActualName = ClassifierFetcher.CurrentInputToMatchParameter.ActualName; 194 204 coveringSolutionCreator.CreatedClassifierParameter.ActualName = "CombinedIntegerVector"; 195 205 196 206 ClassifierFetcher.ProblemDataParameter.ActualName = ProblemDataParameter.Name; 197 207 198 ActionExecuter.Current ClassifierToMatchParameter.ActualName = ClassifierFetcher.CurrentClassifierToMatchParameter.ActualName;208 ActionExecuter.CurrentActionToMatchParameter.ActualName = ClassifierFetcher.CurrentActionToMatchParameter.ActualName; 199 209 ActionExecuter.NegativeRewardParameter.ActualName = NegativeRewardParameter.Name; 200 210 ActionExecuter.PositiveRewardParameter.ActualName = PositiveRewardParameter.Name; … … 241 251 xcsAnalyzer.ProblemDataParameter.ActualName = ProblemDataParameter.Name; 242 252 xcsAnalyzer.ResultsParameter.ActualName = "Results"; 253 xcsAnalyzer.ClassifierComparerParameter.ActualName = ClassifierComparerParameter.Name; 243 254 } 244 255 } -
branches/LearningClassifierSystems/HeuristicLab.Problems.ConditionActionClassification/3.3/Implementation/ConditionActionClassificationProblemData.cs
r9167 r9194 119 119 #endregion 120 120 121 private IDictionary<int, IClassifier> fetchClassifiersCache = new Dictionary<int, IClassifier>();122 123 124 121 [StorableConstructor] 125 122 protected ConditionActionClassificationProblemData(bool deserializing) : base(deserializing) { } … … 201 198 } 202 199 203 public IEnumerable<I Classifier> FetchClassifier(IEnumerable<int> rows) {200 public IEnumerable<IInput> FetchInput(IEnumerable<int> rows) { 204 201 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) { 210 220 if (!fetchClassifiersCache.ContainsKey(rowNumber)) { 211 221 int[] elements = new int[Length.Value]; … … 231 241 return fetchClassifiersCache[rowNumber]; 232 242 } 243 #endregion 233 244 } 234 245 }
Note: See TracChangeset
for help on using the changeset viewer.