Changeset 9154 for branches/LearningClassifierSystems/HeuristicLab.Problems.ConditionActionClassification/3.3/Implementation/ConditionActionClassificationProblem.cs
- Timestamp:
- 01/14/13 15:23:17 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/LearningClassifierSystems/HeuristicLab.Problems.ConditionActionClassification/3.3/Implementation/ConditionActionClassificationProblem.cs
r9110 r9154 76 76 get { return (IFixedValueParameter<IntValue>)Parameters["ThetaMinimalNumberOfActions"]; } 77 77 } 78 //for test purposes79 public IFixedValueParameter<IntValue> LengthParameter {80 get { return (IFixedValueParameter<IntValue>)Parameters["Length"]; }81 }82 public IFixedValueParameter<IntValue> ActionPartLengthParameter {83 get { return (IFixedValueParameter<IntValue>)Parameters["ActionPartLength"]; }84 }85 public IFixedValueParameter<IntMatrix> BoundsParameter {86 get { return (IFixedValueParameter<IntMatrix>)Parameters["Bounds"]; }87 }88 78 #endregion 89 79 … … 120 110 } 121 111 IParameter IConditionActionProblem.ActionExecuterParameter { get { return ActionExecuterParameter; } } 122 public C ombinedIntegerVectorClassifierFetcher ClassifierFetcher {112 public ClassifierFetcher ClassifierFetcher { 123 113 get { return ClassifierFetcherParameter.Value; } 124 114 } 125 public ValueParameter<C ombinedIntegerVectorClassifierFetcher> ClassifierFetcherParameter {126 get { return (ValueParameter<C ombinedIntegerVectorClassifierFetcher>)Parameters[ClassifierFetcherParameterName]; }115 public ValueParameter<ClassifierFetcher> ClassifierFetcherParameter { 116 get { return (ValueParameter<ClassifierFetcher>)Parameters[ClassifierFetcherParameterName]; } 127 117 } 128 118 IClassifierFetcher IConditionActionProblem.ClassifierFetcher { get { return ClassifierFetcher; } } … … 150 140 IParameter IConditionActionProblem.CoveringSolutionCreatorParameter { 151 141 get { return CoveringSolutionCreatorParameter; } 142 } 143 private XCSSolutionAnalyzer XCSSolutionAnalyzer { 144 get { return Operators.OfType<XCSSolutionAnalyzer>().FirstOrDefault(); } 152 145 } 153 146 #endregion … … 170 163 public ConditionActionClassificationProblem(ConditionActionClassificationProblemData problemData, XCSEvaluator evaluator, UniformRandomCombinedIntegerVectorCreator solutionCreator, ICoveringSolutionCreator coveringSolutionCreator) 171 164 : base(evaluator, solutionCreator) { 172 Parameters.Add(new FixedValueParameter<IntValue>("Length", "The operator to create a solution.", new IntValue(7)));173 Parameters.Add(new FixedValueParameter<IntValue>("ActionPartLength", "The operator to create a solution.", new IntValue(1)));174 int[,] elements = new int[,] { { 0, 3 }, { 0, 3 }, { 0, 3 }, { 0, 3 }, { 0, 3 }, { 0, 3 }, { 0, 2 } };175 Parameters.Add(new FixedValueParameter<IntMatrix>("Bounds", "The operator to create a solution.", new IntMatrix(elements)));176 165 Parameters.Add(new ValueParameter<ConditionActionClassificationProblemData>("ProblemData", "", problemData)); 177 166 Parameters.Add(new FixedValueParameter<DoubleValue>("PositiveReward", "", new DoubleValue(1000))); … … 182 171 183 172 Parameters.Add(new ValueParameter<IActionExecuter>(ActionExecuterParameterName, "", new ActionExecuter())); 184 Parameters.Add(new ValueParameter<C ombinedIntegerVectorClassifierFetcher>(ClassifierFetcherParameterName, "", new CombinedIntegerVectorClassifierFetcher()));173 Parameters.Add(new ValueParameter<ClassifierFetcher>(ClassifierFetcherParameterName, "", new ClassifierFetcher())); 185 174 Parameters.Add(new FixedValueParameter<ItemSet<IClassifier>>("PossibleActions")); 186 175 Parameters.Add(new FixedValueParameter<ItemSet<CombinedIntegerVector>>("PossibleActionsConcreteClass")); … … 196 185 Evaluator.InitialPredictionParameter.ActualName = "InitialPrediction"; 197 186 198 SolutionCreator.ActionPartLengthParameter.ActualName = ActionPartLengthParameter.Name;199 SolutionCreator.LengthParameter.ActualName = LengthParameter.Name;200 SolutionCreator.BoundsParameter.ActualName = BoundsParameter.Name;187 SolutionCreator.ActionPartLengthParameter.ActualName = ProblemData.ActionLengthParameter.Name; 188 SolutionCreator.LengthParameter.ActualName = ProblemData.LengthParameter.Name; 189 SolutionCreator.BoundsParameter.ActualName = ProblemData.BoundsParameter.Name; 201 190 202 191 coveringSolutionCreator.ChangeSymbolProbabilityParameter.ActualName = ChangeSymbolProbabilityInCoveringParameter.Name; … … 204 193 coveringSolutionCreator.CreatedClassifierParameter.ActualName = "CombinedIntegerVector"; 205 194 206 ClassifierFetcher.ActionPartLengthParameter.ActualName = ActionPartLengthParameter.Name;207 ClassifierFetcher.BoundsParameter.ActualName = BoundsParameter.Name;208 195 ClassifierFetcher.ProblemDataParameter.ActualName = ProblemDataParameter.Name; 209 196 … … 217 204 ThetaMinimalNumberOfActions.Value = PossibleActions.Count; 218 205 219 BoundsParameter.ValueChanged += new System.EventHandler(BoundsParameter_ValueChanged); 220 LengthParameter.ValueChanged += new System.EventHandler(LengthParameter_ValueChanged); 221 ActionPartLengthParameter.ValueChanged += new System.EventHandler(ActionPartLengthParameter_ValueChanged); 222 } 223 224 #region event handler 225 private void ActionPartLengthParameter_ValueChanged(object sender, System.EventArgs e) { 206 InitializeOperators(); 207 208 problemData.Changed += new System.EventHandler(problemData_Changed); 209 } 210 211 private void problemData_Changed(object sender, System.EventArgs e) { 226 212 SetPossibleActions(); 227 213 } 228 private void LengthParameter_ValueChanged(object sender, System.EventArgs e) { 229 SetPossibleActions(); 230 } 231 private void BoundsParameter_ValueChanged(object sender, System.EventArgs e) { 232 SetPossibleActions(); 233 } 234 #endregion 214 215 private void InitializeOperators() { 216 Operators.Add(new XCSSolutionAnalyzer()); 217 218 ParameterizeAnalyzers(); 219 } 220 221 private void ParameterizeAnalyzers() { 222 if (XCSSolutionAnalyzer != null) { 223 XCSSolutionAnalyzer.ClassifierParameter.ActualName = SolutionCreator.CombinedIntegerVectorParameter.ActualName; 224 XCSSolutionAnalyzer.PredictionParameter.ActualName = Evaluator.PredictionParameter.ActualName; 225 XCSSolutionAnalyzer.ErrorParameter.ActualName = Evaluator.ErrorParameter.ActualName; 226 XCSSolutionAnalyzer.FitnessParameter.ActualName = Evaluator.FitnessParameter.ActualName; 227 XCSSolutionAnalyzer.ExperienceParameter.ActualName = Evaluator.ExperienceParameter.ActualName; 228 XCSSolutionAnalyzer.AverageActionSetSizeParameter.ActualName = Evaluator.AverageActionSetSizeParameter.ActualName; 229 XCSSolutionAnalyzer.NumerosityParameter.ActualName = Evaluator.NumerosityParameter.ActualName; 230 XCSSolutionAnalyzer.TimestampParameter.ActualName = Evaluator.TimestampParameter.ActualName; 231 XCSSolutionAnalyzer.ProblemDataParameter.ActualName = ProblemDataParameter.Name; 232 XCSSolutionAnalyzer.ResultsParameter.ActualName = "Results"; 233 } 234 } 235 235 236 236 private void SetPossibleActions() { 237 237 //get bounds of action 238 IntMatrix actionBounds = GetElementsOfBoundsForAction( BoundsParameter.Value, LengthParameter.Value.Value, ActionPartLengthParameter.Value.Value);239 int actionLength = ActionPartLengthParameter.Value.Value;240 int start = LengthParameter.Value.Value - actionLength;238 IntMatrix actionBounds = GetElementsOfBoundsForAction(ProblemData.Bounds, ProblemData.Length.Value, ProblemData.ActionLength.Value); 239 int actionLength = ProblemData.ActionLength.Value; 240 int start = ProblemData.Length.Value - actionLength; 241 241 int[] elements = new int[actionLength]; 242 242 int[] curPos = new int[actionLength];
Note: See TracChangeset
for help on using the changeset viewer.