Free cookie consent management tool by TermsFeed Policy Generator

Changeset 5521 for branches


Ignore:
Timestamp:
02/21/11 00:03:47 (14 years ago)
Author:
mkommend
Message:

#1418: Corrected wiring of artificial ant problem.

Location:
branches/DataAnalysis Refactoring
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/DataAnalysis Refactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Creators/ProbabilisticTreeCreator.cs

    r5510 r5521  
    2727using HeuristicLab.Core;
    2828using HeuristicLab.Data;
     29using HeuristicLab.Parameters;
    2930using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    30 using HeuristicLab.Parameters;
    3131
    3232namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding {
     
    8585      Parameters.Add(new ValueLookupParameter<IntValue>(MaximumFunctionDefinitionsParameterName, "The maximum allowed number of automatically defined functions."));
    8686      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."));
    8888    }
    8989
  • branches/DataAnalysis Refactoring/HeuristicLab.Problems.ArtificialAnt/3.4/ArtificialAntProblem.cs

    r5517 r5521  
    212212    public ArtificialAntProblem()
    213213      : base() {
    214       SymbolicExpressionTreeCreator creator = new ProbabilisticTreeCreator();
     214      ProbabilisticTreeCreator creator = new ProbabilisticTreeCreator();
    215215      Evaluator evaluator = new Evaluator();
    216216      BoolMatrix world = new BoolMatrix(santaFeAntTrail);
     
    229229
    230230      creator.SymbolicExpressionTreeParameter.ActualName = "AntTrailSolution";
     231      creator.SymbolicExpressionTreeGrammarParameter.ActualName = "ArtificialAntExpressionGrammar";
    231232      evaluator.QualityParameter.ActualName = "FoodEaten";
    232233      InitializeOperators();
     
    272273      OnEvaluatorChanged();
    273274    }
    274 
    275275    private void Evaluator_QualityParameter_ActualNameChanged(object sender, EventArgs e) {
    276276      ParameterizeAnalyzers();
     
    293293    private void MaxFunctionDefinitionsParameter_ValueChanged(object sender, EventArgs e) {
    294294      ArtificialAntExpressionGrammar.MaxFunctionDefinitions = MaxFunctionDefinitions.Value;
     295      ParameterizeOperators();
     296      ParameterizeAnalyzers();
    295297    }
    296298    private void MaxFunctionArgumentsParameter_ValueChanged(object sender, EventArgs e) {
    297299      ArtificialAntExpressionGrammar.MaxFunctionArguments = MaxFunctionArguments.Value;
     300      ParameterizeOperators();
     301      ParameterizeAnalyzers();
    298302    }
    299303
     
    321325
    322326    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>()) {
    324330        op.SymbolicExpressionTreeGrammarParameter.ActualName = ArtificialAntExpressionGrammarParameter.Name;
    325331      }
    326       foreach (ISymbolicExpressionTreeSizeConstraintOperator op in Operators.OfType<ISymbolicExpressionTreeSizeConstraintOperator>()) {
     332      foreach (ISymbolicExpressionTreeSizeConstraintOperator op in operators.OfType<ISymbolicExpressionTreeSizeConstraintOperator>()) {
    327333        op.MaximumSymbolicExpressionTreeDepthParameter.ActualName = MaxExpressionDepthParameter.Name;
    328334        op.MaximumSymbolicExpressionTreeLengthParameter.ActualName = MaxExpressionLengthParameter.Name;
    329335
    330336      }
    331       foreach (Evaluator op in Operators.OfType<Evaluator>()) {
     337      foreach (Evaluator op in operators.OfType<Evaluator>()) {
    332338        op.SymbolicExpressionTreeParameter.ActualName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName;
    333339        op.MaxTimeStepsParameter.ActualName = MaxTimeStepsParameter.Name;
    334340        op.WorldParameter.ActualName = WorldParameter.Name;
    335341      }
    336       foreach (ISymbolicExpressionTreeCrossover op in Operators.OfType<ISymbolicExpressionTreeCrossover>()) {
     342      foreach (ISymbolicExpressionTreeCrossover op in operators.OfType<ISymbolicExpressionTreeCrossover>()) {
    337343        op.ParentsParameter.ActualName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName;
    338344        op.ChildParameter.ActualName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName;
    339345      }
    340       foreach (ISymbolicExpressionTreeManipulator op in Operators.OfType<ISymbolicExpressionTreeManipulator>()) {
     346      foreach (ISymbolicExpressionTreeManipulator op in operators.OfType<ISymbolicExpressionTreeManipulator>()) {
    341347        op.SymbolicExpressionTreeParameter.ActualName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName;
    342348      }
    343       foreach (ISymbolicExpressionTreeArchitectureAlteringOperator op in Operators.OfType<ISymbolicExpressionTreeArchitectureAlteringOperator>()) {
     349      foreach (ISymbolicExpressionTreeArchitectureAlteringOperator op in operators.OfType<ISymbolicExpressionTreeArchitectureAlteringOperator>()) {
    344350        op.MaximumFunctionDefinitionsParameter.ActualName = MaxFunctionDefinitionsParameter.Name;
    345351        op.MaximumFunctionArgumentsParameter.ActualName = MaxFunctionArgumentsParameter.Name;
    346352      }
    347       foreach (ISymbolicExpressionTreeCreator op in Operators.OfType<ISymbolicExpressionTreeCreator>()) {
    348         op.SymbolicExpressionTreeParameter.ActualName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName;
    349       }
    350353    }
    351354    #endregion
Note: See TracChangeset for help on using the changeset viewer.