- Timestamp:
- 02/21/11 00:03:47 (14 years ago)
- Location:
- branches/DataAnalysis Refactoring
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataAnalysis Refactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Creators/ProbabilisticTreeCreator.cs
r5510 r5521 27 27 using HeuristicLab.Core; 28 28 using HeuristicLab.Data; 29 using HeuristicLab.Parameters; 29 30 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 30 using HeuristicLab.Parameters;31 31 32 32 namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding { … … 85 85 Parameters.Add(new ValueLookupParameter<IntValue>(MaximumFunctionDefinitionsParameterName, "The maximum allowed number of automatically defined functions.")); 86 86 Parameters.Add(new ValueLookupParameter<IntValue>(MaximumFunctionArgumentsParameterName, "The maximum allowed number of arguments of automatically defined functions.")); 87 Parameters.Add(new ValueLookupParameter< SymbolicExpressionTreeGrammar>(SymbolicExpressionTreeGrammarParameterName, "The tree grammar that defines the correct syntax of symbolic expression trees that should be created."));87 Parameters.Add(new ValueLookupParameter<ISymbolicExpressionTreeGrammar>(SymbolicExpressionTreeGrammarParameterName, "The tree grammar that defines the correct syntax of symbolic expression trees that should be created.")); 88 88 } 89 89 -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.ArtificialAnt/3.4/ArtificialAntProblem.cs
r5517 r5521 212 212 public ArtificialAntProblem() 213 213 : base() { 214 SymbolicExpressionTreeCreator creator = new ProbabilisticTreeCreator();214 ProbabilisticTreeCreator creator = new ProbabilisticTreeCreator(); 215 215 Evaluator evaluator = new Evaluator(); 216 216 BoolMatrix world = new BoolMatrix(santaFeAntTrail); … … 229 229 230 230 creator.SymbolicExpressionTreeParameter.ActualName = "AntTrailSolution"; 231 creator.SymbolicExpressionTreeGrammarParameter.ActualName = "ArtificialAntExpressionGrammar"; 231 232 evaluator.QualityParameter.ActualName = "FoodEaten"; 232 233 InitializeOperators(); … … 272 273 OnEvaluatorChanged(); 273 274 } 274 275 275 private void Evaluator_QualityParameter_ActualNameChanged(object sender, EventArgs e) { 276 276 ParameterizeAnalyzers(); … … 293 293 private void MaxFunctionDefinitionsParameter_ValueChanged(object sender, EventArgs e) { 294 294 ArtificialAntExpressionGrammar.MaxFunctionDefinitions = MaxFunctionDefinitions.Value; 295 ParameterizeOperators(); 296 ParameterizeAnalyzers(); 295 297 } 296 298 private void MaxFunctionArgumentsParameter_ValueChanged(object sender, EventArgs e) { 297 299 ArtificialAntExpressionGrammar.MaxFunctionArguments = MaxFunctionArguments.Value; 300 ParameterizeOperators(); 301 ParameterizeAnalyzers(); 298 302 } 299 303 … … 321 325 322 326 private void ParameterizeOperators() { 323 foreach (ISymbolicExpressionTreeGrammarBasedOperator op in Operators.OfType<ISymbolicExpressionTreeGrammarBasedOperator>()) { 327 var operators = Parameters.OfType<IValueParameter>().Select(p => p.ActualValue).OfType<IOperator>().Union(Operators); 328 329 foreach (ISymbolicExpressionTreeGrammarBasedOperator op in operators.OfType<ISymbolicExpressionTreeGrammarBasedOperator>()) { 324 330 op.SymbolicExpressionTreeGrammarParameter.ActualName = ArtificialAntExpressionGrammarParameter.Name; 325 331 } 326 foreach (ISymbolicExpressionTreeSizeConstraintOperator op in Operators.OfType<ISymbolicExpressionTreeSizeConstraintOperator>()) {332 foreach (ISymbolicExpressionTreeSizeConstraintOperator op in operators.OfType<ISymbolicExpressionTreeSizeConstraintOperator>()) { 327 333 op.MaximumSymbolicExpressionTreeDepthParameter.ActualName = MaxExpressionDepthParameter.Name; 328 334 op.MaximumSymbolicExpressionTreeLengthParameter.ActualName = MaxExpressionLengthParameter.Name; 329 335 330 336 } 331 foreach (Evaluator op in Operators.OfType<Evaluator>()) {337 foreach (Evaluator op in operators.OfType<Evaluator>()) { 332 338 op.SymbolicExpressionTreeParameter.ActualName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName; 333 339 op.MaxTimeStepsParameter.ActualName = MaxTimeStepsParameter.Name; 334 340 op.WorldParameter.ActualName = WorldParameter.Name; 335 341 } 336 foreach (ISymbolicExpressionTreeCrossover op in Operators.OfType<ISymbolicExpressionTreeCrossover>()) {342 foreach (ISymbolicExpressionTreeCrossover op in operators.OfType<ISymbolicExpressionTreeCrossover>()) { 337 343 op.ParentsParameter.ActualName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName; 338 344 op.ChildParameter.ActualName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName; 339 345 } 340 foreach (ISymbolicExpressionTreeManipulator op in Operators.OfType<ISymbolicExpressionTreeManipulator>()) {346 foreach (ISymbolicExpressionTreeManipulator op in operators.OfType<ISymbolicExpressionTreeManipulator>()) { 341 347 op.SymbolicExpressionTreeParameter.ActualName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName; 342 348 } 343 foreach (ISymbolicExpressionTreeArchitectureAlteringOperator op in Operators.OfType<ISymbolicExpressionTreeArchitectureAlteringOperator>()) {349 foreach (ISymbolicExpressionTreeArchitectureAlteringOperator op in operators.OfType<ISymbolicExpressionTreeArchitectureAlteringOperator>()) { 344 350 op.MaximumFunctionDefinitionsParameter.ActualName = MaxFunctionDefinitionsParameter.Name; 345 351 op.MaximumFunctionArgumentsParameter.ActualName = MaxFunctionArgumentsParameter.Name; 346 352 } 347 foreach (ISymbolicExpressionTreeCreator op in Operators.OfType<ISymbolicExpressionTreeCreator>()) {348 op.SymbolicExpressionTreeParameter.ActualName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName;349 }350 353 } 351 354 #endregion
Note: See TracChangeset
for help on using the changeset viewer.