Changeset 3616
- Timestamp:
- 05/05/10 00:48:18 (15 years ago)
- Location:
- trunk/sources
- Files:
-
- 2 added
- 6 deleted
- 34 edited
- 1 copied
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Algorithms.GeneticAlgorithm/3.3/GeneticAlgorithm.cs
r3376 r3616 33 33 using HeuristicLab.PluginInfrastructure; 34 34 using HeuristicLab.Random; 35 using HeuristicLab.Analysis; 35 36 36 37 namespace HeuristicLab.Algorithms.GeneticAlgorithm { … … 77 78 get { return (ValueParameter<IntValue>)Parameters["Elites"]; } 78 79 } 80 private ValueParameter<MultiAnalyzer> AnalyzerParameter { 81 get { return (ValueParameter<MultiAnalyzer>)Parameters["Analyzer"]; } 82 } 79 83 private ValueParameter<IntValue> MaximumGenerationsParameter { 80 84 get { return (ValueParameter<IntValue>)Parameters["MaximumGenerations"]; } … … 115 119 set { ElitesParameter.Value = value; } 116 120 } 121 public MultiAnalyzer Analyzer { 122 get { return AnalyzerParameter.Value; } 123 set { AnalyzerParameter.Value = value; } 124 } 117 125 public IntValue MaximumGenerations { 118 126 get { return MaximumGenerationsParameter.Value; } … … 132 140 get { return selectors; } 133 141 } 142 private BestAverageWorstQualityAnalyzer qualityAnalyzer; 134 143 #endregion 135 144 … … 144 153 Parameters.Add(new OptionalConstrainedValueParameter<IManipulator>("Mutator", "The operator used to mutate solutions.")); 145 154 Parameters.Add(new ValueParameter<IntValue>("Elites", "The numer of elite solutions which are kept in each generation.", new IntValue(1))); 155 Parameters.Add(new ValueParameter<MultiAnalyzer>("Analyzer", "The operator used to analyze each generation.", new MultiAnalyzer())); 146 156 Parameters.Add(new ValueParameter<IntValue>("MaximumGenerations", "The maximum number of generations which should be processed.", new IntValue(1000))); 147 157 … … 168 178 geneticAlgorithmMainLoop.MutationProbabilityParameter.ActualName = MutationProbabilityParameter.Name; 169 179 geneticAlgorithmMainLoop.RandomParameter.ActualName = RandomCreator.RandomParameter.ActualName; 180 geneticAlgorithmMainLoop.AnalyzerParameter.ActualName = AnalyzerParameter.Name; 170 181 geneticAlgorithmMainLoop.ResultsParameter.ActualName = "Results"; 171 182 … … 189 200 ParameterizeStochasticOperator(Problem.SolutionCreator); 190 201 ParameterizeStochasticOperator(Problem.Evaluator); 191 ParameterizeStochasticOperator(Problem.Visualizer);192 202 foreach (IOperator op in Problem.Operators) ParameterizeStochasticOperator(op); 193 203 ParameterizeSolutionsCreator(); 194 204 ParameterizeGeneticAlgorithmMainLoop(); 195 205 ParameterizeSelectors(); 206 ParameterizeAnalyzers(); 196 207 UpdateCrossovers(); 197 208 UpdateMutators(); 209 UpdateAnalyzers(); 198 210 Problem.Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged); 199 if (Problem.Visualizer != null) Problem.Visualizer.VisualizationParameter.ActualNameChanged += new EventHandler(Visualizer_VisualizationParameter_ActualNameChanged);200 211 base.OnProblemChanged(); 201 212 } … … 211 222 ParameterizeGeneticAlgorithmMainLoop(); 212 223 ParameterizeSelectors(); 224 ParameterizeAnalyzers(); 213 225 Problem.Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged); 214 226 base.Problem_EvaluatorChanged(sender, e); 215 }216 protected override void Problem_VisualizerChanged(object sender, EventArgs e) {217 ParameterizeStochasticOperator(Problem.Visualizer);218 ParameterizeGeneticAlgorithmMainLoop();219 if (Problem.Visualizer != null) Problem.Visualizer.VisualizationParameter.ActualNameChanged += new EventHandler(Visualizer_VisualizationParameter_ActualNameChanged);220 base.Problem_VisualizerChanged(sender, e);221 227 } 222 228 protected override void Problem_OperatorsChanged(object sender, EventArgs e) { … … 224 230 UpdateCrossovers(); 225 231 UpdateMutators(); 232 UpdateAnalyzers(); 226 233 base.Problem_OperatorsChanged(sender, e); 227 234 } … … 243 250 ParameterizeGeneticAlgorithmMainLoop(); 244 251 ParameterizeSelectors(); 245 } 246 private void Visualizer_VisualizationParameter_ActualNameChanged(object sender, EventArgs e) { 247 ParameterizeGeneticAlgorithmMainLoop(); 252 ParameterizeAnalyzers(); 248 253 } 249 254 #endregion … … 253 258 private void Initialize() { 254 259 InitializeSelectors(); 260 InitializeAnalyzers(); 255 261 UpdateSelectors(); 262 UpdateAnalyzers(); 256 263 PopulationSizeParameter.ValueChanged += new EventHandler(PopulationSizeParameter_ValueChanged); 257 264 PopulationSize.ValueChanged += new EventHandler(PopulationSize_ValueChanged); … … 262 269 UpdateMutators(); 263 270 Problem.Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged); 264 if (Problem.Visualizer != null) Problem.Visualizer.VisualizationParameter.ActualNameChanged += new EventHandler(Visualizer_VisualizationParameter_ActualNameChanged);265 271 } 266 272 } … … 271 277 } 272 278 private void ParameterizeGeneticAlgorithmMainLoop() { 273 GeneticAlgorithmMainLoop.BestKnownQualityParameter.ActualName = Problem.BestKnownQualityParameter.Name;274 279 GeneticAlgorithmMainLoop.EvaluatorParameter.ActualName = Problem.EvaluatorParameter.Name; 275 280 GeneticAlgorithmMainLoop.MaximizationParameter.ActualName = Problem.MaximizationParameter.Name; 276 281 GeneticAlgorithmMainLoop.QualityParameter.ActualName = Problem.Evaluator.QualityParameter.ActualName; 277 GeneticAlgorithmMainLoop.VisualizerParameter.ActualName = Problem.VisualizerParameter.Name;278 if (Problem.Visualizer != null)279 GeneticAlgorithmMainLoop.VisualizationParameter.ActualName = Problem.Visualizer.VisualizationParameter.ActualName;280 282 } 281 283 private void ParameterizeStochasticOperator(IOperator op) { … … 287 289 selectors.AddRange(ApplicationManager.Manager.GetInstances<ISelector>().Where(x => !(x is IMultiObjectiveSelector)).OrderBy(x => x.Name)); 288 290 ParameterizeSelectors(); 291 } 292 private void InitializeAnalyzers() { 293 qualityAnalyzer = new BestAverageWorstQualityAnalyzer(); 294 ParameterizeAnalyzers(); 289 295 } 290 296 private void ParameterizeSelectors() { … … 299 305 selector.QualityParameter.ActualName = Problem.Evaluator.QualityParameter.ActualName; 300 306 } 307 } 308 } 309 private void ParameterizeAnalyzers() { 310 qualityAnalyzer.ResultsParameter.ActualName = "Results"; 311 if (Problem != null) { 312 qualityAnalyzer.MaximizationParameter.ActualName = Problem.MaximizationParameter.Name; 313 qualityAnalyzer.QualityParameter.ActualName = Problem.Evaluator.QualityParameter.ActualName; 314 qualityAnalyzer.BestKnownQualityParameter.ActualName = Problem.BestKnownQualityParameter.Name; 301 315 } 302 316 } … … 335 349 } 336 350 } 351 private void UpdateAnalyzers() { 352 Analyzer.Operators.Clear(); 353 Analyzer.Operators.Add(qualityAnalyzer); 354 if (Problem != null) { 355 foreach (IAnalyzer analyzer in Problem.Operators.OfType<IAnalyzer>().OrderBy(x => x.Name)) 356 Analyzer.Operators.Add(analyzer); 357 } 358 } 337 359 #endregion 338 360 } -
trunk/sources/HeuristicLab.Algorithms.GeneticAlgorithm/3.3/GeneticAlgorithmMainLoop.cs
r3376 r3616 47 47 get { return (SubScopesLookupParameter<DoubleValue>)Parameters["Quality"]; } 48 48 } 49 public ValueLookupParameter<DoubleValue> BestKnownQualityParameter {50 get { return (ValueLookupParameter<DoubleValue>)Parameters["BestKnownQuality"]; }51 }52 49 public ValueLookupParameter<IOperator> SelectorParameter { 53 50 get { return (ValueLookupParameter<IOperator>)Parameters["Selector"]; } … … 74 71 get { return (ValueLookupParameter<VariableCollection>)Parameters["Results"]; } 75 72 } 76 public ValueLookupParameter<IOperator> VisualizerParameter { 77 get { return (ValueLookupParameter<IOperator>)Parameters["Visualizer"]; } 78 } 79 public LookupParameter<IItem> VisualizationParameter { 80 get { return (LookupParameter<IItem>)Parameters["Visualization"]; } 73 public ValueLookupParameter<IOperator> AnalyzerParameter { 74 get { return (ValueLookupParameter<IOperator>)Parameters["Analyzer"]; } 81 75 } 82 76 private ScopeParameter CurrentScopeParameter { … … 101 95 Parameters.Add(new ValueLookupParameter<BoolValue>("Maximization", "True if the problem is a maximization problem, otherwise false.")); 102 96 Parameters.Add(new SubScopesLookupParameter<DoubleValue>("Quality", "The value which represents the quality of a solution.")); 103 Parameters.Add(new ValueLookupParameter<DoubleValue>("BestKnownQuality", "The best known quality value found so far."));104 97 Parameters.Add(new ValueLookupParameter<IOperator>("Selector", "The operator used to select solutions for reproduction.")); 105 98 Parameters.Add(new ValueLookupParameter<IOperator>("Crossover", "The operator used to cross solutions.")); … … 110 103 Parameters.Add(new ValueLookupParameter<IntValue>("MaximumGenerations", "The maximum number of generations which should be processed.")); 111 104 Parameters.Add(new ValueLookupParameter<VariableCollection>("Results", "The variable collection where results should be stored.")); 112 Parameters.Add(new ValueLookupParameter<IOperator>("Visualizer", "The operator used to visualize solutions.")); 113 Parameters.Add(new LookupParameter<IItem>("Visualization", "The item which represents the visualization of solutions.")); 105 Parameters.Add(new ValueLookupParameter<IOperator>("Analyzer", "The operator used to analyze each generation.")); 114 106 Parameters.Add(new ScopeParameter("CurrentScope", "The current scope which represents a population of solutions on which the genetic algorithm should be applied.")); 115 107 #endregion … … 117 109 #region Create operators 118 110 VariableCreator variableCreator = new VariableCreator(); 119 BestQualityMemorizer bestQualityMemorizer1 = new BestQualityMemorizer(); 120 BestQualityMemorizer bestQualityMemorizer2 = new BestQualityMemorizer(); 121 BestAverageWorstQualityCalculator bestAverageWorstQualityCalculator1 = new BestAverageWorstQualityCalculator(); 122 DataTableValuesCollector dataTableValuesCollector1 = new DataTableValuesCollector(); 123 QualityDifferenceCalculator qualityDifferenceCalculator1 = new QualityDifferenceCalculator(); 124 Placeholder visualizer1 = new Placeholder(); 125 ResultsCollector resultsCollector = new ResultsCollector(); 111 ResultsCollector resultsCollector1 = new ResultsCollector(); 112 Placeholder analyzer1 = new Placeholder(); 126 113 Placeholder selector = new Placeholder(); 127 114 SubScopesProcessor subScopesProcessor1 = new SubScopesProcessor(); … … 139 126 IntCounter intCounter = new IntCounter(); 140 127 Comparator comparator = new Comparator(); 141 BestQualityMemorizer bestQualityMemorizer3 = new BestQualityMemorizer(); 142 BestQualityMemorizer bestQualityMemorizer4 = new BestQualityMemorizer(); 143 BestAverageWorstQualityCalculator bestAverageWorstQualityCalculator2 = new BestAverageWorstQualityCalculator(); 144 DataTableValuesCollector dataTableValuesCollector2 = new DataTableValuesCollector(); 145 QualityDifferenceCalculator qualityDifferenceCalculator2 = new QualityDifferenceCalculator(); 146 Placeholder visualizer2 = new Placeholder(); 128 ResultsCollector resultsCollector2 = new ResultsCollector(); 129 Placeholder analyzer2 = new Placeholder(); 147 130 ConditionalBranch conditionalBranch = new ConditionalBranch(); 148 131 149 132 variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Generations", new IntValue(0))); 150 133 151 bestQualityMemorizer1.BestQualityParameter.ActualName = "BestQuality"; 152 bestQualityMemorizer1.MaximizationParameter.ActualName = "Maximization"; 153 bestQualityMemorizer1.QualityParameter.ActualName = "Quality"; 154 155 bestQualityMemorizer2.BestQualityParameter.ActualName = "BestKnownQuality"; 156 bestQualityMemorizer2.MaximizationParameter.ActualName = "Maximization"; 157 bestQualityMemorizer2.QualityParameter.ActualName = "Quality"; 158 159 bestAverageWorstQualityCalculator1.AverageQualityParameter.ActualName = "CurrentAverageQuality"; 160 bestAverageWorstQualityCalculator1.BestQualityParameter.ActualName = "CurrentBestQuality"; 161 bestAverageWorstQualityCalculator1.MaximizationParameter.ActualName = "Maximization"; 162 bestAverageWorstQualityCalculator1.QualityParameter.ActualName = "Quality"; 163 bestAverageWorstQualityCalculator1.WorstQualityParameter.ActualName = "CurrentWorstQuality"; 164 165 dataTableValuesCollector1.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Best Quality", null, "CurrentBestQuality")); 166 dataTableValuesCollector1.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Average Quality", null, "CurrentAverageQuality")); 167 dataTableValuesCollector1.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Worst Quality", null, "CurrentWorstQuality")); 168 dataTableValuesCollector1.CollectedValues.Add(new LookupParameter<DoubleValue>("Best Quality", null, "BestQuality")); 169 dataTableValuesCollector1.CollectedValues.Add(new LookupParameter<DoubleValue>("Best Known Quality", null, "BestKnownQuality")); 170 dataTableValuesCollector1.DataTableParameter.ActualName = "Qualities"; 171 172 qualityDifferenceCalculator1.AbsoluteDifferenceParameter.ActualName = "AbsoluteDifferenceBestKnownToBest"; 173 qualityDifferenceCalculator1.FirstQualityParameter.ActualName = "BestKnownQuality"; 174 qualityDifferenceCalculator1.RelativeDifferenceParameter.ActualName = "RelativeDifferenceBestKnownToBest"; 175 qualityDifferenceCalculator1.SecondQualityParameter.ActualName = "BestQuality"; 176 177 visualizer1.Name = "Visualizer"; 178 visualizer1.OperatorParameter.ActualName = "Visualizer"; 179 180 resultsCollector.CollectedValues.Add(new LookupParameter<IntValue>("Generations")); 181 resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Best Quality", null, "CurrentBestQuality")); 182 resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Average Quality", null, "CurrentAverageQuality")); 183 resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Worst Quality", null, "CurrentWorstQuality")); 184 resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Best Quality", null, "BestQuality")); 185 resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Best Known Quality", null, "BestKnownQuality")); 186 resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Absolute Difference of Best Known Quality to Best Quality", null, "AbsoluteDifferenceBestKnownToBest")); 187 resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Relative Difference of Best Known Quality to Best Quality", null, "RelativeDifferenceBestKnownToBest")); 188 resultsCollector.CollectedValues.Add(new LookupParameter<IItem>("Solution Visualization", null, "Visualization")); 189 resultsCollector.CollectedValues.Add(new LookupParameter<DataTable>("Qualities")); 190 resultsCollector.ResultsParameter.ActualName = "Results"; 134 resultsCollector1.CollectedValues.Add(new LookupParameter<IntValue>("Generations")); 135 resultsCollector1.ResultsParameter.ActualName = "Results"; 136 137 analyzer1.Name = "Analyzer"; 138 analyzer1.OperatorParameter.ActualName = "Analyzer"; 191 139 192 140 selector.Name = "Selector"; … … 222 170 comparator.RightSideParameter.ActualName = "MaximumGenerations"; 223 171 224 bestQualityMemorizer3.BestQualityParameter.ActualName = "BestQuality"; 225 bestQualityMemorizer3.MaximizationParameter.ActualName = "Maximization"; 226 bestQualityMemorizer3.QualityParameter.ActualName = "Quality"; 227 228 bestQualityMemorizer4.BestQualityParameter.ActualName = "BestKnownQuality"; 229 bestQualityMemorizer4.MaximizationParameter.ActualName = "Maximization"; 230 bestQualityMemorizer4.QualityParameter.ActualName = "Quality"; 231 232 bestAverageWorstQualityCalculator2.AverageQualityParameter.ActualName = "CurrentAverageQuality"; 233 bestAverageWorstQualityCalculator2.BestQualityParameter.ActualName = "CurrentBestQuality"; 234 bestAverageWorstQualityCalculator2.MaximizationParameter.ActualName = "Maximization"; 235 bestAverageWorstQualityCalculator2.QualityParameter.ActualName = "Quality"; 236 bestAverageWorstQualityCalculator2.WorstQualityParameter.ActualName = "CurrentWorstQuality"; 237 238 dataTableValuesCollector2.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Best Quality", null, "CurrentBestQuality")); 239 dataTableValuesCollector2.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Average Quality", null, "CurrentAverageQuality")); 240 dataTableValuesCollector2.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Worst Quality", null, "CurrentWorstQuality")); 241 dataTableValuesCollector2.CollectedValues.Add(new LookupParameter<DoubleValue>("Best Quality", null, "BestQuality")); 242 dataTableValuesCollector2.CollectedValues.Add(new LookupParameter<DoubleValue>("Best Known Quality", null, "BestKnownQuality")); 243 dataTableValuesCollector2.DataTableParameter.ActualName = "Qualities"; 244 245 qualityDifferenceCalculator2.AbsoluteDifferenceParameter.ActualName = "AbsoluteDifferenceBestKnownToBest"; 246 qualityDifferenceCalculator2.FirstQualityParameter.ActualName = "BestKnownQuality"; 247 qualityDifferenceCalculator2.RelativeDifferenceParameter.ActualName = "RelativeDifferenceBestKnownToBest"; 248 qualityDifferenceCalculator2.SecondQualityParameter.ActualName = "BestQuality"; 249 250 visualizer2.Name = "Visualizer"; 251 visualizer2.OperatorParameter.ActualName = "Visualizer"; 172 resultsCollector2.CollectedValues.Add(new LookupParameter<IntValue>("Generations")); 173 resultsCollector2.ResultsParameter.ActualName = "Results"; 174 175 analyzer2.Name = "Analyzer"; 176 analyzer2.OperatorParameter.ActualName = "Analyzer"; 252 177 253 178 conditionalBranch.ConditionParameter.ActualName = "Terminate"; … … 256 181 #region Create operator graph 257 182 OperatorGraph.InitialOperator = variableCreator; 258 variableCreator.Successor = bestQualityMemorizer1; 259 bestQualityMemorizer1.Successor = bestQualityMemorizer2; 260 bestQualityMemorizer2.Successor = bestAverageWorstQualityCalculator1; 261 bestAverageWorstQualityCalculator1.Successor = dataTableValuesCollector1; 262 dataTableValuesCollector1.Successor = qualityDifferenceCalculator1; 263 qualityDifferenceCalculator1.Successor = visualizer1; 264 visualizer1.Successor = resultsCollector; 265 resultsCollector.Successor = selector; 183 variableCreator.Successor = resultsCollector1; 184 resultsCollector1.Successor = analyzer1; 185 analyzer1.Successor = selector; 266 186 selector.Successor = subScopesProcessor1; 267 187 subScopesProcessor1.Operators.Add(new EmptyOperator()); … … 285 205 mergingReducer.Successor = intCounter; 286 206 intCounter.Successor = comparator; 287 comparator.Successor = bestQualityMemorizer3; 288 bestQualityMemorizer3.Successor = bestQualityMemorizer4; 289 bestQualityMemorizer4.Successor = bestAverageWorstQualityCalculator2; 290 bestAverageWorstQualityCalculator2.Successor = dataTableValuesCollector2; 291 dataTableValuesCollector2.Successor = qualityDifferenceCalculator2; 292 qualityDifferenceCalculator2.Successor = visualizer2; 293 visualizer2.Successor = conditionalBranch; 207 comparator.Successor = resultsCollector2; 208 resultsCollector2.Successor = analyzer2; 209 analyzer2.Successor = conditionalBranch; 294 210 conditionalBranch.FalseBranch = selector; 295 211 conditionalBranch.TrueBranch = null; -
trunk/sources/HeuristicLab.Algorithms.GeneticAlgorithm/3.3/IslandGeneticAlgorithm.cs
r3609 r3616 271 271 ParameterizeStochasticOperator(Problem.SolutionCreator); 272 272 ParameterizeStochasticOperator(Problem.Evaluator); 273 ParameterizeStochasticOperator(Problem.Visualizer);274 273 foreach (IOperator op in Problem.Operators) ParameterizeStochasticOperator(op); 275 274 ParameterizeSolutionsCreator(); … … 279 278 UpdateMutators(); 280 279 Problem.Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged); 281 if (Problem.Visualizer != null) Problem.Visualizer.VisualizationParameter.ActualNameChanged += new EventHandler(Visualizer_VisualizationParameter_ActualNameChanged);282 280 base.OnProblemChanged(); 283 281 } … … 295 293 Problem.Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged); 296 294 base.Problem_EvaluatorChanged(sender, e); 297 }298 protected override void Problem_VisualizerChanged(object sender, EventArgs e) {299 ParameterizeStochasticOperator(Problem.Visualizer);300 ParameterizeMainLoop();301 if (Problem.Visualizer != null) Problem.Visualizer.VisualizationParameter.ActualNameChanged += new EventHandler(Visualizer_VisualizationParameter_ActualNameChanged);302 base.Problem_VisualizerChanged(sender, e);303 295 } 304 296 protected override void Problem_OperatorsChanged(object sender, EventArgs e) { … … 325 317 ParameterizeMainLoop(); 326 318 ParameterizeSelectors(); 327 }328 private void Visualizer_VisualizationParameter_ActualNameChanged(object sender, EventArgs e) {329 ParameterizeMainLoop();330 319 } 331 320 private void MigrationRateParameter_ValueChanged(object sender, EventArgs e) { … … 355 344 UpdateMutators(); 356 345 Problem.Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged); 357 if (Problem.Visualizer != null) Problem.Visualizer.VisualizationParameter.ActualNameChanged += new EventHandler(Visualizer_VisualizationParameter_ActualNameChanged);358 346 } 359 347 } … … 367 355 MainLoop.MaximizationParameter.ActualName = Problem.MaximizationParameter.Name; 368 356 MainLoop.QualityParameter.ActualName = Problem.Evaluator.QualityParameter.ActualName; 369 MainLoop.VisualizerParameter.ActualName = Problem.VisualizerParameter.Name;370 if (Problem.Visualizer != null)371 MainLoop.VisualizationParameter.ActualName = Problem.Visualizer.VisualizationParameter.ActualName;372 357 } 373 358 private void ParameterizeStochasticOperator(IOperator op) { -
trunk/sources/HeuristicLab.Algorithms.GeneticAlgorithm/3.3/IslandGeneticAlgorithmMainLoop.cs
r3611 r3616 100 100 get { return (ValueLookupParameter<ResultCollection>)Parameters["Results"]; } 101 101 } 102 public ValueLookupParameter<IOperator> VisualizerParameter { 103 get { return (ValueLookupParameter<IOperator>)Parameters["Visualizer"]; } 104 } 105 public LookupParameter<IItem> VisualizationParameter { 106 get { return (LookupParameter<IItem>)Parameters["Visualization"]; } 102 public ValueLookupParameter<IOperator> AnalyzerParameter { 103 get { return (ValueLookupParameter<IOperator>)Parameters["Analyzer"]; } 107 104 } 108 105 #endregion … … 132 129 Parameters.Add(new ValueLookupParameter<IntValue>("Elites", "The numer of elite solutions which are kept in each generation.")); 133 130 Parameters.Add(new ValueLookupParameter<ResultCollection>("Results", "The results collection to store the results.")); 134 Parameters.Add(new ValueLookupParameter<IOperator>("Visualizer", "The operator used to visualize solutions.")); 135 Parameters.Add(new LookupParameter<IItem>("Visualization", "The item which represents the visualization of solutions.")); 131 Parameters.Add(new ValueLookupParameter<IOperator>("Analyzer", "The operator used to analyze each island.")); 136 132 #endregion 137 133 … … 144 140 DataTableValuesCollector islandDataTableValuesCollector1 = new DataTableValuesCollector(); 145 141 QualityDifferenceCalculator islandQualityDifferenceCalculator1 = new QualityDifferenceCalculator(); 146 Placeholder island Visualizer1 = new Placeholder();142 Placeholder islandAnalyzer1 = new Placeholder(); 147 143 ResultsCollector islandResultsCollector = new ResultsCollector(); 148 144 BestQualityMemorizer bestQualityMemorizer1 = new BestQualityMemorizer(); … … 170 166 DataTableValuesCollector islandDataTableValuesCollector2 = new DataTableValuesCollector(); 171 167 QualityDifferenceCalculator islandQualityDifferenceCalculator2 = new QualityDifferenceCalculator(); 172 Placeholder island Visualizer2 = new Placeholder();168 Placeholder islandAnalyzer2 = new Placeholder(); 173 169 IntCounter generationsCounter = new IntCounter(); 174 170 IntCounter generationsSinceLastMigrationCounter = new IntCounter(); … … 218 214 islandQualityDifferenceCalculator1.SecondQualityParameter.ActualName = "BestQuality"; 219 215 220 island Visualizer1.Name = "Visualizer";221 island Visualizer1.OperatorParameter.ActualName = "Visualizer";216 islandAnalyzer1.Name = "Analyzer"; 217 islandAnalyzer1.OperatorParameter.ActualName = "Analyzer"; 222 218 223 219 islandResultsCollector.CollectedValues.Add(new LookupParameter<IntValue>("Generations")); … … 229 225 islandResultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Absolute Difference of Best Known Quality to Best Quality", null, "AbsoluteDifferenceBestKnownToBest")); 230 226 islandResultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Relative Difference of Best Known Quality to Best Quality", null, "RelativeDifferenceBestKnownToBest")); 231 islandResultsCollector.CollectedValues.Add(new LookupParameter<IItem>("Solution Visualization", null, "Visualization"));232 227 islandResultsCollector.CollectedValues.Add(new LookupParameter<DataTable>("Qualities")); 233 228 islandResultsCollector.ResultsParameter.ActualName = "IslandResults"; … … 317 312 islandQualityDifferenceCalculator2.SecondQualityParameter.ActualName = "BestQuality"; 318 313 319 island Visualizer2.Name = "Visualizer";320 island Visualizer2.OperatorParameter.ActualName = "Visualizer";314 islandAnalyzer2.Name = "Analyzer"; 315 islandAnalyzer2.OperatorParameter.ActualName = "Analyzer"; 321 316 322 317 generationsCounter.Name = "Generations + 1"; … … 399 394 islandBestAverageWorstQualityCalculator1.Successor = islandDataTableValuesCollector1; 400 395 islandDataTableValuesCollector1.Successor = islandQualityDifferenceCalculator1; 401 islandQualityDifferenceCalculator1.Successor = island Visualizer1;402 island Visualizer1.Successor = islandResultsCollector;396 islandQualityDifferenceCalculator1.Successor = islandAnalyzer1; 397 islandAnalyzer1.Successor = islandResultsCollector; 403 398 bestQualityMemorizer1.Successor = bestQualityMemorizer2; 404 399 bestQualityMemorizer2.Successor = bestAverageWorstQualityCalculator1; … … 432 427 islandBestAverageWorstQualityCalculator2.Successor = islandDataTableValuesCollector2; 433 428 islandDataTableValuesCollector2.Successor = islandQualityDifferenceCalculator2; 434 islandQualityDifferenceCalculator2.Successor = island Visualizer2;435 island Visualizer2.Successor = null;429 islandQualityDifferenceCalculator2.Successor = islandAnalyzer2; 430 islandAnalyzer2.Successor = null; 436 431 generationsCounter.Successor = generationsSinceLastMigrationCounter; 437 432 generationsSinceLastMigrationCounter.Successor = migrationComparator; -
trunk/sources/HeuristicLab.Algorithms.LocalSearch/3.3/LocalSearch.cs
r3376 r3616 192 192 base.Problem_EvaluatorChanged(sender, e); 193 193 } 194 protected override void Problem_VisualizerChanged(object sender, EventArgs e) {195 ParameterizeStochasticOperator(Problem.Visualizer);196 ParameterizeMainLoop();197 if (Problem.Visualizer != null) Problem.Visualizer.VisualizationParameter.ActualNameChanged += new EventHandler(Visualizer_VisualizationParameter_ActualNameChanged);198 base.Problem_VisualizerChanged(sender, e);199 }200 194 protected override void Problem_OperatorsChanged(object sender, EventArgs e) { 201 195 foreach (IOperator op in Problem.Operators) ParameterizeStochasticOperator(op); … … 230 224 ParameterizeMoveEvaluators(); 231 225 ParameterizeMoveMakers(); 232 }233 private void Visualizer_VisualizationParameter_ActualNameChanged(object sender, EventArgs e) {234 ParameterizeMainLoop();235 226 } 236 227 #endregion … … 304 295 if (MoveEvaluator != null) 305 296 MainLoop.MoveQualityParameter.ActualName = MoveEvaluator.MoveQualityParameter.ActualName; 306 MainLoop.VisualizerParameter.ActualName = Problem.VisualizerParameter.Name;307 if (Problem.Visualizer != null)308 MainLoop.VisualizationParameter.ActualName = Problem.Visualizer.VisualizationParameter.ActualName;309 297 } 310 298 private void ParameterizeStochasticOperator(IOperator op) { -
trunk/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/IslandOffspringSelectionGeneticAlgorithm.cs
r3611 r3616 327 327 ParameterizeStochasticOperator(Problem.SolutionCreator); 328 328 ParameterizeStochasticOperator(Problem.Evaluator); 329 ParameterizeStochasticOperator(Problem.Visualizer);330 329 foreach (IOperator op in Problem.Operators) ParameterizeStochasticOperator(op); 331 330 ParameterizeSolutionsCreator(); … … 335 334 UpdateMutators(); 336 335 Problem.Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged); 337 if (Problem.Visualizer != null) Problem.Visualizer.VisualizationParameter.ActualNameChanged += new EventHandler(Visualizer_VisualizationParameter_ActualNameChanged);338 336 base.OnProblemChanged(); 339 337 } … … 351 349 Problem.Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged); 352 350 base.Problem_EvaluatorChanged(sender, e); 353 }354 protected override void Problem_VisualizerChanged(object sender, EventArgs e) {355 ParameterizeStochasticOperator(Problem.Visualizer);356 ParameterizeMainLoop();357 if (Problem.Visualizer != null) Problem.Visualizer.VisualizationParameter.ActualNameChanged += new EventHandler(Visualizer_VisualizationParameter_ActualNameChanged);358 base.Problem_VisualizerChanged(sender, e);359 351 } 360 352 protected override void Problem_OperatorsChanged(object sender, EventArgs e) { … … 381 373 ParameterizeMainLoop(); 382 374 ParameterizeSelectors(); 383 }384 private void Visualizer_VisualizationParameter_ActualNameChanged(object sender, EventArgs e) {385 ParameterizeMainLoop();386 375 } 387 376 private void MigrationRateParameter_ValueChanged(object sender, EventArgs e) { … … 431 420 UpdateMutators(); 432 421 Problem.Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged); 433 if (Problem.Visualizer != null) Problem.Visualizer.VisualizationParameter.ActualNameChanged += new EventHandler(Visualizer_VisualizationParameter_ActualNameChanged);434 422 } 435 423 } … … 443 431 MainLoop.MaximizationParameter.ActualName = Problem.MaximizationParameter.Name; 444 432 MainLoop.QualityParameter.ActualName = Problem.Evaluator.QualityParameter.ActualName; 445 MainLoop.VisualizerParameter.ActualName = Problem.VisualizerParameter.Name;446 if (Problem.Visualizer != null)447 MainLoop.VisualizationParameter.ActualName = Problem.Visualizer.VisualizationParameter.ActualName;448 433 } 449 434 private void ParameterizeStochasticOperator(IOperator op) { -
trunk/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/OffspringSelectionGeneticAlgorithm.cs
r3510 r3616 246 246 ParameterizeStochasticOperator(Problem.SolutionCreator); 247 247 ParameterizeStochasticOperator(Problem.Evaluator); 248 ParameterizeStochasticOperator(Problem.Visualizer);249 248 foreach (IOperator op in Problem.Operators) ParameterizeStochasticOperator(op); 250 249 ParameterizeSolutionsCreator(); … … 254 253 UpdateMutators(); 255 254 Problem.Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged); 256 if (Problem.Visualizer != null) Problem.Visualizer.VisualizationParameter.ActualNameChanged += new EventHandler(Visualizer_VisualizationParameter_ActualNameChanged);257 255 base.OnProblemChanged(); 258 256 } … … 270 268 Problem.Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged); 271 269 base.Problem_EvaluatorChanged(sender, e); 272 }273 protected override void Problem_VisualizerChanged(object sender, EventArgs e) {274 ParameterizeStochasticOperator(Problem.Visualizer);275 ParameterizMainLoop();276 if (Problem.Visualizer != null) Problem.Visualizer.VisualizationParameter.ActualNameChanged += new EventHandler(Visualizer_VisualizationParameter_ActualNameChanged);277 base.Problem_VisualizerChanged(sender, e);278 270 } 279 271 protected override void Problem_OperatorsChanged(object sender, EventArgs e) { … … 300 292 ParameterizMainLoop(); 301 293 ParameterizeSelectors(); 302 }303 private void Visualizer_VisualizationParameter_ActualNameChanged(object sender, EventArgs e) {304 ParameterizMainLoop();305 294 } 306 295 #endregion … … 321 310 UpdateMutators(); 322 311 Problem.Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged); 323 if (Problem.Visualizer != null) Problem.Visualizer.VisualizationParameter.ActualNameChanged += new EventHandler(Visualizer_VisualizationParameter_ActualNameChanged);324 312 } 325 313 } … … 333 321 MainLoop.MaximizationParameter.ActualName = Problem.MaximizationParameter.Name; 334 322 MainLoop.QualityParameter.ActualName = Problem.Evaluator.QualityParameter.ActualName; 335 MainLoop.VisualizerParameter.ActualName = Problem.VisualizerParameter.Name;336 if (Problem.Visualizer != null)337 MainLoop.VisualizationParameter.ActualName = Problem.Visualizer.VisualizationParameter.ActualName;338 323 } 339 324 private void ParameterizeStochasticOperator(IOperator op) { -
trunk/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/SASEGASA.cs
r3510 r3616 295 295 ParameterizeStochasticOperator(Problem.SolutionCreator); 296 296 ParameterizeStochasticOperator(Problem.Evaluator); 297 ParameterizeStochasticOperator(Problem.Visualizer);298 297 foreach (IOperator op in Problem.Operators) ParameterizeStochasticOperator(op); 299 298 ParameterizeSolutionsCreator(); … … 303 302 UpdateMutators(); 304 303 Problem.Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged); 305 if (Problem.Visualizer != null) Problem.Visualizer.VisualizationParameter.ActualNameChanged += new EventHandler(Visualizer_VisualizationParameter_ActualNameChanged);306 304 base.OnProblemChanged(); 307 305 } … … 319 317 Problem.Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged); 320 318 base.Problem_EvaluatorChanged(sender, e); 321 }322 protected override void Problem_VisualizerChanged(object sender, EventArgs e) {323 ParameterizeStochasticOperator(Problem.Visualizer);324 ParameterizeMainLoop();325 if (Problem.Visualizer != null) Problem.Visualizer.VisualizationParameter.ActualNameChanged += new EventHandler(Visualizer_VisualizationParameter_ActualNameChanged);326 base.Problem_VisualizerChanged(sender, e);327 319 } 328 320 protected override void Problem_OperatorsChanged(object sender, EventArgs e) { … … 349 341 ParameterizeMainLoop(); 350 342 ParameterizeSelectors(); 351 }352 private void Visualizer_VisualizationParameter_ActualNameChanged(object sender, EventArgs e) {353 ParameterizeMainLoop();354 343 } 355 344 private void MaximumGenerationsParameter_ValueChanged(object sender, EventArgs e) { … … 391 380 UpdateMutators(); 392 381 Problem.Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged); 393 if (Problem.Visualizer != null) Problem.Visualizer.VisualizationParameter.ActualNameChanged += new EventHandler(Visualizer_VisualizationParameter_ActualNameChanged);394 382 } 395 383 } … … 403 391 MainLoop.MaximizationParameter.ActualName = Problem.MaximizationParameter.Name; 404 392 MainLoop.QualityParameter.ActualName = Problem.Evaluator.QualityParameter.ActualName; 405 MainLoop.VisualizerParameter.ActualName = Problem.VisualizerParameter.Name;406 393 MainLoop.MigrationIntervalParameter.Value = new IntValue(MaximumGenerations.Value / NumberOfVillages.Value); 407 if (Problem.Visualizer != null)408 MainLoop.VisualizationParameter.ActualName = Problem.Visualizer.VisualizationParameter.ActualName;409 394 } 410 395 private void ParameterizeStochasticOperator(IOperator op) { -
trunk/sources/HeuristicLab.Algorithms.SimulatedAnnealing/3.3/SimulatedAnnealing.cs
r3376 r3616 221 221 base.Problem_EvaluatorChanged(sender, e); 222 222 } 223 protected override void Problem_VisualizerChanged(object sender, EventArgs e) {224 ParameterizeStochasticOperator(Problem.Visualizer);225 ParameterizeMainLoop();226 if (Problem.Visualizer != null) Problem.Visualizer.VisualizationParameter.ActualNameChanged += new EventHandler(Visualizer_VisualizationParameter_ActualNameChanged);227 base.Problem_VisualizerChanged(sender, e);228 }229 223 protected override void Problem_OperatorsChanged(object sender, EventArgs e) { 230 224 foreach (IOperator op in Problem.Operators) ParameterizeStochasticOperator(op); … … 260 254 ParameterizeMoveEvaluators(); 261 255 ParameterizeMoveMakers(); 262 }263 private void Visualizer_VisualizationParameter_ActualNameChanged(object sender, EventArgs e) {264 ParameterizeMainLoop();265 256 } 266 257 #endregion … … 343 334 if (MoveEvaluator != null) 344 335 MainLoop.MoveQualityParameter.ActualName = MoveEvaluator.MoveQualityParameter.ActualName; 345 MainLoop.VisualizerParameter.ActualName = Problem.VisualizerParameter.Name;346 if (Problem.Visualizer != null)347 MainLoop.VisualizationParameter.ActualName = Problem.Visualizer.VisualizationParameter.ActualName;348 336 } 349 337 private void ParameterizeStochasticOperator(IOperator op) { -
trunk/sources/HeuristicLab.Algorithms.TabuSearch/3.3/TabuSearch.cs
r3376 r3616 223 223 base.Problem_EvaluatorChanged(sender, e); 224 224 } 225 protected override void Problem_VisualizerChanged(object sender, EventArgs e) {226 ParameterizeStochasticOperator(Problem.Visualizer);227 ParameterizeMainLoop();228 if (Problem.Visualizer != null) Problem.Visualizer.VisualizationParameter.ActualNameChanged += new EventHandler(Visualizer_VisualizationParameter_ActualNameChanged);229 base.Problem_VisualizerChanged(sender, e);230 }231 225 protected override void Problem_OperatorsChanged(object sender, EventArgs e) { 232 226 foreach (IOperator op in Problem.Operators) ParameterizeStochasticOperator(op); … … 281 275 ParameterizeMainLoop(); 282 276 } 283 private void Visualizer_VisualizationParameter_ActualNameChanged(object sender, EventArgs e) {284 ParameterizeMainLoop();285 }286 277 private void SampleSizeParameter_NameChanged(object sender, EventArgs e) { 287 278 ParameterizeMoveGenerators(); … … 297 288 op.MoveQualityParameter.ActualNameChanged += new EventHandler(MoveEvaluator_MoveQualityParameter_ActualNameChanged); 298 289 } 299 if (Problem.Visualizer != null) Problem.Visualizer.VisualizationParameter.ActualNameChanged += new EventHandler(Visualizer_VisualizationParameter_ActualNameChanged);300 290 } 301 291 MoveGeneratorParameter.ValueChanged += new EventHandler(MoveGeneratorParameter_ValueChanged); … … 377 367 if (TabuChecker != null) 378 368 MainLoop.MoveTabuParameter.ActualName = TabuChecker.MoveTabuParameter.ActualName; 379 MainLoop.VisualizerParameter.ActualName = Problem.VisualizerParameter.Name;380 if (Problem.Visualizer != null)381 MainLoop.VisualizationParameter.ActualName = Problem.Visualizer.VisualizationParameter.ActualName;382 369 } 383 370 private void ParameterizeStochasticOperator(IOperator op) { -
trunk/sources/HeuristicLab.Analysis/3.3/HeuristicLab.Analysis-3.3.csproj
r3384 r3616 85 85 <ItemGroup> 86 86 <None Include="HeuristicLabAnalysisPlugin.cs.frame" /> 87 <Compile Include="BestAverageWorstQualityAnalyzer.cs" /> 87 88 <Compile Include="BestAverageWorstQualityCalculator.cs" /> 88 89 <Compile Include="BestQualityMemorizer.cs" /> 90 <Compile Include="MultiAnalyzer.cs" /> 89 91 <Compile Include="QualityDifferenceCalculator.cs" /> 90 92 <Compile Include="DataRow.cs" /> … … 125 127 <Name>HeuristicLab.Operators-3.3</Name> 126 128 </ProjectReference> 129 <ProjectReference Include="..\..\HeuristicLab.Optimization.Operators\3.3\HeuristicLab.Optimization.Operators-3.3.csproj"> 130 <Project>{25087811-F74C-4128-BC86-8324271DA13E}</Project> 131 <Name>HeuristicLab.Optimization.Operators-3.3</Name> 132 </ProjectReference> 133 <ProjectReference Include="..\..\HeuristicLab.Optimization\3.3\HeuristicLab.Optimization-3.3.csproj"> 134 <Project>{14AB8D24-25BC-400C-A846-4627AA945192}</Project> 135 <Name>HeuristicLab.Optimization-3.3</Name> 136 </ProjectReference> 127 137 <ProjectReference Include="..\..\HeuristicLab.Parameters\3.3\HeuristicLab.Parameters-3.3.csproj"> 128 138 <Project>{56F9106A-079F-4C61-92F6-86A84C2D84B7}</Project> -
trunk/sources/HeuristicLab.Analysis/3.3/HeuristicLabAnalysisPlugin.cs.frame
r3384 r3616 34 34 [PluginDependency("HeuristicLab.Data", "3.3")] 35 35 [PluginDependency("HeuristicLab.Operators", "3.3")] 36 [PluginDependency("HeuristicLab.Optimization", "3.3")] 37 [PluginDependency("HeuristicLab.Optimization.Operators", "3.3")] 36 38 [PluginDependency("HeuristicLab.Parameters", "3.3")] 37 39 [PluginDependency("HeuristicLab.Persistence", "3.3")] -
trunk/sources/HeuristicLab.Operators/3.3/CheckedMultiOperator.cs
r3591 r3616 31 31 namespace HeuristicLab.Operators { 32 32 /// <summary> 33 /// A base class for operators which apply arbitrary many other operators of a specific type , operators can be checked/unchecked.33 /// A base class for operators which apply arbitrary many other operators of a specific type that can be checked or unchecked. 34 34 /// </summary> 35 [Item("CheckedMultiOperator<T>", "A base class for operators which apply arbitrary many other operators of a specific type .")]35 [Item("CheckedMultiOperator<T>", "A base class for operators which apply arbitrary many other operators of a specific type that can be checked or unchecked.")] 36 36 [StorableClass] 37 37 public abstract class CheckedMultiOperator<T> : MultiOperator<T> where T : class, IOperator { -
trunk/sources/HeuristicLab.Optimization/3.3/Algorithm.cs
r3372 r3616 255 255 problem.SolutionCreatorChanged -= new EventHandler(Problem_SolutionCreatorChanged); 256 256 problem.EvaluatorChanged -= new EventHandler(Problem_EvaluatorChanged); 257 problem.VisualizerChanged -= new EventHandler(Problem_VisualizerChanged);258 257 problem.OperatorsChanged -= new EventHandler(Problem_OperatorsChanged); 259 258 } … … 261 260 problem.SolutionCreatorChanged += new EventHandler(Problem_SolutionCreatorChanged); 262 261 problem.EvaluatorChanged += new EventHandler(Problem_EvaluatorChanged); 263 problem.VisualizerChanged += new EventHandler(Problem_VisualizerChanged);264 262 problem.OperatorsChanged += new EventHandler(Problem_OperatorsChanged); 265 263 } … … 267 265 protected virtual void Problem_SolutionCreatorChanged(object sender, EventArgs e) { } 268 266 protected virtual void Problem_EvaluatorChanged(object sender, EventArgs e) { } 269 protected virtual void Problem_VisualizerChanged(object sender, EventArgs e) { }270 267 protected virtual void Problem_OperatorsChanged(object sender, EventArgs e) { } 271 268 #endregion -
trunk/sources/HeuristicLab.Optimization/3.3/HeuristicLab.Optimization-3.3.csproj
r3614 r3616 87 87 <Compile Include="Algorithm.cs" /> 88 88 <Compile Include="BatchRun.cs" /> 89 <Compile Include="Interfaces\IAnalyzer.cs" /> 89 90 <Compile Include="RunCollectionComparisonConstraint.cs" /> 90 91 <Compile Include="RunCollectionConstraintCollection.cs" /> … … 107 108 <Compile Include="RunCollection.cs" /> 108 109 <Compile Include="Run.cs" /> 109 <Compile Include="Interfaces\IMultiObjectiveSolutionsVisualizer.cs" />110 110 <Compile Include="Interfaces\IResult.cs" /> 111 <Compile Include="Interfaces\ISingleObjectiveSolutionsVisualizer.cs" />112 <Compile Include="Interfaces\ISolutionsVisualizer.cs" />113 111 <Compile Include="Interfaces\IDiscreteDoubleValueModifier.cs" /> 114 112 <Compile Include="Interfaces\IExhaustiveMoveGenerator.cs" /> -
trunk/sources/HeuristicLab.Optimization/3.3/Interfaces/IAnalyzer.cs
r3612 r3616 20 20 #endregion 21 21 22 using HeuristicLab.Common;23 22 using HeuristicLab.Core; 24 23 25 24 namespace HeuristicLab.Optimization { 26 25 /// <summary> 27 /// An interface which represents an operator for visualizing solutions.26 /// An interface which represents an analysis operator. 28 27 /// </summary> 29 public interface ISolutionsVisualizer : IOperator { 30 ILookupParameter VisualizationParameter { get; } 31 } 28 public interface IAnalyzer : IOperator { } 32 29 } -
trunk/sources/HeuristicLab.Optimization/3.3/Interfaces/IProblem.cs
r3376 r3616 34 34 IParameter EvaluatorParameter { get; } 35 35 IEvaluator Evaluator { get; } 36 IParameter VisualizerParameter { get; }37 ISolutionsVisualizer Visualizer { get; }38 36 IEnumerable<IOperator> Operators { get; } 39 37 40 38 event EventHandler SolutionCreatorChanged; 41 39 event EventHandler EvaluatorChanged; 42 event EventHandler VisualizerChanged;43 40 event EventHandler OperatorsChanged; 44 41 } -
trunk/sources/HeuristicLab.Problems.ArtificialAnt/3.3/ArtificialAntProblem.cs
r3539 r3616 125 125 } 126 126 127 public OptionalValueParameter<ISingleObjectiveSolutionsVisualizer> VisualizerParameter {128 get { return (OptionalValueParameter<ISingleObjectiveSolutionsVisualizer>)Parameters["Visualizer"]; }129 }130 IParameter IProblem.VisualizerParameter {131 get { return VisualizerParameter; }132 }133 127 public ValueParameter<DoubleValue> BestKnownQualityParameter { 134 128 get { return (ValueParameter<DoubleValue>)Parameters["BestKnownQuality"]; } … … 184 178 get { return (GlobalSymbolicExpressionGrammar)ArtificialAntExpressionGrammarParameter.Value; } 185 179 } 186 public ISingleObjectiveSolutionsVisualizer Visualizer {187 get { return VisualizerParameter.Value; }188 set { VisualizerParameter.Value = value; }189 }190 ISolutionsVisualizer IProblem.Visualizer {191 get { return VisualizerParameter.Value; }192 }193 180 public DoubleValue BestKnownQuality { 194 181 get { return BestKnownQualityParameter.Value; } … … 204 191 SymbolicExpressionTreeCreator creator = new ProbabilisticTreeCreator(); 205 192 Evaluator evaluator = new Evaluator(); 206 BestAntTrailVisualizer visualizer = new BestAntTrailVisualizer();207 193 BoolMatrix world = new BoolMatrix(santaFeAntTrail); 208 194 ISymbolicExpressionGrammar grammar = new GlobalSymbolicExpressionGrammar(new ArtificialAntExpressionGrammar()); … … 218 204 Parameters.Add(new ValueParameter<BoolMatrix>("World", "The world for the artificial ant with scattered food items.", world)); 219 205 Parameters.Add(new ValueParameter<IntValue>("MaxTimeSteps", "The number of time steps the artificial ant has available to collect all food items.", new IntValue(600))); 220 Parameters.Add(new ValueParameter<ISingleObjectiveSolutionsVisualizer>("Visualizer", "The operator which should be used to visualize artificial ant solutions.", visualizer));221 206 222 207 creator.SymbolicExpressionTreeParameter.ActualName = "AntTrailSolution"; … … 251 236 changed(this, EventArgs.Empty); 252 237 } 253 public event EventHandler VisualizerChanged;254 private void OnVisualizerChanged() {255 var changed = VisualizerChanged;256 if (changed != null)257 changed(this, EventArgs.Empty);258 }259 238 260 239 public event EventHandler OperatorsChanged; … … 283 262 ParameterizeVisualizer(); 284 263 OnEvaluatorChanged(); 285 }286 287 private void VisualizerParameter_ValueChanged(object sender, EventArgs e) {288 ParameterizeVisualizer();289 OnVisualizerChanged();290 264 } 291 265 … … 304 278 EvaluatorParameter.ValueChanged += new EventHandler(EvaluatorParameter_ValueChanged); 305 279 Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged); 306 VisualizerParameter.ValueChanged += new EventHandler(VisualizerParameter_ValueChanged);307 280 MaxFunctionArgumentsParameter.ValueChanged += new EventHandler(MaxFunctionArgumentsParameter_ValueChanged); 308 281 MaxFunctionArguments.ValueChanged += new EventHandler(MaxFunctionArgumentsParameter_ValueChanged); … … 336 309 } 337 310 private void ParameterizeVisualizer() { 338 if (Visualizer != null) {339 Visualizer.QualityParameter.ActualName = Evaluator.QualityParameter.ActualName;340 var antTrailVisualizer = Visualizer as IAntTrailVisualizer;341 if (antTrailVisualizer != null) {342 antTrailVisualizer.SymbolicExpressionTreeParameter.ActualName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName;343 antTrailVisualizer.WorldParameter.ActualName = WorldParameter.Name;344 antTrailVisualizer.MaxTimeStepsParameter.ActualName = MaxTimeStepsParameter.Name;345 }346 var bestSymExpressionVisualizer = Visualizer as BestSymbolicExpressionTreeVisualizer;347 if (bestSymExpressionVisualizer != null) {348 bestSymExpressionVisualizer.SymbolicExpressionTreeParameter.ActualName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName;349 }350 }311 //if (Visualizer != null) { 312 // Visualizer.QualityParameter.ActualName = Evaluator.QualityParameter.ActualName; 313 // var antTrailVisualizer = Visualizer as IAntTrailVisualizer; 314 // if (antTrailVisualizer != null) { 315 // antTrailVisualizer.SymbolicExpressionTreeParameter.ActualName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName; 316 // antTrailVisualizer.WorldParameter.ActualName = WorldParameter.Name; 317 // antTrailVisualizer.MaxTimeStepsParameter.ActualName = MaxTimeStepsParameter.Name; 318 // } 319 // var bestSymExpressionVisualizer = Visualizer as BestSymbolicExpressionTreeVisualizer; 320 // if (bestSymExpressionVisualizer != null) { 321 // bestSymExpressionVisualizer.SymbolicExpressionTreeParameter.ActualName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName; 322 // } 323 //} 351 324 } 352 325 -
trunk/sources/HeuristicLab.Problems.ArtificialAnt/3.3/BestAntTrailVisualizer.cs
r3376 r3616 53 53 get { return (ILookupParameter<AntTrail>)Parameters["AntTrail"]; } 54 54 } 55 ILookupParameter ISolutionsVisualizer.VisualizationParameter {56 get { return AntTrailParameter; }57 }58 55 59 56 public BestAntTrailVisualizer() -
trunk/sources/HeuristicLab.Problems.ArtificialAnt/3.3/BestSymbolicExpressionTreeVisualizer.cs
r3376 r3616 36 36 [Item("BestSymbolicExpressionTreeVisualizer", "An operator for visualizing the best symbolic expression tree of an artificial ant problem.")] 37 37 [StorableClass] 38 public sealed class BestSymbolicExpressionTreeVisualizer : SingleSuccessorOperator, I SingleObjectiveSolutionsVisualizer, ISolutionsVisualizer {38 public sealed class BestSymbolicExpressionTreeVisualizer : SingleSuccessorOperator, IAnalyzer { 39 39 public ILookupParameter<ItemArray<SymbolicExpressionTree>> SymbolicExpressionTreeParameter { 40 40 get { return (ILookupParameter<ItemArray<SymbolicExpressionTree>>)Parameters["SymbolicExpressionTree"]; } … … 45 45 public ILookupParameter<SymbolicExpressionTree> BestSymbolicExpressionTreeParameter { 46 46 get { return (ILookupParameter<SymbolicExpressionTree>)Parameters["BestSymbolicExpressionTree"]; } 47 }48 ILookupParameter ISolutionsVisualizer.VisualizationParameter {49 get { return BestSymbolicExpressionTreeParameter; }50 47 } 51 48 -
trunk/sources/HeuristicLab.Problems.ArtificialAnt/3.3/IAntTrailVisualizer.cs
r3376 r3616 28 28 29 29 namespace HeuristicLab.Problems.ArtificialAnt { 30 public interface IAntTrailVisualizer : I SolutionsVisualizer, ISingleObjectiveSolutionsVisualizer {30 public interface IAntTrailVisualizer : IAnalyzer { 31 31 ILookupParameter<ItemArray<SymbolicExpressionTree>> SymbolicExpressionTreeParameter { get; } 32 32 ILookupParameter<BoolMatrix> WorldParameter { get; } -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/BestValidationSymbolicRegressionSolutionVisualizer.cs
r3549 r3616 42 42 [Item("BestSymbolicExpressionTreeVisualizer", "An operator for visualizing the best symbolic regression solution based on the validation set.")] 43 43 [StorableClass] 44 public sealed class BestValidationSymbolicRegressionSolutionVisualizer : SingleSuccessorOperator, I SingleObjectiveSolutionsVisualizer, ISolutionsVisualizer {44 public sealed class BestValidationSymbolicRegressionSolutionVisualizer : SingleSuccessorOperator, IAnalyzer { 45 45 private const string SymbolicExpressionTreeInterpreterParameterName = "SymbolicExpressionTreeInterpreter"; 46 46 private const string UpperEstimationLimitParameterName = "UpperEstimationLimit"; … … 88 88 public ILookupParameter<SymbolicRegressionSolution> BestValidationSolutionParameter { 89 89 get { return (ILookupParameter<SymbolicRegressionSolution>)Parameters[BestValidationSolutionParameterName]; } 90 }91 ILookupParameter ISolutionsVisualizer.VisualizationParameter {92 get { return BestValidationSolutionParameter; }93 90 } 94 91 -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/SymbolicRegressionProblem.cs
r3599 r3616 89 89 get { return (ValueParameter<IntValue>)Parameters["MaxFunctionArguments"]; } 90 90 } 91 public OptionalValueParameter<ISingleObjectiveSolutionsVisualizer> VisualizerParameter {92 get { return (OptionalValueParameter<ISingleObjectiveSolutionsVisualizer>)Parameters["Visualizer"]; }93 }94 IParameter IProblem.VisualizerParameter {95 get { return VisualizerParameter; }96 }97 91 public OptionalValueParameter<DoubleValue> BestKnownQualityParameter { 98 92 get { return (OptionalValueParameter<DoubleValue>)Parameters["BestKnownQuality"]; } … … 152 146 public ISymbolicExpressionGrammar FunctionTreeGrammar { 153 147 get { return (ISymbolicExpressionGrammar)FunctionTreeGrammarParameter.Value; } 154 }155 public ISingleObjectiveSolutionsVisualizer Visualizer {156 get { return VisualizerParameter.Value; }157 set { VisualizerParameter.Value = value; }158 }159 ISolutionsVisualizer IProblem.Visualizer {160 get { return VisualizerParameter.Value; }161 148 } 162 149 public DoubleValue BestKnownQuality { … … 207 194 Parameters.Add(new ValueParameter<IntValue>("MaxFunctionDefiningBranches", "Maximal number of automatically defined functions.", (IntValue)new IntValue(0).AsReadOnly())); 208 195 Parameters.Add(new ValueParameter<IntValue>("MaxFunctionArguments", "Maximal number of arguments of automatically defined functions.", (IntValue)new IntValue(0).AsReadOnly())); 209 Parameters.Add(new ValueParameter<ISingleObjectiveSolutionsVisualizer>("Visualizer", "The operator which should be used to visualize symbolic regression solutions.", visualizer));210 196 211 197 creator.SymbolicExpressionTreeParameter.ActualName = "SymbolicRegressionModel"; … … 240 226 SolutionCreatorParameter.ValueChanged += new EventHandler(SolutionCreatorParameter_ValueChanged); 241 227 EvaluatorParameter.ValueChanged += new EventHandler(EvaluatorParameter_ValueChanged); 242 VisualizerParameter.ValueChanged += new EventHandler(VisualizerParameter_ValueChanged);243 228 } 244 229 … … 288 273 ParameterizeVisualizer(); 289 274 } 290 protected virtual void OnVisualizerChanged(EventArgs e) {291 ParameterizeVisualizer();292 RaiseVisualizerChanged(e);293 }294 275 #endregion 295 276 … … 303 284 private void EvaluatorParameter_ValueChanged(object sender, EventArgs e) { 304 285 OnEvaluatorChanged(e); 305 }306 private void VisualizerParameter_ValueChanged(object sender, EventArgs e) {307 OnVisualizerChanged(e);308 286 } 309 287 private void ArchitectureParameter_ValueChanged(object sender, EventArgs e) { … … 325 303 private void RaiseEvaluatorChanged(EventArgs e) { 326 304 var changed = EvaluatorChanged; 327 if (changed != null)328 changed(this, e);329 }330 public event EventHandler VisualizerChanged;331 private void RaiseVisualizerChanged(EventArgs e) {332 var changed = VisualizerChanged;333 305 if (changed != null) 334 306 changed(this, e); … … 394 366 395 367 private void ParameterizeVisualizer() { 396 var solutionVisualizer = Visualizer as BestValidationSymbolicRegressionSolutionVisualizer;397 if (solutionVisualizer != null) {398 solutionVisualizer.SymbolicExpressionTreeParameter.ActualName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName;399 solutionVisualizer.DataAnalysisProblemDataParameter.ActualName = DataAnalysisProblemDataParameter.Name;400 solutionVisualizer.UpperEstimationLimitParameter.ActualName = UpperEstimationLimitParameter.Name;401 solutionVisualizer.LowerEstimationLimitParameter.ActualName = LowerEstimationLimitParameter.Name;402 solutionVisualizer.QualityParameter.ActualName = Evaluator.QualityParameter.Name;403 solutionVisualizer.SymbolicExpressionTreeInterpreterParameter.ActualName = SymbolicExpressionTreeInterpreterParameter.Name;404 solutionVisualizer.ValidationSamplesStartParameter.Value = ValidationSamplesStart;405 solutionVisualizer.ValidationSamplesEndParameter.Value = ValidationSamplesEnd;406 }368 //var solutionVisualizer = Visualizer as BestValidationSymbolicRegressionSolutionVisualizer; 369 //if (solutionVisualizer != null) { 370 // solutionVisualizer.SymbolicExpressionTreeParameter.ActualName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName; 371 // solutionVisualizer.DataAnalysisProblemDataParameter.ActualName = DataAnalysisProblemDataParameter.Name; 372 // solutionVisualizer.UpperEstimationLimitParameter.ActualName = UpperEstimationLimitParameter.Name; 373 // solutionVisualizer.LowerEstimationLimitParameter.ActualName = LowerEstimationLimitParameter.Name; 374 // solutionVisualizer.QualityParameter.ActualName = Evaluator.QualityParameter.Name; 375 // solutionVisualizer.SymbolicExpressionTreeInterpreterParameter.ActualName = SymbolicExpressionTreeInterpreterParameter.Name; 376 // solutionVisualizer.ValidationSamplesStartParameter.Value = ValidationSamplesStart; 377 // solutionVisualizer.ValidationSamplesEndParameter.Value = ValidationSamplesEnd; 378 //} 407 379 } 408 380 -
trunk/sources/HeuristicLab.Problems.Knapsack/3.3/Interfaces/IKnapsackSolutionsVisualizer.cs
r3467 r3616 29 29 /// An interface which represents an operator for visualizing solutions of Knapsack Problems. 30 30 /// </summary> 31 public interface IKnapsackSolutionsVisualizer : I SingleObjectiveSolutionsVisualizer {31 public interface IKnapsackSolutionsVisualizer : IAnalyzer { 32 32 ILookupParameter<ItemArray<BinaryVector>> BinaryVectorParameter { get; } 33 33 ILookupParameter<IntValue> KnapsackCapacityParameter { get; } -
trunk/sources/HeuristicLab.Problems.Knapsack/3.3/KnapsackProblem.cs
r3537 r3616 74 74 get { return EvaluatorParameter; } 75 75 } 76 public OptionalValueParameter<IKnapsackSolutionsVisualizer> VisualizerParameter {77 get { return (OptionalValueParameter<IKnapsackSolutionsVisualizer>)Parameters["Visualizer"]; }78 }79 IParameter IProblem.VisualizerParameter {80 get { return VisualizerParameter; }81 }82 76 public OptionalValueParameter<DoubleValue> BestKnownQualityParameter { 83 77 get { return (OptionalValueParameter<DoubleValue>)Parameters["BestKnownQuality"]; } … … 122 116 get { return EvaluatorParameter.Value; } 123 117 } 124 public IKnapsackSolutionsVisualizer Visualizer {125 get { return VisualizerParameter.Value; }126 set { VisualizerParameter.Value = value; }127 }128 ISolutionsVisualizer IProblem.Visualizer {129 get { return VisualizerParameter.Value; }130 }131 118 public DoubleValue BestKnownQuality { 132 119 get { return BestKnownQualityParameter.Value; } … … 165 152 RandomBinaryVectorCreator creator = new RandomBinaryVectorCreator(); 166 153 KnapsackEvaluator evaluator = new KnapsackEvaluator(); 167 IKnapsackSolutionsVisualizer visualizer = new BestKnapsackVisualizer();168 154 169 155 Parameters.Add(new ValueParameter<BoolValue>("Maximization", "Set to true as the Knapsack Problem is a maximization problem.", new BoolValue(true))); … … 175 161 Parameters.Add(new ValueParameter<IKnapsackEvaluator>("Evaluator", "The operator which should be used to evaluate Knapsack solutions.", evaluator)); 176 162 Parameters.Add(new OptionalValueParameter<DoubleValue>("BestKnownQuality", "The quality of the best known solution of this Knapsack instance.")); 177 Parameters.Add(new ValueParameter<IKnapsackSolutionsVisualizer>("Visualizer", "The operator which should be used to visualize Knapsack solutions.", visualizer));178 163 179 164 creator.BinaryVectorParameter.ActualName = "KnapsackSolution"; … … 208 193 EvaluatorChanged(this, EventArgs.Empty); 209 194 } 210 public event EventHandler VisualizerChanged;211 private void OnVisualizerChanged() {212 if (VisualizerChanged != null)213 VisualizerChanged(this, EventArgs.Empty);214 }215 195 216 196 public event EventHandler OperatorsChanged; … … 270 250 void PenaltyParameter_ValueChanged(object sender, EventArgs e) { 271 251 ParameterizeEvaluator(); 272 }273 void VisualizerParameter_ValueChanged(object sender, EventArgs e) {274 OnVisualizerChanged();275 252 } 276 253 void OneBitflipMoveParameter_ActualNameChanged(object sender, EventArgs e) { … … 295 272 ValuesParameter.Value.Reset += new EventHandler(ValuesValue_Reset); 296 273 PenaltyParameter.ValueChanged += new EventHandler(PenaltyParameter_ValueChanged); 297 VisualizerParameter.ValueChanged += new EventHandler(VisualizerParameter_ValueChanged);298 274 } 299 275 private void ParameterizeSolutionCreator() { … … 314 290 } 315 291 private void ParameterizeVisualizer() { 316 if (Visualizer is IKnapsackSolutionsVisualizer) {317 IKnapsackSolutionsVisualizer visualizer =318 (IKnapsackSolutionsVisualizer)Visualizer;319 visualizer.BinaryVectorParameter.ActualName = SolutionCreator.BinaryVectorParameter.ActualName;320 visualizer.KnapsackCapacityParameter.ActualName = KnapsackCapacityParameter.Name;321 visualizer.WeightsParameter.ActualName = WeightsParameter.Name;322 visualizer.ValuesParameter.ActualName = ValuesParameter.Name;323 }292 //if (Visualizer is IKnapsackSolutionsVisualizer) { 293 // IKnapsackSolutionsVisualizer visualizer = 294 // (IKnapsackSolutionsVisualizer)Visualizer; 295 // visualizer.BinaryVectorParameter.ActualName = SolutionCreator.BinaryVectorParameter.ActualName; 296 // visualizer.KnapsackCapacityParameter.ActualName = KnapsackCapacityParameter.Name; 297 // visualizer.WeightsParameter.ActualName = WeightsParameter.Name; 298 // visualizer.ValuesParameter.ActualName = ValuesParameter.Name; 299 //} 324 300 } 325 301 private void InitializeOperators() { -
trunk/sources/HeuristicLab.Problems.Knapsack/3.3/Visualizers/BestKnapsackVisualizer.cs
r3467 r3616 59 59 } 60 60 61 ILookupParameter ISolutionsVisualizer.VisualizationParameter {62 get { return KnapsackSolutionParameter; }63 }64 65 61 public BestKnapsackVisualizer() 66 62 : base() { -
trunk/sources/HeuristicLab.Problems.OneMax/3.3/Interfaces/IOneMaxSolutionsVisualizer.cs
r3115 r3616 26 26 /// An interface which represents an operator for visualizing solutions of OneMax Problems. 27 27 /// </summary> 28 public interface IOneMaxSolutionsVisualizer : I SingleObjectiveSolutionsVisualizer { }28 public interface IOneMaxSolutionsVisualizer : IAnalyzer { } 29 29 } -
trunk/sources/HeuristicLab.Problems.OneMax/3.3/OnemaxProblem.cs
r3528 r3616 64 64 get { return EvaluatorParameter; } 65 65 } 66 public OptionalValueParameter<IOneMaxSolutionsVisualizer> VisualizerParameter {67 get { return (OptionalValueParameter<IOneMaxSolutionsVisualizer>)Parameters["Visualizer"]; }68 }69 IParameter IProblem.VisualizerParameter {70 get { return VisualizerParameter; }71 }72 66 public ValueParameter<DoubleValue> BestKnownQualityParameter { 73 67 get { return (ValueParameter<DoubleValue>)Parameters["BestKnownQuality"]; } … … 100 94 get { return EvaluatorParameter.Value; } 101 95 } 102 public IOneMaxSolutionsVisualizer Visualizer {103 get { return VisualizerParameter.Value; }104 set { VisualizerParameter.Value = value; }105 }106 ISolutionsVisualizer IProblem.Visualizer {107 get { return VisualizerParameter.Value; }108 }109 96 public DoubleValue BestKnownQuality { 110 97 get { return BestKnownQualityParameter.Value; } … … 126 113 Parameters.Add(new ValueParameter<IOneMaxEvaluator>("Evaluator", "The operator which should be used to evaluate OneMax solutions.", evaluator)); 127 114 Parameters.Add(new ValueParameter<DoubleValue>("BestKnownQuality", "The quality of the best known solution of this OneMax instance.", new DoubleValue(5))); 128 Parameters.Add(new ValueParameter<IOneMaxSolutionsVisualizer>("Visualizer", "The operator which should be used to visualize OneMax solutions.", null));129 115 130 116 creator.BinaryVectorParameter.ActualName = "OneMaxSolution"; … … 156 142 EvaluatorChanged(this, EventArgs.Empty); 157 143 } 158 public event EventHandler VisualizerChanged;159 private void OnVisualizerChanged() {160 if (VisualizerChanged != null)161 VisualizerChanged(this, EventArgs.Empty);162 }163 144 164 145 public event EventHandler OperatorsChanged; … … 193 174 void BestKnownQualityParameter_ValueChanged(object sender, EventArgs e) { 194 175 BestKnownQualityParameter.Value.Value = Length.Value; 195 }196 void VisualizerParameter_ValueChanged(object sender, EventArgs e) {197 OnVisualizerChanged();198 176 } 199 177 void OneBitflipMoveParameter_ActualNameChanged(object sender, EventArgs e) { … … 216 194 BestKnownQualityParameter.Value.Value = Length.Value; 217 195 BestKnownQualityParameter.ValueChanged += new EventHandler(BestKnownQualityParameter_ValueChanged); 218 VisualizerParameter.ValueChanged += new EventHandler(VisualizerParameter_ValueChanged);219 196 } 220 197 private void ParameterizeSolutionCreator() { -
trunk/sources/HeuristicLab.Problems.TestFunctions/3.3/Interfaces/ISingleObjectiveTestFunctionProblemSolutionsVisualizer.cs
r3376 r3616 29 29 /// An interface which represents an operator for visualizing solutions of single objective test functions. 30 30 /// </summary> 31 public interface ISingleObjectiveTestFunctionProblemSolutionsVisualizer : I SingleObjectiveSolutionsVisualizer {31 public interface ISingleObjectiveTestFunctionProblemSolutionsVisualizer : IAnalyzer { 32 32 ILookupParameter<RealVector> PointParameter { get; } 33 33 } -
trunk/sources/HeuristicLab.Problems.TestFunctions/3.3/SingleObjectiveTestFunctionProblem.cs
r3450 r3616 75 75 get { return EvaluatorParameter; } 76 76 } 77 public OptionalValueParameter<ISingleObjectiveTestFunctionProblemSolutionsVisualizer> VisualizerParameter {78 get { return (OptionalValueParameter<ISingleObjectiveTestFunctionProblemSolutionsVisualizer>)Parameters["Visualizer"]; }79 }80 IParameter IProblem.VisualizerParameter {81 get { return VisualizerParameter; }82 }83 77 public OptionalValueParameter<DoubleValue> BestKnownQualityParameter { 84 78 get { return (OptionalValueParameter<DoubleValue>)Parameters["BestKnownQuality"]; } … … 118 112 IEvaluator IProblem.Evaluator { 119 113 get { return EvaluatorParameter.Value; } 120 }121 public ISingleObjectiveTestFunctionProblemSolutionsVisualizer Visualizer {122 get { return VisualizerParameter.Value; }123 set { VisualizerParameter.Value = value; }124 }125 ISolutionsVisualizer IProblem.Visualizer {126 get { return VisualizerParameter.Value; }127 114 } 128 115 public DoubleValue BestKnownQuality { … … 148 135 Parameters.Add(new ValueParameter<IRealVectorCreator>("SolutionCreator", "The operator which should be used to create new TSP solutions.", creator)); 149 136 Parameters.Add(new ValueParameter<ISingleObjectiveTestFunctionProblemEvaluator>("Evaluator", "The operator which should be used to evaluate TSP solutions.", evaluator)); 150 Parameters.Add(new OptionalValueParameter<ISingleObjectiveTestFunctionProblemSolutionsVisualizer>("Visualizer", "The operator which should be used to visualize TSP solutions."));151 137 Parameters.Add(new OptionalValueParameter<DoubleValue>("BestKnownQuality", "The quality of the best known solution of this TSP instance.", new DoubleValue(evaluator.BestKnownQuality))); 152 138 … … 182 168 if (EvaluatorChanged != null) 183 169 EvaluatorChanged(this, EventArgs.Empty); 184 }185 public event EventHandler VisualizerChanged;186 private void OnVisualizerChanged() {187 if (VisualizerChanged != null)188 VisualizerChanged(this, EventArgs.Empty);189 170 } 190 171 public event EventHandler OperatorsChanged; … … 226 207 private void Evaluator_QualityParameter_ActualNameChanged(object sender, EventArgs e) { 227 208 ParameterizeOperators(); 228 }229 private void VisualizerParameter_ValueChanged(object sender, EventArgs e) {230 ParameterizeVisualizer();231 209 } 232 210 private void BoundsParameter_ValueChanged(object sender, EventArgs e) { … … 291 269 EvaluatorParameter.ValueChanged += new EventHandler(EvaluatorParameter_ValueChanged); 292 270 Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged); 293 VisualizerParameter.ValueChanged += new EventHandler(VisualizerParameter_ValueChanged);294 271 strategyVectorCreator.BoundsParameter.ValueChanged += new EventHandler(strategyVectorCreator_BoundsParameter_ValueChanged); 295 272 strategyVectorCreator.StrategyParameterParameter.ActualNameChanged += new EventHandler(strategyVectorCreator_StrategyParameterParameter_ActualNameChanged); … … 344 321 } 345 322 private void ParameterizeVisualizer() { 346 if (Visualizer != null) {347 Visualizer.QualityParameter.ActualName = Evaluator.QualityParameter.ActualName;348 Visualizer.PointParameter.ActualName = SolutionCreator.RealVectorParameter.ActualName;349 }323 //if (Visualizer != null) { 324 // Visualizer.QualityParameter.ActualName = Evaluator.QualityParameter.ActualName; 325 // Visualizer.PointParameter.ActualName = SolutionCreator.RealVectorParameter.ActualName; 326 //} 350 327 } 351 328 private void ParameterizeOperators() { -
trunk/sources/HeuristicLab.Problems.TravelingSalesman.Views/3.3/TravelingSalesmanProblemView.cs
r3566 r3616 66 66 } else { 67 67 parameterCollectionView.Content = ((IParameterizedNamedItem)Content).Parameters; 68 pathTSPTourView.Content = new PathTSPTour(Content.Coordinates, Content.BestKnownSolution );68 pathTSPTourView.Content = new PathTSPTour(Content.Coordinates, Content.BestKnownSolution, Content.BestKnownQuality); 69 69 } 70 70 SetEnabledStateOfControls(); -
trunk/sources/HeuristicLab.Problems.TravelingSalesman/3.3/Analyzers/BestTSPSolutionAnalyzer.cs
r3612 r3616 32 32 namespace HeuristicLab.Problems.TravelingSalesman { 33 33 /// <summary> 34 /// An operator for visualizing the best tourof Traveling Salesman Problems given in path representation using city coordinates.34 /// An operator for analyzing the best solution of Traveling Salesman Problems given in path representation using city coordinates. 35 35 /// </summary> 36 [Item("Best PathTSPTourVisualizer", "An operator for visualizing the best tourof Traveling Salesman Problems given in path representation using city coordinates.")]36 [Item("BestTSPSolutionAnalyzer", "An operator for analyzing the best solution of Traveling Salesman Problems given in path representation using city coordinates.")] 37 37 [StorableClass] 38 public sealed class Best PathTSPTourVisualizer : SingleSuccessorOperator, IPathCoordinatesTSPSolutionsVisualizer {39 public ILookupParameter<DoubleMatrix> CoordinatesParameter {40 get { return ( ILookupParameter<DoubleMatrix>)Parameters["Coordinates"]; }38 public sealed class BestTSPSolutionAnalyzer : SingleSuccessorOperator, IAnalyzer { 39 public LookupParameter<DoubleMatrix> CoordinatesParameter { 40 get { return (LookupParameter<DoubleMatrix>)Parameters["Coordinates"]; } 41 41 } 42 public ILookupParameter<ItemArray<Permutation>> PermutationParameter {43 get { return ( ILookupParameter<ItemArray<Permutation>>)Parameters["Permutation"]; }42 public SubScopesLookupParameter<Permutation> PermutationParameter { 43 get { return (SubScopesLookupParameter<Permutation>)Parameters["Permutation"]; } 44 44 } 45 public ILookupParameter<ItemArray<DoubleValue>> QualityParameter {46 get { return ( ILookupParameter<ItemArray<DoubleValue>>)Parameters["Quality"]; }45 public SubScopesLookupParameter<DoubleValue> QualityParameter { 46 get { return (SubScopesLookupParameter<DoubleValue>)Parameters["Quality"]; } 47 47 } 48 public ILookupParameter<PathTSPTour> PathTSPTourParameter {49 get { return ( ILookupParameter<PathTSPTour>)Parameters["PathTSPTour"]; }48 public LookupParameter<PathTSPTour> BestSolutionParameter { 49 get { return (LookupParameter<PathTSPTour>)Parameters["BestSolution"]; } 50 50 } 51 ILookupParameter ISolutionsVisualizer.VisualizationParameter {52 get { return PathTSPTourParameter; }51 public ValueLookupParameter<ResultCollection> ResultsParameter { 52 get { return (ValueLookupParameter<ResultCollection>)Parameters["Results"]; } 53 53 } 54 54 55 public Best PathTSPTourVisualizer()55 public BestTSPSolutionAnalyzer() 56 56 : base() { 57 57 Parameters.Add(new LookupParameter<DoubleMatrix>("Coordinates", "The x- and y-Coordinates of the cities.")); 58 Parameters.Add(new SubScopesLookupParameter<Permutation>("Permutation", "The TSP solutions given in path representation from which the best solution should be visualized.")); 59 Parameters.Add(new SubScopesLookupParameter<DoubleValue>("Quality", "The qualities of the TSP solutions which should be visualized.")); 60 Parameters.Add(new LookupParameter<PathTSPTour>("PathTSPTour", "The visual representation of the best TSP solution.")); 58 Parameters.Add(new SubScopesLookupParameter<Permutation>("Permutation", "The TSP solutions given in path representation from which the best solution should be analyzed.")); 59 Parameters.Add(new SubScopesLookupParameter<DoubleValue>("Quality", "The qualities of the TSP solutions which should be analyzed.")); 60 Parameters.Add(new LookupParameter<PathTSPTour>("BestSolution", "The best TSP solution.")); 61 Parameters.Add(new ValueLookupParameter<ResultCollection>("Results", "The result collection where the best TSP solution should be stored.")); 61 62 } 62 63 … … 65 66 ItemArray<Permutation> permutations = PermutationParameter.ActualValue; 66 67 ItemArray<DoubleValue> qualities = QualityParameter.ActualValue; 68 ResultCollection results = ResultsParameter.ActualValue; 67 69 68 70 int i = qualities.Select((x, index) => new { index, x.Value }).OrderBy(x => x.Value).First().index; 69 71 70 PathTSPTour tour = PathTSPTourParameter.ActualValue; 71 if (tour == null) PathTSPTourParameter.ActualValue = new PathTSPTour(coordinates, permutations[i]); 72 else { 73 tour.Coordinates = coordinates; 74 tour.Permutation = permutations[i]; 72 PathTSPTour tour = BestSolutionParameter.ActualValue; 73 if (tour == null) { 74 tour = new PathTSPTour(coordinates, permutations[i], qualities[i]); 75 BestSolutionParameter.ActualValue = tour; 76 results.Add(new Result("Best TSP Solution", tour)); 77 } else { 78 if (tour.Quality.Value > qualities[i].Value) { 79 tour.Coordinates = coordinates; 80 tour.Permutation = permutations[i]; 81 tour.Quality = qualities[i]; 82 results["Best TSP Solution"].Value = tour; 83 } 75 84 } 85 76 86 return base.Apply(); 77 87 } -
trunk/sources/HeuristicLab.Problems.TravelingSalesman/3.3/HeuristicLab.Problems.TravelingSalesman-3.3.csproj
r3384 r3616 84 84 </ItemGroup> 85 85 <ItemGroup> 86 <Compile Include="Analyzers\BestTSPSolutionAnalyzer.cs" /> 86 87 <Compile Include="Evaluators\TSPEuclideanPathEvaluator.cs" /> 87 88 <Compile Include="Evaluators\TSPGeoPathEvaluator.cs" /> … … 97 98 <Compile Include="TravelingSalesmanProblem.cs" /> 98 99 <Compile Include="TSPLIBTourParser.cs" /> 99 <Compile Include="Interfaces\ICoordinatesTSPSolutionsVisualizer.cs" />100 <Compile Include="Interfaces\IPathCoordinatesTSPSolutionsVisualizer.cs" />101 <Compile Include="Interfaces\ITSPSolutionsVisualizer.cs" />102 100 <Compile Include="PathTSPTour.cs" /> 103 <Compile Include="Visualizers\BestPathTSPTourVisualizer.cs" />104 101 <Compile Include="Evaluators\TSPCoordinatesPathEvaluator.cs" /> 105 102 <Compile Include="Evaluators\TSPEvaluator.cs" /> -
trunk/sources/HeuristicLab.Problems.TravelingSalesman/3.3/PathTSPTour.cs
r3431 r3616 65 65 } 66 66 } 67 [Storable] 68 private DoubleValue quality; 69 public DoubleValue Quality { 70 get { return quality; } 71 set { 72 if (quality != value) { 73 if (quality != null) DeregisterQualityEvents(); 74 quality = value; 75 if (quality != null) RegisterQualityEvents(); 76 OnQualityChanged(); 77 } 78 } 79 } 67 80 68 81 public PathTSPTour() : base() { } … … 78 91 Initialize(); 79 92 } 93 public PathTSPTour(DoubleMatrix coordinates, Permutation permutation, DoubleValue quality) 94 : base() { 95 this.coordinates = coordinates; 96 this.permutation = permutation; 97 this.quality = quality; 98 Initialize(); 99 } 80 100 [StorableConstructor] 81 101 private PathTSPTour(bool deserializing) : base(deserializing) { } … … 85 105 if (coordinates != null) RegisterCoordinatesEvents(); 86 106 if (permutation != null) RegisterPermutationEvents(); 107 if (quality != null) RegisterQualityEvents(); 87 108 } 88 109 … … 92 113 clone.coordinates = (DoubleMatrix)cloner.Clone(coordinates); 93 114 clone.permutation = (Permutation)cloner.Clone(permutation); 115 clone.quality = (DoubleValue)cloner.Clone(quality); 94 116 clone.Initialize(); 95 117 return clone; … … 106 128 private void OnPermutationChanged() { 107 129 var changed = PermutationChanged; 130 if (changed != null) 131 changed(this, EventArgs.Empty); 132 } 133 public event EventHandler QualityChanged; 134 private void OnQualityChanged() { 135 var changed = QualityChanged; 108 136 if (changed != null) 109 137 changed(this, EventArgs.Empty); … … 126 154 Permutation.Reset -= new EventHandler(Permutation_Reset); 127 155 } 156 private void RegisterQualityEvents() { 157 Quality.ValueChanged += new EventHandler(Quality_ValueChanged); 158 } 159 private void DeregisterQualityEvents() { 160 Quality.ValueChanged -= new EventHandler(Quality_ValueChanged); 161 } 128 162 129 163 private void Coordinates_ItemChanged(object sender, EventArgs<int, int> e) { … … 139 173 OnPermutationChanged(); 140 174 } 175 private void Quality_ValueChanged(object sender, EventArgs e) { 176 OnQualityChanged(); 177 } 141 178 #endregion 142 179 } -
trunk/sources/HeuristicLab.Problems.TravelingSalesman/3.3/TravelingSalesmanProblem.cs
r3504 r3616 71 71 get { return EvaluatorParameter; } 72 72 } 73 public OptionalValueParameter<ITSPSolutionsVisualizer> VisualizerParameter {74 get { return (OptionalValueParameter<ITSPSolutionsVisualizer>)Parameters["Visualizer"]; }75 }76 IParameter IProblem.VisualizerParameter {77 get { return VisualizerParameter; }78 }79 73 public OptionalValueParameter<DoubleValue> BestKnownQualityParameter { 80 74 get { return (OptionalValueParameter<DoubleValue>)Parameters["BestKnownQuality"]; } … … 118 112 get { return EvaluatorParameter.Value; } 119 113 } 120 public ITSPSolutionsVisualizer Visualizer {121 get { return VisualizerParameter.Value; }122 set { VisualizerParameter.Value = value; }123 }124 ISolutionsVisualizer IProblem.Visualizer {125 get { return VisualizerParameter.Value; }126 }127 114 public DoubleValue BestKnownQuality { 128 115 get { return BestKnownQualityParameter.Value; } … … 133 120 set { BestKnownSolutionParameter.Value = value; } 134 121 } 135 private List<I PermutationOperator> operators;122 private List<IOperator> operators; 136 123 public IEnumerable<IOperator> Operators { 137 get { return operators.Cast<IOperator>(); } 124 get { return operators; } 125 } 126 private BestTSPSolutionAnalyzer Analyzer { 127 get { return operators.OfType<BestTSPSolutionAnalyzer>().FirstOrDefault(); } 138 128 } 139 129 #endregion … … 143 133 RandomPermutationCreator creator = new RandomPermutationCreator(); 144 134 TSPRoundedEuclideanPathEvaluator evaluator = new TSPRoundedEuclideanPathEvaluator(); 145 BestPathTSPTourVisualizer visualizer = new BestPathTSPTourVisualizer();146 135 147 136 Parameters.Add(new ValueParameter<BoolValue>("Maximization", "Set to false as the Traveling Salesman Problem is a minimization problem.", new BoolValue(false))); … … 151 140 Parameters.Add(new ValueParameter<IPermutationCreator>("SolutionCreator", "The operator which should be used to create new TSP solutions.", creator)); 152 141 Parameters.Add(new ValueParameter<ITSPEvaluator>("Evaluator", "The operator which should be used to evaluate TSP solutions.", evaluator)); 153 Parameters.Add(new OptionalValueParameter<ITSPSolutionsVisualizer>("Visualizer", "The operator which should be used to visualize TSP solutions.", visualizer));154 142 Parameters.Add(new OptionalValueParameter<DoubleValue>("BestKnownQuality", "The quality of the best known solution of this TSP instance.")); 155 143 Parameters.Add(new OptionalValueParameter<Permutation>("BestKnownSolution", "The best known solution of this TSP instance.")); … … 166 154 ParameterizeSolutionCreator(); 167 155 ParameterizeEvaluator(); 168 ParameterizeVisualizer();169 156 170 157 Initialize(); … … 221 208 EvaluatorChanged(this, EventArgs.Empty); 222 209 } 223 public event EventHandler VisualizerChanged;224 private void OnVisualizerChanged() {225 if (VisualizerChanged != null)226 VisualizerChanged(this, EventArgs.Empty);227 }228 210 public event EventHandler OperatorsChanged; 229 211 private void OnOperatorsChanged() { … … 249 231 ParameterizeSolutionCreator(); 250 232 ParameterizeEvaluator(); 251 Parameterize Visualizer();233 ParameterizeAnalyzer(); 252 234 ParameterizeOperators(); 253 235 OnSolutionCreatorChanged(); … … 255 237 private void SolutionCreator_PermutationParameter_ActualNameChanged(object sender, EventArgs e) { 256 238 ParameterizeEvaluator(); 257 Parameterize Visualizer();239 ParameterizeAnalyzer(); 258 240 ParameterizeOperators(); 259 241 } … … 262 244 ParameterizeEvaluator(); 263 245 UpdateMoveEvaluators(); 264 Parameterize Visualizer();246 ParameterizeAnalyzer(); 265 247 ClearDistanceMatrix(); 266 248 OnEvaluatorChanged(); 267 249 } 268 250 private void Evaluator_QualityParameter_ActualNameChanged(object sender, EventArgs e) { 269 ParameterizeVisualizer(); 270 } 271 private void VisualizerParameter_ValueChanged(object sender, EventArgs e) { 272 ParameterizeVisualizer(); 273 OnVisualizerChanged(); 251 ParameterizeAnalyzer(); 274 252 } 275 253 private void MoveGenerator_InversionMoveParameter_ActualNameChanged(object sender, EventArgs e) { … … 298 276 EvaluatorParameter.ValueChanged += new EventHandler(EvaluatorParameter_ValueChanged); 299 277 Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged); 300 VisualizerParameter.ValueChanged += new EventHandler(VisualizerParameter_ValueChanged);301 278 } 302 279 303 280 private void InitializeOperators() { 304 operators = new List<IPermutationOperator>(); 305 operators.AddRange(ApplicationManager.Manager.GetInstances<IPermutationOperator>()); 281 operators = new List<IOperator>(); 282 operators.Add(new BestTSPSolutionAnalyzer()); 283 ParameterizeAnalyzer(); 284 operators.AddRange(ApplicationManager.Manager.GetInstances<IPermutationOperator>().Cast<IOperator>()); 306 285 ParameterizeOperators(); 307 286 UpdateMoveEvaluators(); … … 344 323 } 345 324 } 346 private void ParameterizeVisualizer() { 347 if (Visualizer != null) { 348 Visualizer.QualityParameter.ActualName = Evaluator.QualityParameter.ActualName; 349 if (Visualizer is ICoordinatesTSPSolutionsVisualizer) 350 ((ICoordinatesTSPSolutionsVisualizer)Visualizer).CoordinatesParameter.ActualName = CoordinatesParameter.Name; 351 if (Visualizer is IPathCoordinatesTSPSolutionsVisualizer) 352 ((IPathCoordinatesTSPSolutionsVisualizer)Visualizer).PermutationParameter.ActualName = SolutionCreator.PermutationParameter.ActualName; 325 private void ParameterizeAnalyzer() { 326 if (Analyzer != null) { 327 Analyzer.QualityParameter.ActualName = Evaluator.QualityParameter.ActualName; 328 Analyzer.CoordinatesParameter.ActualName = CoordinatesParameter.Name; 329 Analyzer.PermutationParameter.ActualName = SolutionCreator.PermutationParameter.ActualName; 330 Analyzer.ResultsParameter.ActualName = "Results"; 353 331 } 354 332 }
Note: See TracChangeset
for help on using the changeset viewer.