Changeset 3620 for trunk/sources/HeuristicLab.Algorithms.EvolutionStrategy
- Timestamp:
- 05/05/10 02:07:54 (15 years ago)
- Location:
- trunk/sources/HeuristicLab.Algorithms.EvolutionStrategy/3.3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Algorithms.EvolutionStrategy/3.3/EvolutionStrategyMainLoop.cs
r3376 r3620 77 77 get { return (ValueLookupParameter<VariableCollection>)Parameters["Results"]; } 78 78 } 79 public ValueLookupParameter<IOperator> VisualizerParameter { 80 get { return (ValueLookupParameter<IOperator>)Parameters["Visualizer"]; } 81 } 82 public LookupParameter<IItem> VisualizationParameter { 83 get { return (LookupParameter<IItem>)Parameters["Visualization"]; } 79 public ValueLookupParameter<IOperator> AnalyzerParameter { 80 get { return (ValueLookupParameter<IOperator>)Parameters["Analyzer"]; } 84 81 } 85 82 private ScopeParameter CurrentScopeParameter { … … 120 117 Parameters.Add(new ValueLookupParameter<IOperator>("Evaluator", "The operator used to evaluate solutions.")); 121 118 Parameters.Add(new ValueLookupParameter<VariableCollection>("Results", "The variable collection where results should be stored.")); 122 Parameters.Add(new ValueLookupParameter<IOperator>("Visualizer", "The operator used to visualize solutions.")); 123 Parameters.Add(new LookupParameter<IItem>("Visualization", "The item which represents the visualization of solutions.")); 119 Parameters.Add(new ValueLookupParameter<IOperator>("Analyzer", "The operator used to analyze each generation.")); 124 120 Parameters.Add(new ScopeParameter("CurrentScope", "The current scope which represents a population of solutions on which the EvolutionStrategy should be applied.")); 125 121 Parameters.Add(new ValueLookupParameter<IOperator>("StrategyParameterManipulator", "The operator to mutate the endogeneous strategy parameters.")); … … 129 125 #region Create operators 130 126 VariableCreator variableCreator = new VariableCreator(); 131 BestQualityMemorizer bestQualityMemorizer1 = new BestQualityMemorizer(); 132 BestQualityMemorizer bestQualityMemorizer2 = new BestQualityMemorizer(); 133 BestAverageWorstQualityCalculator bestAverageWorstQualityCalculator1 = new BestAverageWorstQualityCalculator(); 134 DataTableValuesCollector dataTableValuesCollector1 = new DataTableValuesCollector(); 135 QualityDifferenceCalculator qualityDifferenceCalculator1 = new QualityDifferenceCalculator(); 136 Placeholder visualizer1 = new Placeholder(); 137 ResultsCollector resultsCollector = new ResultsCollector(); 127 ResultsCollector resultsCollector1 = new ResultsCollector(); 128 Placeholder analyzer1 = new Placeholder(); 138 129 WithoutRepeatingBatchedRandomSelector selector = new WithoutRepeatingBatchedRandomSelector(); 139 130 SubScopesProcessor subScopesProcessor1 = new SubScopesProcessor(); … … 159 150 IntCounter intCounter = new IntCounter(); 160 151 Comparator comparator = new Comparator(); 161 BestQualityMemorizer bestQualityMemorizer3 = new BestQualityMemorizer(); 162 BestQualityMemorizer bestQualityMemorizer4 = new BestQualityMemorizer(); 163 BestAverageWorstQualityCalculator bestAverageWorstQualityCalculator2 = new BestAverageWorstQualityCalculator(); 164 DataTableValuesCollector dataTableValuesCollector2 = new DataTableValuesCollector(); 165 QualityDifferenceCalculator qualityDifferenceCalculator2 = new QualityDifferenceCalculator(); 166 Placeholder visualizer2 = new Placeholder(); 152 ResultsCollector resultsCollector2 = new ResultsCollector(); 153 Placeholder analyzer2 = new Placeholder(); 167 154 ConditionalBranch conditionalBranch = new ConditionalBranch(); 168 155 169 156 variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Generations", new IntValue(0))); 170 157 171 bestQualityMemorizer1.BestQualityParameter.ActualName = "BestQuality"; 172 bestQualityMemorizer1.MaximizationParameter.ActualName = MaximizationParameter.Name; 173 bestQualityMemorizer1.QualityParameter.ActualName = QualityParameter.Name; 174 175 bestQualityMemorizer2.BestQualityParameter.ActualName = BestKnownQualityParameter.Name; 176 bestQualityMemorizer2.MaximizationParameter.ActualName = MaximizationParameter.Name; 177 bestQualityMemorizer2.QualityParameter.ActualName = QualityParameter.Name; 178 179 bestAverageWorstQualityCalculator1.AverageQualityParameter.ActualName = "CurrentAverageQuality"; 180 bestAverageWorstQualityCalculator1.BestQualityParameter.ActualName = "CurrentBestQuality"; 181 bestAverageWorstQualityCalculator1.MaximizationParameter.ActualName = MaximizationParameter.Name; 182 bestAverageWorstQualityCalculator1.QualityParameter.ActualName = QualityParameter.Name; 183 bestAverageWorstQualityCalculator1.WorstQualityParameter.ActualName = "CurrentWorstQuality"; 184 185 dataTableValuesCollector1.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Best Quality", null, "CurrentBestQuality")); 186 dataTableValuesCollector1.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Average Quality", null, "CurrentAverageQuality")); 187 dataTableValuesCollector1.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Worst Quality", null, "CurrentWorstQuality")); 188 dataTableValuesCollector1.CollectedValues.Add(new LookupParameter<DoubleValue>("Best Quality", null, "BestQuality")); 189 dataTableValuesCollector1.CollectedValues.Add(new LookupParameter<DoubleValue>("Best Known Quality", null, BestKnownQualityParameter.Name)); 190 dataTableValuesCollector1.DataTableParameter.ActualName = "Qualities"; 191 192 qualityDifferenceCalculator1.AbsoluteDifferenceParameter.ActualName = "AbsoluteDifferenceBestKnownToBest"; 193 qualityDifferenceCalculator1.FirstQualityParameter.ActualName = BestKnownQualityParameter.Name; 194 qualityDifferenceCalculator1.RelativeDifferenceParameter.ActualName = "RelativeDifferenceBestKnownToBest"; 195 qualityDifferenceCalculator1.SecondQualityParameter.ActualName = "BestQuality"; 196 197 visualizer1.Name = "Visualizer (placeholder)"; 198 visualizer1.OperatorParameter.ActualName = VisualizerParameter.Name; 199 200 resultsCollector.CollectedValues.Add(new LookupParameter<IntValue>("Generations")); 201 resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Best Quality", null, "CurrentBestQuality")); 202 resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Average Quality", null, "CurrentAverageQuality")); 203 resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Worst Quality", null, "CurrentWorstQuality")); 204 resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Best Quality", null, "BestQuality")); 205 resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Best Known Quality", null, BestKnownQualityParameter.Name)); 206 resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Absolute Difference of Best Known Quality to Best Quality", null, "AbsoluteDifferenceBestKnownToBest")); 207 resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Relative Difference of Best Known Quality to Best Quality", null, "RelativeDifferenceBestKnownToBest")); 208 resultsCollector.CollectedValues.Add(new LookupParameter<IItem>("Solution Visualization", null, VisualizationParameter.Name)); 209 resultsCollector.CollectedValues.Add(new LookupParameter<DataTable>("Qualities")); 210 resultsCollector.ResultsParameter.ActualName = ResultsParameter.Name; 158 resultsCollector1.CollectedValues.Add(new LookupParameter<IntValue>("Generations")); 159 resultsCollector1.ResultsParameter.ActualName = "Results"; 160 161 analyzer1.Name = "Analyzer (placeholder)"; 162 analyzer1.OperatorParameter.ActualName = AnalyzerParameter.Name; 211 163 212 164 selector.Name = "ES Random Selector"; … … 267 219 comparator.RightSideParameter.ActualName = MaximumGenerationsParameter.Name; 268 220 269 bestQualityMemorizer3.BestQualityParameter.ActualName = "BestQuality"; 270 bestQualityMemorizer3.MaximizationParameter.ActualName = MaximizationParameter.Name; 271 bestQualityMemorizer3.QualityParameter.ActualName = QualityParameter.Name; 272 273 bestQualityMemorizer4.BestQualityParameter.ActualName = BestKnownQualityParameter.Name; 274 bestQualityMemorizer4.MaximizationParameter.ActualName = MaximizationParameter.Name; 275 bestQualityMemorizer4.QualityParameter.ActualName = QualityParameter.Name; 276 277 bestAverageWorstQualityCalculator2.AverageQualityParameter.ActualName = "CurrentAverageQuality"; 278 bestAverageWorstQualityCalculator2.BestQualityParameter.ActualName = "CurrentBestQuality"; 279 bestAverageWorstQualityCalculator2.MaximizationParameter.ActualName = MaximizationParameter.Name; 280 bestAverageWorstQualityCalculator2.QualityParameter.ActualName = QualityParameter.Name; 281 bestAverageWorstQualityCalculator2.WorstQualityParameter.ActualName = "CurrentWorstQuality"; 282 283 dataTableValuesCollector2.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Best Quality", null, "CurrentBestQuality")); 284 dataTableValuesCollector2.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Average Quality", null, "CurrentAverageQuality")); 285 dataTableValuesCollector2.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Worst Quality", null, "CurrentWorstQuality")); 286 dataTableValuesCollector2.CollectedValues.Add(new LookupParameter<DoubleValue>("Best Quality", null, "BestQuality")); 287 dataTableValuesCollector2.CollectedValues.Add(new LookupParameter<DoubleValue>("Best Known Quality", null, BestKnownQualityParameter.Name)); 288 dataTableValuesCollector2.DataTableParameter.ActualName = "Qualities"; 289 290 qualityDifferenceCalculator2.AbsoluteDifferenceParameter.ActualName = "AbsoluteDifferenceBestKnownToBest"; 291 qualityDifferenceCalculator2.FirstQualityParameter.ActualName = BestKnownQualityParameter.Name; 292 qualityDifferenceCalculator2.RelativeDifferenceParameter.ActualName = "RelativeDifferenceBestKnownToBest"; 293 qualityDifferenceCalculator2.SecondQualityParameter.ActualName = "BestQuality"; 294 295 visualizer2.Name = "Visualizer (placeholder)"; 296 visualizer2.OperatorParameter.ActualName = VisualizerParameter.Name; 221 resultsCollector2.CollectedValues.Add(new LookupParameter<IntValue>("Generations")); 222 resultsCollector2.ResultsParameter.ActualName = "Results"; 223 224 analyzer2.Name = "Analyzer (placeholder)"; 225 analyzer2.OperatorParameter.ActualName = AnalyzerParameter.Name; 297 226 298 227 conditionalBranch.ConditionParameter.ActualName = "Terminate"; … … 301 230 #region Create operator graph 302 231 OperatorGraph.InitialOperator = variableCreator; 303 variableCreator.Successor = bestQualityMemorizer1; 304 bestQualityMemorizer1.Successor = bestQualityMemorizer2; 305 bestQualityMemorizer2.Successor = bestAverageWorstQualityCalculator1; 306 bestAverageWorstQualityCalculator1.Successor = dataTableValuesCollector1; 307 dataTableValuesCollector1.Successor = qualityDifferenceCalculator1; 308 qualityDifferenceCalculator1.Successor = visualizer1; 309 visualizer1.Successor = resultsCollector; 310 resultsCollector.Successor = selector; 232 variableCreator.Successor = resultsCollector1; 233 resultsCollector1.Successor = analyzer1; 234 analyzer1.Successor = selector; 311 235 selector.Successor = subScopesProcessor1; 312 236 subScopesProcessor1.Operators.Add(new EmptyOperator()); … … 336 260 rightReducer.Successor = intCounter; 337 261 intCounter.Successor = comparator; 338 comparator.Successor = bestQualityMemorizer3; 339 bestQualityMemorizer3.Successor = bestQualityMemorizer4; 340 bestQualityMemorizer4.Successor = bestAverageWorstQualityCalculator2; 341 bestAverageWorstQualityCalculator2.Successor = dataTableValuesCollector2; 342 dataTableValuesCollector2.Successor = qualityDifferenceCalculator2; 343 qualityDifferenceCalculator2.Successor = visualizer2; 344 visualizer2.Successor = conditionalBranch; 262 comparator.Successor = resultsCollector2; 263 resultsCollector2.Successor = analyzer2; 264 analyzer2.Successor = conditionalBranch; 345 265 conditionalBranch.FalseBranch = selector; 346 266 conditionalBranch.TrueBranch = null;
Note: See TracChangeset
for help on using the changeset viewer.