[1050] | 1 | #region License Information
|
---|
| 2 | /* HeuristicLab
|
---|
| 3 | * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
|
---|
| 4 | *
|
---|
| 5 | * This file is part of HeuristicLab.
|
---|
| 6 | *
|
---|
| 7 | * HeuristicLab is free software: you can redistribute it and/or modify
|
---|
| 8 | * it under the terms of the GNU General Public License as published by
|
---|
| 9 | * the Free Software Foundation, either version 3 of the License, or
|
---|
| 10 | * (at your option) any later version.
|
---|
| 11 | *
|
---|
| 12 | * HeuristicLab is distributed in the hope that it will be useful,
|
---|
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 15 | * GNU General Public License for more details.
|
---|
| 16 | *
|
---|
| 17 | * You should have received a copy of the GNU General Public License
|
---|
| 18 | * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
|
---|
| 19 | */
|
---|
| 20 | #endregion
|
---|
| 21 |
|
---|
| 22 | using System;
|
---|
| 23 | using System.Collections.Generic;
|
---|
| 24 | using System.Linq;
|
---|
| 25 | using System.Text;
|
---|
| 26 | using HeuristicLab.Core;
|
---|
| 27 | using System.Xml;
|
---|
| 28 | using System.Diagnostics;
|
---|
| 29 | using HeuristicLab.DataAnalysis;
|
---|
| 30 | using HeuristicLab.Operators;
|
---|
| 31 | using HeuristicLab.Random;
|
---|
| 32 | using HeuristicLab.Selection;
|
---|
| 33 | using HeuristicLab.Logging;
|
---|
| 34 | using HeuristicLab.Data;
|
---|
[1052] | 35 | using HeuristicLab.Operators.Programmable;
|
---|
[1856] | 36 | using HeuristicLab.Modeling;
|
---|
[1914] | 37 | using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
|
---|
[1050] | 38 |
|
---|
| 39 | namespace HeuristicLab.GP.StructureIdentification {
|
---|
[1914] | 40 |
|
---|
| 41 | [EmptyStorableClass]
|
---|
[1287] | 42 | public class StandardGP : AlgorithmBase, IEditable {
|
---|
| 43 |
|
---|
[1857] | 44 | public override string Name { get { return "StandardGP"; } }
|
---|
| 45 |
|
---|
[1287] | 46 | public virtual int MaxGenerations {
|
---|
| 47 | get { return GetVariableInjector().GetVariable("MaxGenerations").GetValue<IntData>().Data; }
|
---|
| 48 | set { GetVariableInjector().GetVariable("MaxGenerations").GetValue<IntData>().Data = value; }
|
---|
[1050] | 49 | }
|
---|
[1051] | 50 |
|
---|
[1287] | 51 | public virtual int TournamentSize {
|
---|
| 52 | get { return GetVariableInjector().GetVariable("TournamentSize").GetValue<IntData>().Data; }
|
---|
| 53 | set { GetVariableInjector().GetVariable("TournamentSize").GetValue<IntData>().Data = value; }
|
---|
[1050] | 54 | }
|
---|
[1287] | 55 |
|
---|
| 56 | public double FullTreeShakingFactor {
|
---|
| 57 | get { return GetVariableInjector().GetVariable("FullTreeShakingFactor").GetValue<DoubleData>().Data; }
|
---|
| 58 | set { GetVariableInjector().GetVariable("FullTreeShakingFactor").GetValue<DoubleData>().Data = value; }
|
---|
[1050] | 59 | }
|
---|
| 60 |
|
---|
[1287] | 61 | public double OnePointShakingFactor {
|
---|
| 62 | get { return GetVariableInjector().GetVariable("OnePointShakingFactor").GetValue<DoubleData>().Data; }
|
---|
| 63 | set { GetVariableInjector().GetVariable("OnePointShakingFactor").GetValue<DoubleData>().Data = value; }
|
---|
[1051] | 64 | }
|
---|
| 65 |
|
---|
[1287] | 66 | public int MinInitialTreeSize {
|
---|
| 67 | get { return GetVariableInjector().GetVariable("MinInitialTreeSize").GetValue<IntData>().Data; }
|
---|
| 68 | set { GetVariableInjector().GetVariable("MinInitialTreeSize").GetValue<IntData>().Data = value; }
|
---|
[1051] | 69 | }
|
---|
| 70 |
|
---|
[1287] | 71 | public override int MaxTreeSize {
|
---|
| 72 | get {
|
---|
| 73 | return base.MaxTreeSize;
|
---|
| 74 | }
|
---|
[1051] | 75 | set {
|
---|
[1287] | 76 | base.MaxTreeSize = value;
|
---|
| 77 | MinInitialTreeSize = value / 2;
|
---|
[1051] | 78 | }
|
---|
| 79 | }
|
---|
| 80 |
|
---|
[1287] | 81 | public override int PopulationSize {
|
---|
| 82 | get {
|
---|
| 83 | return base.PopulationSize;
|
---|
| 84 | }
|
---|
| 85 | set {
|
---|
| 86 | base.PopulationSize = value;
|
---|
| 87 | Parents = 2 * value;
|
---|
| 88 | }
|
---|
[1051] | 89 | }
|
---|
| 90 |
|
---|
[1287] | 91 | public StandardGP()
|
---|
| 92 | : base() {
|
---|
| 93 | PopulationSize = 10000;
|
---|
[1050] | 94 | MaxGenerations = 100;
|
---|
| 95 | TournamentSize = 7;
|
---|
| 96 | MutationRate = 0.15;
|
---|
[1052] | 97 | Elites = 1;
|
---|
[1287] | 98 | MaxTreeSize = 100;
|
---|
| 99 | MaxTreeHeight = 10;
|
---|
| 100 | FullTreeShakingFactor = 0.1;
|
---|
| 101 | OnePointShakingFactor = 1.0;
|
---|
| 102 | PunishmentFactor = 10.0;
|
---|
| 103 | UseEstimatedTargetValue = false;
|
---|
| 104 | SetSeedRandomly = true;
|
---|
[1050] | 105 | }
|
---|
| 106 |
|
---|
[1287] | 107 | protected internal override IOperator CreateProblemInjector() {
|
---|
| 108 | return new ProblemInjector();
|
---|
| 109 | }
|
---|
[1050] | 110 |
|
---|
[1287] | 111 | protected internal override IOperator CreateSelector() {
|
---|
[1050] | 112 | TournamentSelector selector = new TournamentSelector();
|
---|
| 113 | selector.Name = "Selector";
|
---|
| 114 | selector.GetVariableInfo("Selected").ActualName = "Parents";
|
---|
| 115 | selector.GetVariableInfo("GroupSize").Local = false;
|
---|
| 116 | selector.RemoveVariable("GroupSize");
|
---|
| 117 | selector.GetVariableInfo("GroupSize").ActualName = "TournamentSize";
|
---|
[1287] | 118 | return selector;
|
---|
| 119 | }
|
---|
[1050] | 120 |
|
---|
[1287] | 121 | protected internal override IOperator CreateGlobalInjector() {
|
---|
| 122 | VariableInjector globalInjector = (VariableInjector)base.CreateGlobalInjector();
|
---|
| 123 | globalInjector.AddVariable(new HeuristicLab.Core.Variable("TournamentSize", new IntData()));
|
---|
| 124 | globalInjector.AddVariable(new HeuristicLab.Core.Variable("MaxGenerations", new IntData()));
|
---|
| 125 | globalInjector.AddVariable(new HeuristicLab.Core.Variable("FullTreeShakingFactor", new DoubleData()));
|
---|
| 126 | globalInjector.AddVariable(new HeuristicLab.Core.Variable("OnePointShakingFactor", new DoubleData()));
|
---|
| 127 | globalInjector.AddVariable(new HeuristicLab.Core.Variable("MinInitialTreeSize", new IntData()));
|
---|
| 128 | return globalInjector;
|
---|
| 129 | }
|
---|
[1050] | 130 |
|
---|
[1287] | 131 | protected internal override IOperator CreateCrossover() {
|
---|
| 132 | StandardCrossOver crossover = new StandardCrossOver();
|
---|
| 133 | crossover.Name = "Crossover";
|
---|
| 134 | crossover.GetVariableInfo("OperatorLibrary").ActualName = "FunctionLibrary";
|
---|
| 135 | return crossover;
|
---|
| 136 | }
|
---|
[1050] | 137 |
|
---|
[1287] | 138 | protected internal override IOperator CreateTreeCreator() {
|
---|
| 139 | ProbabilisticTreeCreator treeCreator = new ProbabilisticTreeCreator();
|
---|
| 140 | treeCreator.Name = "Tree generator";
|
---|
| 141 | treeCreator.GetVariableInfo("OperatorLibrary").ActualName = "FunctionLibrary";
|
---|
| 142 | treeCreator.GetVariableInfo("MinTreeSize").ActualName = "MinInitialTreeSize";
|
---|
| 143 | return treeCreator;
|
---|
[1050] | 144 | }
|
---|
| 145 |
|
---|
[1287] | 146 | protected internal override IOperator CreateFunctionLibraryInjector() {
|
---|
[1873] | 147 | ConfigurableFunctionLibraryInjector funLibInjector = new ConfigurableFunctionLibraryInjector();
|
---|
| 148 | funLibInjector.GetVariableValue<BoolData>("Xor", null, false).Data = false;
|
---|
| 149 | funLibInjector.GetVariableValue<BoolData>("Average", null, false).Data = false;
|
---|
| 150 | return funLibInjector;
|
---|
[1050] | 151 | }
|
---|
| 152 |
|
---|
[1287] | 153 | protected internal override IOperator CreateManipulator() {
|
---|
[1050] | 154 | CombinedOperator manipulator = new CombinedOperator();
|
---|
[1287] | 155 | manipulator.Name = "Manipulator";
|
---|
[1050] | 156 | StochasticMultiBranch multibranch = new StochasticMultiBranch();
|
---|
| 157 | FullTreeShaker fullTreeShaker = new FullTreeShaker();
|
---|
| 158 | fullTreeShaker.GetVariableInfo("OperatorLibrary").ActualName = "FunctionLibrary";
|
---|
[1287] | 159 | fullTreeShaker.GetVariableInfo("ShakingFactor").ActualName = "FullTreeShakingFactor";
|
---|
[1050] | 160 |
|
---|
| 161 | OnePointShaker onepointShaker = new OnePointShaker();
|
---|
| 162 | onepointShaker.GetVariableInfo("OperatorLibrary").ActualName = "FunctionLibrary";
|
---|
[1287] | 163 | onepointShaker.GetVariableInfo("ShakingFactor").ActualName = "OnePointShakingFactor";
|
---|
[1050] | 164 | ChangeNodeTypeManipulation changeNodeTypeManipulation = new ChangeNodeTypeManipulation();
|
---|
| 165 | changeNodeTypeManipulation.GetVariableInfo("OperatorLibrary").ActualName = "FunctionLibrary";
|
---|
| 166 | CutOutNodeManipulation cutOutNodeManipulation = new CutOutNodeManipulation();
|
---|
| 167 | cutOutNodeManipulation.GetVariableInfo("OperatorLibrary").ActualName = "FunctionLibrary";
|
---|
| 168 | DeleteSubTreeManipulation deleteSubTreeManipulation = new DeleteSubTreeManipulation();
|
---|
| 169 | deleteSubTreeManipulation.GetVariableInfo("OperatorLibrary").ActualName = "FunctionLibrary";
|
---|
| 170 | SubstituteSubTreeManipulation substituteSubTreeManipulation = new SubstituteSubTreeManipulation();
|
---|
| 171 | substituteSubTreeManipulation.GetVariableInfo("OperatorLibrary").ActualName = "FunctionLibrary";
|
---|
| 172 |
|
---|
[1051] | 173 | IOperator[] manipulators = new IOperator[] {
|
---|
| 174 | onepointShaker, fullTreeShaker,
|
---|
| 175 | changeNodeTypeManipulation,
|
---|
| 176 | cutOutNodeManipulation,
|
---|
| 177 | deleteSubTreeManipulation,
|
---|
| 178 | substituteSubTreeManipulation};
|
---|
| 179 |
|
---|
| 180 | DoubleArrayData probabilities = new DoubleArrayData(new double[manipulators.Length]);
|
---|
[1287] | 181 | for (int i = 0; i < manipulators.Length; i++) {
|
---|
[1051] | 182 | probabilities.Data[i] = 1.0;
|
---|
| 183 | multibranch.AddSubOperator(manipulators[i]);
|
---|
| 184 | }
|
---|
| 185 | multibranch.GetVariableInfo("Probabilities").Local = true;
|
---|
| 186 | multibranch.AddVariable(new HeuristicLab.Core.Variable("Probabilities", probabilities));
|
---|
| 187 |
|
---|
[1050] | 188 | manipulator.OperatorGraph.AddOperator(multibranch);
|
---|
| 189 | manipulator.OperatorGraph.InitialOperator = multibranch;
|
---|
| 190 | return manipulator;
|
---|
| 191 | }
|
---|
| 192 |
|
---|
[1287] | 193 | protected internal override IOperator CreateBestSolutionProcessor() {
|
---|
| 194 | SequentialProcessor bestSolutionProcessor = new SequentialProcessor();
|
---|
| 195 | MeanSquaredErrorEvaluator testMseEvaluator = new MeanSquaredErrorEvaluator();
|
---|
| 196 | testMseEvaluator.Name = "TestMeanSquaredErrorEvaluator";
|
---|
| 197 | testMseEvaluator.GetVariableInfo("MSE").ActualName = "TestQuality";
|
---|
| 198 | testMseEvaluator.GetVariableInfo("SamplesStart").ActualName = "TestSamplesStart";
|
---|
| 199 | testMseEvaluator.GetVariableInfo("SamplesEnd").ActualName = "TestSamplesEnd";
|
---|
| 200 | MeanAbsolutePercentageErrorEvaluator trainingMapeEvaluator = new MeanAbsolutePercentageErrorEvaluator();
|
---|
| 201 | trainingMapeEvaluator.Name = "TrainingMapeEvaluator";
|
---|
| 202 | trainingMapeEvaluator.GetVariableInfo("MAPE").ActualName = "TrainingMAPE";
|
---|
| 203 | trainingMapeEvaluator.GetVariableInfo("SamplesStart").ActualName = "TrainingSamplesStart";
|
---|
| 204 | trainingMapeEvaluator.GetVariableInfo("SamplesEnd").ActualName = "TrainingSamplesEnd";
|
---|
| 205 | MeanAbsolutePercentageErrorEvaluator validationMapeEvaluator = new MeanAbsolutePercentageErrorEvaluator();
|
---|
| 206 | validationMapeEvaluator.Name = "ValidationMapeEvaluator";
|
---|
| 207 | validationMapeEvaluator.GetVariableInfo("MAPE").ActualName = "ValidationMAPE";
|
---|
| 208 | validationMapeEvaluator.GetVariableInfo("SamplesStart").ActualName = "ValidationSamplesStart";
|
---|
| 209 | validationMapeEvaluator.GetVariableInfo("SamplesEnd").ActualName = "ValidationSamplesEnd";
|
---|
| 210 | MeanAbsolutePercentageErrorEvaluator testMapeEvaluator = new MeanAbsolutePercentageErrorEvaluator();
|
---|
| 211 | testMapeEvaluator.Name = "TestMapeEvaluator";
|
---|
| 212 | testMapeEvaluator.GetVariableInfo("MAPE").ActualName = "TestMAPE";
|
---|
| 213 | testMapeEvaluator.GetVariableInfo("SamplesStart").ActualName = "TestSamplesStart";
|
---|
| 214 | testMapeEvaluator.GetVariableInfo("SamplesEnd").ActualName = "TestSamplesEnd";
|
---|
| 215 | MeanAbsolutePercentageOfRangeErrorEvaluator trainingMapreEvaluator = new MeanAbsolutePercentageOfRangeErrorEvaluator();
|
---|
| 216 | trainingMapreEvaluator.Name = "TrainingMapreEvaluator";
|
---|
| 217 | trainingMapreEvaluator.GetVariableInfo("MAPRE").ActualName = "TrainingMAPRE";
|
---|
| 218 | trainingMapreEvaluator.GetVariableInfo("SamplesStart").ActualName = "TrainingSamplesStart";
|
---|
| 219 | trainingMapreEvaluator.GetVariableInfo("SamplesEnd").ActualName = "TrainingSamplesEnd";
|
---|
| 220 | MeanAbsolutePercentageOfRangeErrorEvaluator validationMapreEvaluator = new MeanAbsolutePercentageOfRangeErrorEvaluator();
|
---|
| 221 | validationMapreEvaluator.Name = "ValidationMapreEvaluator";
|
---|
| 222 | validationMapreEvaluator.GetVariableInfo("MAPRE").ActualName = "ValidationMAPRE";
|
---|
| 223 | validationMapreEvaluator.GetVariableInfo("SamplesStart").ActualName = "ValidationSamplesStart";
|
---|
| 224 | validationMapreEvaluator.GetVariableInfo("SamplesEnd").ActualName = "ValidationSamplesEnd";
|
---|
| 225 | MeanAbsolutePercentageOfRangeErrorEvaluator testMapreEvaluator = new MeanAbsolutePercentageOfRangeErrorEvaluator();
|
---|
| 226 | testMapreEvaluator.Name = "TestMapreEvaluator";
|
---|
| 227 | testMapreEvaluator.GetVariableInfo("MAPRE").ActualName = "TestMAPRE";
|
---|
| 228 | testMapreEvaluator.GetVariableInfo("SamplesStart").ActualName = "TestSamplesStart";
|
---|
| 229 | testMapreEvaluator.GetVariableInfo("SamplesEnd").ActualName = "TestSamplesEnd";
|
---|
| 230 | CoefficientOfDeterminationEvaluator trainingR2Evaluator = new CoefficientOfDeterminationEvaluator();
|
---|
| 231 | trainingR2Evaluator.Name = "TrainingR2Evaluator";
|
---|
| 232 | trainingR2Evaluator.GetVariableInfo("R2").ActualName = "TrainingR2";
|
---|
| 233 | trainingR2Evaluator.GetVariableInfo("SamplesStart").ActualName = "TrainingSamplesStart";
|
---|
| 234 | trainingR2Evaluator.GetVariableInfo("SamplesEnd").ActualName = "TrainingSamplesEnd";
|
---|
| 235 | CoefficientOfDeterminationEvaluator validationR2Evaluator = new CoefficientOfDeterminationEvaluator();
|
---|
| 236 | validationR2Evaluator.Name = "ValidationR2Evaluator";
|
---|
| 237 | validationR2Evaluator.GetVariableInfo("R2").ActualName = "ValidationR2";
|
---|
| 238 | validationR2Evaluator.GetVariableInfo("SamplesStart").ActualName = "ValidationSamplesStart";
|
---|
| 239 | validationR2Evaluator.GetVariableInfo("SamplesEnd").ActualName = "ValidationSamplesEnd";
|
---|
| 240 | CoefficientOfDeterminationEvaluator testR2Evaluator = new CoefficientOfDeterminationEvaluator();
|
---|
| 241 | testR2Evaluator.Name = "TestR2Evaluator";
|
---|
| 242 | testR2Evaluator.GetVariableInfo("R2").ActualName = "TestR2";
|
---|
| 243 | testR2Evaluator.GetVariableInfo("SamplesStart").ActualName = "TestSamplesStart";
|
---|
| 244 | testR2Evaluator.GetVariableInfo("SamplesEnd").ActualName = "TestSamplesEnd";
|
---|
[1890] | 245 | VarianceAccountedForEvaluator trainingVAFEvaluator = new VarianceAccountedForEvaluator();
|
---|
| 246 | trainingVAFEvaluator.Name = "TrainingVAFEvaluator";
|
---|
| 247 | trainingVAFEvaluator.GetVariableInfo("VAF").ActualName = "TrainingVAF";
|
---|
| 248 | trainingVAFEvaluator.GetVariableInfo("SamplesStart").ActualName = "TrainingSamplesStart";
|
---|
| 249 | trainingVAFEvaluator.GetVariableInfo("SamplesEnd").ActualName = "TrainingSamplesEnd";
|
---|
| 250 | VarianceAccountedForEvaluator validationVAFEvaluator = new VarianceAccountedForEvaluator();
|
---|
| 251 | validationVAFEvaluator.Name = "ValidationVAFEvaluator";
|
---|
| 252 | validationVAFEvaluator.GetVariableInfo("VAF").ActualName = "ValidationVAF";
|
---|
| 253 | validationVAFEvaluator.GetVariableInfo("SamplesStart").ActualName = "ValidationSamplesStart";
|
---|
| 254 | validationVAFEvaluator.GetVariableInfo("SamplesEnd").ActualName = "ValidationSamplesEnd";
|
---|
| 255 | VarianceAccountedForEvaluator testVAFEvaluator = new VarianceAccountedForEvaluator();
|
---|
| 256 | testVAFEvaluator.Name = "TestVAFEvaluator";
|
---|
| 257 | testVAFEvaluator.GetVariableInfo("VAF").ActualName = "TestVAF";
|
---|
| 258 | testVAFEvaluator.GetVariableInfo("SamplesStart").ActualName = "TestSamplesStart";
|
---|
| 259 | testVAFEvaluator.GetVariableInfo("SamplesEnd").ActualName = "TestSamplesEnd";
|
---|
| 260 |
|
---|
[1287] | 261 | ProgrammableOperator progOperator = new ProgrammableOperator();
|
---|
| 262 | progOperator.RemoveVariableInfo("Result");
|
---|
| 263 | progOperator.AddVariableInfo(new HeuristicLab.Core.VariableInfo("EvaluatedSolutions", "", typeof(IntData), VariableKind.In));
|
---|
| 264 | progOperator.Code = @"
|
---|
| 265 | int evalSolutions = EvaluatedSolutions.Data;
|
---|
| 266 | scope.AddVariable(new Variable(""EvaluatedSolutions"", new IntData(evalSolutions)));
|
---|
| 267 | ";
|
---|
| 268 | bestSolutionProcessor.AddSubOperator(testMseEvaluator);
|
---|
| 269 | bestSolutionProcessor.AddSubOperator(trainingMapeEvaluator);
|
---|
| 270 | bestSolutionProcessor.AddSubOperator(validationMapeEvaluator);
|
---|
| 271 | bestSolutionProcessor.AddSubOperator(testMapeEvaluator);
|
---|
| 272 | bestSolutionProcessor.AddSubOperator(trainingMapreEvaluator);
|
---|
| 273 | bestSolutionProcessor.AddSubOperator(validationMapreEvaluator);
|
---|
| 274 | bestSolutionProcessor.AddSubOperator(testMapreEvaluator);
|
---|
| 275 | bestSolutionProcessor.AddSubOperator(trainingR2Evaluator);
|
---|
| 276 | bestSolutionProcessor.AddSubOperator(validationR2Evaluator);
|
---|
| 277 | bestSolutionProcessor.AddSubOperator(testR2Evaluator);
|
---|
[1890] | 278 | bestSolutionProcessor.AddSubOperator(trainingVAFEvaluator);
|
---|
| 279 | bestSolutionProcessor.AddSubOperator(validationVAFEvaluator);
|
---|
| 280 | bestSolutionProcessor.AddSubOperator(testVAFEvaluator);
|
---|
[1287] | 281 | bestSolutionProcessor.AddSubOperator(progOperator);
|
---|
| 282 | return bestSolutionProcessor;
|
---|
[1050] | 283 | }
|
---|
| 284 |
|
---|
[1287] | 285 | protected internal override IOperator CreateLoggingOperator() {
|
---|
| 286 | CombinedOperator loggingOperator = new CombinedOperator();
|
---|
| 287 | loggingOperator.Name = "Logging";
|
---|
[1050] | 288 | SequentialProcessor seq = new SequentialProcessor();
|
---|
[1287] | 289 |
|
---|
[1050] | 290 | DataCollector collector = new DataCollector();
|
---|
| 291 | ItemList<StringData> names = collector.GetVariable("VariableNames").GetValue<ItemList<StringData>>();
|
---|
| 292 | names.Add(new StringData("BestQuality"));
|
---|
| 293 | names.Add(new StringData("AverageQuality"));
|
---|
| 294 | names.Add(new StringData("WorstQuality"));
|
---|
[1052] | 295 | names.Add(new StringData("BestValidationQuality"));
|
---|
| 296 | names.Add(new StringData("AverageValidationQuality"));
|
---|
| 297 | names.Add(new StringData("WorstValidationQuality"));
|
---|
[1050] | 298 | LinechartInjector lineChartInjector = new LinechartInjector();
|
---|
| 299 | lineChartInjector.GetVariableInfo("Linechart").ActualName = "Quality Linechart";
|
---|
[1052] | 300 | lineChartInjector.GetVariable("NumberOfLines").GetValue<IntData>().Data = 6;
|
---|
[1050] | 301 | QualityLogger qualityLogger = new QualityLogger();
|
---|
[1052] | 302 | QualityLogger validationQualityLogger = new QualityLogger();
|
---|
[1287] | 303 | validationQualityLogger.Name = "ValidationQualityLogger";
|
---|
[1052] | 304 | validationQualityLogger.GetVariableInfo("Quality").ActualName = "ValidationQuality";
|
---|
| 305 | validationQualityLogger.GetVariableInfo("QualityLog").ActualName = "ValidationQualityLog";
|
---|
[1051] | 306 |
|
---|
| 307 | seq.AddSubOperator(collector);
|
---|
| 308 | seq.AddSubOperator(lineChartInjector);
|
---|
| 309 | seq.AddSubOperator(qualityLogger);
|
---|
[1052] | 310 | seq.AddSubOperator(validationQualityLogger);
|
---|
[1051] | 311 |
|
---|
[1287] | 312 | loggingOperator.OperatorGraph.AddOperator(seq);
|
---|
| 313 | loggingOperator.OperatorGraph.InitialOperator = seq;
|
---|
| 314 | return loggingOperator;
|
---|
[1050] | 315 | }
|
---|
| 316 |
|
---|
[1906] | 317 | protected internal override Model CreateGPModel(IScope bestModelScope) {
|
---|
| 318 | Model model = base.CreateGPModel(bestModelScope);
|
---|
| 319 | model.TestMeanSquaredError = bestModelScope.GetVariableValue<DoubleData>("TestQuality", false).Data;
|
---|
| 320 | return model;
|
---|
| 321 | }
|
---|
| 322 |
|
---|
[1287] | 323 | public virtual IEditor CreateEditor() {
|
---|
[1051] | 324 | return new StandardGpEditor(this);
|
---|
| 325 | }
|
---|
| 326 |
|
---|
[1052] | 327 | public override IView CreateView() {
|
---|
[1051] | 328 | return new StandardGpEditor(this);
|
---|
| 329 | }
|
---|
[1050] | 330 | }
|
---|
| 331 | }
|
---|