- Timestamp:
- 04/23/13 13:31:29 (12 years ago)
- Location:
- branches/LearningClassifierSystems/HeuristicLab.Algorithms.GAssist/3.3
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/LearningClassifierSystems/HeuristicLab.Algorithms.GAssist/3.3
- Property svn:ignore
-
old new 1 1 *.user 2 2 Plugin.cs 3 obj
-
- Property svn:ignore
-
branches/LearningClassifierSystems/HeuristicLab.Algorithms.GAssist/3.3/GAssist.cs
r9352 r9392 65 65 get { return (ValueParameter<IntValue>)Parameters["PopulationSize"]; } 66 66 } 67 public ValueParameter<MDLIterationOperator> MDLIterationOperatorParameter { 68 get { return (ValueParameter<MDLIterationOperator>)Parameters["MDLIterationOperator"]; } 69 } 67 70 public IConstrainedValueParameter<IDefaultRuleOperator> DefaultRuleParameter { 68 71 get { return (IConstrainedValueParameter<IDefaultRuleOperator>)Parameters["DefaultRule"]; } … … 121 124 private ValueParameter<ItemCollection<IDiscretizer>> DiscretizersParameter { 122 125 get { return (ValueParameter<ItemCollection<IDiscretizer>>)Parameters["Discretizers"]; } 126 } 127 public ValueParameter<IntValue> MDLActivationIterationParameter { 128 get { return (ValueParameter<IntValue>)Parameters["MDLActivationIteration"]; } 129 } 130 public ValueParameter<DoubleValue> InitialTheoryLengthRatioParameter { 131 get { return (ValueParameter<DoubleValue>)Parameters["InitialTheoryLengthRatio"]; } 132 } 133 public ValueParameter<DoubleValue> WeightRelaxFactorParameter { 134 get { return (ValueParameter<DoubleValue>)Parameters["WeightRelaxFactor"]; } 135 } 136 public ValueParameter<IntValue> WeightAdaptionIterationsParameter { 137 get { return (ValueParameter<IntValue>)Parameters["WeightAdaptionIterations"]; } 138 } 139 public ValueParameter<IntValue> NumberOfStrataParameter { 140 get { return (ValueParameter<IntValue>)Parameters["NumberOfStrata"]; } 123 141 } 124 142 #endregion … … 180 198 get { return (RandomCreator)OperatorGraph.InitialOperator; } 181 199 } 200 private VariableCreator VariableCreator { 201 get { return (VariableCreator)RandomCreator.Successor; } 202 } 203 private Placeholder MDLIterationPlaceholder { 204 get { return (Placeholder)VariableCreator.Successor; } 205 } 206 private ILASOperator ILASOperator { 207 get { return (ILASOperator)MDLIterationPlaceholder.Successor; } 208 } 209 private InitializeDiscretizersOperator InitializeDiscretizers { 210 get { return (InitializeDiscretizersOperator)ILASOperator.Successor; } 211 } 182 212 private SolutionsCreator SolutionsCreator { 183 get { return (SolutionsCreator) RandomCreator.Successor; }213 get { return (SolutionsCreator)InitializeDiscretizers.Successor; } 184 214 } 185 215 private GAssistMainLoop GeneticAlgorithmMainLoop { … … 204 234 Parameters.Add(new ValueParameter<GAssistSpecialStageMultiOperator>("SpecialStages", "", new GAssistSpecialStageMultiOperator())); 205 235 Parameters.Add(new ValueParameter<IntValue>("MaximumGenerations", "The maximum number of generations which should be processed.", new IntValue(1000))); 206 Parameters.Add(new FixedValueParameter<PercentValue>("SplitProbability", "", new PercentValue(0.05))); 207 Parameters.Add(new FixedValueParameter<PercentValue>("MergeProbability", "", new PercentValue(0.05))); 208 Parameters.Add(new FixedValueParameter<PercentValue>("StartReinitializeProbability", "", new PercentValue(0.05))); 209 Parameters.Add(new FixedValueParameter<PercentValue>("EndReinitializeProbability", "", new PercentValue(Double.Epsilon))); 210 Parameters.Add(new FixedValueParameter<PercentValue>("OneProbability", "", new PercentValue(0.75))); 211 Parameters.Add(new FixedValueParameter<IntValue>("MaximumNumberOfIntervals", "", new IntValue(5))); 212 Parameters.Add(new FixedValueParameter<IntValue>("InitialNumberOfRules", "", new IntValue(20))); 236 Parameters.Add(new ValueParameter<PercentValue>("SplitProbability", "", new PercentValue(0.05))); 237 Parameters.Add(new ValueParameter<PercentValue>("MergeProbability", "", new PercentValue(0.05))); 238 Parameters.Add(new ValueParameter<PercentValue>("StartReinitializeProbability", "", new PercentValue(0.05))); 239 Parameters.Add(new ValueParameter<PercentValue>("EndReinitializeProbability", "", new PercentValue(Double.Epsilon))); 240 Parameters.Add(new ValueParameter<PercentValue>("OneProbability", "", new PercentValue(0.75))); 241 Parameters.Add(new ValueParameter<IntValue>("MaximumNumberOfIntervals", "", new IntValue(5))); 242 Parameters.Add(new ValueParameter<IntValue>("InitialNumberOfRules", "", new IntValue(20))); 243 Parameters.Add(new ValueParameter<MDLIterationOperator>("MDLIterationOperator", "", new MDLIterationOperator())); 213 244 Parameters.Add(new ConstrainedValueParameter<IDefaultRuleOperator>("DefaultRule", "")); 214 245 Parameters.Add(new ConstrainedValueParameter<IDiscreteDoubleValueModifier>("ReinitializeCurveOperator", "")); 215 246 Parameters.Add(new ValueParameter<ItemCollection<IDiscretizer>>("Discretizers", "", new ItemCollection<IDiscretizer>())); 216 247 248 Parameters.Add(new ValueParameter<IntValue>("MDLActivationIteration", "", new IntValue(25))); 249 Parameters.Add(new ValueParameter<DoubleValue>("InitialTheoryLengthRatio", "", new DoubleValue(0.075))); 250 Parameters.Add(new ValueParameter<DoubleValue>("WeightRelaxFactor", "", new DoubleValue(0.9))); 251 Parameters.Add(new ValueParameter<IntValue>("WeightAdaptionIterations", "", new IntValue(10))); 252 253 Parameters.Add(new ValueParameter<IntValue>("NumberOfStrata", "", new IntValue(2))); 254 217 255 RandomCreator randomCreator = new RandomCreator(); 256 VariableCreator variableCreator = new VariableCreator(); 257 Placeholder mdlIterationPlaceholder = new Placeholder(); 258 ILASOperator ilasOperator = new ILASOperator(); 259 InitializeDiscretizersOperator initializeDiscretizers = new InitializeDiscretizersOperator(); 218 260 SolutionsCreator solutionsCreator = new SolutionsCreator(); 219 261 SubScopesCounter subScopesCounter = new SubScopesCounter(); … … 227 269 randomCreator.SetSeedRandomlyParameter.ActualName = SetSeedRandomlyParameter.Name; 228 270 randomCreator.SetSeedRandomlyParameter.Value = null; 229 randomCreator.Successor = solutionsCreator; 271 randomCreator.Successor = variableCreator; 272 273 variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Generations", new IntValue(0))); // Class GAssistMainLoop expects this to be called Generations 274 variableCreator.Successor = mdlIterationPlaceholder; 275 276 mdlIterationPlaceholder.Name = "MDL Iteration Operator"; 277 mdlIterationPlaceholder.OperatorParameter.ActualName = MDLIterationOperatorParameter.Name; 278 mdlIterationPlaceholder.Successor = ilasOperator; 279 280 ilasOperator.RandomParameter.ActualName = randomCreator.RandomParameter.ActualName; 281 ilasOperator.NumberOfStrataParameter.ActualName = NumberOfStrataParameter.Name; 282 ilasOperator.Successor = initializeDiscretizers; 283 284 initializeDiscretizers.DiscretizersParameter.ActualName = DiscretizersParameter.Name; 285 initializeDiscretizers.Successor = solutionsCreator; 230 286 231 287 solutionsCreator.NumberOfSolutionsParameter.ActualName = PopulationSizeParameter.Name; … … 240 296 resultsCollector.Successor = mainLoop; 241 297 298 mainLoop.MDLIterationParameter.ActualName = MDLIterationOperatorParameter.Name; 242 299 mainLoop.DefaultRuleParameter.ActualName = DefaultRuleParameter.Name; 243 300 mainLoop.SelectorParameter.ActualName = SelectorParameter.Name; … … 348 405 ParameterizeStochasticOperator(Problem.SolutionCreator); 349 406 ParameterizeStochasticOperator(Problem.Evaluator); 350 foreach (IOperator op in Problem.Operators.OfType<IOperator>()) ParameterizeStochasticOperator(op); 407 ParameterizeMDLOperator(Problem.Evaluator); 408 ParameterizeIterationBasedOperators(Problem.Evaluator); 409 foreach (IOperator op in Problem.Operators.OfType<IOperator>()) { 410 ParameterizeStochasticOperator(op); 411 } 351 412 ParameterizeSolutionsCreator(); 352 413 ParameterizeGeneticAlgorithmMainLoop(); 414 ParameterizeMDL(); 353 415 ParameterizeSelectors(); 354 416 ParameterizeAnalyzers(); … … 359 421 UpdateAnalyzers(); 360 422 Problem.Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged); 423 ILASOperator.ProblemDataParameter.ActualName = Problem.ProblemDataParameter.Name; 424 InitializeDiscretizers.ProblemDataParameter.ActualName = Problem.ProblemDataParameter.Name; 361 425 base.OnProblemChanged(); 426 } 427 428 private void ParameterizeMDL() { 429 MDLIterationOperatorParameter.Value.QualityParameter.ActualName = Problem.Evaluator.QualityParameter.ActualName; 430 //change 431 MDLIterationOperatorParameter.Value.IndividualParameter.ActualName = "DecisionList"; 432 MDLIterationOperatorParameter.Value.ProblemDataParameter.ActualName = Problem.ProblemDataParameter.Name; 433 MDLIterationOperatorParameter.Value.MaximizationParameter.ActualName = Problem.MaximizationParameter.Name; 434 435 MDLIterationOperatorParameter.Value.InitialTheoryLengthRatioParameter.ActualName = InitialTheoryLengthRatioParameter.Name; 436 MDLIterationOperatorParameter.Value.MDLActivationIterationParameter.ActualName = MDLActivationIterationParameter.Name; 437 MDLIterationOperatorParameter.Value.WeightAdaptionIterationsParameter.ActualName = WeightAdaptionIterationsParameter.Name; 438 MDLIterationOperatorParameter.Value.WeightRelaxFactorParameter.ActualName = WeightRelaxFactorParameter.Name; 439 MDLIterationOperatorParameter.Value.IterationsParameter.ActualName = "Generations"; 362 440 } 363 441 … … 374 452 ParameterizeAnalyzers(); 375 453 Problem.Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged); 454 Problem.Evaluator.StrataParameter.ActualName = ILASOperator.StrataParameter.ActualName; 376 455 base.Problem_EvaluatorChanged(sender, e); 377 456 } … … 433 512 stochasticOp.RandomParameter.ActualName = RandomCreator.RandomParameter.ActualName; 434 513 stochasticOp.RandomParameter.Hidden = true; 514 } 515 } 516 private void ParameterizeMDLOperator(IOperator op) { 517 IMDLCalculatorBasedOperator stochasticOp = op as IMDLCalculatorBasedOperator; 518 if (stochasticOp != null) { 519 stochasticOp.MDLCalculatorParameter.ActualName = MDLIterationOperatorParameter.Value.MDLCalculatorParameter.ActualName; 435 520 } 436 521 } … … 469 554 } 470 555 } 556 private void ParameterizeIterationBasedOperators(IOperator op) { 557 IIterationBasedOperator iterationOp = op as IIterationBasedOperator; 558 if (iterationOp != null) { 559 ParameterizeIterationBasedOperators(iterationOp); 560 } 561 } 562 private void ParameterizeIterationBasedOperators(IIterationBasedOperator op) { 563 op.IterationsParameter.ActualName = "Generations"; 564 op.IterationsParameter.Hidden = true; 565 op.MaximumIterationsParameter.ActualName = "MaximumGenerations"; 566 op.MaximumIterationsParameter.Hidden = true; 567 } 471 568 private void ParameterizeIterationBasedOperators() { 472 569 if (Problem != null) { 473 570 foreach (IIterationBasedOperator op in Problem.Operators.OfType<IIterationBasedOperator>()) { 474 op.IterationsParameter.ActualName = "Generations"; 475 op.IterationsParameter.Hidden = true; 476 op.MaximumIterationsParameter.ActualName = "MaximumGenerations"; 477 op.MaximumIterationsParameter.Hidden = true; 571 ParameterizeIterationBasedOperators(op); 478 572 } 479 573 } -
branches/LearningClassifierSystems/HeuristicLab.Algorithms.GAssist/3.3/GAssistMainLoop.cs
r9352 r9392 61 61 public ValueLookupParameter<IOperator> MutatorParameter { 62 62 get { return (ValueLookupParameter<IOperator>)Parameters["Mutator"]; } 63 } 64 public ValueLookupParameter<IOperator> MDLIterationParameter { 65 get { return (ValueLookupParameter<IOperator>)Parameters["MDLIteration"]; } 63 66 } 64 67 public ValueLookupParameter<IOperator> DefaultRuleParameter { … … 134 137 Parameters.Add(new ValueLookupParameter<IOperator>("ReinitializationProbabilityOperator", "")); 135 138 Parameters.Add(new ValueLookupParameter<IOperator>("DefaultRule", "")); 139 Parameters.Add(new ValueLookupParameter<IOperator>("MDLIteration", "")); 136 140 Parameters.Add(new ScopeParameter("CurrentScope", "The current scope which represents a population of solutions on which the genetic algorithm should be applied.")); 137 141 #endregion 138 142 139 143 #region Create operators 140 VariableCreator variableCreator = new VariableCreator();141 144 ResultsCollector resultsCollector1 = new ResultsCollector(); 142 145 Placeholder analyzer1 = new Placeholder(); 146 Placeholder mdlIterationOperator = new Placeholder(); 147 Placeholder defaultRuleOperator = new Placeholder(); 143 148 Placeholder reinitializationProbabilityOperator = new Placeholder(); 144 Placeholder defaultRuleOperator = new Placeholder();145 149 Placeholder selector = new Placeholder(); 146 150 SubScopesProcessor subScopesProcessor1 = new SubScopesProcessor(); … … 167 171 ConditionalBranch conditionalBranch = new ConditionalBranch(); 168 172 169 variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Generations", new IntValue(0))); // Class GeneticAlgorithm expects this to be called Generations170 171 173 resultsCollector1.CollectedValues.Add(new LookupParameter<IntValue>("Generations")); 172 174 resultsCollector1.ResultsParameter.ActualName = "Results"; … … 174 176 analyzer1.Name = "Analyzer"; 175 177 analyzer1.OperatorParameter.ActualName = "Analyzer"; 178 179 mdlIterationOperator.Name = "MDL Iteration Operator"; 180 mdlIterationOperator.OperatorParameter.ActualName = MDLIterationParameter.Name; 176 181 177 182 defaultRuleOperator.Name = "Default Rule Operator"; … … 234 239 235 240 #region Create operator graph 236 OperatorGraph.InitialOperator = variableCreator; 237 variableCreator.Successor = resultsCollector1; 241 OperatorGraph.InitialOperator = resultsCollector1; 238 242 resultsCollector1.Successor = analyzer1; 239 analyzer1.Successor = defaultRuleOperator; 243 analyzer1.Successor = mdlIterationOperator; 244 mdlIterationOperator.Successor = defaultRuleOperator; 240 245 defaultRuleOperator.Successor = reinitializationProbabilityOperator; 241 246 reinitializationProbabilityOperator.Successor = selector; … … 272 277 comparator.Successor = analyzer2; 273 278 analyzer2.Successor = conditionalBranch; 274 conditionalBranch.FalseBranch = defaultRuleOperator;279 conditionalBranch.FalseBranch = mdlIterationOperator; 275 280 conditionalBranch.TrueBranch = null; 276 281 conditionalBranch.Successor = null;
Note: See TracChangeset
for help on using the changeset viewer.