Changeset 9105
- Timestamp:
- 01/03/13 20:19:00 (12 years ago)
- Location:
- branches/LearningClassifierSystems
- Files:
-
- 11 added
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/LearningClassifierSystems/HeuristicLab.Algorithms.LearningClassifierSystems/3.3/LCSAdaptedGeneticAlgorithm.cs
r9089 r9105 52 52 get { return (ValueLookupParameter<IOperator>)Parameters["Crossover"]; } 53 53 } 54 public ValueLookupParameter<IOperator> AfterCrossoverParameter { 55 get { return (ValueLookupParameter<IOperator>)Parameters["AfterCrossover"]; } 56 } 54 57 public ValueLookupParameter<PercentValue> MutationProbabilityParameter { 55 58 get { return (ValueLookupParameter<PercentValue>)Parameters["MutationProbability"]; } … … 102 105 Parameters.Add(new ValueLookupParameter<IOperator>("Selector", "The operator used to select solutions for reproduction.")); 103 106 Parameters.Add(new ValueLookupParameter<IOperator>("Crossover", "The operator used to cross solutions.")); 107 Parameters.Add(new ValueLookupParameter<IOperator>("AfterCrossover", "The operator executed after crossing the solutions.")); 104 108 Parameters.Add(new ValueLookupParameter<PercentValue>("MutationProbability", "The probability that the mutation operator is applied on a solution.")); 105 109 Parameters.Add(new ValueLookupParameter<IOperator>("Mutator", "The operator used to mutate solutions.")); … … 121 125 UniformSubScopesProcessor uniformSubScopesProcessor1 = new UniformSubScopesProcessor(); 122 126 Placeholder crossover = new Placeholder(); 123 DataReducer dataReducer = new DataReducer();127 Placeholder afterCrossover = new Placeholder(); 124 128 StochasticBranch stochasticBranch = new StochasticBranch(); 125 129 Placeholder mutator = new Placeholder(); 126 130 SubScopesRemover subScopesRemover = new SubScopesRemover(); 127 131 SubScopesCounter subScopesCounter = new SubScopesCounter(); 128 SubScopesProcessor subScopesProcessor2 = new SubScopesProcessor();129 BestSelector bestSelector = new BestSelector();130 RightReducer rightReducer = new RightReducer();131 132 MergingReducer mergingReducer = new MergingReducer(); 132 133 IntCounter intCounter = new IntCounter(); … … 151 152 crossover.OperatorParameter.ActualName = "Crossover"; 152 153 153 dataReducer.Name = "Average Fitness of Parents"; 154 dataReducer.ParameterToReduce.ActualName = "Fitness"; 155 dataReducer.ReductionOperation.Value = new ReductionOperation(ReductionOperations.Avg); 156 dataReducer.TargetParameter.ActualName = "Fitness"; 157 dataReducer.TargetOperation.Value = new ReductionOperation(ReductionOperations.Assign); 154 afterCrossover.Name = "AfterCrossover"; 155 afterCrossover.OperatorParameter.ActualName = "AfterCrossover"; 158 156 159 157 stochasticBranch.ProbabilityParameter.ActualName = "MutationProbability"; … … 167 165 subScopesCounter.Name = "Increment EvaluatedSolutions"; 168 166 subScopesCounter.ValueParameter.ActualName = EvaluatedSolutionsParameter.Name; 169 170 bestSelector.CopySelected = new BoolValue(false);171 bestSelector.MaximizationParameter.ActualName = "Maximization";172 bestSelector.NumberOfSelectedSubScopesParameter.ActualName = "N";173 bestSelector.QualityParameter.ActualName = "Fitness";174 167 175 168 intCounter.Increment = new IntValue(1); … … 195 188 subScopesProcessor1.Operators.Add(new EmptyOperator()); 196 189 subScopesProcessor1.Operators.Add(childrenCreator); 197 subScopesProcessor1.Successor = subScopesProcessor2;190 subScopesProcessor1.Successor = mergingReducer; 198 191 childrenCreator.Successor = uniformSubScopesProcessor1; 199 192 uniformSubScopesProcessor1.Operator = crossover; 200 193 uniformSubScopesProcessor1.Successor = subScopesCounter; 201 crossover.Successor = dataReducer;202 dataReducer.Successor = stochasticBranch;194 crossover.Successor = afterCrossover; 195 afterCrossover.Successor = stochasticBranch; 203 196 stochasticBranch.FirstBranch = mutator; 204 197 stochasticBranch.SecondBranch = null; … … 207 200 subScopesRemover.Successor = null; 208 201 subScopesCounter.Successor = null; 209 subScopesProcessor2.Operators.Add(bestSelector);210 subScopesProcessor2.Operators.Add(new EmptyOperator());211 subScopesProcessor2.Successor = mergingReducer;212 bestSelector.Successor = rightReducer;213 rightReducer.Successor = null;214 202 mergingReducer.Successor = intCounter; 215 203 intCounter.Successor = comparator; -
branches/LearningClassifierSystems/HeuristicLab.Algorithms.LearningClassifierSystems/3.3/LearningClassifierSystemMainLoop.cs
r9090 r9105 50 50 get { return (IConstrainedValueParameter<IManipulator>)Parameters["Mutator"]; } 51 51 } 52 public IConstrainedValueParameter<IOperator> AfterCrossoverParameter { 53 get { return (IConstrainedValueParameter<IOperator>)Parameters["AfterCrossover"]; } 54 } 52 55 #endregion 53 56 … … 57 60 private PredictionArrayCalculator predictionArrayCalculator; 58 61 private ActionSelector actionSelector; 62 private DoDeletionBeforeCoveringOperator doDeletionBeforeCovering; 59 63 private CoveringOperator covering; 64 private ConditionalSelector subsumptionSelector; 60 65 61 66 private Placeholder evaluator; 62 67 private Placeholder actionExecuter; 63 68 private Placeholder classifierFetcher; 69 private Placeholder actionSetSubsumption; 64 70 #endregion 65 71 … … 85 91 test.IntegerVectorParameter.ActualName = "CombinedIntegerVector"; 86 92 Parameters.Add(new OptionalConstrainedValueParameter<IManipulator>("Mutator", "The operator used to mutate solutions.", new ItemSet<IManipulator>() { new UniformOnePositionManipulator() }, test)); 93 XCSAfterCrossoverOperator afterCrossover = new XCSAfterCrossoverOperator(); 94 Parameters.Add(new ConstrainedValueParameter<IOperator>("AfterCrossover", "The operator used to select solutions for reproduction.", new ItemSet<IOperator>() { new XCSAfterCrossoverOperator() }, afterCrossover)); 87 95 #endregion 88 96 … … 91 99 ConditionalBranch initialPopulationConditionalBranch = new ConditionalBranch(); 92 100 initialSolutionsCreator = new SolutionsCreator(); 101 Assigner initialPopulationSizeAssigner = new Assigner(); 93 102 IntCounter iterationCounter = new IntCounter(); 94 103 UniformSubScopesProcessor matchCondtionSubScopesProcessor = new UniformSubScopesProcessor(); … … 102 111 SubScopesProcessor matchSetSubScopesProcessor = new SubScopesProcessor(); 103 112 CountNumberOfUniqueActions countNumberOfUniqueActions = new CountNumberOfUniqueActions(); 113 doDeletionBeforeCovering = new DoDeletionBeforeCoveringOperator(); 114 ConditionalBranch doDeletionBeforeCoveringConditionalBranch = new ConditionalBranch(); 115 MergingReducer matchSetMergingReducerForDeletion = new MergingReducer(); 116 SubScopeVariableCopier subscopeVariableCopier = new SubScopeVariableCopier(); 117 XCSDeletionOperator deletionOperator = new XCSDeletionOperator(); 118 ConditionalSelector deletionSelector = new ConditionalSelector(); 119 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(); 104 125 covering = new CoveringOperator(); 105 MergingReducer mergingReducer = new MergingReducer();106 MergingReducer m ergingReducerWithSuccessor = new MergingReducer();126 MergingReducer actionSetMergingReducer = new MergingReducer(); 127 MergingReducer matchSetMergingReducer = new MergingReducer(); 107 128 evaluator = new Placeholder(); 108 129 SubScopesProcessor actionSetSubScopesProcessor = new SubScopesProcessor(); … … 112 133 SumAccuracy sumAccuracy = new SumAccuracy(); 113 134 UniformSubScopesProcessor updateParametersSubScopesProcessor = new UniformSubScopesProcessor(); 135 ConditionalBranch actionSetSubsumptionBranch = new ConditionalBranch(); 136 subsumptionSelector = new ConditionalSelector(); 137 LeftReducer leftReducer = new LeftReducer(); 138 XCSCheckIfGAShouldBeApplied checkIfGAShouldRun = new XCSCheckIfGAShouldBeApplied(); 139 ConditionalBranch runGAConditionalBranch = new ConditionalBranch(); 140 UniformSubScopesProcessor timestampAssignerSubscopeProcessor = new UniformSubScopesProcessor(); 141 Assigner timestampAssigner = new Assigner(); 114 142 LCSAdaptedGeneticAlgorithm adaptedGeneticAlgorithmMainLoop = new LCSAdaptedGeneticAlgorithm(); 143 IntCounter currentPopulationSizeCounter = new IntCounter(); 144 CalculateNumberOfDeletionsOperator calculateNumberOfDeletions = new CalculateNumberOfDeletionsOperator(); 145 XCSDeletionOperator deletionOperatorAfterGA = new XCSDeletionOperator(); 146 ConditionalSelector deletionSelectorAfterGA = new ConditionalSelector(); 147 LeftReducer leftReducerAfterGA = new LeftReducer(); 115 148 116 149 classifierFetcher = new Placeholder(); 117 150 actionExecuter = new Placeholder(); 151 actionSetSubsumption = new Placeholder(); 118 152 119 153 variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("ZeroIntValue", new IntValue(0))); 120 154 variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("OneIntValue", new IntValue(1))); 121 155 variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Iteration", new IntValue(0))); 156 variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("CurrentPopulationSize", new IntValue(0))); 122 157 123 158 initialPopulationConditionalBranch.ConditionParameter.ActualName = "CreateInitialPopulation"; 124 159 125 160 initialSolutionsCreator.NumberOfSolutionsParameter.ActualName = "N"; 161 162 initialPopulationSizeAssigner.LeftSideParameter.ActualName = "CurrentPopulationSize"; 163 initialPopulationSizeAssigner.RightSideParameter.ActualName = "N"; 126 164 127 165 iterationCounter.ValueParameter.ActualName = "Iteration"; 128 166 iterationCounter.IncrementParameter.ActualName = "OneIntValue"; 129 167 130 matchCondtionSubScopesProcessor.Operator = matchConditionOperator;131 132 168 matchConditionOperator.MatchParameter.ActualName = "CombinedIntegerVector"; 133 169 … … 135 171 conditionMatchSelector.ConditionParameter.ActualName = "MatchCondition"; 136 172 173 conditionMatchSelectorAfterDeletion.CopySelected = new BoolValue(false); 174 conditionMatchSelectorAfterDeletion.ConditionParameter.ActualName = "MatchCondition"; 175 137 176 countNumberOfUniqueActions.ClassifiersParameter.ActualName = "CombinedIntegerVector"; 177 178 countNumberOfUniqueActionsAfterDeletion.ClassifiersParameter.ActualName = "CombinedIntegerVector"; 179 180 subscopeVariableCopier.SubScopeIndexParameter.Value = new IntValue(1); 181 182 doDeletionBeforeCovering.CurrentPopulationSizeParameter.ActualName = "CurrentPopulationSize"; 183 doDeletionBeforeCovering.NumberOfUniqueActionsParameter.ActualName = countNumberOfUniqueActions.NumberOfUniqueActionsParameter.ActualName; 184 doDeletionBeforeCovering.PopulationSizeParameter.ActualName = "N"; 185 186 doDeletionBeforeCoveringConditionalBranch.ConditionParameter.ActualName = doDeletionBeforeCovering.DoDeletionParameter.ActualName; 187 188 deletionOperator.NumberToDeleteParameter.ActualName = doDeletionBeforeCovering.NumberToDeleteParameter.ActualName; 189 deletionOperator.AverageActionSetSizesParameter.ActualName = "AverageActionSetSize"; 190 deletionOperator.FitnessesParameter.ActualName = "Fitness"; 191 deletionOperator.NumerositiesParameter.ActualName = "Numerosity"; 192 deletionOperator.ExperiencesParameter.ActualName = "Experience"; 193 deletionOperator.ThetaDeletionParameter.ActualName = "ThetaDeletion"; 194 deletionOperator.DeltaParameter.ActualName = "Delta"; 195 deletionOperator.RandomParameter.ActualName = "Random"; 196 197 deletionSelector.ConditionParameter.ActualName = deletionOperator.HasToBeDeletedVariableName; 198 deletionSelector.CopySelected = new BoolValue(false); 138 199 139 200 covering.ActionsInMatchSetParameter.ActualName = countNumberOfUniqueActions.UniqueActionsParameter.ActualName; 140 201 covering.ParallelParameter.Value.Value = true; 141 202 covering.RandomParameter.ActualName = "Random"; 203 covering.CurrentPopulationSizeParameter.ActualName = "CurrentPopulationSize"; 142 204 143 205 matchActionSubScopesProcessor.Operator = matchActionOperator; … … 155 217 actionMatchSelector.ConditionParameter.ActualName = "MatchAction"; 156 218 219 actionSetSubsumptionBranch.ConditionParameter.ActualName = "DoActionSetSubsumption"; 220 221 subsumptionSelector.CopySelected = new BoolValue(false); 222 157 223 SelectorParameter.Value.CopySelected = new BoolValue(true); 158 SelectorParameter.Value.NumberOfSelectedSubScopesParameter.Value = new IntValue( 200);224 SelectorParameter.Value.NumberOfSelectedSubScopesParameter.Value = new IntValue(4); 159 225 160 226 evaluator.Name = "Evaluator"; … … 176 242 sumAccuracy.AccuracyParameter.ActualName = calculateAccuracy.AccuracyParameter.ActualName; 177 243 sumAccuracy.NumerosityParameter.ActualName = "Numerosity"; 244 245 //BEGIN parameters have to be set differently 246 checkIfGAShouldRun.TimeStampsParameter.ActualName = "Timestamp"; 247 checkIfGAShouldRun.NumerositiesParameter.ActualName = "Numerosity"; 248 checkIfGAShouldRun.ThetaGAParameter.ActualName = "ThetaGA"; 249 //END 250 checkIfGAShouldRun.IterationParameter.ActualName = iterationCounter.ValueParameter.ActualName; 251 252 runGAConditionalBranch.ConditionParameter.ActualName = checkIfGAShouldRun.RunGAParameter.ActualName; 253 254 timestampAssigner.LeftSideParameter.ActualName = "Timestamp"; 255 timestampAssigner.RightSideParameter.ActualName = iterationCounter.ValueParameter.ActualName; 256 257 afterCrossover.NumerosityParameter.ActualName = "Numerosity"; 258 afterCrossover.ExperienceParameter.ActualName = "Experience"; 259 afterCrossover.TimestampParameter.ActualName = "Timestamp"; 260 afterCrossover.CurrentIterationParameter.ActualName = "Iteration"; 261 afterCrossover.FitnessParameter.ActualName = "Fitness"; 262 afterCrossover.AverageActionSetSizeParameter.ActualName = "AverageActionSetSize"; 263 afterCrossover.PredictionParameter.ActualName = "Prediction"; 264 afterCrossover.ErrorParameter.ActualName = "Error"; 265 afterCrossover.ParentFitnessParameter.ActualName = "Fitness"; 266 afterCrossover.ParentErrorParameter.ActualName = "Error"; 267 afterCrossover.ParentPredictionParameter.ActualName = "Prediction"; 268 afterCrossover.ParentAverageActionSetSizeParameter.ActualName = "AverageActionSetSize"; 178 269 179 270 adaptedGeneticAlgorithmMainLoop.SelectorParameter.ActualName = SelectorParameter.Name; … … 183 274 adaptedGeneticAlgorithmMainLoop.MaximumGenerationsParameter.ActualName = "ZeroIntValue"; 184 275 adaptedGeneticAlgorithmMainLoop.QualityParameter.ActualName = "Fitness"; 185 //needed?186 276 adaptedGeneticAlgorithmMainLoop.MutationProbabilityParameter.Value = new PercentValue(10); 187 277 adaptedGeneticAlgorithmMainLoop.MaximizationParameter.Value = new BoolValue(true); 278 adaptedGeneticAlgorithmMainLoop.AfterCrossoverParameter.ActualName = AfterCrossoverParameter.Name; 279 280 currentPopulationSizeCounter.ValueParameter.ActualName = "CurrentPopulationSize"; 281 currentPopulationSizeCounter.Increment = new IntValue(2); 282 283 calculateNumberOfDeletions.CurrentPopulationSizeParameter.ActualName = "CurrentPopulationSize"; 284 calculateNumberOfDeletions.PopulationSizeParameter.ActualName = "N"; 285 286 deletionOperatorAfterGA.NumberToDeleteParameter.ActualName = calculateNumberOfDeletions.NumberOfDeletionsParameter.ActualName; 287 deletionOperatorAfterGA.AverageActionSetSizesParameter.ActualName = "AverageActionSetSize"; 288 deletionOperatorAfterGA.FitnessesParameter.ActualName = "Fitness"; 289 deletionOperatorAfterGA.NumerositiesParameter.ActualName = "Numerosity"; 290 deletionOperatorAfterGA.ExperiencesParameter.ActualName = "Experience"; 291 deletionOperatorAfterGA.ThetaDeletionParameter.ActualName = "ThetaDeletion"; 292 deletionOperatorAfterGA.DeltaParameter.ActualName = "Delta"; 293 deletionOperatorAfterGA.RandomParameter.ActualName = "Random"; 294 295 deletionSelectorAfterGA.ConditionParameter.ActualName = deletionOperatorAfterGA.HasToBeDeletedVariableName; 296 deletionSelectorAfterGA.CopySelected = new BoolValue(false); 188 297 #endregion 189 298 … … 193 302 variableCreator.Successor = initialPopulationConditionalBranch; 194 303 initialPopulationConditionalBranch.TrueBranch = initialSolutionsCreator; 304 initialSolutionsCreator.Successor = initialPopulationSizeAssigner; 195 305 initialPopulationConditionalBranch.FalseBranch = new EmptyOperator(); 196 306 initialPopulationConditionalBranch.Successor = classifierFetcher; 197 307 classifierFetcher.Successor = matchCondtionSubScopesProcessor; 308 matchCondtionSubScopesProcessor.Operator = matchConditionOperator; 198 309 matchCondtionSubScopesProcessor.Successor = conditionMatchSelector; 199 //variableCreator.Successor = adaptedGeneticAlgorithmMainLoop;200 //adaptedGeneticAlgorithmMainLoop.Successor = conditionMatchSelector;201 202 310 conditionMatchSelector.Successor = matchSetSubScopesProcessor; 203 311 matchSetSubScopesProcessor.Operators.Add(new EmptyOperator()); 204 312 matchSetSubScopesProcessor.Operators.Add(countNumberOfUniqueActions); 205 matchSetSubScopesProcessor.Successor = mergingReducerWithSuccessor; 206 countNumberOfUniqueActions.Successor = covering; 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 207 333 covering.Successor = predictionArrayCalculator; 208 334 predictionArrayCalculator.Successor = actionSelector; … … 218 344 sumAccuracy.Successor = updateParametersSubScopesProcessor; 219 345 updateParametersSubScopesProcessor.Operator = evaluator; 220 221 actionSetSubScopesProcessor.Successor = mergingReducer; 222 223 mergingReducerWithSuccessor.Successor = iterationCounter; 346 updateParametersSubScopesProcessor.Successor = actionSetSubsumptionBranch; 347 actionSetSubsumptionBranch.TrueBranch = actionSetSubsumption; 348 actionSetSubsumption.Successor = subsumptionSelector; 349 subsumptionSelector.Successor = leftReducer; 350 actionSetSubsumptionBranch.FalseBranch = new EmptyOperator(); 351 actionSetSubsumptionBranch.Successor = checkIfGAShouldRun; 352 checkIfGAShouldRun.Successor = runGAConditionalBranch; 353 runGAConditionalBranch.TrueBranch = timestampAssignerSubscopeProcessor; 354 runGAConditionalBranch.FalseBranch = new EmptyOperator(); 355 timestampAssignerSubscopeProcessor.Operator = timestampAssigner; 356 timestampAssignerSubscopeProcessor.Successor = adaptedGeneticAlgorithmMainLoop; 357 adaptedGeneticAlgorithmMainLoop.Successor = currentPopulationSizeCounter; 358 359 actionSetSubScopesProcessor.Successor = actionSetMergingReducer; 360 361 matchSetMergingReducer.Successor = calculateNumberOfDeletions; 362 calculateNumberOfDeletions.Successor = deletionOperatorAfterGA; 363 deletionOperatorAfterGA.Successor = deletionSelectorAfterGA; 364 deletionSelectorAfterGA.Successor = leftReducerAfterGA; 365 leftReducerAfterGA.Successor = iterationCounter; 224 366 iterationCounter.Successor = classifierFetcher; 225 //mergingReducer.Successor = adaptedGeneticAlgorithmMainLoop;226 367 #endregion 227 368 } … … 249 390 actionExecuter.OperatorParameter.ActualName = problem.ActionExecuterParameter.Name; 250 391 392 problem.ActionSetSubsumptionOperator.ThetaSubsumptionParameter.ActualName = "ThetaSubsumption"; 393 problem.ActionSetSubsumptionOperator.ErrorsParameter.ActualName = "Error"; 394 problem.ActionSetSubsumptionOperator.ErrorZeroParameter.ActualName = "ErrorZero"; 395 problem.ActionSetSubsumptionOperator.ExperiencesParameter.ActualName = "Experience"; 396 problem.ActionSetSubsumptionOperator.NumerositiesParameter.ActualName = "Numerosity"; 397 398 subsumptionSelector.ConditionParameter.ActualName = problem.ActionSetSubsumptionOperator.HasBeenSubsumedParameterName; 399 400 actionSetSubsumption.OperatorParameter.ActualName = problem.ActionSetSubsumptionOperatorParameter.Name; 401 251 402 matchConditionOperator.TargetMatchParameter.ActualName = problem.ClassifierFetcher.CurrentClassifierToMatchParameter.ActualName; 403 404 doDeletionBeforeCovering.MinimalNumberOfUniqueActionsParameter.ActualName = problem.ThetaMinimalNumberOfActionsParameter.Name; 252 405 253 406 covering.SolutionCreatorParameter.ActualName = problem.CoveringSolutionCreatorParameter.Name; -
branches/LearningClassifierSystems/HeuristicLab.Encodings.CombinedIntegerVectorEncoding/3.3/CombinedIntegerVector.cs
r9089 r9105 48 48 public IntMatrix Bounds { get { return (IntMatrix)bounds.Clone(); } } 49 49 50 public int ConditionLength { get { return Length - actionLength; } } 51 50 52 [StorableConstructor] 51 53 protected CombinedIntegerVector(bool deserializing) : base(deserializing) { } … … 184 186 } 185 187 188 public bool IsMoreGeneral(IClassifier target) { 189 var targetVector = target as CombinedIntegerVector; 190 int curbounds; 191 192 if (this.NumberOfGeneralSymbols() <= targetVector.NumberOfGeneralSymbols()) return false; 193 194 for (int i = 0; i < ConditionLength; i++) { 195 curbounds = i % bounds.Rows; 196 if (this[i] != bounds[curbounds, 1] - 1 && this[i] != targetVector[i]) { 197 return false; 198 } 199 } 200 return true; 201 } 202 203 private int NumberOfGeneralSymbols() { 204 int numberOfGeneralSymbols = 0; 205 int curbounds; 206 207 for (int i = 0; i < ConditionLength; i++) { 208 curbounds = i % bounds.Rows; 209 numberOfGeneralSymbols += this[i] == bounds[curbounds, 1] - 1 ? 1 : 0; 210 } 211 212 return numberOfGeneralSymbols; 213 } 214 186 215 public override string ToString() { 187 216 StringBuilder strBuilder = new StringBuilder(this.Length); -
branches/LearningClassifierSystems/HeuristicLab.Encodings.CombinedIntegerVectorEncoding/3.3/HeuristicLab.Encodings.CombinedIntegerVectorEncoding-3.3.csproj
r9090 r9105 95 95 <Reference Include="System" /> 96 96 <Reference Include="System.Core" /> 97 <Reference Include="System.Drawing" /> 97 98 <Reference Include="System.Xml.Linq" /> 98 99 <Reference Include="System.Data.DataSetExtensions" /> -
branches/LearningClassifierSystems/HeuristicLab.Encodings.ConditionActionEncoding/3.3
- Property svn:ignore
-
old new 1 1 obj 2 2 Plugin.cs 3 *.user
-
- Property svn:ignore
-
branches/LearningClassifierSystems/HeuristicLab.Encodings.ConditionActionEncoding/3.3/Covering/CoveringOperator.cs
r9090 r9105 53 53 get { return (ILookupParameter<IRandom>)Parameters["Random"]; } 54 54 } 55 public ILookupParameter<IntValue> CurrentPopulationSizeParameter { 56 get { return (ILookupParameter<IntValue>)Parameters["CurrentPopulationSize"]; } 57 } 55 58 public IValueLookupParameter<BoolValue> ParallelParameter { 56 59 get { return (IValueLookupParameter<BoolValue>)Parameters["Parallel"]; } … … 83 86 Parameters.Add(new ValueLookupParameter<BoolValue>("Parallel", "True if the operator should be applied in parallel on all sub-scopes, otherwise false.", new BoolValue(true))); 84 87 Parameters.Add(new ScopeParameter("CurrentScope", "The current scope to which the new solutions are added as sub-scopes.")); 88 Parameters.Add(new LookupParameter<IntValue>("CurrentPopulationSize")); 85 89 } 86 90 … … 97 101 throw new ArgumentException("More classifiers with unique actions shall be created than unique actions are available."); 98 102 } 103 104 CurrentPopulationSizeParameter.ActualValue.Value += count; 99 105 100 106 int current = CurrentScope.SubScopes.Count; -
branches/LearningClassifierSystems/HeuristicLab.Encodings.ConditionActionEncoding/3.3/Covering/ICovering.cs
r9090 r9105 33 33 IValueLookupParameter<ICoveringSolutionCreator> SolutionCreatorParameter { get; } 34 34 IValueLookupParameter<BoolValue> ParallelParameter { get; } 35 36 ILookupParameter<IntValue> CurrentPopulationSizeParameter { get; } 35 37 } 36 38 } -
branches/LearningClassifierSystems/HeuristicLab.Encodings.ConditionActionEncoding/3.3/HeuristicLab.Encodings.ConditionActionEncoding-3.3.csproj
r9089 r9105 71 71 <Reference Include="System" /> 72 72 <Reference Include="System.Core" /> 73 <Reference Include="System.Drawing" /> 73 74 <Reference Include="System.Xml.Linq" /> 74 75 <Reference Include="System.Data.DataSetExtensions" /> … … 83 84 <Compile Include="ActionSelection\RandomActionSelector.cs" /> 84 85 <Compile Include="Covering\CoveringOperator.cs" /> 86 <Compile Include="Covering\DoDeletionBeforeCovering.cs" /> 85 87 <Compile Include="Covering\ICovering.cs" /> 86 88 <Compile Include="Covering\ICoveringSolutionCreator.cs" /> 89 <Compile Include="Deletion\CalculateNumberOfDeletionsOperator.cs" /> 90 <Compile Include="Deletion\XCSDeletionOperator.cs" /> 87 91 <Compile Include="Evaluators\XCSEvaluator.cs" /> 88 92 <Compile Include="Evaluators\IConditionActionEvaluator.cs" /> 89 93 <Compile Include="Evaluators\IXCSEvaluator.cs" /> 94 <Compile Include="GA\XCSAfterCrossoverOperator.cs" /> 90 95 <Compile Include="IClassifier.cs" /> 91 96 <Compile Include="Interfaces\IConditionActionProblem.cs" /> 92 97 <Compile Include="Interfaces\IConditionActionProblemData.cs" /> 93 98 <Compile Include="Operator\CalculateAccuracy.cs" /> 99 <Compile Include="GA\XCSCheckIfGAShouldBeApplied.cs" /> 94 100 <Compile Include="Operator\CountNumberOfUniqueActions.cs" /> 95 101 <Compile Include="Operator\PredictionArrayCalculator.cs" /> 96 102 <Compile Include="Operator\MatchActionOperator.cs" /> 97 103 <Compile Include="Operator\MatchConditionOperator.cs" /> 104 <Compile Include="Operator\SubScopeVariableCopier.cs" /> 98 105 <Compile Include="Operator\SumAccuracy.cs" /> 99 106 <Compile Include="Properties\AssemblyInfo.cs" /> … … 104 111 <Compile Include="Selectors\IMatchSelector.cs" /> 105 112 <Compile Include="Selectors\MatchSelector.cs" /> 113 <Compile Include="Subsumption\ActionSetSubsumptionoperator.cs" /> 114 <Compile Include="Subsumption\IActionSetSubsumption.cs" /> 106 115 <None Include="Properties\AssemblyInfo.cs.frame" /> 107 116 </ItemGroup> … … 112 121 <ItemGroup /> 113 122 <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> 123 <PropertyGroup> 124 <PreBuildEvent>set Path=%25Path%25;$(ProjectDir);$(SolutionDir) 125 set ProjectDir=$(ProjectDir) 126 set SolutionDir=$(SolutionDir) 127 set Outdir=$(Outdir) 128 129 call PreBuildEvent.cmd 130 </PreBuildEvent> 131 </PropertyGroup> 114 132 <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 115 133 Other similar extension points exist, see Microsoft.Common.targets. -
branches/LearningClassifierSystems/HeuristicLab.Encodings.ConditionActionEncoding/3.3/IClassifier.cs
r9089 r9105 35 35 bool MatchCondition(IClassifier target); 36 36 bool MatchAction(IClassifier target); 37 bool IsMoreGeneral(IClassifier target); 37 38 38 39 //to use IMatching as key in a dictionary, Equals and GetHashCode have to be override. -
branches/LearningClassifierSystems/HeuristicLab.Encodings.ConditionActionEncoding/3.3/Interfaces/IConditionActionProblem.cs
r9090 r9105 39 39 IParameter CoveringSolutionCreatorParameter { get; } 40 40 41 IParameter ActionSetSubsumptionOperatorParameter { get; } 42 IActionSetSubsumption ActionSetSubsumptionOperator { get; } 43 41 44 new IXCSEvaluator Evaluator { get; } 42 45 } -
branches/LearningClassifierSystems/HeuristicLab.Problems.ConditionActionClassification/3.3/HeuristicLab.Problems.ConditionActionClassification-3.3.csproj
r9089 r9105 65 65 <Reference Include="System" /> 66 66 <Reference Include="System.Core" /> 67 <Reference Include="System.Drawing" /> 67 68 <Reference Include="System.Xml.Linq" /> 68 69 <Reference Include="System.Data.DataSetExtensions" /> … … 94 95 </ItemGroup> 95 96 <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> 97 <PropertyGroup> 98 <PreBuildEvent>set Path=%25Path%25;$(ProjectDir);$(SolutionDir) 99 set ProjectDir=$(ProjectDir) 100 set SolutionDir=$(SolutionDir) 101 set Outdir=$(Outdir) 102 103 call PreBuildEvent.cmd 104 </PreBuildEvent> 105 </PropertyGroup> 96 106 <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 97 107 Other similar extension points exist, see Microsoft.Common.targets. -
branches/LearningClassifierSystems/HeuristicLab.Problems.ConditionActionClassification/3.3/Implementation/ConditionActionClassificationProblem.cs
r9090 r9105 36 36 private const string ClassifierFetcherParameterName = "ClassifierFetcher"; 37 37 private const string ActionExecuterParameterName = "ActionExecuter"; 38 private const string ActionSetSubsumptionOperatorParameterName = "ActionSetSubsumption"; 38 39 39 40 IXCSEvaluator IConditionActionProblem.Evaluator { … … 118 119 IClassifierFetcher IConditionActionProblem.ClassifierFetcher { get { return ClassifierFetcher; } } 119 120 IParameter IConditionActionProblem.ClassifierFetcherParameter { get { return ClassifierFetcherParameter; } } 121 122 123 public ActionSetSubsumptionoperator ActionSetSubsumptionOperator { 124 get { return ActionSetSubsumptionOperatorParameter.Value; } 125 } 126 public ValueParameter<ActionSetSubsumptionoperator> ActionSetSubsumptionOperatorParameter { 127 get { return (ValueParameter<ActionSetSubsumptionoperator>)Parameters[ActionSetSubsumptionOperatorParameterName]; } 128 } 129 IActionSetSubsumption IConditionActionProblem.ActionSetSubsumptionOperator { get { return ActionSetSubsumptionOperator; } } 130 IParameter IConditionActionProblem.ActionSetSubsumptionOperatorParameter { get { return ActionSetSubsumptionOperatorParameter; } } 120 131 121 132 private IntValue ThetaMinimalNumberOfActions { … … 164 175 Parameters.Add(new ValueParameter<CombinedIntegerVectorClassifierFetcher>(ClassifierFetcherParameterName, "", new CombinedIntegerVectorClassifierFetcher())); 165 176 Parameters.Add(new FixedValueParameter<ItemSet<IClassifier>>("PossibleActions")); 166 Parameters.Add(new FixedValueParameter<IntValue>("ThetaMinimalNumberOfActions", "Minimal number of actions, which have to be present in the match set, or else covering will occure." ));177 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))); 167 178 168 179 Parameters.Add(new ValueParameter<ICoveringSolutionCreator>("CoveringSolutionCreator", "", coveringSolutionCreator)); 169 180 Parameters.Add(new FixedValueParameter<PercentValue>("ChangeSymbolProbabilityInCovering", "", new PercentValue(0.5))); 181 182 Parameters.Add(new ValueParameter<ActionSetSubsumptionoperator>(ActionSetSubsumptionOperatorParameterName, "", new ActionSetSubsumptionoperator())); 170 183 171 184 Evaluator.InitialErrorParameter.ActualName = "InitialError"; … … 188 201 ActionExecuter.NegativeRewardParameter.ActualName = NegativeRewardParameter.Name; 189 202 ActionExecuter.PositiveRewardParameter.ActualName = PositiveRewardParameter.Name; 203 204 ActionSetSubsumptionOperator.ClassifiersParameter.ActualName = "CombinedIntegerVector"; 190 205 191 206 SetPossibleActions();
Note: See TracChangeset
for help on using the changeset viewer.