Changeset 13713 for branches/PerformanceComparison
- Timestamp:
- 03/17/16 00:29:30 (9 years ago)
- Location:
- branches/PerformanceComparison
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/PerformanceComparison/HeuristicLab.Encodings.PermutationEncoding/3.3/Creators/PreexistingPermutationCreator.cs
r13706 r13713 73 73 Parameters.Add(new LookupParameter<Permutation>("Permutation", "The new random permutation.")); 74 74 Parameters.Add(new ValueParameter<PermutationType>("PermutationType", "The type of the permutation.", new PermutationType(PermutationTypes.RelativeUndirected))); 75 Parameters.Add(new ValueLookupParameter<ScopeList>("PreexistingSolutions", "The list of solutions that should be used to create a new solution." ));76 Parameters.Add(new ValueLookupParameter<BoolValue>("SampleFromPreexisting", "Whether the preexisting solutions should be used as a basis to sample from or whether they should be cloned." ));75 Parameters.Add(new ValueLookupParameter<ScopeList>("PreexistingSolutions", "The list of solutions that should be used to create a new solution.", new ScopeList())); 76 Parameters.Add(new ValueLookupParameter<BoolValue>("SampleFromPreexisting", "Whether the preexisting solutions should be used as a basis to sample from or whether they should be cloned.", new BoolValue(true))); 77 77 } 78 78 -
branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem.Common/3.3/ExpertSystem.cs
r13685 r13713 40 40 using RunCreationClient = HeuristicLab.Clients.OKB.RunCreation.RunCreationClient; 41 41 using SingleObjectiveOKBProblem = HeuristicLab.Clients.OKB.RunCreation.SingleObjectiveOKBProblem; 42 using SingleObjectiveOKBSolution = HeuristicLab.Clients.OKB.RunCreation.SingleObjectiveOKBSolution; 42 43 43 44 namespace HeuristicLab.OptimizationExpertSystem.Common { 44 45 [Item("Expert-System", "Currently in experimental phase, an expert system that makes algorithm suggestions based on fitness landscape analysis features and an optimization knowledge base.")] 45 [StorableClass]46 46 [Creatable(CreatableAttribute.Categories.TestingAndAnalysis, Priority = 119)] 47 47 public sealed class ExpertSystem : NamedItem, IStorableContent, INotifyPropertyChanged { … … 123 123 } 124 124 125 [Storable(Name = "newSolutionPool")] 126 private CheckedItemList<IScope> solutionPool; 127 public CheckedItemList<IScope> SolutionPool { 128 get { return solutionPool; } 129 set { 130 if (solutionPool == value) return; 131 solutionPool = value; 132 OnPropertyChanged("SolutionPool"); 133 } 125 [Storable] 126 private CheckedItemList<IScope> solutionSeedingPool; 127 public CheckedItemList<IScope> SolutionSeedingPool { 128 get { return solutionSeedingPool; } 129 set { solutionSeedingPool = value; } 130 } 131 132 [Storable] 133 private EnumValue<SeedingStrategyTypes> seedingStrategy; 134 public EnumValue<SeedingStrategyTypes> SeedingStrategy { 135 get { return seedingStrategy; } 136 set { seedingStrategy = value; } 134 137 } 135 138 … … 167 170 } 168 171 currentResult = cloner.Clone(original.currentResult); 169 solutionPool = cloner.Clone(original.solutionPool); 172 solutionSeedingPool = cloner.Clone(original.solutionSeedingPool); 173 seedingStrategy = cloner.Clone(original.seedingStrategy); 170 174 currentInstance = cloner.Clone(original.currentInstance); 171 175 RegisterEventHandlers(); … … 180 184 problemInstances = new RunCollection(); 181 185 problem = new SingleObjectiveOKBProblem(); 182 solutionPool = new CheckedItemList<IScope>();183 186 algorithmId2RunMapping = new BidirectionalLookup<long, IRun>(); 184 187 algorithmId2AlgorithmInstanceMapping = new BidirectionalDictionary<long, IAlgorithm>(); 188 solutionSeedingPool = new CheckedItemList<IScope>(); 189 seedingStrategy = new EnumValue<SeedingStrategyTypes>(SeedingStrategyTypes.NoSeeding); 185 190 RegisterEventHandlers(); 186 191 } 187 192 188 193 private void ProblemOnProblemChanged(object sender, EventArgs eventArgs) { 189 if (Problem == null) return;194 190 195 } 191 196 … … 202 207 private void RegisterEventHandlers() { 203 208 problem.ProblemChanged += ProblemOnProblemChanged; 209 problem.Solutions.ItemsAdded += ProblemSolutionsChanged; 210 problem.Solutions.ItemsReplaced += ProblemSolutionsChanged; 211 problem.Solutions.ItemsRemoved += ProblemSolutionsChanged; 212 problem.Solutions.CollectionReset += ProblemSolutionsChanged; 204 213 runs.CollectionReset += InformationChanged; 205 214 runs.ItemsAdded += InformationChanged; … … 210 219 knowledgeBase.ItemsAdded += InformationChanged; 211 220 knowledgeBase.ItemsRemoved += InformationChanged; 221 } 222 223 private void ProblemSolutionsChanged(object sender, EventArgs e) { 224 foreach (var sol in Problem.Solutions.Select(x => x.Solution).OfType<IScope>()) { 225 if (!SolutionSeedingPool.Contains(sol)) 226 SolutionSeedingPool.Add(sol, false); 227 } 212 228 } 213 229 … … 354 370 }; 355 371 356 public voidStartAlgorithmAsync(int index) {372 public Task StartAlgorithmAsync(int index) { 357 373 var selectedInstance = suggestedInstances[index]; 358 var algorithm = (IAlgorithm)selectedInstance.Clone(); 359 algorithm.Problem = Problem.CloneProblem(); 360 algorithm.Prepare(true); 374 var algorithmClone = (IAlgorithm)selectedInstance.Clone(); 375 var problemClone = Problem.CloneProblem() as ISingleObjectiveHeuristicOptimizationProblem; 376 if (problemClone == null) throw new InvalidOperationException("Problem is not of type " + typeof(ISingleObjectiveHeuristicOptimizationProblem).FullName); 377 // TODO: It is assumed the problem instance by default is configured using no preexisting solution creator 378 if (SeedingStrategy.Value != SeedingStrategyTypes.NoSeeding) { 379 if (!SolutionSeedingPool.CheckedItems.Any()) throw new InvalidOperationException("There are no solutions selected for seeding."); 380 // TODO: It would be necessary to specify the solution creator somewhere (property and GUI) 381 var seedingCreator = problemClone.Operators.OfType<IPreexistingSolutionCreator>().FirstOrDefault(); 382 if (seedingCreator == null) throw new InvalidOperationException("The problem does not contain a solution creator that allows seeding."); 383 seedingCreator.PreexistingSolutionsParameter.Value.Replace(SolutionSeedingPool.CheckedItems.Select(x => x.Value)); 384 seedingCreator.SampleFromPreexistingParameter.Value.Value = SeedingStrategy.Value == SeedingStrategyTypes.SeedBySampling; 385 // TODO: WHY!? WHY??!? 386 ((dynamic)problemClone.SolutionCreatorParameter).Value = (dynamic)seedingCreator; 387 } 388 algorithmClone.Problem = problemClone; 389 algorithmClone.Prepare(true); 361 390 IParameter stopParam; 362 391 var monitorStop = true; 363 if (algorithm .Parameters.TryGetValue("MaximumEvaluations", out stopParam)) {392 if (algorithmClone.Parameters.TryGetValue("MaximumEvaluations", out stopParam)) { 364 393 var maxEvalParam = stopParam as IValueParameter<Data.IntValue>; 365 394 if (maxEvalParam != null) { … … 368 397 } 369 398 } 370 algorithm.ExecutionStateChanged += AlgorithmOnExecutionStateChanged; 371 algorithm.ExceptionOccurred += AlgorithmOnExceptionOccurred; 372 if (monitorStop) algorithm.ExecutionTimeChanged += AlgorithmOnExecutionTimeChanged; 373 374 algorithm.Start(); 399 400 // TODO: The following can be simplified when we have async implementation patterns for our algorithms: 401 // TODO: The closures can be removed and replaced with private member methods 402 var waitHandle = new AutoResetEvent(false); 403 404 #region EventHandler closures 405 EventHandler exeStateChanged = (sender, e) => { 406 if (algorithmClone.ExecutionState == ExecutionState.Started) { 407 CurrentResult = algorithmClone.Results; 408 } else if (algorithmClone.ExecutionState == ExecutionState.Stopped) { 409 foreach (var solution in algorithmClone.Results.Where(x => x.Name.ToLower().Contains("solution")).Select(x => x.Value).OfType<IScope>()) { 410 Problem.Solutions.Add(new SingleObjectiveOKBSolution(Problem.ProblemId) { 411 Quality = solution.Variables.ContainsKey(Problem.Problem.Evaluator.QualityParameter.ActualName) ? ((DoubleValue)solution.Variables[Problem.Problem.Evaluator.QualityParameter.ActualName].Value).Value : double.NaN, 412 Solution = (IItem)solution.Clone() 413 }); 414 } 415 Runs.Add(algorithmClone.Runs.Last()); 416 waitHandle.Set(); 417 } 418 }; 419 420 EventHandler<EventArgs<Exception>> exceptionOccurred = (sender, e) => { 421 waitHandle.Set(); 422 }; 423 424 EventHandler timeChanged = (sender, e) => { 425 IResult evalSolResult; 426 if (!algorithmClone.Results.TryGetValue("EvaluatedSolutions", out evalSolResult) || !(evalSolResult.Value is Data.IntValue)) return; 427 var evalSols = ((Data.IntValue)evalSolResult.Value).Value; 428 if (evalSols >= MaximumEvaluations && algorithmClone.ExecutionState == ExecutionState.Started) 429 algorithmClone.Stop(); 430 }; 431 #endregion 432 433 algorithmClone.ExecutionStateChanged += exeStateChanged; 434 algorithmClone.ExceptionOccurred += exceptionOccurred; 435 if (monitorStop) algorithmClone.ExecutionTimeChanged += timeChanged; 436 437 return Task.Factory.StartNew(() => { 438 algorithmClone.Start(); 439 waitHandle.WaitOne(); 440 waitHandle.Dispose(); 441 }); 375 442 } 376 443 377 444 public void StartAlgorithm(int index) { 378 var selectedInstance = suggestedInstances[index]; 379 var algorithm = (IAlgorithm)selectedInstance.Clone(); 380 algorithm.Problem = Problem.CloneProblem(); 381 algorithm.Prepare(true); 382 IParameter stopParam; 383 var monitorStop = true; 384 if (algorithm.Parameters.TryGetValue("MaximumEvaluations", out stopParam)) { 385 var maxEvalParam = stopParam as IValueParameter<Data.IntValue>; 386 if (maxEvalParam != null) { 387 maxEvalParam.Value.Value = MaximumEvaluations; 388 monitorStop = false; 389 } 390 } 391 algorithm.ExecutionStateChanged += AlgorithmOnExecutionStateChanged; 392 algorithm.ExceptionOccurred += AlgorithmOnExceptionOccurred; 393 if (monitorStop) algorithm.ExecutionTimeChanged += AlgorithmOnExecutionTimeChanged; 394 395 using (algWh = new AutoResetEvent(false)) { 396 algorithm.Start(); 397 algWh.WaitOne(); 398 } 399 algWh = null; 400 } 401 402 private AutoResetEvent algWh; 403 404 private void AlgorithmOnExecutionStateChanged(object sender, EventArgs eventArgs) { 405 var alg = sender as IAlgorithm; 406 if (alg == null) return; 407 if (alg.ExecutionState == ExecutionState.Started) { 408 CurrentResult = alg.Results; 409 } else if (alg.ExecutionState == ExecutionState.Stopped) { 410 alg.ExecutionStateChanged -= AlgorithmOnExecutionStateChanged; 411 alg.ExceptionOccurred -= AlgorithmOnExceptionOccurred; 412 alg.ExecutionTimeChanged -= AlgorithmOnExecutionTimeChanged; 413 foreach (var solution in alg.Results.Where(x => x.Name.ToLower().Contains("solution")).Select(x => x.Value).OfType<IScope>()) { 414 solutionPool.Add(solution); 415 } 416 Runs.Add(alg.Runs.Last()); 417 if (algWh != null) algWh.Set(); 418 } 419 } 420 421 private void AlgorithmOnExceptionOccurred(object sender, EventArgs<Exception> eventArgs) { 422 var alg = sender as IAlgorithm; 423 if (alg == null) return; 424 alg.ExecutionStateChanged -= AlgorithmOnExecutionStateChanged; 425 alg.ExceptionOccurred -= AlgorithmOnExceptionOccurred; 426 alg.ExecutionTimeChanged -= AlgorithmOnExecutionTimeChanged; 427 if (algWh != null) algWh.Set(); 428 } 429 430 private void AlgorithmOnExecutionTimeChanged(object sender, EventArgs eventArgs) { 431 var alg = sender as IAlgorithm; 432 if (alg == null) return; 433 IResult evalSolResult; 434 if (!alg.Results.TryGetValue("EvaluatedSolutions", out evalSolResult) || !(evalSolResult.Value is Data.IntValue)) return; 435 var evalSols = ((Data.IntValue)evalSolResult.Value).Value; 436 if (evalSols >= MaximumEvaluations) alg.Stop(); 445 StartAlgorithmAsync(index).Wait(); 437 446 } 438 447 … … 613 622 } 614 623 615 suggestedInstances.Clear();616 624 var instanceLadder = instances.Select(x => (IAlgorithm)x.Value.Clone()).ToList(); 617 625 if (Maximization) instanceLadder.Reverse(); 618 suggestedInstances. AddRange(instanceLadder);626 suggestedInstances.Replace(instanceLadder); 619 627 } 620 628 -
branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem.Common/3.3/HeuristicLab.OptimizationExpertSystem.Common-3.3.csproj
r13663 r13713 109 109 <Private>False</Private> 110 110 </Reference> 111 <Reference Include="HeuristicLab.Parameters-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> 112 <SpecificVersion>False</SpecificVersion> 113 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Parameters-3.3.dll</HintPath> 114 <Private>False</Private> 115 </Reference> 111 116 <Reference Include="HeuristicLab.Persistence-3.3"> 112 117 <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Persistence-3.3.dll</HintPath> … … 140 145 <Compile Include="ExpertSystem.cs" /> 141 146 <Compile Include="Plugin.cs" /> 147 <Compile Include="SeedingStrategyTypes.cs" /> 142 148 <None Include="Properties\AssemblyInfo.cs.frame" /> 143 149 <Compile Include="ProblemCharacteristicAnalysis\CharacteristicCalculator.cs" /> -
branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem/3.3/ExpertSystemView.Designer.cs
r13668 r13713 27 27 private System.ComponentModel.IContainer components = null; 28 28 29 /// <summary> 30 /// Clean up any resources being used. 31 /// </summary> 32 /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> 33 protected override void Dispose(bool disposing) { 34 if (disposing && (components != null)) { 35 components.Dispose(); 36 } 37 base.Dispose(disposing); 38 } 39 29 40 #region Component Designer generated code 30 41 … … 47 58 this.problemTabPage = new System.Windows.Forms.TabPage(); 48 59 this.problemViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost(); 49 this.algorithmTabPage = new System.Windows.Forms.TabPage();50 this.algorithmCloneButton = new System.Windows.Forms.Button();51 this.algorithmStartButton = new System.Windows.Forms.Button();52 this.algorithmViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost();53 this.algorithmSuggestionLabel = new System.Windows.Forms.Label();54 this.suggestedInstancesComboBox = new System.Windows.Forms.ComboBox();55 this.runsTabPage = new System.Windows.Forms.TabPage();56 this.runsView = new HeuristicLab.Optimization.Views.RunCollectionView();57 60 this.solutionsTabPage = new System.Windows.Forms.TabPage(); 58 this. qualityNameLabel = new System.Windows.Forms.Label();61 this.solutionNameLabel = new System.Windows.Forms.Label(); 59 62 this.solutionDiversitySimilarityLabel = new System.Windows.Forms.Label(); 60 this.solutionName Label = new System.Windows.Forms.Label();63 this.solutionNameComboBox = new System.Windows.Forms.ComboBox(); 61 64 this.similarityComboBox = new System.Windows.Forms.ComboBox(); 62 this.qualityNameComboBox = new System.Windows.Forms.ComboBox(); 63 this.solutionNameComboBox = new System.Windows.Forms.ComboBox(); 64 this.solutionsTabControl = new System.Windows.Forms.TabControl(); 65 this.solutionsListTabPage = new System.Windows.Forms.TabPage(); 66 this.solutionsViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost(); 65 this.solutionsTabControl = new HeuristicLab.MainForm.WindowsForms.DragOverTabControl(); 66 this.solutionsSeedingTabPage = new System.Windows.Forms.TabPage(); 67 67 this.solutionsQualityTabPage = new System.Windows.Forms.TabPage(); 68 68 this.solutionsQualityViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost(); … … 75 75 this.solutionsNetworkTabPage = new System.Windows.Forms.TabPage(); 76 76 this.solutionsNetworkChart = new HeuristicLab.Visualization.ChartControlsExtensions.EnhancedChart(); 77 this.solversTabPage = new System.Windows.Forms.TabPage(); 78 this.solversSplitContainer = new System.Windows.Forms.SplitContainer(); 79 this.solverParametersView = new HeuristicLab.Core.Views.ParameterCollectionView(); 80 this.solverResultsView = new HeuristicLab.Optimization.Views.ResultCollectionView(); 81 this.algorithmCloneButton = new System.Windows.Forms.Button(); 82 this.algorithmStartButton = new System.Windows.Forms.Button(); 83 this.algorithmSuggestionLabel = new System.Windows.Forms.Label(); 84 this.suggestedInstancesComboBox = new System.Windows.Forms.ComboBox(); 85 this.runsTabPage = new System.Windows.Forms.TabPage(); 86 this.runsView = new HeuristicLab.Optimization.Views.RunCollectionView(); 77 87 this.okbTabPage = new System.Windows.Forms.TabPage(); 78 88 this.kbViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost(); 79 89 this.problemInstancesTabPage = new System.Windows.Forms.TabPage(); 80 this. label1= new System.Windows.Forms.Label();90 this.projectionLabel = new System.Windows.Forms.Label(); 81 91 this.projectionComboBox = new System.Windows.Forms.ComboBox(); 82 this.problemInstancesTabControl = new System.Windows.Forms.TabControl();92 this.problemInstancesTabControl = new HeuristicLab.MainForm.WindowsForms.DragOverTabControl(); 83 93 this.instancesTabPage = new System.Windows.Forms.TabPage(); 84 94 this.problemInstancesView = new HeuristicLab.MainForm.WindowsForms.ViewHost(); … … 89 99 this.okbDownloadButton = new System.Windows.Forms.Button(); 90 100 this.openFileDialog = new System.Windows.Forms.OpenFileDialog(); 101 this.solutionsSeedingTableLayoutPanel = new System.Windows.Forms.TableLayoutPanel(); 91 102 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit(); 92 103 this.tabControl.SuspendLayout(); 93 104 this.problemTabPage.SuspendLayout(); 94 this.algorithmTabPage.SuspendLayout();95 this.runsTabPage.SuspendLayout();96 105 this.solutionsTabPage.SuspendLayout(); 97 106 this.solutionsTabControl.SuspendLayout(); 98 this.solutions ListTabPage.SuspendLayout();107 this.solutionsSeedingTabPage.SuspendLayout(); 99 108 this.solutionsQualityTabPage.SuspendLayout(); 100 109 this.solutionsDiversityTabPage.SuspendLayout(); … … 103 112 this.solutionsNetworkTabPage.SuspendLayout(); 104 113 ((System.ComponentModel.ISupportInitialize)(this.solutionsNetworkChart)).BeginInit(); 114 this.solversTabPage.SuspendLayout(); 115 ((System.ComponentModel.ISupportInitialize)(this.solversSplitContainer)).BeginInit(); 116 this.solversSplitContainer.Panel1.SuspendLayout(); 117 this.solversSplitContainer.Panel2.SuspendLayout(); 118 this.solversSplitContainer.SuspendLayout(); 119 this.runsTabPage.SuspendLayout(); 105 120 this.okbTabPage.SuspendLayout(); 106 121 this.problemInstancesTabPage.SuspendLayout(); … … 148 163 | System.Windows.Forms.AnchorStyles.Right))); 149 164 this.tabControl.Controls.Add(this.problemTabPage); 150 this.tabControl.Controls.Add(this.algorithmTabPage); 165 this.tabControl.Controls.Add(this.solutionsTabPage); 166 this.tabControl.Controls.Add(this.solversTabPage); 151 167 this.tabControl.Controls.Add(this.runsTabPage); 152 this.tabControl.Controls.Add(this.solutionsTabPage);153 168 this.tabControl.Controls.Add(this.okbTabPage); 154 169 this.tabControl.Controls.Add(this.problemInstancesTabPage); … … 185 200 this.problemViewHost.ViewType = null; 186 201 // 187 // algorithmTabPage188 //189 this.algorithmTabPage.Controls.Add(this.algorithmCloneButton);190 this.algorithmTabPage.Controls.Add(this.algorithmStartButton);191 this.algorithmTabPage.Controls.Add(this.algorithmViewHost);192 this.algorithmTabPage.Controls.Add(this.algorithmSuggestionLabel);193 this.algorithmTabPage.Controls.Add(this.suggestedInstancesComboBox);194 this.algorithmTabPage.Location = new System.Drawing.Point(4, 22);195 this.algorithmTabPage.Name = "algorithmTabPage";196 this.algorithmTabPage.Padding = new System.Windows.Forms.Padding(3);197 this.algorithmTabPage.Size = new System.Drawing.Size(681, 428);198 this.algorithmTabPage.TabIndex = 4;199 this.algorithmTabPage.Text = "Algorithm";200 this.algorithmTabPage.UseVisualStyleBackColor = true;201 //202 // algorithmCloneButton203 //204 this.algorithmCloneButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));205 this.algorithmCloneButton.Location = new System.Drawing.Point(649, 5);206 this.algorithmCloneButton.Name = "algorithmCloneButton";207 this.algorithmCloneButton.Size = new System.Drawing.Size(26, 23);208 this.algorithmCloneButton.TabIndex = 3;209 this.algorithmCloneButton.Text = "Clone";210 this.algorithmCloneButton.UseVisualStyleBackColor = true;211 this.algorithmCloneButton.Click += new System.EventHandler(this.AlgorithmCloneButtonOnClick);212 //213 // algorithmStartButton214 //215 this.algorithmStartButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));216 this.algorithmStartButton.Location = new System.Drawing.Point(617, 5);217 this.algorithmStartButton.Name = "algorithmStartButton";218 this.algorithmStartButton.Size = new System.Drawing.Size(26, 23);219 this.algorithmStartButton.TabIndex = 3;220 this.algorithmStartButton.Text = "Start";221 this.algorithmStartButton.UseVisualStyleBackColor = true;222 this.algorithmStartButton.Click += new System.EventHandler(this.AlgorithmStartButtonOnClick);223 //224 // algorithmViewHost225 //226 this.algorithmViewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)227 | System.Windows.Forms.AnchorStyles.Left)228 | System.Windows.Forms.AnchorStyles.Right)));229 this.algorithmViewHost.Caption = "View";230 this.algorithmViewHost.Content = null;231 this.algorithmViewHost.Enabled = false;232 this.algorithmViewHost.Location = new System.Drawing.Point(6, 36);233 this.algorithmViewHost.Name = "algorithmViewHost";234 this.algorithmViewHost.ReadOnly = false;235 this.algorithmViewHost.Size = new System.Drawing.Size(669, 386);236 this.algorithmViewHost.TabIndex = 2;237 this.algorithmViewHost.ViewsLabelVisible = true;238 this.algorithmViewHost.ViewType = null;239 //240 // algorithmSuggestionLabel241 //242 this.algorithmSuggestionLabel.AutoSize = true;243 this.algorithmSuggestionLabel.Location = new System.Drawing.Point(6, 9);244 this.algorithmSuggestionLabel.Name = "algorithmSuggestionLabel";245 this.algorithmSuggestionLabel.Size = new System.Drawing.Size(156, 13);246 this.algorithmSuggestionLabel.TabIndex = 1;247 this.algorithmSuggestionLabel.Text = "Suggested Algorithm Instances:";248 //249 // suggestedInstancesComboBox250 //251 this.suggestedInstancesComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)252 | System.Windows.Forms.AnchorStyles.Right)));253 this.suggestedInstancesComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;254 this.suggestedInstancesComboBox.FormattingEnabled = true;255 this.suggestedInstancesComboBox.Location = new System.Drawing.Point(178, 6);256 this.suggestedInstancesComboBox.Name = "suggestedInstancesComboBox";257 this.suggestedInstancesComboBox.Size = new System.Drawing.Size(433, 21);258 this.suggestedInstancesComboBox.TabIndex = 0;259 this.suggestedInstancesComboBox.SelectedIndexChanged += new System.EventHandler(this.SuggestedInstancesComboBoxOnSelectedIndexChanged);260 //261 // runsTabPage262 //263 this.runsTabPage.Controls.Add(this.runsView);264 this.runsTabPage.Location = new System.Drawing.Point(4, 22);265 this.runsTabPage.Name = "runsTabPage";266 this.runsTabPage.Padding = new System.Windows.Forms.Padding(3);267 this.runsTabPage.Size = new System.Drawing.Size(681, 428);268 this.runsTabPage.TabIndex = 3;269 this.runsTabPage.Text = "Runs";270 this.runsTabPage.UseVisualStyleBackColor = true;271 //272 // runsView273 //274 this.runsView.Caption = "RunCollection View";275 this.runsView.Content = null;276 this.runsView.Dock = System.Windows.Forms.DockStyle.Fill;277 this.runsView.Location = new System.Drawing.Point(3, 3);278 this.runsView.Name = "runsView";279 this.runsView.ReadOnly = false;280 this.runsView.Size = new System.Drawing.Size(675, 422);281 this.runsView.TabIndex = 1;282 //283 202 // solutionsTabPage 284 203 // 285 this.solutionsTabPage.Controls.Add(this. qualityNameLabel);204 this.solutionsTabPage.Controls.Add(this.solutionNameLabel); 286 205 this.solutionsTabPage.Controls.Add(this.solutionDiversitySimilarityLabel); 287 this.solutionsTabPage.Controls.Add(this.solutionName Label);206 this.solutionsTabPage.Controls.Add(this.solutionNameComboBox); 288 207 this.solutionsTabPage.Controls.Add(this.similarityComboBox); 289 this.solutionsTabPage.Controls.Add(this.qualityNameComboBox);290 this.solutionsTabPage.Controls.Add(this.solutionNameComboBox);291 208 this.solutionsTabPage.Controls.Add(this.solutionsTabControl); 292 209 this.solutionsTabPage.Location = new System.Drawing.Point(4, 22); … … 298 215 this.solutionsTabPage.UseVisualStyleBackColor = true; 299 216 // 300 // qualityNameLabel301 // 302 this. qualityNameLabel.AutoSize = true;303 this. qualityNameLabel.Location = new System.Drawing.Point(227, 9);304 this. qualityNameLabel.Name = "qualityNameLabel";305 this. qualityNameLabel.Size = new System.Drawing.Size(42, 13);306 this. qualityNameLabel.TabIndex = 2;307 this. qualityNameLabel.Text = "Quality:";217 // solutionNameLabel 218 // 219 this.solutionNameLabel.AutoSize = true; 220 this.solutionNameLabel.Location = new System.Drawing.Point(235, 9); 221 this.solutionNameLabel.Name = "solutionNameLabel"; 222 this.solutionNameLabel.Size = new System.Drawing.Size(48, 13); 223 this.solutionNameLabel.TabIndex = 2; 224 this.solutionNameLabel.Text = "Solution:"; 308 225 // 309 226 // solutionDiversitySimilarityLabel 310 227 // 311 228 this.solutionDiversitySimilarityLabel.AutoSize = true; 312 this.solutionDiversitySimilarityLabel.Location = new System.Drawing.Point( 449, 9);229 this.solutionDiversitySimilarityLabel.Location = new System.Drawing.Point(5, 9); 313 230 this.solutionDiversitySimilarityLabel.Name = "solutionDiversitySimilarityLabel"; 314 231 this.solutionDiversitySimilarityLabel.Size = new System.Drawing.Size(50, 13); … … 316 233 this.solutionDiversitySimilarityLabel.Text = "Similarity:"; 317 234 // 318 // solutionNameLabel 319 // 320 this.solutionNameLabel.AutoSize = true; 321 this.solutionNameLabel.Location = new System.Drawing.Point(6, 9); 322 this.solutionNameLabel.Name = "solutionNameLabel"; 323 this.solutionNameLabel.Size = new System.Drawing.Size(48, 13); 324 this.solutionNameLabel.TabIndex = 2; 325 this.solutionNameLabel.Text = "Solution:"; 235 // solutionNameComboBox 236 // 237 this.solutionNameComboBox.DisplayMember = "ItemName"; 238 this.solutionNameComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 239 this.solutionNameComboBox.FormattingEnabled = true; 240 this.solutionNameComboBox.Location = new System.Drawing.Point(291, 6); 241 this.solutionNameComboBox.Name = "solutionNameComboBox"; 242 this.solutionNameComboBox.Size = new System.Drawing.Size(150, 21); 243 this.solutionNameComboBox.TabIndex = 1; 244 this.solutionNameComboBox.SelectedIndexChanged += new System.EventHandler(this.SimilarityComboBoxOnSelectedIndexChanged); 326 245 // 327 246 // similarityComboBox … … 330 249 this.similarityComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 331 250 this.similarityComboBox.FormattingEnabled = true; 332 this.similarityComboBox.Location = new System.Drawing.Point( 505, 6);251 this.similarityComboBox.Location = new System.Drawing.Point(61, 6); 333 252 this.similarityComboBox.Name = "similarityComboBox"; 334 253 this.similarityComboBox.Size = new System.Drawing.Size(150, 21); 335 254 this.similarityComboBox.TabIndex = 1; 336 this.similarityComboBox.SelectedIndexChanged += new System.EventHandler(this.similarityComboBox_SelectedIndexChanged); 337 // 338 // qualityNameComboBox 339 // 340 this.qualityNameComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 341 this.qualityNameComboBox.FormattingEnabled = true; 342 this.qualityNameComboBox.Location = new System.Drawing.Point(281, 6); 343 this.qualityNameComboBox.Name = "qualityNameComboBox"; 344 this.qualityNameComboBox.Size = new System.Drawing.Size(150, 21); 345 this.qualityNameComboBox.TabIndex = 1; 346 this.qualityNameComboBox.SelectedIndexChanged += new System.EventHandler(this.qualityNameComboBox_SelectedIndexChanged); 347 // 348 // solutionNameComboBox 349 // 350 this.solutionNameComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 351 this.solutionNameComboBox.FormattingEnabled = true; 352 this.solutionNameComboBox.Location = new System.Drawing.Point(60, 6); 353 this.solutionNameComboBox.Name = "solutionNameComboBox"; 354 this.solutionNameComboBox.Size = new System.Drawing.Size(150, 21); 355 this.solutionNameComboBox.TabIndex = 1; 356 this.solutionNameComboBox.SelectedIndexChanged += new System.EventHandler(this.solutionNameComboBox_SelectedIndexChanged); 255 this.similarityComboBox.SelectedIndexChanged += new System.EventHandler(this.SimilarityComboBoxOnSelectedIndexChanged); 357 256 // 358 257 // solutionsTabControl 359 258 // 259 this.solutionsTabControl.AllowDrop = true; 360 260 this.solutionsTabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 361 261 | System.Windows.Forms.AnchorStyles.Left) 362 262 | System.Windows.Forms.AnchorStyles.Right))); 363 this.solutionsTabControl.Controls.Add(this.solutions ListTabPage);263 this.solutionsTabControl.Controls.Add(this.solutionsSeedingTabPage); 364 264 this.solutionsTabControl.Controls.Add(this.solutionsQualityTabPage); 365 265 this.solutionsTabControl.Controls.Add(this.solutionsDiversityTabPage); … … 373 273 this.solutionsTabControl.TabIndex = 0; 374 274 // 375 // solutionsListTabPage 376 // 377 this.solutionsListTabPage.Controls.Add(this.solutionsViewHost); 378 this.solutionsListTabPage.Location = new System.Drawing.Point(4, 22); 379 this.solutionsListTabPage.Name = "solutionsListTabPage"; 380 this.solutionsListTabPage.Padding = new System.Windows.Forms.Padding(3); 381 this.solutionsListTabPage.Size = new System.Drawing.Size(667, 366); 382 this.solutionsListTabPage.TabIndex = 0; 383 this.solutionsListTabPage.Text = "List"; 384 this.solutionsListTabPage.UseVisualStyleBackColor = true; 385 // 386 // solutionsViewHost 387 // 388 this.solutionsViewHost.Caption = "View"; 389 this.solutionsViewHost.Content = null; 390 this.solutionsViewHost.Dock = System.Windows.Forms.DockStyle.Fill; 391 this.solutionsViewHost.Enabled = false; 392 this.solutionsViewHost.Location = new System.Drawing.Point(3, 3); 393 this.solutionsViewHost.Name = "solutionsViewHost"; 394 this.solutionsViewHost.ReadOnly = false; 395 this.solutionsViewHost.Size = new System.Drawing.Size(661, 360); 396 this.solutionsViewHost.TabIndex = 0; 397 this.solutionsViewHost.ViewsLabelVisible = true; 398 this.solutionsViewHost.ViewType = null; 275 // solutionsSeedingTabPage 276 // 277 this.solutionsSeedingTabPage.Controls.Add(this.solutionsSeedingTableLayoutPanel); 278 this.solutionsSeedingTabPage.Location = new System.Drawing.Point(4, 22); 279 this.solutionsSeedingTabPage.Name = "solutionsSeedingTabPage"; 280 this.solutionsSeedingTabPage.Padding = new System.Windows.Forms.Padding(3); 281 this.solutionsSeedingTabPage.Size = new System.Drawing.Size(667, 366); 282 this.solutionsSeedingTabPage.TabIndex = 6; 283 this.solutionsSeedingTabPage.Text = "Seeding"; 284 this.solutionsSeedingTabPage.UseVisualStyleBackColor = true; 399 285 // 400 286 // solutionsQualityTabPage … … 511 397 // solutionsNetworkChart 512 398 // 399 chartArea1.AxisX.IsStartedFromZero = false; 513 400 chartArea1.AxisX.LabelStyle.Enabled = false; 514 401 chartArea1.AxisX.LineWidth = 0; 515 402 chartArea1.AxisX.MajorGrid.Enabled = false; 516 403 chartArea1.AxisX.MajorTickMark.Enabled = false; 404 chartArea1.AxisY.IsStartedFromZero = false; 517 405 chartArea1.AxisY.LabelStyle.Enabled = false; 518 406 chartArea1.AxisY.LineWidth = 0; … … 540 428 this.solutionsNetworkChart.Text = "enhancedChart1"; 541 429 // 430 // solversTabPage 431 // 432 this.solversTabPage.Controls.Add(this.solversSplitContainer); 433 this.solversTabPage.Controls.Add(this.algorithmCloneButton); 434 this.solversTabPage.Controls.Add(this.algorithmStartButton); 435 this.solversTabPage.Controls.Add(this.algorithmSuggestionLabel); 436 this.solversTabPage.Controls.Add(this.suggestedInstancesComboBox); 437 this.solversTabPage.Location = new System.Drawing.Point(4, 22); 438 this.solversTabPage.Name = "solversTabPage"; 439 this.solversTabPage.Padding = new System.Windows.Forms.Padding(3); 440 this.solversTabPage.Size = new System.Drawing.Size(681, 428); 441 this.solversTabPage.TabIndex = 4; 442 this.solversTabPage.Text = "Solvers"; 443 this.solversTabPage.UseVisualStyleBackColor = true; 444 // 445 // solversSplitContainer 446 // 447 this.solversSplitContainer.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 448 | System.Windows.Forms.AnchorStyles.Left) 449 | System.Windows.Forms.AnchorStyles.Right))); 450 this.solversSplitContainer.FixedPanel = System.Windows.Forms.FixedPanel.Panel1; 451 this.solversSplitContainer.Location = new System.Drawing.Point(3, 33); 452 this.solversSplitContainer.Name = "solversSplitContainer"; 453 // 454 // solversSplitContainer.Panel1 455 // 456 this.solversSplitContainer.Panel1.Controls.Add(this.solverParametersView); 457 // 458 // solversSplitContainer.Panel2 459 // 460 this.solversSplitContainer.Panel2.Controls.Add(this.solverResultsView); 461 this.solversSplitContainer.Size = new System.Drawing.Size(675, 392); 462 this.solversSplitContainer.SplitterDistance = 300; 463 this.solversSplitContainer.TabIndex = 4; 464 // 465 // solverParametersView 466 // 467 this.solverParametersView.AllowEditingOfHiddenParameters = true; 468 this.solverParametersView.Caption = "ParameterCollection View"; 469 this.solverParametersView.Content = null; 470 this.solverParametersView.Dock = System.Windows.Forms.DockStyle.Fill; 471 this.solverParametersView.Location = new System.Drawing.Point(0, 0); 472 this.solverParametersView.Name = "solverParametersView"; 473 this.solverParametersView.ReadOnly = true; 474 this.solverParametersView.ShowDetails = false; 475 this.solverParametersView.Size = new System.Drawing.Size(300, 392); 476 this.solverParametersView.TabIndex = 0; 477 // 478 // solverResultsView 479 // 480 this.solverResultsView.Caption = "ResultCollection View"; 481 this.solverResultsView.Content = null; 482 this.solverResultsView.Dock = System.Windows.Forms.DockStyle.Fill; 483 this.solverResultsView.Location = new System.Drawing.Point(0, 0); 484 this.solverResultsView.Name = "solverResultsView"; 485 this.solverResultsView.ReadOnly = true; 486 this.solverResultsView.ShowDetails = true; 487 this.solverResultsView.Size = new System.Drawing.Size(371, 392); 488 this.solverResultsView.TabIndex = 0; 489 // 490 // algorithmCloneButton 491 // 492 this.algorithmCloneButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); 493 this.algorithmCloneButton.Location = new System.Drawing.Point(649, 5); 494 this.algorithmCloneButton.Name = "algorithmCloneButton"; 495 this.algorithmCloneButton.Size = new System.Drawing.Size(26, 23); 496 this.algorithmCloneButton.TabIndex = 3; 497 this.algorithmCloneButton.Text = "Clone"; 498 this.algorithmCloneButton.UseVisualStyleBackColor = true; 499 this.algorithmCloneButton.Click += new System.EventHandler(this.AlgorithmCloneButtonOnClick); 500 // 501 // algorithmStartButton 502 // 503 this.algorithmStartButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); 504 this.algorithmStartButton.Location = new System.Drawing.Point(617, 5); 505 this.algorithmStartButton.Name = "algorithmStartButton"; 506 this.algorithmStartButton.Size = new System.Drawing.Size(26, 23); 507 this.algorithmStartButton.TabIndex = 3; 508 this.algorithmStartButton.Text = "Start"; 509 this.algorithmStartButton.UseVisualStyleBackColor = true; 510 this.algorithmStartButton.Click += new System.EventHandler(this.AlgorithmStartButtonOnClick); 511 // 512 // algorithmSuggestionLabel 513 // 514 this.algorithmSuggestionLabel.AutoSize = true; 515 this.algorithmSuggestionLabel.Location = new System.Drawing.Point(6, 9); 516 this.algorithmSuggestionLabel.Name = "algorithmSuggestionLabel"; 517 this.algorithmSuggestionLabel.Size = new System.Drawing.Size(99, 13); 518 this.algorithmSuggestionLabel.TabIndex = 1; 519 this.algorithmSuggestionLabel.Text = "Suggested Solvers:"; 520 // 521 // suggestedInstancesComboBox 522 // 523 this.suggestedInstancesComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 524 | System.Windows.Forms.AnchorStyles.Right))); 525 this.suggestedInstancesComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 526 this.suggestedInstancesComboBox.FormattingEnabled = true; 527 this.suggestedInstancesComboBox.Location = new System.Drawing.Point(111, 6); 528 this.suggestedInstancesComboBox.Name = "suggestedInstancesComboBox"; 529 this.suggestedInstancesComboBox.Size = new System.Drawing.Size(500, 21); 530 this.suggestedInstancesComboBox.TabIndex = 0; 531 this.suggestedInstancesComboBox.SelectedIndexChanged += new System.EventHandler(this.SuggestedInstancesComboBoxOnSelectedIndexChanged); 532 // 533 // runsTabPage 534 // 535 this.runsTabPage.Controls.Add(this.runsView); 536 this.runsTabPage.Location = new System.Drawing.Point(4, 22); 537 this.runsTabPage.Name = "runsTabPage"; 538 this.runsTabPage.Padding = new System.Windows.Forms.Padding(3); 539 this.runsTabPage.Size = new System.Drawing.Size(681, 428); 540 this.runsTabPage.TabIndex = 3; 541 this.runsTabPage.Text = "Runs"; 542 this.runsTabPage.UseVisualStyleBackColor = true; 543 // 544 // runsView 545 // 546 this.runsView.Caption = "RunCollection View"; 547 this.runsView.Content = null; 548 this.runsView.Dock = System.Windows.Forms.DockStyle.Fill; 549 this.runsView.Location = new System.Drawing.Point(3, 3); 550 this.runsView.Name = "runsView"; 551 this.runsView.ReadOnly = false; 552 this.runsView.Size = new System.Drawing.Size(675, 422); 553 this.runsView.TabIndex = 1; 554 // 542 555 // okbTabPage 543 556 // … … 567 580 // problemInstancesTabPage 568 581 // 569 this.problemInstancesTabPage.Controls.Add(this. label1);582 this.problemInstancesTabPage.Controls.Add(this.projectionLabel); 570 583 this.problemInstancesTabPage.Controls.Add(this.projectionComboBox); 571 584 this.problemInstancesTabPage.Controls.Add(this.problemInstancesTabControl); … … 579 592 this.problemInstancesTabPage.UseVisualStyleBackColor = true; 580 593 // 581 // label1582 // 583 this. label1.AutoSize = true;584 this. label1.Location = new System.Drawing.Point(35, 11);585 this. label1.Name = "label1";586 this. label1.Size = new System.Drawing.Size(57, 13);587 this. label1.TabIndex = 6;588 this. label1.Text = "Projection:";594 // projectionLabel 595 // 596 this.projectionLabel.AutoSize = true; 597 this.projectionLabel.Location = new System.Drawing.Point(35, 11); 598 this.projectionLabel.Name = "projectionLabel"; 599 this.projectionLabel.Size = new System.Drawing.Size(57, 13); 600 this.projectionLabel.TabIndex = 6; 601 this.projectionLabel.Text = "Projection:"; 589 602 // 590 603 // projectionComboBox … … 600 613 // problemInstancesTabControl 601 614 // 615 this.problemInstancesTabControl.AllowDrop = true; 602 616 this.problemInstancesTabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 603 617 | System.Windows.Forms.AnchorStyles.Left) … … 719 733 this.openFileDialog.Title = "Open Optimizer"; 720 734 // 735 // solutionsSeedingTableLayoutPanel 736 // 737 this.solutionsSeedingTableLayoutPanel.ColumnCount = 1; 738 this.solutionsSeedingTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); 739 this.solutionsSeedingTableLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill; 740 this.solutionsSeedingTableLayoutPanel.Location = new System.Drawing.Point(3, 3); 741 this.solutionsSeedingTableLayoutPanel.Name = "solutionsSeedingTableLayoutPanel"; 742 this.solutionsSeedingTableLayoutPanel.RowCount = 2; 743 this.solutionsSeedingTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 30F)); 744 this.solutionsSeedingTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle()); 745 this.solutionsSeedingTableLayoutPanel.Size = new System.Drawing.Size(661, 360); 746 this.solutionsSeedingTableLayoutPanel.TabIndex = 0; 747 // 721 748 // ExpertSystemView 722 749 // … … 740 767 this.tabControl.ResumeLayout(false); 741 768 this.problemTabPage.ResumeLayout(false); 742 this.algorithmTabPage.ResumeLayout(false);743 this.algorithmTabPage.PerformLayout();744 this.runsTabPage.ResumeLayout(false);745 769 this.solutionsTabPage.ResumeLayout(false); 746 770 this.solutionsTabPage.PerformLayout(); 747 771 this.solutionsTabControl.ResumeLayout(false); 748 this.solutions ListTabPage.ResumeLayout(false);772 this.solutionsSeedingTabPage.ResumeLayout(false); 749 773 this.solutionsQualityTabPage.ResumeLayout(false); 750 774 this.solutionsDiversityTabPage.ResumeLayout(false); … … 753 777 this.solutionsNetworkTabPage.ResumeLayout(false); 754 778 ((System.ComponentModel.ISupportInitialize)(this.solutionsNetworkChart)).EndInit(); 779 this.solversTabPage.ResumeLayout(false); 780 this.solversTabPage.PerformLayout(); 781 this.solversSplitContainer.Panel1.ResumeLayout(false); 782 this.solversSplitContainer.Panel2.ResumeLayout(false); 783 ((System.ComponentModel.ISupportInitialize)(this.solversSplitContainer)).EndInit(); 784 this.solversSplitContainer.ResumeLayout(false); 785 this.runsTabPage.ResumeLayout(false); 755 786 this.okbTabPage.ResumeLayout(false); 756 787 this.problemInstancesTabPage.ResumeLayout(false); … … 775 806 private System.Windows.Forms.TabPage problemTabPage; 776 807 private MainForm.WindowsForms.ViewHost problemViewHost; 777 private System.Windows.Forms.TabPage algorithmTabPage; 778 private MainForm.WindowsForms.ViewHost algorithmViewHost; 808 private System.Windows.Forms.TabPage solversTabPage; 779 809 private System.Windows.Forms.Label algorithmSuggestionLabel; 780 810 private System.Windows.Forms.ComboBox suggestedInstancesComboBox; … … 786 816 private MainForm.WindowsForms.ViewHost kbViewHost; 787 817 private System.Windows.Forms.Button algorithmStartButton; 788 private System.Windows.Forms.TabControl problemInstancesTabControl;818 private HeuristicLab.MainForm.WindowsForms.DragOverTabControl problemInstancesTabControl; 789 819 private System.Windows.Forms.TabPage instancesTabPage; 790 820 private MainForm.WindowsForms.ViewHost problemInstancesView; 791 821 private System.Windows.Forms.TabPage mapTabPage; 792 822 private Visualization.ChartControlsExtensions.EnhancedChart instanceMapChart; 793 private System.Windows.Forms.Label label1;823 private System.Windows.Forms.Label projectionLabel; 794 824 private System.Windows.Forms.ComboBox projectionComboBox; 795 825 private System.Windows.Forms.TabPage solutionsTabPage; 796 private System.Windows.Forms.TabControl solutionsTabControl; 797 private System.Windows.Forms.TabPage solutionsListTabPage; 826 private HeuristicLab.MainForm.WindowsForms.DragOverTabControl solutionsTabControl; 798 827 private System.Windows.Forms.TabPage solutionsQualityTabPage; 799 828 private System.Windows.Forms.TabPage solutionsDiversityTabPage; 800 private System.Windows.Forms.Label qualityNameLabel;801 private System.Windows.Forms.Label solutionNameLabel;802 private System.Windows.Forms.ComboBox qualityNameComboBox;803 private System.Windows.Forms.ComboBox solutionNameComboBox;804 829 private MainForm.WindowsForms.ViewHost solutionsQualityViewHost; 805 private MainForm.WindowsForms.ViewHost solutionsViewHost;806 830 private MainForm.WindowsForms.ViewHost solutionsDiversityViewHost; 807 831 private System.Windows.Forms.Label solutionDiversitySimilarityLabel; … … 814 838 private Visualization.ChartControlsExtensions.EnhancedChart solutionsNetworkChart; 815 839 private System.Windows.Forms.Button algorithmCloneButton; 840 private System.Windows.Forms.SplitContainer solversSplitContainer; 841 private Core.Views.ParameterCollectionView solverParametersView; 842 private Optimization.Views.ResultCollectionView solverResultsView; 843 private System.Windows.Forms.Label solutionNameLabel; 844 private System.Windows.Forms.ComboBox solutionNameComboBox; 845 private System.Windows.Forms.TabPage solutionsSeedingTabPage; 846 private System.Windows.Forms.TableLayoutPanel solutionsSeedingTableLayoutPanel; 816 847 } 817 848 } -
branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem/3.3/ExpertSystemView.cs
r13668 r13713 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 2Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 22 22 using HeuristicLab.Analysis; 23 23 using HeuristicLab.Analysis.QualityAnalysis; 24 using HeuristicLab.Clients.OKB.RunCreation; 24 25 using HeuristicLab.Common; 25 26 using HeuristicLab.Common.Resources; 27 using HeuristicLab.Core; 26 28 using HeuristicLab.Core.Views; 27 29 using HeuristicLab.Data; 30 using HeuristicLab.Data.Views; 28 31 using HeuristicLab.MainForm; 29 32 using HeuristicLab.Optimization; … … 37 40 using System.Windows.Forms; 38 41 using System.Windows.Forms.DataVisualization.Charting; 42 using DoubleValue = HeuristicLab.Data.DoubleValue; 39 43 40 44 namespace HeuristicLab.OptimizationExpertSystem { … … 42 46 [Content(typeof(ExpertSystem), IsDefaultView = true)] 43 47 public partial class ExpertSystemView : NamedItemView { 44 protected TypeSelectorDialog problemTypeSelectorDialog; 48 private EnumValueView<SeedingStrategyTypes> seedingStrategyView; 49 private CheckedItemListView<IScope> seedingSolutionsView; 45 50 protected virtual bool SuppressEvents { get; set; } 46 51 private bool okbDownloadInProgress; … … 61 66 refreshMapButton.Text = string.Empty; 62 67 refreshMapButton.Image = VSImageLibrary.Refresh; 63 } 64 65 protected override void Dispose(bool disposing) { 66 if (disposing) { 67 if (problemTypeSelectorDialog != null) problemTypeSelectorDialog.Dispose(); 68 if (components != null) components.Dispose(); 69 } 70 base.Dispose(disposing); 71 } 72 68 seedingStrategyView = new EnumValueView<SeedingStrategyTypes>() { 69 Dock = DockStyle.Fill 70 }; 71 seedingSolutionsView = new CheckedItemListView<IScope>() { 72 Dock = DockStyle.Fill 73 }; 74 solutionsSeedingTableLayoutPanel.SuspendLayout(); 75 solutionsSeedingTableLayoutPanel.Controls.Add(seedingStrategyView, 0, 0); 76 solutionsSeedingTableLayoutPanel.Controls.Add(seedingSolutionsView, 0, 1); 77 solutionsSeedingTableLayoutPanel.ResumeLayout(true); 78 } 79 80 #region Event Registration 73 81 protected override void DeregisterContentEvents() { 74 82 Content.PropertyChanged -= ContentOnPropertyChanged; … … 78 86 Content.SuggestedInstances.ItemsRemoved -= SuggestedInstancesOnChanged; 79 87 Content.SuggestedInstances.ItemsReplaced -= SuggestedInstancesOnChanged; 80 Content.SolutionPool.ItemsAdded -= SolutionPoolOnChanged; 81 Content.SolutionPool.ItemsRemoved -= SolutionPoolOnChanged; 82 Content.SolutionPool.ItemsReplaced -= SolutionPoolOnChanged; 83 Content.SolutionPool.CollectionReset -= SolutionPoolOnChanged; 84 if (Content.Problem != null) Content.Problem.ProblemChanged -= ContentOnProblemChanged; 88 DeregisterProblemEvents(Content.Problem); 85 89 base.DeregisterContentEvents(); 86 90 } 91 87 92 protected override void RegisterContentEvents() { 88 93 base.RegisterContentEvents(); … … 93 98 Content.SuggestedInstances.ItemsRemoved += SuggestedInstancesOnChanged; 94 99 Content.SuggestedInstances.ItemsReplaced += SuggestedInstancesOnChanged; 95 Content.SolutionPool.ItemsAdded += SolutionPoolOnChanged; 96 Content.SolutionPool.ItemsRemoved += SolutionPoolOnChanged; 97 Content.SolutionPool.ItemsReplaced += SolutionPoolOnChanged; 98 Content.SolutionPool.CollectionReset += SolutionPoolOnChanged; 99 if (Content.Problem != null) Content.Problem.ProblemChanged += ContentOnProblemChanged; 100 } 100 RegisterProblemEvents(Content.Problem); 101 } 102 103 private void DeregisterProblemEvents(OKBProblem problem) { 104 if (problem == null) return; 105 problem.Solutions.ItemsAdded -= SolutionsOnChanged; 106 problem.Solutions.ItemsRemoved -= SolutionsOnChanged; 107 problem.Solutions.ItemsReplaced -= SolutionsOnChanged; 108 problem.Solutions.CollectionReset -= SolutionsOnChanged; 109 problem.ProblemChanged -= ContentOnProblemChanged; 110 } 111 112 private void RegisterProblemEvents(OKBProblem problem) { 113 if (problem == null) return; 114 problem.Solutions.ItemsAdded += SolutionsOnChanged; 115 problem.Solutions.ItemsRemoved += SolutionsOnChanged; 116 problem.Solutions.ItemsReplaced += SolutionsOnChanged; 117 problem.Solutions.CollectionReset += SolutionsOnChanged; 118 problem.ProblemChanged += ContentOnProblemChanged; 119 } 120 #endregion 101 121 102 122 protected override void OnContentChanged() { … … 107 127 if (Content == null) { 108 128 maxEvaluationsTextBox.Text = String.Empty; 109 110 129 problemViewHost.Content = null; 111 algorithmViewHost.Content = null; 130 solverParametersView.Content = null; 131 solverResultsView.Content = null; 112 132 runsView.Content = null; 113 solutionsViewHost.Content = null;114 133 kbViewHost.Content = null; 115 134 problemInstancesView.Content = null; 135 seedingStrategyView.Content = null; 136 seedingSolutionsView.Content = null; 116 137 } else { 117 138 maxEvaluationsTextBox.Text = Content.MaximumEvaluations.ToString(); 118 139 problemViewHost.Content = Content.Problem; 119 140 runsView.Content = Content.Runs; 120 solutionsViewHost.Content = Content.SolutionPool;121 141 kbViewHost.ViewType = typeof(RunCollectionRLDView); 122 142 kbViewHost.Content = Content.KnowledgeBase; 123 143 problemInstancesView.Content = Content.ProblemInstances; 124 algorithmViewHost.Content = Content.CurrentResult; 144 solverResultsView.Content = Content.CurrentResult; 145 seedingStrategyView.Content = Content.SeedingStrategy; 146 seedingSolutionsView.Content = Content.SolutionSeedingPool; 125 147 } 126 148 } finally { SuppressEvents = false; } 127 149 UpdateSuggestedInstancesCombobox(); 150 UpdateSimilarityCalculators(); 128 151 UpdateNamesComboboxes(); 129 UpdateSimilarityCalculators();130 152 } 131 153 … … 137 159 algorithmStartButton.Enabled = Content != null && !ReadOnly && !Locked && suggestedInstancesComboBox.SelectedIndex >= 0; 138 160 algorithmCloneButton.Enabled = Content != null && !ReadOnly && !Locked && suggestedInstancesComboBox.SelectedIndex >= 0; 139 algorithmViewHost.Enabled = Content != null && !ReadOnly && !Locked;140 161 runsView.Enabled = Content != null; 141 162 kbViewHost.Enabled = Content != null && !okbDownloadInProgress; … … 143 164 refreshMapButton.Enabled = Content != null; 144 165 okbDownloadButton.Enabled = Content != null && Content.Problem != null && Content.Problem.ProblemId >= 0 && !ReadOnly && !Locked && !okbDownloadInProgress; 145 }146 147 private void UpdateSuggestedInstancesCombobox() {148 var prevSelection = (IAlgorithm)suggestedInstancesComboBox.SelectedItem;149 var prevNewIndex = -1;150 suggestedInstancesComboBox.Items.Clear();151 if (Content == null) return;152 153 for (var i = 0; i < Content.SuggestedInstances.Count; i++) {154 suggestedInstancesComboBox.Items.Add(Content.SuggestedInstances[i]);155 if (prevSelection == null || Content.SuggestedInstances[i].Name == prevSelection.Name)156 prevNewIndex = prevSelection == null ? 0 : i;157 }158 if (prevNewIndex >= 0) {159 suggestedInstancesComboBox.SelectedIndex = prevNewIndex;160 }161 }162 163 private void UpdateNamesComboboxes() {164 var selectedSolutionName = solutionNameComboBox.SelectedIndex >= 0 ? (string)solutionNameComboBox.SelectedItem : string.Empty;165 var selectedQualityName = qualityNameComboBox.SelectedIndex >= 0 ? (string)qualityNameComboBox.SelectedItem : string.Empty;166 167 solutionNameComboBox.Items.Clear();168 qualityNameComboBox.Items.Clear();169 if (Content == null) return;170 var qualityNames = new HashSet<string>(Content.SolutionPool.SelectMany(x => x.Variables).Where(x => x.Value is DoubleValue).Select(x => x.Name));171 var solutionNames = Content.SolutionPool.SelectMany(x => x.Variables).Where(x => !qualityNames.Contains(x.Name));172 173 foreach (var sn in solutionNames.GroupBy(x => x.Name).OrderBy(x => x.Key)) {174 solutionNameComboBox.Items.Add(sn.Key);175 // either it was previously selected, or the variable value is defined in the HeuristicLab.Encodings sub-namespace176 if (sn.Key == selectedSolutionName || (string.IsNullOrEmpty(selectedSolutionName) && sn.All(x => x.Value != null && x.Value.GetType().FullName.StartsWith("HeuristicLab.Encodings."))))177 solutionNameComboBox.SelectedItem = sn.Key;178 }179 foreach (var qn in qualityNames.OrderBy(x => x)) {180 qualityNameComboBox.Items.Add(qn);181 if (qn == selectedQualityName || string.IsNullOrEmpty(selectedQualityName)) qualityNameComboBox.SelectedItem = qn;182 }183 }184 185 private void UpdateSimilarityCalculators() {186 var selected = (ISolutionSimilarityCalculator)(similarityComboBox.SelectedIndex >= 0 ? similarityComboBox.SelectedItem : null);187 similarityComboBox.Items.Clear();188 189 if (Content == null || Content.Problem == null) return;190 191 foreach (var calc in Content.Problem.Operators.OfType<ISolutionSimilarityCalculator>()) {192 similarityComboBox.Items.Add(calc);193 if (selected != null && calc.ItemName == selected.ItemName) similarityComboBox.SelectedItem = calc;194 }195 if (selected == null && similarityComboBox.Items.Count > 0)196 similarityComboBox.SelectedIndex = 0;197 166 } 198 167 … … 216 185 case "MaximumEvaluations": maxEvaluationsTextBox.Text = Content.MaximumEvaluations.ToString(); break; 217 186 case "Problem": 187 DeregisterProblemEvents(problemViewHost.Content as OKBProblem); 218 188 problemViewHost.Content = Content.Problem; 219 Content.Problem.ProblemChanged += ContentOnProblemChanged; 189 RegisterProblemEvents(Content.Problem); 190 UpdateNamesComboboxes(); 220 191 break; 221 192 case "ProblemInstances": problemInstancesView.Content = Content.ProblemInstances; break; 222 case "CurrentResult": algorithmViewHost.Content = Content.CurrentResult; break;193 case "CurrentResult": solverResultsView.Content = Content.CurrentResult; break; 223 194 } 224 195 } finally { SuppressEvents = false; } … … 230 201 } 231 202 232 private void Solution PoolOnChanged(object sender, EventArgs e) {203 private void SolutionsOnChanged(object sender, EventArgs e) { 233 204 UpdateNamesComboboxes(); 234 if (qualityNameComboBox.SelectedIndex >= 0) { 235 var qualityName = (string)qualityNameComboBox.SelectedItem; 236 UpdateSolutionQualityAnalysis(qualityName); 237 } 238 if (similarityComboBox.SelectedIndex >= 0) { 239 var calculator = (ISolutionSimilarityCalculator)similarityComboBox.SelectedItem; 240 UpdateSolutionDiversityAnalysis(calculator); 241 UpdateSolutionFdcAnalysis(calculator); 242 UpdateSolutionLengthScaleAnalysis(calculator); 243 UpdateSolutionNetworkAnalysis(calculator); 244 } else solutionsDiversityViewHost.Content = null; 205 UpdateSolutionVisualization(); 245 206 } 246 207 #endregion … … 263 224 } 264 225 } 265 #endregion266 #endregion267 226 268 227 private void RefreshMapButtonOnClick(object sender, EventArgs e) { 269 228 Content.UpdateInstanceProjection(); 270 229 UpdateProjectionComboBox(); 271 }272 273 private void UpdateProjectionComboBox() {274 projectionComboBox.Items.Clear();275 var projStrings = Content.ProblemInstances276 .SelectMany(x => x.Results.Where(y => Regex.IsMatch(y.Key, "^Projection[.].*[.][XY]$")))277 .Select(x => Regex.Match(x.Key, "Projection[.](?<g>.*)[.][XY]").Groups["g"].Value)278 .Distinct();279 foreach (var str in projStrings) {280 projectionComboBox.Items.Add(str);281 }282 230 } 283 231 … … 295 243 } 296 244 297 private void OkbDownloadProgressOnStateChanged(object sender, EventArgs eventArgs) { 245 private void OkbDownloadProgressOnStateChanged(object sender, EventArgs e) { 246 if (InvokeRequired) { Invoke((Action<object, EventArgs>)OkbDownloadProgressOnStateChanged, sender, e); return; } 298 247 var progress = (IProgress)sender; 299 248 okbDownloadInProgress = progress.ProgressState == ProgressState.Started; … … 316 265 317 266 private void ProjectionComboBoxOnSelectedIndexChanged(object sender, EventArgs e) { 267 if (InvokeRequired) { Invoke((Action<object, EventArgs>)ProjectionComboBoxOnSelectedIndexChanged, sender, e); return; } 318 268 if (projectionComboBox.SelectedIndex < 0) return; 319 269 var projection = (string)projectionComboBox.SelectedItem; … … 346 296 } 347 297 298 private void SuggestedInstancesComboBoxOnSelectedIndexChanged(object sender, EventArgs e) { 299 if (InvokeRequired) { Invoke((Action<object, EventArgs>)SuggestedInstancesComboBoxOnSelectedIndexChanged, sender, e); return; } 300 if (suggestedInstancesComboBox.SelectedIndex >= 0) { 301 solverParametersView.Content = Content.SuggestedInstances[suggestedInstancesComboBox.SelectedIndex].Parameters; 302 } else solverParametersView.Content = null; 303 SetEnabledStateOfControls(); 304 } 305 306 private void SimilarityComboBoxOnSelectedIndexChanged(object sender, EventArgs e) { 307 if (InvokeRequired) { Invoke((Action<object, EventArgs>)SimilarityComboBoxOnSelectedIndexChanged, sender, e); return; } 308 var calculator = (ISolutionSimilarityCalculator)similarityComboBox.SelectedItem; 309 if (calculator != null) { 310 calculator.SolutionVariableName = (string)solutionNameComboBox.SelectedItem; 311 calculator.QualityVariableName = Content.Problem.Problem.Evaluator.QualityParameter.ActualName; 312 } 313 UpdateSolutionDiversityAnalysis(calculator); 314 UpdateSolutionFdcAnalysis(calculator); 315 UpdateSolutionLengthScaleAnalysis(calculator); 316 UpdateSolutionNetworkAnalysis(calculator); 317 } 318 #endregion 319 #endregion 320 321 #region Control Configuration 322 private void UpdateSuggestedInstancesCombobox() { 323 var prevSelection = (IAlgorithm)suggestedInstancesComboBox.SelectedItem; 324 var prevNewIndex = -1; 325 suggestedInstancesComboBox.Items.Clear(); 326 if (Content == null) return; 327 328 for (var i = 0; i < Content.SuggestedInstances.Count; i++) { 329 suggestedInstancesComboBox.Items.Add(Content.SuggestedInstances[i]); 330 if (prevSelection == null || Content.SuggestedInstances[i].Name == prevSelection.Name) 331 prevNewIndex = prevSelection == null ? 0 : i; 332 } 333 if (prevNewIndex >= 0) { 334 suggestedInstancesComboBox.SelectedIndex = prevNewIndex; 335 } 336 } 337 338 private void UpdateSimilarityCalculators() { 339 var selected = (ISolutionSimilarityCalculator)(similarityComboBox.SelectedIndex >= 0 ? similarityComboBox.SelectedItem : null); 340 similarityComboBox.Items.Clear(); 341 342 if (Content == null || Content.Problem == null) return; 343 344 foreach (var calc in Content.Problem.Operators.OfType<ISolutionSimilarityCalculator>()) { 345 similarityComboBox.Items.Add(calc); 346 if (selected != null && calc.ItemName == selected.ItemName) similarityComboBox.SelectedItem = calc; 347 } 348 if (selected == null && similarityComboBox.Items.Count > 0) 349 similarityComboBox.SelectedIndex = 0; 350 } 351 352 private void UpdateNamesComboboxes() { 353 var selectedSolutionName = solutionNameComboBox.SelectedIndex >= 0 ? (string)solutionNameComboBox.SelectedItem : string.Empty; 354 355 solutionNameComboBox.Items.Clear(); 356 if (Content == null) return; 357 var solutionNames = Content.Problem.Solutions.Select(x => x.Solution).OfType<IScope>().SelectMany(x => x.Variables); 358 359 foreach (var sn in solutionNames.GroupBy(x => x.Name).OrderBy(x => x.Key)) { 360 solutionNameComboBox.Items.Add(sn.Key); 361 // either it was previously selected, or the variable value is defined in the HeuristicLab.Encodings sub-namespace 362 if (sn.Key == selectedSolutionName || (string.IsNullOrEmpty(selectedSolutionName) && sn.All(x => x.Value != null && x.Value.GetType().FullName.StartsWith("HeuristicLab.Encodings.")))) 363 solutionNameComboBox.SelectedItem = sn.Key; 364 } 365 } 366 367 private void UpdateProjectionComboBox() { 368 projectionComboBox.Items.Clear(); 369 var projStrings = Content.ProblemInstances 370 .SelectMany(x => x.Results.Where(y => Regex.IsMatch(y.Key, "^Projection[.].*[.][XY]$"))) 371 .Select(x => Regex.Match(x.Key, "Projection[.](?<g>.*)[.][XY]").Groups["g"].Value) 372 .Distinct(); 373 foreach (var str in projStrings) { 374 projectionComboBox.Items.Add(str); 375 } 376 } 377 #endregion 378 379 #region Visualization 380 #region Solution Visualization 381 public void UpdateSolutionVisualization() { 382 if (InvokeRequired) { Invoke((Action)UpdateSolutionVisualization); return; } 383 var qualityName = Content.Problem.Problem.Evaluator.QualityParameter.ActualName; 384 UpdateSolutionQualityAnalysis(qualityName); 385 if (similarityComboBox.SelectedIndex >= 0) { 386 var calculator = (ISolutionSimilarityCalculator)similarityComboBox.SelectedItem; 387 UpdateSolutionDiversityAnalysis(calculator); 388 UpdateSolutionFdcAnalysis(calculator); 389 UpdateSolutionLengthScaleAnalysis(calculator); 390 UpdateSolutionNetworkAnalysis(calculator); 391 } else { 392 solutionsDiversityViewHost.Content = null; 393 solutionsFdcViewHost.Content = null; 394 solutionsLengthScaleViewHost.Content = null; 395 solutionsNetworkChart.Series.First().Points.Clear(); 396 } 397 } 348 398 private void UpdateSolutionQualityAnalysis(string qualityName) { 349 399 var dt = solutionsQualityViewHost.Content as DataTable; 350 400 if (dt == null) { 351 401 dt = QualityDistributionAnalyzer.PrepareTable(qualityName); 402 dt.VisualProperties.Title = "Quality Distribution"; 352 403 solutionsQualityViewHost.Content = dt; 353 404 } 354 QualityDistributionAnalyzer.UpdateTable(dt, Content. SolutionPool.Where(x => x.Variables.ContainsKey(qualityName)).Select(x => x.Variables[qualityName].Value).OfType<DoubleValue>().Select(x => x.Value));405 QualityDistributionAnalyzer.UpdateTable(dt, Content.Problem.Solutions.Select(x => x.Solution).OfType<IScope>().Where(x => x.Variables.ContainsKey(qualityName)).Select(x => x.Variables[qualityName].Value).OfType<DoubleValue>().Select(x => x.Value)); 355 406 } 356 407 … … 358 409 try { 359 410 solutionsDiversityViewHost.Content = null; 360 if (Content.SolutionPool == null) return; 361 var similarities = new double[Content.SolutionPool.Count, Content.SolutionPool.Count]; 362 for (int i = 0; i < Content.SolutionPool.Count; i++) { 363 for (int j = 0; j < Content.SolutionPool.Count; j++) 364 similarities[i, j] = calculator.CalculateSolutionSimilarity(Content.SolutionPool[i], Content.SolutionPool[j]); 411 var similarities = new double[Content.Problem.Solutions.Count, Content.Problem.Solutions.Count]; 412 for (int i = 0; i < Content.Problem.Solutions.Count; i++) { 413 for (int j = 0; j < Content.Problem.Solutions.Count; j++) 414 similarities[i, j] = calculator.CalculateSolutionSimilarity((IScope)Content.Problem.Solutions[i].Solution, (IScope)Content.Problem.Solutions[j].Solution); 365 415 } 366 416 var hm = new HeatMap(similarities, "Solution Similarities", 0.0, 1.0); … … 372 422 try { 373 423 solutionsFdcViewHost.Content = null; 374 if (Content.SolutionPool == null) return;375 424 var points = new List<Point2D<double>>(); 376 for (int i = 0; i < Content. SolutionPool.Count; i++) {377 for (int j = 0; j < Content. SolutionPool.Count; j++) {425 for (int i = 0; i < Content.Problem.Solutions.Count; i++) { 426 for (int j = 0; j < Content.Problem.Solutions.Count; j++) { 378 427 if (i == j) continue; 379 var qDiff = Math.Abs(((DoubleValue)Content.SolutionPool[i].Variables[calculator.QualityVariableName].Value).Value - ((DoubleValue)Content.SolutionPool[j].Variables[calculator.QualityVariableName].Value).Value); 380 points.Add(new Point2D<double>(qDiff, 1.0 - calculator.CalculateSolutionSimilarity(Content.SolutionPool[i], Content.SolutionPool[j]))); 428 var qDiff = Math.Abs(((DoubleValue)((IScope)Content.Problem.Solutions[i].Solution).Variables[calculator.QualityVariableName].Value).Value 429 - ((DoubleValue)((IScope)Content.Problem.Solutions[j].Solution).Variables[calculator.QualityVariableName].Value).Value); 430 points.Add(new Point2D<double>(qDiff, 1.0 - calculator.CalculateSolutionSimilarity((IScope)Content.Problem.Solutions[i].Solution, (IScope)Content.Problem.Solutions[j].Solution))); 381 431 } 382 432 } 383 433 var splot = new ScatterPlot("Fitness-Distance", ""); 434 splot.VisualProperties.XAxisTitle = "Absolute Fitness Difference"; 435 splot.VisualProperties.XAxisMinimumFixedValue = 0.0; 436 splot.VisualProperties.YAxisTitle = "Solution Distance"; 437 splot.VisualProperties.YAxisMinimumFixedValue = 0.0; 438 splot.VisualProperties.YAxisMaximumFixedValue = 1.0; 384 439 var row = new ScatterPlotDataRow("Fdc", "", points); 385 440 row.VisualProperties.PointSize = 7; … … 392 447 try { 393 448 solutionsLengthScaleViewHost.Content = null; 394 if (Content.SolutionPool == null) return;395 449 var dt = solutionsLengthScaleViewHost.Content as DataTable; 396 450 if (dt == null) { … … 404 458 405 459 private IEnumerable<double> CalculateLengthScale(ISolutionSimilarityCalculator calculator) { 406 for (int i = 0; i < Content. SolutionPool.Count; i++) {407 for (int j = 0; j < Content. SolutionPool.Count; j++) {460 for (int i = 0; i < Content.Problem.Solutions.Count; i++) { 461 for (int j = 0; j < Content.Problem.Solutions.Count; j++) { 408 462 if (i == j) continue; 409 var sim = calculator.CalculateSolutionSimilarity( Content.SolutionPool[i], Content.SolutionPool[j]);463 var sim = calculator.CalculateSolutionSimilarity((IScope)Content.Problem.Solutions[i].Solution, (IScope)Content.Problem.Solutions[j].Solution); 410 464 if (sim.IsAlmost(0)) continue; 411 var qDiff = Math.Abs(((DoubleValue)Content.SolutionPool[i].Variables[calculator.QualityVariableName].Value).Value - ((DoubleValue)Content.SolutionPool[j].Variables[calculator.QualityVariableName].Value).Value); 465 var qDiff = Math.Abs(((DoubleValue)((IScope)Content.Problem.Solutions[i].Solution).Variables[calculator.QualityVariableName].Value).Value 466 - ((DoubleValue)((IScope)Content.Problem.Solutions[j].Solution).Variables[calculator.QualityVariableName].Value).Value); 412 467 yield return qDiff / sim; 413 468 } … … 419 474 var series = solutionsNetworkChart.Series["SolutionSeries"]; 420 475 series.Points.Clear(); 421 var dissimilarities = new DoubleMatrix(Content. SolutionPool.Count, Content.SolutionPool.Count);422 for (int i = 0; i < Content. SolutionPool.Count; i++) {423 for (int j = 0; j < Content. SolutionPool.Count; j++) {476 var dissimilarities = new DoubleMatrix(Content.Problem.Solutions.Count, Content.Problem.Solutions.Count); 477 for (int i = 0; i < Content.Problem.Solutions.Count; i++) { 478 for (int j = 0; j < Content.Problem.Solutions.Count; j++) { 424 479 if (i == j) continue; 425 dissimilarities[i, j] = 1.0 - calculator.CalculateSolutionSimilarity( Content.SolutionPool[i], Content.SolutionPool[j]);480 dissimilarities[i, j] = 1.0 - calculator.CalculateSolutionSimilarity((IScope)Content.Problem.Solutions[i].Solution, (IScope)Content.Problem.Solutions[j].Solution); 426 481 } 427 482 } 428 483 var coords = MultidimensionalScaling.KruskalShepard(dissimilarities); 429 484 for (var i = 0; i < coords.Rows; i++) { 430 var quality = ((DoubleValue) Content.SolutionPool[i].Variables[calculator.QualityVariableName].Value).Value;485 var quality = ((DoubleValue)((IScope)Content.Problem.Solutions[i].Solution).Variables[calculator.QualityVariableName].Value).Value; 431 486 series.Points.Add(new DataPoint() { 432 Name = i.ToString(),487 Name = (i + 1).ToString(), 433 488 XValue = coords[i, 0], 434 489 YValues = new[] { coords[i, 1], quality }, … … 438 493 } catch { } 439 494 } 440 441 private void SuggestedInstancesComboBoxOnSelectedIndexChanged(object sender, EventArgs e) { 442 SetEnabledStateOfControls(); 443 } 444 445 private void qualityNameComboBox_SelectedIndexChanged(object sender, EventArgs e) { 446 if (qualityNameComboBox.SelectedIndex < 0) return; 447 solutionsQualityViewHost.Content = null; 448 solutionsDiversityViewHost.Content = null; 449 var qualityName = (string)qualityNameComboBox.SelectedItem; 450 UpdateSolutionQualityAnalysis(qualityName); 451 var calculator = (ISolutionSimilarityCalculator)similarityComboBox.SelectedItem; 452 if (calculator != null) calculator.QualityVariableName = qualityName; 453 UpdateSolutionDiversityAnalysis(calculator); 454 UpdateSolutionFdcAnalysis(calculator); 455 UpdateSolutionLengthScaleAnalysis(calculator); 456 UpdateSolutionNetworkAnalysis(calculator); 457 } 458 459 private void solutionNameComboBox_SelectedIndexChanged(object sender, EventArgs e) { 460 var calculator = (ISolutionSimilarityCalculator)similarityComboBox.SelectedItem; 461 if (calculator != null) calculator.SolutionVariableName = (string)solutionNameComboBox.SelectedItem; 462 UpdateSolutionDiversityAnalysis(calculator); 463 UpdateSolutionFdcAnalysis(calculator); 464 UpdateSolutionLengthScaleAnalysis(calculator); 465 UpdateSolutionNetworkAnalysis(calculator); 466 } 467 468 private void similarityComboBox_SelectedIndexChanged(object sender, EventArgs e) { 469 var calculator = (ISolutionSimilarityCalculator)similarityComboBox.SelectedItem; 470 if (calculator != null) { 471 calculator.SolutionVariableName = (string)solutionNameComboBox.SelectedItem; 472 calculator.QualityVariableName = (string)qualityNameComboBox.SelectedItem; 473 } 474 UpdateSolutionDiversityAnalysis(calculator); 475 UpdateSolutionFdcAnalysis(calculator); 476 UpdateSolutionLengthScaleAnalysis(calculator); 477 UpdateSolutionNetworkAnalysis(calculator); 478 } 495 #endregion 496 #endregion 479 497 } 480 498 }
Note: See TracChangeset
for help on using the changeset viewer.