[3130] | 1 | #region License Information
|
---|
| 2 | /* HeuristicLab
|
---|
| 3 | * Copyright (C) 2002-2010 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 HeuristicLab.Analysis;
|
---|
| 23 | using HeuristicLab.Core;
|
---|
| 24 | using HeuristicLab.Data;
|
---|
| 25 | using HeuristicLab.Operators;
|
---|
| 26 | using HeuristicLab.Optimization.Operators;
|
---|
| 27 | using HeuristicLab.Parameters;
|
---|
| 28 | using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
|
---|
| 29 | using HeuristicLab.Selection;
|
---|
| 30 | using HeuristicLab.Encodings.RealVectorEncoding;
|
---|
| 31 |
|
---|
| 32 | namespace HeuristicLab.Algorithms.EvolutionStrategy {
|
---|
| 33 | /// <summary>
|
---|
| 34 | /// An operator which represents the main loop of an evolution strategy (EvolutionStrategy).
|
---|
| 35 | /// </summary>
|
---|
| 36 | [Item("EvolutionStrategyMainLoop", "An operator which represents the main loop of an evolution strategy (EvolutionStrategy).")]
|
---|
| 37 | [StorableClass]
|
---|
| 38 | public sealed class EvolutionStrategyMainLoop : AlgorithmOperator {
|
---|
| 39 | #region Parameter properties
|
---|
| 40 | public ValueLookupParameter<IRandom> RandomParameter {
|
---|
| 41 | get { return (ValueLookupParameter<IRandom>)Parameters["Random"]; }
|
---|
| 42 | }
|
---|
| 43 | public ValueLookupParameter<BoolValue> MaximizationParameter {
|
---|
| 44 | get { return (ValueLookupParameter<BoolValue>)Parameters["Maximization"]; }
|
---|
| 45 | }
|
---|
| 46 | public SubScopesLookupParameter<DoubleValue> QualityParameter {
|
---|
| 47 | get { return (SubScopesLookupParameter<DoubleValue>)Parameters["Quality"]; }
|
---|
| 48 | }
|
---|
| 49 | public ValueLookupParameter<DoubleValue> BestKnownQualityParameter {
|
---|
| 50 | get { return (ValueLookupParameter<DoubleValue>)Parameters["BestKnownQuality"]; }
|
---|
| 51 | }
|
---|
| 52 | public ValueLookupParameter<IntValue> PopulationSizeParameter {
|
---|
| 53 | get { return (ValueLookupParameter<IntValue>)Parameters["PopulationSize"]; }
|
---|
| 54 | }
|
---|
| 55 | public ValueLookupParameter<IntValue> ParentsPerChildParameter {
|
---|
| 56 | get { return (ValueLookupParameter<IntValue>)Parameters["ParentsPerChild"]; }
|
---|
| 57 | }
|
---|
| 58 | public ValueLookupParameter<IntValue> ChildrenParameter {
|
---|
| 59 | get { return (ValueLookupParameter<IntValue>)Parameters["Children"]; }
|
---|
| 60 | }
|
---|
| 61 | public ValueLookupParameter<RealVector> StrategyVectorParameter {
|
---|
| 62 | get { return (ValueLookupParameter<RealVector>)Parameters["StrategyVector"]; }
|
---|
| 63 | }
|
---|
| 64 | public ValueLookupParameter<DoubleMatrix> StrategyVectorBoundsParameter {
|
---|
| 65 | get { return (ValueLookupParameter<DoubleMatrix>)Parameters["StrategyVectorBounds"]; }
|
---|
| 66 | }
|
---|
| 67 | public ValueLookupParameter<DoubleValue> GeneralLearningRateParameter {
|
---|
| 68 | get { return (ValueLookupParameter<DoubleValue>)Parameters["GeneralLearningRate"]; }
|
---|
| 69 | }
|
---|
| 70 | public ValueLookupParameter<DoubleValue> LearningRateParameter {
|
---|
| 71 | get { return (ValueLookupParameter<DoubleValue>)Parameters["LearningRate"]; }
|
---|
| 72 | }
|
---|
| 73 | public ValueLookupParameter<BoolValue> PlusSelectionParameter {
|
---|
| 74 | get { return (ValueLookupParameter<BoolValue>)Parameters["PlusSelection"]; }
|
---|
| 75 | }
|
---|
| 76 | public ValueLookupParameter<IntValue> MaximumGenerationsParameter {
|
---|
| 77 | get { return (ValueLookupParameter<IntValue>)Parameters["MaximumGenerations"]; }
|
---|
| 78 | }
|
---|
| 79 | public ValueLookupParameter<IOperator> MutatorParameter {
|
---|
| 80 | get { return (ValueLookupParameter<IOperator>)Parameters["Mutator"]; }
|
---|
| 81 | }
|
---|
| 82 | public ValueLookupParameter<IOperator> RecombinatorParameter {
|
---|
| 83 | get { return (ValueLookupParameter<IOperator>)Parameters["Recombinator"]; }
|
---|
| 84 | }
|
---|
| 85 | public ValueLookupParameter<IOperator> EvaluatorParameter {
|
---|
| 86 | get { return (ValueLookupParameter<IOperator>)Parameters["Evaluator"]; }
|
---|
| 87 | }
|
---|
| 88 | public ValueLookupParameter<VariableCollection> ResultsParameter {
|
---|
| 89 | get { return (ValueLookupParameter<VariableCollection>)Parameters["Results"]; }
|
---|
| 90 | }
|
---|
| 91 | public ValueLookupParameter<IOperator> VisualizerParameter {
|
---|
| 92 | get { return (ValueLookupParameter<IOperator>)Parameters["Visualizer"]; }
|
---|
| 93 | }
|
---|
| 94 | public LookupParameter<IItem> VisualizationParameter {
|
---|
| 95 | get { return (LookupParameter<IItem>)Parameters["Visualization"]; }
|
---|
| 96 | }
|
---|
| 97 | private ScopeParameter CurrentScopeParameter {
|
---|
| 98 | get { return (ScopeParameter)Parameters["CurrentScope"]; }
|
---|
| 99 | }
|
---|
| 100 |
|
---|
| 101 | public IScope CurrentScope {
|
---|
| 102 | get { return CurrentScopeParameter.ActualValue; }
|
---|
| 103 | }
|
---|
| 104 | #endregion
|
---|
| 105 |
|
---|
| 106 | [StorableConstructor]
|
---|
| 107 | private EvolutionStrategyMainLoop(bool deserializing) : base() { }
|
---|
| 108 | public EvolutionStrategyMainLoop()
|
---|
| 109 | : base() {
|
---|
| 110 | Initialize();
|
---|
| 111 | }
|
---|
| 112 |
|
---|
| 113 | private void Initialize() {
|
---|
| 114 | #region Create parameters
|
---|
| 115 | Parameters.Add(new ValueLookupParameter<IRandom>("Random", "A pseudo random number generator."));
|
---|
| 116 | Parameters.Add(new ValueLookupParameter<BoolValue>("Maximization", "True if the problem is a maximization problem, otherwise false."));
|
---|
| 117 | Parameters.Add(new SubScopesLookupParameter<DoubleValue>("Quality", "The value which represents the quality of a solution."));
|
---|
| 118 | Parameters.Add(new ValueLookupParameter<DoubleValue>("BestKnownQuality", "The best known quality value found so far."));
|
---|
| 119 | Parameters.Add(new ValueLookupParameter<IntValue>("PopulationSize", "µ (mu) - the size of the population."));
|
---|
| 120 | Parameters.Add(new ValueLookupParameter<IntValue>("ParentsPerChild", "ρ (rho) - how many parents should be recombined."));
|
---|
| 121 | Parameters.Add(new ValueLookupParameter<IntValue>("Children", "λ (lambda) - the size of the offspring population."));
|
---|
| 122 | Parameters.Add(new ValueLookupParameter<IntValue>("MaximumGenerations", "The maximum number of generations which should be processed."));
|
---|
| 123 | Parameters.Add(new ValueLookupParameter<RealVector>("StrategyVector", "The strategy vector."));
|
---|
| 124 | Parameters.Add(new LookupParameter<DoubleMatrix>("StrategyVectorBounds", "2 column matrix with one row for each dimension specifying upper and lower bound for the strategy vector. If there are less rows than dimensions, the strategy vector will be read in a cycle."));
|
---|
| 125 | Parameters.Add(new ValueLookupParameter<DoubleValue>("GeneralLearningRate", "τ0 (tau0) - the factor with which adjustments in the strategy vector is dampened over all dimensions. Recommendation is to use 1/Sqrt(2*ProblemDimension)."));
|
---|
| 126 | Parameters.Add(new ValueLookupParameter<DoubleValue>("LearningRate", "τ (tau) - the factor with which adjustments in the strategy vector are dampened in a single dimension. Recommendation is to use 1/Sqrt(2*Sqrt(ProblemDimension))."));
|
---|
| 127 | Parameters.Add(new ValueLookupParameter<BoolValue>("PlusSelection", "True for plus selection (elitist population), false for comma selection (non-elitist population)."));
|
---|
| 128 | Parameters.Add(new ValueLookupParameter<IOperator>("Mutator", "The operator used to mutate solutions."));
|
---|
| 129 | Parameters.Add(new ValueLookupParameter<IOperator>("Recombinator", "The operator used to cross solutions."));
|
---|
| 130 | Parameters.Add(new ValueLookupParameter<IOperator>("Evaluator", "The operator used to evaluate solutions."));
|
---|
| 131 | Parameters.Add(new ValueLookupParameter<VariableCollection>("Results", "The variable collection where results should be stored."));
|
---|
| 132 | Parameters.Add(new ValueLookupParameter<IOperator>("Visualizer", "The operator used to visualize solutions."));
|
---|
| 133 | Parameters.Add(new LookupParameter<IItem>("Visualization", "The item which represents the visualization of solutions."));
|
---|
| 134 | Parameters.Add(new ScopeParameter("CurrentScope", "The current scope which represents a population of solutions on which the EvolutionStrategy should be applied."));
|
---|
| 135 | #endregion
|
---|
| 136 |
|
---|
| 137 | #region Create operators
|
---|
| 138 | VariableCreator variableCreator = new VariableCreator();
|
---|
| 139 | BestQualityMemorizer bestQualityMemorizer1 = new BestQualityMemorizer();
|
---|
| 140 | BestQualityMemorizer bestQualityMemorizer2 = new BestQualityMemorizer();
|
---|
| 141 | BestAverageWorstQualityCalculator bestAverageWorstQualityCalculator1 = new BestAverageWorstQualityCalculator();
|
---|
| 142 | DataTableValuesCollector dataTableValuesCollector1 = new DataTableValuesCollector();
|
---|
| 143 | QualityDifferenceCalculator qualityDifferenceCalculator1 = new QualityDifferenceCalculator();
|
---|
| 144 | Placeholder visualizer1 = new Placeholder();
|
---|
| 145 | ResultsCollector resultsCollector = new ResultsCollector();
|
---|
| 146 | WithoutRepeatingBatchedRandomSelector selector = new WithoutRepeatingBatchedRandomSelector();
|
---|
| 147 | SubScopesProcessor subScopesProcessor1 = new SubScopesProcessor();
|
---|
| 148 | Comparator useRecombinationComparator = new Comparator();
|
---|
| 149 | ConditionalBranch useRecombinationBranch = new ConditionalBranch();
|
---|
| 150 | ChildrenCreator childrenCreator = new ChildrenCreator();
|
---|
| 151 | UniformSubScopesProcessor uniformSubScopesProcessor1 = new UniformSubScopesProcessor();
|
---|
| 152 | Placeholder recombinator = new Placeholder();
|
---|
| 153 | StrategyVectorManipulator strategyMutator1 = new StrategyVectorManipulator();
|
---|
| 154 | Placeholder mutator1 = new Placeholder();
|
---|
| 155 | Placeholder evaluator1 = new Placeholder();
|
---|
| 156 | SubScopesRemover subScopesRemover = new SubScopesRemover();
|
---|
| 157 | UniformSubScopesProcessor uniformSubScopesProcessor2 = new UniformSubScopesProcessor();
|
---|
| 158 | StrategyVectorManipulator strategyMutator2 = new StrategyVectorManipulator();
|
---|
| 159 | Placeholder mutator2 = new Placeholder();
|
---|
| 160 | Placeholder evaluator2 = new Placeholder();
|
---|
| 161 | ConditionalBranch plusOrCommaReplacementBranch = new ConditionalBranch();
|
---|
| 162 | MergingReducer plusReplacement = new MergingReducer();
|
---|
| 163 | RightReducer commaReplacement = new RightReducer();
|
---|
| 164 | BestSelector bestSelector = new BestSelector();
|
---|
| 165 | RightReducer rightReducer = new RightReducer();
|
---|
| 166 | IntCounter intCounter = new IntCounter();
|
---|
| 167 | Comparator comparator = new Comparator();
|
---|
| 168 | BestQualityMemorizer bestQualityMemorizer3 = new BestQualityMemorizer();
|
---|
| 169 | BestQualityMemorizer bestQualityMemorizer4 = new BestQualityMemorizer();
|
---|
| 170 | BestAverageWorstQualityCalculator bestAverageWorstQualityCalculator2 = new BestAverageWorstQualityCalculator();
|
---|
| 171 | DataTableValuesCollector dataTableValuesCollector2 = new DataTableValuesCollector();
|
---|
| 172 | QualityDifferenceCalculator qualityDifferenceCalculator2 = new QualityDifferenceCalculator();
|
---|
| 173 | Placeholder visualizer2 = new Placeholder();
|
---|
| 174 | ConditionalBranch conditionalBranch = new ConditionalBranch();
|
---|
| 175 |
|
---|
| 176 | variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Generations", new IntValue(0)));
|
---|
| 177 |
|
---|
| 178 | bestQualityMemorizer1.BestQualityParameter.ActualName = "BestQuality";
|
---|
| 179 | bestQualityMemorizer1.MaximizationParameter.ActualName = MaximizationParameter.Name;
|
---|
| 180 | bestQualityMemorizer1.QualityParameter.ActualName = QualityParameter.Name;
|
---|
| 181 |
|
---|
| 182 | bestQualityMemorizer2.BestQualityParameter.ActualName = BestKnownQualityParameter.Name;
|
---|
| 183 | bestQualityMemorizer2.MaximizationParameter.ActualName = MaximizationParameter.Name;
|
---|
| 184 | bestQualityMemorizer2.QualityParameter.ActualName = QualityParameter.Name;
|
---|
| 185 |
|
---|
| 186 | bestAverageWorstQualityCalculator1.AverageQualityParameter.ActualName = "CurrentAverageQuality";
|
---|
| 187 | bestAverageWorstQualityCalculator1.BestQualityParameter.ActualName = "CurrentBestQuality";
|
---|
| 188 | bestAverageWorstQualityCalculator1.MaximizationParameter.ActualName = MaximizationParameter.Name;
|
---|
| 189 | bestAverageWorstQualityCalculator1.QualityParameter.ActualName = QualityParameter.Name;
|
---|
| 190 | bestAverageWorstQualityCalculator1.WorstQualityParameter.ActualName = "CurrentWorstQuality";
|
---|
| 191 |
|
---|
| 192 | dataTableValuesCollector1.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Best Quality", null, "CurrentBestQuality"));
|
---|
| 193 | dataTableValuesCollector1.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Average Quality", null, "CurrentAverageQuality"));
|
---|
| 194 | dataTableValuesCollector1.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Worst Quality", null, "CurrentWorstQuality"));
|
---|
| 195 | dataTableValuesCollector1.CollectedValues.Add(new LookupParameter<DoubleValue>("Best Quality", null, "BestQuality"));
|
---|
| 196 | dataTableValuesCollector1.CollectedValues.Add(new LookupParameter<DoubleValue>("Best Known Quality", null, BestKnownQualityParameter.Name));
|
---|
| 197 | dataTableValuesCollector1.DataTableParameter.ActualName = "Qualities";
|
---|
| 198 |
|
---|
| 199 | qualityDifferenceCalculator1.AbsoluteDifferenceParameter.ActualName = "AbsoluteDifferenceBestKnownToBest";
|
---|
| 200 | qualityDifferenceCalculator1.FirstQualityParameter.ActualName = BestKnownQualityParameter.Name;
|
---|
| 201 | qualityDifferenceCalculator1.RelativeDifferenceParameter.ActualName = "RelativeDifferenceBestKnownToBest";
|
---|
| 202 | qualityDifferenceCalculator1.SecondQualityParameter.ActualName = "BestQuality";
|
---|
| 203 |
|
---|
| 204 | visualizer1.Name = "Visualizer (placeholder)";
|
---|
| 205 | visualizer1.OperatorParameter.ActualName = VisualizerParameter.Name;
|
---|
| 206 |
|
---|
| 207 | resultsCollector.CollectedValues.Add(new LookupParameter<IntValue>("Generations"));
|
---|
| 208 | resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Best Quality", null, "CurrentBestQuality"));
|
---|
| 209 | resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Average Quality", null, "CurrentAverageQuality"));
|
---|
| 210 | resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Worst Quality", null, "CurrentWorstQuality"));
|
---|
| 211 | resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Best Quality", null, "BestQuality"));
|
---|
| 212 | resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Best Known Quality", null, BestKnownQualityParameter.Name));
|
---|
| 213 | resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Absolute Difference of Best Known Quality to Best Quality", null, "AbsoluteDifferenceBestKnownToBest"));
|
---|
| 214 | resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Relative Difference of Best Known Quality to Best Quality", null, "RelativeDifferenceBestKnownToBest"));
|
---|
| 215 | resultsCollector.CollectedValues.Add(new LookupParameter<IItem>("Solution Visualization", null, VisualizationParameter.Name));
|
---|
| 216 | resultsCollector.CollectedValues.Add(new LookupParameter<DataTable>("Qualities"));
|
---|
| 217 | resultsCollector.ResultsParameter.ActualName = ResultsParameter.Name;
|
---|
| 218 |
|
---|
| 219 | selector.Name = "ES Random Selector";
|
---|
| 220 | selector.ParentsPerChildParameter.ActualName = ParentsPerChildParameter.Name;
|
---|
| 221 | selector.ChildrenParameter.ActualName = ChildrenParameter.Name;
|
---|
| 222 |
|
---|
| 223 | useRecombinationComparator.Name = "ParentsPerChild > 1";
|
---|
| 224 | useRecombinationComparator.LeftSideParameter.ActualName = ParentsPerChildParameter.Name;
|
---|
| 225 | useRecombinationComparator.RightSideParameter.Value = new IntValue(1);
|
---|
| 226 | useRecombinationComparator.Comparison = new Comparison(ComparisonType.Greater);
|
---|
| 227 | useRecombinationComparator.ResultParameter.ActualName = "UseRecombination";
|
---|
| 228 |
|
---|
| 229 | useRecombinationBranch.Name = "Use Recombination?";
|
---|
| 230 | useRecombinationBranch.ConditionParameter.ActualName = "UseRecombination";
|
---|
| 231 |
|
---|
| 232 | childrenCreator.ParentsPerChildParameter.ActualName = ParentsPerChildParameter.Name;
|
---|
| 233 |
|
---|
| 234 | recombinator.Name = "Recombinator (placeholder)";
|
---|
| 235 | recombinator.OperatorParameter.ActualName = RecombinatorParameter.Name;
|
---|
| 236 |
|
---|
| 237 | strategyMutator1.StrategyVectorParameter.ActualName = StrategyVectorParameter.Name;
|
---|
| 238 | strategyMutator1.GeneralLearningRateParameter.ActualName = GeneralLearningRateParameter.Name;
|
---|
| 239 | strategyMutator1.LearningRateParameter.ActualName = LearningRateParameter.Name;
|
---|
| 240 | strategyMutator1.RandomParameter.ActualName = RandomParameter.Name;
|
---|
| 241 |
|
---|
| 242 | mutator1.Name = "Mutator (placeholder)";
|
---|
| 243 | mutator1.OperatorParameter.ActualName = MutatorParameter.Name;
|
---|
| 244 |
|
---|
| 245 | evaluator1.Name = "Evaluator (placeholder)";
|
---|
| 246 | evaluator1.OperatorParameter.ActualName = EvaluatorParameter.Name;
|
---|
| 247 |
|
---|
| 248 | subScopesRemover.RemoveAllSubScopes = true;
|
---|
| 249 |
|
---|
| 250 | strategyMutator2.StrategyVectorParameter.ActualName = StrategyVectorParameter.Name;
|
---|
| 251 | strategyMutator2.GeneralLearningRateParameter.ActualName = GeneralLearningRateParameter.Name;
|
---|
| 252 | strategyMutator2.LearningRateParameter.ActualName = LearningRateParameter.Name;
|
---|
| 253 | strategyMutator2.RandomParameter.ActualName = RandomParameter.Name;
|
---|
| 254 |
|
---|
| 255 | mutator2.Name = "Mutator (placeholder)";
|
---|
| 256 | mutator2.OperatorParameter.ActualName = MutatorParameter.Name;
|
---|
| 257 |
|
---|
| 258 | evaluator2.Name = "Evaluator (placeholder)";
|
---|
| 259 | evaluator2.OperatorParameter.ActualName = EvaluatorParameter.Name;
|
---|
| 260 |
|
---|
| 261 | plusOrCommaReplacementBranch.ConditionParameter.ActualName = PlusSelectionParameter.Name;
|
---|
| 262 |
|
---|
| 263 | bestSelector.CopySelected = new BoolValue(false);
|
---|
| 264 | bestSelector.MaximizationParameter.ActualName = MaximizationParameter.Name;
|
---|
| 265 | bestSelector.NumberOfSelectedSubScopesParameter.ActualName = PopulationSizeParameter.Name;
|
---|
| 266 | bestSelector.QualityParameter.ActualName = QualityParameter.Name;
|
---|
| 267 |
|
---|
| 268 | intCounter.Increment = new IntValue(1);
|
---|
| 269 | intCounter.ValueParameter.ActualName = "Generations";
|
---|
| 270 |
|
---|
| 271 | comparator.Comparison = new Comparison(ComparisonType.GreaterOrEqual);
|
---|
| 272 | comparator.LeftSideParameter.ActualName = "Generations";
|
---|
| 273 | comparator.ResultParameter.ActualName = "Terminate";
|
---|
| 274 | comparator.RightSideParameter.ActualName = MaximumGenerationsParameter.Name;
|
---|
| 275 |
|
---|
| 276 | bestQualityMemorizer3.BestQualityParameter.ActualName = "BestQuality";
|
---|
| 277 | bestQualityMemorizer3.MaximizationParameter.ActualName = MaximizationParameter.Name;
|
---|
| 278 | bestQualityMemorizer3.QualityParameter.ActualName = QualityParameter.Name;
|
---|
| 279 |
|
---|
| 280 | bestQualityMemorizer4.BestQualityParameter.ActualName = BestKnownQualityParameter.Name;
|
---|
| 281 | bestQualityMemorizer4.MaximizationParameter.ActualName = MaximizationParameter.Name;
|
---|
| 282 | bestQualityMemorizer4.QualityParameter.ActualName = QualityParameter.Name;
|
---|
| 283 |
|
---|
| 284 | bestAverageWorstQualityCalculator2.AverageQualityParameter.ActualName = "CurrentAverageQuality";
|
---|
| 285 | bestAverageWorstQualityCalculator2.BestQualityParameter.ActualName = "CurrentBestQuality";
|
---|
| 286 | bestAverageWorstQualityCalculator2.MaximizationParameter.ActualName = MaximizationParameter.Name;
|
---|
| 287 | bestAverageWorstQualityCalculator2.QualityParameter.ActualName = QualityParameter.Name;
|
---|
| 288 | bestAverageWorstQualityCalculator2.WorstQualityParameter.ActualName = "CurrentWorstQuality";
|
---|
| 289 |
|
---|
| 290 | dataTableValuesCollector2.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Best Quality", null, "CurrentBestQuality"));
|
---|
| 291 | dataTableValuesCollector2.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Average Quality", null, "CurrentAverageQuality"));
|
---|
| 292 | dataTableValuesCollector2.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Worst Quality", null, "CurrentWorstQuality"));
|
---|
| 293 | dataTableValuesCollector2.CollectedValues.Add(new LookupParameter<DoubleValue>("Best Quality", null, "BestQuality"));
|
---|
| 294 | dataTableValuesCollector2.CollectedValues.Add(new LookupParameter<DoubleValue>("Best Known Quality", null, BestKnownQualityParameter.Name));
|
---|
| 295 | dataTableValuesCollector2.DataTableParameter.ActualName = "Qualities";
|
---|
| 296 |
|
---|
| 297 | qualityDifferenceCalculator2.AbsoluteDifferenceParameter.ActualName = "AbsoluteDifferenceBestKnownToBest";
|
---|
| 298 | qualityDifferenceCalculator2.FirstQualityParameter.ActualName = BestKnownQualityParameter.Name;
|
---|
| 299 | qualityDifferenceCalculator2.RelativeDifferenceParameter.ActualName = "RelativeDifferenceBestKnownToBest";
|
---|
| 300 | qualityDifferenceCalculator2.SecondQualityParameter.ActualName = "BestQuality";
|
---|
| 301 |
|
---|
| 302 | visualizer2.Name = "Visualizer (placeholder)";
|
---|
| 303 | visualizer2.OperatorParameter.ActualName = VisualizerParameter.Name;
|
---|
| 304 |
|
---|
| 305 | conditionalBranch.ConditionParameter.ActualName = "Terminate";
|
---|
| 306 | #endregion
|
---|
| 307 |
|
---|
| 308 | #region Create operator graph
|
---|
| 309 | OperatorGraph.InitialOperator = variableCreator;
|
---|
| 310 | variableCreator.Successor = bestQualityMemorizer1;
|
---|
| 311 | bestQualityMemorizer1.Successor = bestQualityMemorizer2;
|
---|
| 312 | bestQualityMemorizer2.Successor = bestAverageWorstQualityCalculator1;
|
---|
| 313 | bestAverageWorstQualityCalculator1.Successor = dataTableValuesCollector1;
|
---|
| 314 | dataTableValuesCollector1.Successor = qualityDifferenceCalculator1;
|
---|
| 315 | qualityDifferenceCalculator1.Successor = visualizer1;
|
---|
| 316 | visualizer1.Successor = resultsCollector;
|
---|
| 317 | resultsCollector.Successor = selector;
|
---|
| 318 | selector.Successor = subScopesProcessor1;
|
---|
| 319 | subScopesProcessor1.Operators.Add(new EmptyOperator());
|
---|
| 320 | subScopesProcessor1.Operators.Add(useRecombinationComparator);
|
---|
| 321 | subScopesProcessor1.Successor = plusOrCommaReplacementBranch;
|
---|
| 322 | useRecombinationComparator.Successor = useRecombinationBranch;
|
---|
| 323 | useRecombinationBranch.TrueBranch = childrenCreator;
|
---|
| 324 | useRecombinationBranch.FalseBranch = uniformSubScopesProcessor2;
|
---|
| 325 | useRecombinationBranch.Successor = null;
|
---|
| 326 | childrenCreator.Successor = uniformSubScopesProcessor1;
|
---|
| 327 | uniformSubScopesProcessor1.Operator = recombinator;
|
---|
| 328 | uniformSubScopesProcessor1.Successor = null;
|
---|
| 329 | recombinator.Successor = strategyMutator1;
|
---|
| 330 | strategyMutator1.Successor = mutator1;
|
---|
| 331 | mutator1.Successor = evaluator1;
|
---|
| 332 | evaluator1.Successor = subScopesRemover;
|
---|
| 333 | subScopesRemover.Successor = null;
|
---|
| 334 | uniformSubScopesProcessor2.Operator = strategyMutator2;
|
---|
| 335 | uniformSubScopesProcessor2.Successor = null;
|
---|
| 336 | strategyMutator2.Successor = mutator2;
|
---|
| 337 | mutator2.Successor = evaluator2;
|
---|
| 338 | plusOrCommaReplacementBranch.TrueBranch = plusReplacement;
|
---|
| 339 | plusOrCommaReplacementBranch.FalseBranch = commaReplacement;
|
---|
| 340 | plusOrCommaReplacementBranch.Successor = bestSelector;
|
---|
| 341 | bestSelector.Successor = rightReducer;
|
---|
| 342 | rightReducer.Successor = intCounter;
|
---|
| 343 | intCounter.Successor = comparator;
|
---|
| 344 | comparator.Successor = bestQualityMemorizer3;
|
---|
| 345 | bestQualityMemorizer3.Successor = bestQualityMemorizer4;
|
---|
| 346 | bestQualityMemorizer4.Successor = bestAverageWorstQualityCalculator2;
|
---|
| 347 | bestAverageWorstQualityCalculator2.Successor = dataTableValuesCollector2;
|
---|
| 348 | dataTableValuesCollector2.Successor = qualityDifferenceCalculator2;
|
---|
| 349 | qualityDifferenceCalculator2.Successor = visualizer2;
|
---|
| 350 | visualizer2.Successor = conditionalBranch;
|
---|
| 351 | conditionalBranch.FalseBranch = selector;
|
---|
| 352 | conditionalBranch.TrueBranch = null;
|
---|
| 353 | conditionalBranch.Successor = null;
|
---|
| 354 | #endregion
|
---|
| 355 | }
|
---|
| 356 | }
|
---|
| 357 | }
|
---|