- Timestamp:
- 05/13/19 15:16:40 (6 years ago)
- Location:
- branches/2521_ProblemRefactoring
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2521_ProblemRefactoring/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessCovarianceOptimizationProblem.cs
r16813 r16947 60 60 private static readonly CovarianceSquaredExponentialIso sqrExpIso; 61 61 62 private static readonly SymbolicExpressionTreeEncoding defaultEncoding;63 64 62 static GaussianProcessCovarianceOptimizationProblem() { 65 63 // cumbersome initialization because of ConstrainedValueParameters … … 187 185 Encoding.TreeLength = 10; 188 186 Encoding.TreeDepth = 5; 187 Encoding.GrammarParameter.ReadOnly = false; 189 188 Encoding.Grammar = g; 189 Encoding.GrammarParameter.ReadOnly = true; 190 190 } 191 191 -
branches/2521_ProblemRefactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/SymbolicExpressionTreeEncoding.cs
r16723 r16947 25 25 using System.Collections.Generic; 26 26 using System.Linq; 27 using HEAL.Attic; 27 28 using HeuristicLab.Common; 28 29 using HeuristicLab.Core; … … 30 31 using HeuristicLab.Optimization; 31 32 using HeuristicLab.Parameters; 32 using HEAL.Attic;33 33 using HeuristicLab.PluginInfrastructure; 34 34 … … 167 167 treeDepthParameter = new FixedValueParameter<IntValue>(Name + ".Maximum Tree Depth", "Maximal depth of the symbolic expression. The minimum depth needed for the algorithm is 3 because two levels are reserved for the ProgramRoot and the Start symbol.", new IntValue(maximumDepth)); 168 168 grammarParameter = new ValueParameter<ISymbolicExpressionGrammar>(Name + ".Grammar", "The grammar that should be used for symbolic expression tree.", grammar); 169 grammarParameter.ReadOnly = true; 169 170 functionDefinitionsParameter = new FixedValueParameter<IntValue>(Name + ".Function Definitions", "Maximal number of automatically defined functions", new IntValue(0)); 170 171 functionArgumentsParameter = new FixedValueParameter<IntValue>(Name + ".Function Arguments", "Maximal number of arguments of automatically defined functions.", new IntValue(0)); -
branches/2521_ProblemRefactoring/HeuristicLab.Problems.GeneticProgramming/3.3/ArtificialAnt/Problem.cs
r16946 r16947 82 82 get { return (IValueParameter<BoolMatrix>)Parameters["World"]; } 83 83 } 84 public I ValueParameter<IntValue> MaxTimeStepsParameter {85 get { return (I ValueParameter<IntValue>)Parameters["MaximumTimeSteps"]; }84 public IFixedValueParameter<IntValue> MaxTimeStepsParameter { 85 get { return (IFixedValueParameter<IntValue>)Parameters["MaximumTimeSteps"]; } 86 86 } 87 87 #endregion … … 92 92 set { WorldParameter.Value = value; } 93 93 } 94 public IntValueMaxTimeSteps {95 get { return MaxTimeStepsParameter.Value ; }96 set { MaxTimeStepsParameter.Value = value; }94 public int MaxTimeSteps { 95 get { return MaxTimeStepsParameter.Value.Value; } 96 set { MaxTimeStepsParameter.Value.Value = value; } 97 97 } 98 98 #endregion … … 119 119 BoolMatrix world = new BoolMatrix(ToBoolMatrix(santaFeAntTrail)); 120 120 Parameters.Add(new ValueParameter<BoolMatrix>("World", "The world for the artificial ant with scattered food items.", world)); 121 Parameters.Add(new ValueParameter<IntValue>("MaximumTimeSteps", "The number of time steps the artificial ant has available to collect all food items.", new IntValue(600)));121 Parameters.Add(new FixedValueParameter<IntValue>("MaximumTimeSteps", "The number of time steps the artificial ant has available to collect all food items.", new IntValue(600))); 122 122 123 123 var g = new SimpleSymbolicExpressionGrammar(); … … 128 128 Encoding.TreeLength = 20; 129 129 Encoding.TreeDepth = 10; 130 Encoding.GrammarParameter.ReadOnly = false; 130 131 Encoding.Grammar = g; 131 base.BestKnownQuality = 89; 132 base.Encoding.GrammarParameter.ReadOnly = true; 132 Encoding.GrammarParameter.ReadOnly = true; 133 134 BestKnownQuality = 89; 135 BestKnownQualityParameter.ReadOnly = true; 133 136 } 134 137 135 138 136 139 public override double Evaluate(ISymbolicExpressionTree tree, IRandom random) { 137 var interpreter = new Interpreter(tree, World, MaxTimeSteps .Value);140 var interpreter = new Interpreter(tree, World, MaxTimeSteps); 138 141 interpreter.Run(); 139 142 return interpreter.FoodEaten; … … 146 149 147 150 if (!results.ContainsKey(bestSolutionResultName)) { 148 results.Add(new Result(bestSolutionResultName, new Solution(World, trees[bestIdx], MaxTimeSteps .Value, qualities[bestIdx])));151 results.Add(new Result(bestSolutionResultName, new Solution(World, trees[bestIdx], MaxTimeSteps, qualities[bestIdx]))); 149 152 } else if (((Solution)(results[bestSolutionResultName].Value)).Quality < qualities[bestIdx]) { 150 results[bestSolutionResultName].Value = new Solution(World, trees[bestIdx], MaxTimeSteps .Value, qualities[bestIdx]);153 results[bestSolutionResultName].Value = new Solution(World, trees[bestIdx], MaxTimeSteps, qualities[bestIdx]); 151 154 } 152 155 } -
branches/2521_ProblemRefactoring/HeuristicLab.Problems.GeneticProgramming/3.3/BasicSymbolicRegression/Problem.cs
r16946 r16947 86 86 Encoding.TreeLength = 100; 87 87 Encoding.TreeDepth = 17; 88 Encoding.GrammarParameter.ReadOnly = true;89 88 90 89 UpdateGrammar(); -
branches/2521_ProblemRefactoring/HeuristicLab.Problems.GeneticProgramming/3.3/Boolean/EvenParityProblem.cs
r16813 r16947 96 96 g.AddTerminalSymbol(string.Format("{0}", i)); 97 97 98 Encoding.GrammarParameter.ReadOnly = false; 98 99 Encoding.Grammar = g; 100 Encoding.GrammarParameter.ReadOnly = true; 99 101 102 BestKnownQualityParameter.ReadOnly = false; 100 103 BestKnownQuality = Math.Pow(2, NumberOfBits); // this is a benchmark problem (the best achievable quality is known for a given number of bits) 104 BestKnownQualityParameter.ReadOnly = true; 101 105 } 102 106 -
branches/2521_ProblemRefactoring/HeuristicLab.Problems.GeneticProgramming/3.3/Boolean/MultiplexerProblem.cs
r16946 r16947 86 86 new IntValue(11))); 87 87 88 var g = new SimpleSymbolicExpressionGrammar(); // will be replaced in update grammar 89 Encoding = new SymbolicExpressionTreeEncoding(g, 100, 17); 90 Encoding.GrammarParameter.ReadOnly = true; 88 Encoding.TreeLength = 100; 89 Encoding.TreeDepth = 17; 91 90 92 91 UpdateGrammar(); … … 115 114 Encoding.GrammarParameter.ReadOnly = true; 116 115 116 BestKnownQualityParameter.ReadOnly = false; 117 117 BestKnownQuality = Math.Pow(2, NumberOfBits); // this is a benchmark problem (the best achievable quality is known for a given number of bits) 118 BestKnownQualityParameter.ReadOnly = true; 118 119 } 119 120 -
branches/2521_ProblemRefactoring/HeuristicLab.Problems.GeneticProgramming/3.3/LawnMower/Problem.cs
r16813 r16947 78 78 Encoding.TreeLength = 1000; 79 79 Encoding.TreeDepth = 17; 80 Encoding.GrammarParameter.ReadOnly = false; 80 81 Encoding.Grammar = g; 82 Encoding.GrammarParameter.ReadOnly = true; 81 83 } 82 84 -
branches/2521_ProblemRefactoring/HeuristicLab.Problems.GeneticProgramming/3.3/robocode/Problem.cs
r16946 r16947 73 73 } 74 74 75 public Problem() : base(new SymbolicExpressionTreeEncoding( )) {75 public Problem() : base(new SymbolicExpressionTreeEncoding(new Grammar(), maximumLength: 1000, maximumDepth: 10)) { 76 76 DirectoryValue robocodeDir = new DirectoryValue { Value = @"robocode" }; 77 77 … … 84 84 Parameters.Add(new ValueParameter<EnemyCollection>(EnemiesParameterName, "The enemies that should be battled.", robotList)); 85 85 86 Encoding.TreeLength = 1000;87 Encoding.TreeDepth = 10;88 Encoding.Grammar = new Grammar();89 Encoding.GrammarParameter.ReadOnly = true;90 86 Encoding.FunctionArguments = 0; 91 87 Encoding.FunctionDefinitions = 0;
Note: See TracChangeset
for help on using the changeset viewer.