Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/29/19 15:04:12 (6 years ago)
Author:
mkommend
Message:

#3005: Adapted genetic programming problems to disallow modifications of the grammar.

Location:
trunk/HeuristicLab.Problems.GeneticProgramming/3.3
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/HeuristicLab.Problems.GeneticProgramming/3.3/ArtificialAnt/Problem.cs

    r16565 r16873  
    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
     
    128128      g.AddTerminalSymbols(new string[] { "Move", "Left", "Right" });
    129129      base.Encoding = new SymbolicExpressionTreeEncoding(g, 20, 10);
     130      base.Encoding.GrammarParameter.ReadOnly = true;
    130131    }
    131132
  • trunk/HeuristicLab.Problems.GeneticProgramming/3.3/BasicSymbolicRegression/Problem.cs

    r16565 r16873  
    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;
     
    8787      var g = new SimpleSymbolicExpressionGrammar(); // empty grammar is replaced in UpdateGrammar()
    8888      base.Encoding = new SymbolicExpressionTreeEncoding(g, 100, 17);
     89      Encoding.GrammarParameter.ReadOnly = true;
    8990
    9091      UpdateGrammar();
     
    177178      }
    178179
     180      Encoding.GrammarParameter.ReadOnly = false;
    179181      Encoding.Grammar = g;
     182      Encoding.GrammarParameter.ReadOnly = true;
    180183    }
    181184    #endregion
  • trunk/HeuristicLab.Problems.GeneticProgramming/3.3/Boolean/EvenParityProblem.cs

    r16565 r16873  
    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
  • trunk/HeuristicLab.Problems.GeneticProgramming/3.3/Boolean/MultiplexerProblem.cs

    r16565 r16873  
    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
     
    8888      var g = new SimpleSymbolicExpressionGrammar(); // will be replaced in update grammar
    8989      Encoding = new SymbolicExpressionTreeEncoding(g, 100, 17);
     90      Encoding.GrammarParameter.ReadOnly = true;
    9091
    9192      UpdateGrammar();
     
    110111        g.AddTerminalSymbol(string.Format("d{0}", i));
    111112
     113      Encoding.GrammarParameter.ReadOnly = false;
    112114      Encoding.Grammar = g;
     115      Encoding.GrammarParameter.ReadOnly = true;
    113116
    114117      BestKnownQuality = Math.Pow(2, NumberOfBits); // this is a benchmark problem (the best achievable quality is known for a given number of bits)
  • trunk/HeuristicLab.Problems.GeneticProgramming/3.3/robocode/Problem.cs

    r16565 r16873  
    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 {
     
    8686
    8787      Encoding = new SymbolicExpressionTreeEncoding(new Grammar(), 1000, 10);
     88      Encoding.GrammarParameter.ReadOnly = true;
    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.