Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/18/19 13:23:10 (6 years ago)
Author:
mkommend
Message:

#2521: Changed base ctor call in all GeneticProgrammingProblems.

Location:
branches/2521_ProblemRefactoring/HeuristicLab.Problems.GeneticProgramming/3.3
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/2521_ProblemRefactoring/HeuristicLab.Problems.GeneticProgramming/3.3/ArtificialAnt/Problem.cs

    r16723 r16813  
    2323using System.Diagnostics.Contracts;
    2424using System.Linq;
     25using HEAL.Attic;
    2526using HeuristicLab.Common;
    2627using HeuristicLab.Core;
     
    2930using HeuristicLab.Optimization;
    3031using HeuristicLab.Parameters;
    31 using HEAL.Attic;
    3232
    3333
     
    116116    #endregion
    117117
    118     public Problem()
    119       : base() {
     118    public Problem() : base(new SymbolicExpressionTreeEncoding()) {
    120119      BoolMatrix world = new BoolMatrix(ToBoolMatrix(santaFeAntTrail));
    121120      Parameters.Add(new ValueParameter<BoolMatrix>("World", "The world for the artificial ant with scattered food items.", world));
    122121      Parameters.Add(new ValueParameter<IntValue>("MaximumTimeSteps", "The number of time steps the artificial ant has available to collect all food items.", new IntValue(600)));
    123122
    124       base.BestKnownQuality = 89;
    125123      var g = new SimpleSymbolicExpressionGrammar();
    126124      g.AddSymbols(new string[] { "IfFoodAhead", "Prog2" }, 2, 2);
    127125      g.AddSymbols(new string[] { "Prog3" }, 3, 3);
    128126      g.AddTerminalSymbols(new string[] { "Move", "Left", "Right" });
    129       base.Encoding = new SymbolicExpressionTreeEncoding(g, 20, 10);
     127
     128      Encoding.TreeLength = 20;
     129      Encoding.TreeDepth = 10;
     130      Encoding.Grammar = g;
     131      base.BestKnownQuality = 89;
    130132    }
    131133
  • branches/2521_ProblemRefactoring/HeuristicLab.Problems.GeneticProgramming/3.3/BasicSymbolicRegression/Problem.cs

    r16723 r16813  
    2323using System.Collections.Generic;
    2424using System.Linq;
     25using HEAL.Attic;
    2526using HeuristicLab.Common;
    2627using HeuristicLab.Core;
    2728using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    2829using HeuristicLab.Parameters;
    29 using HEAL.Attic;
    3030using HeuristicLab.Problems.DataAnalysis;
    3131using HeuristicLab.Problems.Instances;
     
    8181    #endregion
    8282
    83     public Problem()
    84       : base() {
     83    public Problem() : base(new SymbolicExpressionTreeEncoding()) {
    8584      Parameters.Add(new ValueParameter<IRegressionProblemData>(ProblemDataParameterName, "The data for the regression problem", new RegressionProblemData()));
    8685
    87       var g = new SimpleSymbolicExpressionGrammar(); // empty grammar is replaced in UpdateGrammar()
    88       base.Encoding = new SymbolicExpressionTreeEncoding(g, 100, 17);
     86      Encoding.TreeLength = 100;
     87      Encoding.TreeDepth = 17;
    8988
    9089      UpdateGrammar();
  • branches/2521_ProblemRefactoring/HeuristicLab.Problems.GeneticProgramming/3.3/Boolean/EvenParityProblem.cs

    r16723 r16813  
    2323using System.Collections.Generic;
    2424using System.Linq;
     25using HEAL.Attic;
    2526using HeuristicLab.Common;
    2627using HeuristicLab.Core;
     
    2829using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    2930using HeuristicLab.Parameters;
    30 using HEAL.Attic;
    3131
    3232
     
    7878
    7979    public EvenParityProblem()
    80       : base() {
     80      : base(new SymbolicExpressionTreeEncoding()) {
    8181      Parameters.Add(new FixedValueParameter<IntValue>(NumberOfBitsParameterName, "The number of bits for the input parameter for the even parity function", new IntValue(4)));
    8282
    83       var g = new SimpleSymbolicExpressionGrammar(); // will be replaced in update grammar
    84       Encoding = new SymbolicExpressionTreeEncoding(g, 100, 17);
     83      Encoding.TreeLength = 100;
     84      Encoding.TreeDepth = 17;
    8585
    8686      UpdateGrammar();
  • branches/2521_ProblemRefactoring/HeuristicLab.Problems.GeneticProgramming/3.3/Boolean/MultiplexerProblem.cs

    r16723 r16813  
    2424using System.Diagnostics.Contracts;
    2525using System.Linq;
     26using HEAL.Attic;
    2627using HeuristicLab.Common;
    2728using HeuristicLab.Core;
     
    2930using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    3031using HeuristicLab.Parameters;
    31 using HEAL.Attic;
    3232
    3333
     
    8181
    8282    public MultiplexerProblem()
    83       : base() {
     83      : base(new SymbolicExpressionTreeEncoding()) {
    8484      Parameters.Add(new FixedValueParameter<IntValue>(NumberOfBitsParameterName,
    8585        "The number of bits for the input parameter for the multiplexer function. This is the sum of the number of address bits and the number of input lines. E.g. the 11-MUX has 3 address bits and 8 input lines",
    8686        new IntValue(11)));
    8787
    88       var g = new SimpleSymbolicExpressionGrammar(); // will be replaced in update grammar
    89       Encoding = new SymbolicExpressionTreeEncoding(g, 100, 17);
    90 
     88      Encoding.TreeLength = 100;
     89      Encoding.TreeDepth = 17;
    9190      UpdateGrammar();
    9291      RegisterEventHandlers();
  • branches/2521_ProblemRefactoring/HeuristicLab.Problems.GeneticProgramming/3.3/LawnMower/Problem.cs

    r16723 r16813  
    2222using System;
    2323using System.Linq;
     24using HEAL.Attic;
    2425using HeuristicLab.Common;
    2526using HeuristicLab.Core;
     
    2829using HeuristicLab.Optimization;
    2930using HeuristicLab.Parameters;
    30 using HEAL.Attic;
    3131using HeuristicLab.Random;
    3232
     
    6262    #endregion
    6363
    64     public Problem()
    65       : base() {
     64    public Problem() : base(new SymbolicExpressionTreeEncoding()) {
    6665      Parameters.Add(new FixedValueParameter<IntValue>(LawnWidthParameterName, "Width of the lawn.", new IntValue(8)));
    6766      Parameters.Add(new FixedValueParameter<IntValue>(LawnLengthParameterName, "Length of the lawn.", new IntValue(8)));
     
    7776      }
    7877
    79       Encoding = new SymbolicExpressionTreeEncoding(g, 1000, 17);
     78      Encoding.TreeLength = 1000;
     79      Encoding.TreeDepth = 17;
     80      Encoding.Grammar = g;
    8081    }
    8182
  • branches/2521_ProblemRefactoring/HeuristicLab.Problems.GeneticProgramming/3.3/robocode/Problem.cs

    r16723 r16813  
    2020#endregion
    2121
     22using HEAL.Attic;
    2223using HeuristicLab.Common;
    2324using HeuristicLab.Core;
     
    2627using HeuristicLab.Optimization;
    2728using HeuristicLab.Parameters;
    28 using HEAL.Attic;
    2929
    3030namespace HeuristicLab.Problems.GeneticProgramming.Robocode {
     
    7373    }
    7474
    75     public Problem()
    76       : base() {
     75    public Problem() : base(new SymbolicExpressionTreeEncoding()) {
    7776      DirectoryValue robocodeDir = new DirectoryValue { Value = @"robocode" };
    7877
     
    8584      Parameters.Add(new ValueParameter<EnemyCollection>(EnemiesParameterName, "The enemies that should be battled.", robotList));
    8685
    87       Encoding = new SymbolicExpressionTreeEncoding(new Grammar(), 1000, 10);
     86      Encoding.TreeLength = 1000;
     87      Encoding.TreeDepth = 10;
     88      Encoding.Grammar = new Grammar();
    8889      Encoding.FunctionArguments = 0;
    8990      Encoding.FunctionDefinitions = 0;
     
    134135    }
    135136
    136     void RobocodePathParameter_ValueChanged(object sender, System.EventArgs e) {
     137    private void RobocodePathParameter_ValueChanged(object sender, System.EventArgs e) {
    137138      EnemiesParameter.Value.RobocodePath = RobocodePathParameter.Value.Value;
    138139    }
Note: See TracChangeset for help on using the changeset viewer.