Changeset 13787
- Timestamp:
- 04/24/16 10:03:52 (9 years ago)
- Location:
- branches/PerformanceComparison
- Files:
-
- 8 added
- 9 edited
- 1 copied
- 5 moved
Legend:
- Unmodified
- Added
- Removed
-
branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem.Common/3.3/Enums.cs
r13757 r13787 26 26 SeedByCloning 27 27 } 28 29 public enum ProblemInstanceProximityType {30 FeatureSpace,31 PCA,32 MDS,33 SOM34 }35 28 } -
branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem.Common/3.3/HeuristicLab.OptimizationExpertSystem.Common-3.3.csproj
r13774 r13787 158 158 </ItemGroup> 159 159 <ItemGroup> 160 <Compile Include="OverallBestRecommender.cs" /> 161 <Compile Include="DistanceWeightedRecommender.cs" /> 162 <Compile Include="IAlgorithmInstanceRecommender.cs" /> 163 <Compile Include="KNearestNeighborRecommender.cs" /> 160 <Compile Include="Interfaces\IRecommendationModel.cs" /> 161 <Compile Include="Recommenders\KNearestNeighborModel.cs" /> 162 <Compile Include="Recommenders\OverallBestRecommender.cs" /> 163 <Compile Include="Recommenders\DistanceWeightedRecommender.cs" /> 164 <Compile Include="Interfaces\IAlgorithmInstanceRecommender.cs" /> 165 <Compile Include="Recommenders\KNearestNeighborRecommender.cs" /> 164 166 <Compile Include="KnowledgeCenter.cs" /> 165 167 <Compile Include="Plugin.cs" /> 166 168 <Compile Include="Enums.cs" /> 169 <Compile Include="Recommenders\FixedRankModel.cs" /> 167 170 <None Include="Properties\AssemblyInfo.cs.frame" /> 168 171 <Compile Include="ProblemCharacteristicAnalysis\CharacteristicCalculator.cs" /> -
branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem.Common/3.3/Interfaces/IAlgorithmInstanceRecommender.cs
r13786 r13787 20 20 #endregion 21 21 22 using HeuristicLab.Common; 23 using HeuristicLab.Optimization; 24 using System.Collections.Generic; 22 using HeuristicLab.Core; 25 23 26 24 namespace HeuristicLab.OptimizationExpertSystem.Common { 27 public interface IAlgorithmInstanceRecommender : I Content{28 I Enumerable<IAlgorithm> GetRanking();25 public interface IAlgorithmInstanceRecommender : IParameterizedItem { 26 IRecommendationModel TrainModel(KnowledgeCenter kc, string[] characteristics); 29 27 } 30 28 } -
branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem.Common/3.3/KnowledgeCenter.cs
r13774 r13787 96 96 } 97 97 98 private readonly CheckedItemList<StringValue> problemCharacteristics; 99 private readonly ReadOnlyCheckedItemList<StringValue> readonlyProblemCharacteristics; 100 public ReadOnlyCheckedItemList<StringValue> ProblemCharacteristics { 101 get { return readonlyProblemCharacteristics; } 102 } 103 104 private IAlgorithmInstanceRecommender algorithmInstanceRecommender; 105 public IAlgorithmInstanceRecommender AlgorithmInstanceRecommender { 106 get { return algorithmInstanceRecommender; } 107 set { algorithmInstanceRecommender = value; } 98 private IRecommendationModel recommendationModel; 99 public IRecommendationModel RecommendationModel { 100 get { return recommendationModel; } 101 set { 102 if (recommendationModel == value) return; 103 recommendationModel = value; 104 OnRecommenderModelChanged(); 105 } 108 106 } 109 107 … … 135 133 readonlyAlgorithmInstances = algorithmInstances.AsReadOnly(); 136 134 problemInstances = new RunCollection(); 137 problemCharacteristics = new CheckedItemList<StringValue>(); 138 readonlyProblemCharacteristics = problemCharacteristics.AsReadOnly(); 139 algorithmInstanceRecommender = new OverallBestRecommender(this); 135 recommendationModel = FixedRankModel.GetEmpty(); 140 136 problem = new SingleObjectiveOKBProblem(); 141 137 algorithmId2RunMapping = new BidirectionalLookup<long, IRun>(); … … 167 163 knowledgeBase.ItemsAdded += InformationChanged; 168 164 knowledgeBase.ItemsRemoved += InformationChanged; 169 problemCharacteristics.ItemsAdded += CharacteristicChanged;170 problemCharacteristics.ItemsReplaced += CharacteristicChanged;171 problemCharacteristics.ItemsRemoved += CharacteristicChanged;172 problemCharacteristics.CollectionReset += CharacteristicChanged;173 problemCharacteristics.CheckedItemsChanged += CharacteristicChanged;174 165 } 175 166 176 167 private void MaximumEvaluationsOnValueChanged(object sender, EventArgs eventArgs) { 177 UpdateSuggestions(); 168 178 169 } 179 170 180 171 private void MinimumTargetOnValueChanged(object sender, EventArgs e) { 181 UpdateSuggestions(); 172 182 173 } 183 174 … … 192 183 var runCollection = sender as RunCollection; 193 184 if (runCollection != null && runCollection.UpdateOfRunsInProgress) return; 194 UpdateSuggestions();195 }196 197 private void CharacteristicChanged(object sender, EventArgs e) {198 if (SuppressEvents) return;199 UpdateInstanceProjection();200 185 } 201 186 … … 205 190 } 206 191 207 public void UpdateInstanceProjection( ) {208 if ( ProblemCharacteristics.Count== 0) return;209 210 var instances = GetProblemCharacteristics( );192 public void UpdateInstanceProjection(string[] characteristics) { 193 if (characteristics.Length == 0) return; 194 195 var instances = GetProblemCharacteristics(characteristics); 211 196 212 197 var key2Idx = new BidirectionalDictionary<IRun, int>(); … … 227 212 #endregion 228 213 #region PCA 229 var ds = new double[instances.Count, ProblemCharacteristics.CheckedItems.Count()];214 var ds = new double[instances.Count, characteristics.Length]; 230 215 foreach (var instance in instances) { 231 216 var arr = instance.Value; … … 240 225 #endregion 241 226 #region SOM 242 var features = new DoubleMatrix( ProblemCharacteristics.CheckedItems.Count(), instances.Count);227 var features = new DoubleMatrix(characteristics.Length, instances.Count); 243 228 foreach (var instance in instances) { 244 229 var arr = instance.Value; … … 283 268 } 284 269 285 p rivate Dictionary<IRun, double[]> GetProblemCharacteristics() {270 public Dictionary<IRun, double[]> GetProblemCharacteristics(string[] characteristics) { 286 271 var instances = new Dictionary<IRun, double[]>(); 287 var values = new List<double>[ ProblemCharacteristics.CheckedItems.Count()];272 var values = new List<double>[characteristics.Length]; 288 273 foreach (var run in ProblemInstances) { 289 274 var f = 0; 290 instances[run] = new double[ ProblemCharacteristics.CheckedItems.Count()];291 foreach (var c in ProblemCharacteristics.CheckedItems.Select(x => x.Value.Value)) {275 instances[run] = new double[characteristics.Length]; 276 foreach (var c in characteristics) { 292 277 if (values[f] == null) values[f] = new List<double>(ProblemInstances.Count); 293 278 IItem item; … … 514 499 if (alg != null) { 515 500 lock (algorithmId2AlgorithmInstanceMapping) { 501 algorithmInstances.Add(alg); 516 502 algorithmId2AlgorithmInstanceMapping.Add(algInst.Id, alg); 517 503 progress.Status = string.Format("Downloaded algorithm {0} (okb-id: {1})...", algInst.Name, algInst.Id); … … 549 535 550 536 progress.Status = "Finishing..."; 551 var algInstRunDict = runList.Where(x => x.Parameters.ContainsKey("Problem Name") && x.Parameters["Problem Name"] is StringValue) 552 .GroupBy(x => ((StringValue)x.Parameters["Problem Name"]).Value) 553 .ToDictionary(x => x.Key, x => x.GroupBy(y => ((StringValue)y.Parameters["Algorithm Name"]).Value) 554 .ToDictionary(y => y.Key, y => y.ToList())); 555 556 foreach (var instance in ProblemInstances) { 557 IItem probNameParam; 558 if (!instance.Parameters.TryGetValue("Problem Name", out probNameParam)) continue; 559 560 var probInstanceName = ((StringValue)probNameParam).Value; 561 var maximization = ((BoolValue)instance.Parameters["Maximization"]).Value; 562 563 IItem bkParam; 564 if (!instance.Parameters.TryGetValue("BestKnownQuality", out bkParam) || !(bkParam is DoubleValue)) { 565 Dictionary<string, List<IRun>> algRuns; 566 if (!algInstRunDict.TryGetValue(probInstanceName, out algRuns)) continue; 567 var list = algRuns.SelectMany(x => x.Value) 568 .Where(x => x.Results.ContainsKey("QualityPerEvaluations")) 569 .Select(x => ((IndexedDataTable<double>)x.Results["QualityPerEvaluations"]).Rows.First().Values.Last().Item2); 570 bkParam = new DoubleValue(maximization ? list.Max() : list.Min()); 571 instance.Parameters["BestKnownQuality"] = bkParam; 572 } else bkParam = instance.Parameters["BestKnownQuality"]; 573 574 var bkQuality = ((DoubleValue)bkParam).Value; 575 576 if (!algInstRunDict.ContainsKey(probInstanceName)) continue; 577 // TODO: Things needs to be configurable here (table name, targets) 578 foreach (var target in new[] { 1, 1.01, 1.05, 1.1, 1.2, 1.5 }) { 579 var indexMap = new BidirectionalDictionary<string, int>(); 580 var dict = new Dictionary<string, double>(); 581 var idx = 0; 582 foreach (var kvp in algInstRunDict[probInstanceName]) { 583 var result = ExpectedRuntimeHelper.CalculateErt(kvp.Value, "QualityPerEvaluations", bkQuality * target, maximization); 584 indexMap.Add(kvp.Key, idx); 585 dict[kvp.Key] = !double.IsNaN(result.ExpectedRuntime) ? result.ExpectedRuntime : int.MaxValue; 586 idx++; 587 } 588 var points = dict.OrderBy(x => indexMap.GetByFirst(x.Key)).Select(x => x.Value > 0 ? Math.Log10(x.Value) : 0).ToArray(); 589 int[] clusters; 590 Ckmeans1dClusters(points, 5, out clusters); 591 var ranks = clusters.Select((c, i) => new { Cluster = c, Perf = dict[indexMap.GetBySecond(i)] }) 592 .GroupBy(x => x.Cluster, x => x.Perf) 593 .Select(x => new { Cluster = x.Key, AvgPerf = x.Average() }) 594 .OrderBy(x => x.AvgPerf) 595 .Select((c, i) => new { Cluster = c.Cluster, Rank = i }) 596 .ToDictionary(x => x.Cluster, x => x.Rank); 597 for (var i = 0; i < clusters.Length; i++) { 598 var resultName = "Rank." + indexMap.GetBySecond(i) + "@" + ((target - 1) * 100) + "%"; 599 instance.Results[resultName] = new IntValue(dict[indexMap.GetBySecond(i)] < int.MaxValue ? ranks[clusters[i]] : 6); 600 } 601 } 602 } 603 try { 604 SuppressEvents = true; 605 problemCharacteristics.Replace(characteristics.Select(x => new StringValue(x))); 606 foreach (var pc in problemCharacteristics.Where(x => !x.Value.StartsWith("Characteristic."))) 607 problemCharacteristics.SetItemCheckedState(pc, false); 608 } finally { SuppressEvents = false; } 537 609 538 try { 610 539 KnowledgeBase.UpdateOfRunsInProgress = true; … … 612 541 KnowledgeBase.AddRange(runList); 613 542 } finally { KnowledgeBase.UpdateOfRunsInProgress = false; } 543 544 var algInstRunDict = runList.Where(x => x.Parameters.ContainsKey("Problem Name") && x.Parameters["Problem Name"] is StringValue) 545 .GroupBy(x => ((StringValue)x.Parameters["Problem Name"]).Value) 546 .ToDictionary(x => x.Key, x => x.GroupBy(y => ((StringValue)y.Parameters["Algorithm Name"]).Value) 547 .ToDictionary(y => y.Key, y => y.ToList())); 548 549 // set best-known quality to best-found in case it is not known 550 foreach (var kvp in algInstRunDict) { 551 var prob = ProblemInstances.SingleOrDefault(x => ((StringValue)x.Parameters["Problem Name"]).Value == kvp.Key); 552 if (prob == null) continue; 553 var maximization = ((BoolValue)prob.Parameters["Maximization"]).Value; 554 555 IItem bkParam; 556 if (!prob.Parameters.TryGetValue("BestKnownQuality", out bkParam) || !(bkParam is DoubleValue)) { 557 var list = kvp.Value.SelectMany(x => x.Value) 558 .Where(x => x.Results.ContainsKey("QualityPerEvaluations")) 559 .Select(x => ((IndexedDataTable<double>)x.Results["QualityPerEvaluations"]).Rows.First().Values.Last().Item2); 560 if (!list.Any()) continue; 561 bkParam = new DoubleValue(maximization ? list.Max() : list.Min()); 562 prob.Parameters["BestKnownQuality"] = bkParam; 563 } 564 } 565 566 // add algorithm instance ranks as features to the problem instances for a range of targets 567 foreach (var target in new[] {1, 1.01, 1.05, 1.1, 1.2, 1.5}) { 568 var cls = GetPerformanceClasses(target, 5); 569 foreach (var kvp in cls) { 570 var prob = kvp.Key; 571 foreach (var kvp2 in kvp.Value) { 572 var resultName = "Rank." + algorithmId2AlgorithmInstanceMapping.GetByFirst(kvp2.Key) + "@" + ((target - 1) * 100) + "%"; 573 prob.Results[resultName] = new IntValue(kvp2.Value); 574 } 575 } 576 } 614 577 } finally { progress.Finish(); ProblemInstances.UpdateOfRunsInProgress = false; } 615 UpdateInstanceProjection(); 616 UpdateSuggestions(); 617 } 618 619 public void UpdateSuggestions() { 620 // TODO: Maintain a separate list of suggested instances 621 // TODO: expose expected expected run time 622 algorithmInstances.Replace(AlgorithmInstanceRecommender.GetRanking()); 578 UpdateInstanceProjection(ProblemInstances.ResultNames.Where(x => x.StartsWith("Characteristic.")).ToArray()); 623 579 } 624 580 625 581 public Dictionary<IAlgorithm, double> GetAlgorithmPerformance(IRun problemInstance) { 626 582 if (!problemInstance.Parameters.ContainsKey("BestKnownQuality")) return new Dictionary<IAlgorithm, double>(); 627 var target = GetTarget(((DoubleValue)problemInstance.Parameters["BestKnownQuality"]).Value );583 var target = GetTarget(((DoubleValue)problemInstance.Parameters["BestKnownQuality"]).Value, Maximization); 628 584 return knowledgeBase.Where(x => ((StringValue)x.Parameters["Problem Name"]).Value == ((StringValue)problemInstance.Parameters["Problem Name"]).Value) 629 585 .GroupBy(x => algorithmId2AlgorithmInstanceMapping.GetByFirst(algorithmId2RunMapping.GetBySecond(x).Single())) … … 636 592 } 637 593 638 public IEnumerable<IRegressionProblem> Get DataAnalysisProblem(double target) {594 public IEnumerable<IRegressionProblem> GetRegressionProblemPerAlgorithmInstance(double target, string[] characteristics) { 639 595 if (Problem == null) yield break; 640 var characteristics = GetProblemCharacteristics();596 var features = GetProblemCharacteristics(characteristics); 641 597 // TODO: knowledgebase only stores problem name as a string 642 598 // this doesn't work if there are two equally named problem instances … … 647 603 var ds = new ModifiableDataset(); 648 604 ds.AddVariable("Problem Name", new List<string>()); 649 foreach (var pc in ProblemCharacteristics.CheckedItems)650 ds.AddVariable(pc .Value.Value, new List<double>());605 foreach (var pc in characteristics) 606 ds.AddVariable(pc, new List<double>()); 651 607 ds.AddVariable("ERT", new List<double>()); 652 var max = Maximization;653 608 foreach (var pr in problemRuns) { 654 609 var prob = problemMap[pr.Key]; 655 var features = characteristics[prob]; 610 var f = features[prob]; 611 var max = ((BoolValue)prob.Parameters["Maximization"]).Value; 656 612 var bkq = ((DoubleValue)prob.Parameters["BestKnownQuality"]).Value; 657 var ert = ExpectedRuntimeHelper.CalculateErt(pr.ToList(), "QualityPerEvaluations", GetTarget(bkq ), max).ExpectedRuntime;613 var ert = ExpectedRuntimeHelper.CalculateErt(pr.ToList(), "QualityPerEvaluations", GetTarget(bkq, max), max).ExpectedRuntime; 658 614 if (double.IsNaN(ert)) ert = int.MaxValue; 659 ds.AddRow(new object[] { pr.Key }.Concat(f eatures.Cast<object>()).Concat(new object[] { ert }));660 } 661 var datAnalysisData = new RegressionProblemData(ds, ProblemCharacteristics.CheckedItems.Select(x => x.Value.Value), "ERT");615 ds.AddRow(new object[] { pr.Key }.Concat(f.Cast<object>()).Concat(new object[] { ert })); 616 } 617 var datAnalysisData = new RegressionProblemData(ds, characteristics, "ERT"); 662 618 var result = new RegressionProblem() { 663 619 Name = algorithmId2AlgorithmInstanceMapping.GetByFirst(relevantRuns.Key).Name … … 668 624 } 669 625 670 private double GetTarget(double bestKnownQuality) { 671 return bestKnownQuality * (Maximization ? (1 - MinimumTarget.Value) : (1 + MinimumTarget.Value)); 672 } 673 674 public Dictionary<IRun, double> GetProblemDistances(ProblemInstanceProximityType proximityType) { 675 var result = new Dictionary<IRun, double>(); 626 public IEnumerable<IClassificationProblem> GetClassificationProblemPerAlgorithmInstance(double target, string[] characteristics) { 627 if (Problem == null) yield break; 628 629 var classes = GetPerformanceClasses(target, 5); 630 var features = GetProblemCharacteristics(characteristics); 631 632 foreach (var alg in AlgorithmInstances) { 633 var ds = new ModifiableDataset(); 634 ds.AddVariable("Problem Name", new List<string>()); 635 foreach (var pc in characteristics) 636 ds.AddVariable(pc, new List<double>()); 637 ds.AddVariable("Class", new List<double>()); 638 639 foreach (var c in classes) { 640 int cls; 641 if (c.Value.TryGetValue(algorithmId2AlgorithmInstanceMapping.GetBySecond(alg), out cls)) { 642 ds.AddRow(new object[] { ((StringValue)c.Key.Parameters["Problem Name"]).Value } 643 .Concat(features[c.Key].Cast<object>()).Concat(new object[] { cls })); 644 } 645 } 646 var datAnalysisData = new ClassificationProblemData(ds, characteristics, "Class"); 647 var result = new ClassificationProblem() { 648 Name = alg.Name 649 }; 650 result.ProblemDataParameter.Value = datAnalysisData; 651 yield return result; 652 } 653 } 654 655 public Dictionary<IRun, double> GetProblemDistances(string[] characteristics) { 656 var result = new Dictionary<IRun, double>(); 676 657 var currentInstance = problemId2ProblemInstanceMapping.GetByFirst(Problem.ProblemId); 677 switch (proximityType) { 678 case ProblemInstanceProximityType.MDS: 679 case ProblemInstanceProximityType.PCA: 680 case ProblemInstanceProximityType.SOM: 681 double xa, ya; 682 GetProjectionCoordinates(currentInstance, proximityType, out xa, out ya); 683 foreach (var b in ProblemInstances) { 684 if (b == currentInstance) continue; 685 double xb, yb; 686 GetProjectionCoordinates(b, proximityType, out xb, out yb); 687 var d = Math.Sqrt((xa - xb) * (xa - xb) + (ya - yb) * (ya - yb)); 688 result[b] = d; 689 } 690 break; 691 case ProblemInstanceProximityType.FeatureSpace: 692 var features = GetProblemCharacteristics(); 693 var cF = features[currentInstance]; 694 foreach (var b in ProblemInstances) { 695 if (b == currentInstance) continue; 696 var sum = features[b].Select((t, f) => (cF[f] - t) * (cF[f] - t)).Sum(); 697 result[b] = Math.Sqrt(sum); 698 } 699 break; 700 default: throw new InvalidOperationException(string.Format("Unkonwn proximity type {0}", proximityType)); 658 var features = GetProblemCharacteristics(characteristics); 659 var cF = features[currentInstance]; 660 foreach (var b in ProblemInstances) { 661 if (b == currentInstance) continue; 662 var sum = features[b].Select((t, f) => (cF[f] - t) * (cF[f] - t)).Sum(); 663 result[b] = Math.Sqrt(sum); 701 664 } 702 665 return result; 703 666 } 704 667 705 private void GetProjectionCoordinates(IRun problemInstance, ProblemInstanceProximityType proximityType, out double x, out double y) { 706 x = ((DoubleValue)problemInstance.Results["Projection." + proximityType + ".X"]).Value; 707 y = ((DoubleValue)problemInstance.Results["Projection." + proximityType + ".Y"]).Value; 708 if (proximityType == ProblemInstanceProximityType.SOM) { 709 x = Math.Floor(x); 710 y = Math.Floor(y); 711 } 668 public Dictionary<IRun, Dictionary<long, int>> GetPerformanceClasses(double target, int nClasses) { 669 var result = new Dictionary<IRun, Dictionary<long, int>>(); 670 var problemMap = ProblemInstances.Select(x => new { Key = ((StringValue)x.Parameters["Problem Name"]).Value, Value = x }) 671 .ToDictionary(x => x.Key, x => x.Value); 672 foreach (var pr in KnowledgeBase.GroupBy(x => ((StringValue)x.Parameters["Problem Name"]).Value).ToList()) { 673 var bkq = ((DoubleValue)problemMap[pr.Key].Parameters["BestKnownQuality"]).Value; 674 var max = ((BoolValue)problemMap[pr.Key].Parameters["Maximization"]).Value; 675 676 result[problemMap[pr.Key]] = new Dictionary<long, int>(); 677 678 var indexMap = new BidirectionalDictionary<long, int>(); 679 var perf = new Dictionary<long, double>(); 680 var idx = 0; 681 foreach (var kvp in pr.GroupBy(x => algorithmId2RunMapping.GetBySecond(x).Single())) { 682 var ert = ExpectedRuntimeHelper.CalculateErt(kvp.ToList(), "QualityPerEvaluations", GetTarget(bkq, max), max).ExpectedRuntime; 683 if (double.IsNaN(ert)) { 684 // algorithm can't solve that instance with the given target 685 // these are put into their own additional class 686 result[problemMap[pr.Key]][kvp.Key] = nClasses; 687 continue; 688 } 689 indexMap.Add(kvp.Key, idx); 690 perf[kvp.Key] = Math.Log10(ert); 691 idx++; 692 } 693 if (perf.Count == 0) continue; 694 695 var points = perf.OrderBy(x => indexMap.GetByFirst(x.Key)).Select(x => x.Value).ToArray(); 696 int[] clusters; 697 Ckmeans1dClusters(points, nClasses, out clusters); 698 var ranks = clusters.Select((c, i) => new { Cluster = c, Perf = perf[indexMap.GetBySecond(i)] }) 699 .GroupBy(x => x.Cluster, x => x.Perf) 700 .Select(x => new { Cluster = x.Key, AvgPerf = x.Average() }) 701 .OrderBy(x => x.AvgPerf) 702 .Select((c, i) => new { Cluster = c.Cluster, Rank = i }) 703 .ToDictionary(x => x.Cluster, x => x.Rank); 704 for (var i = 0; i < clusters.Length; i++) 705 result[problemMap[pr.Key]][indexMap.GetBySecond(i)] = ranks[clusters[i]]; 706 } 707 return result; 708 } 709 710 private double GetTarget(double bestKnownQuality, bool maximization) { 711 return bestKnownQuality * (maximization ? (1 - MinimumTarget.Value) : (1 + MinimumTarget.Value)); 712 712 } 713 713 … … 722 722 var handler = AlgorithmInstanceStarted; 723 723 if (handler != null) handler(this, new EventArgs<IAlgorithm>(instance)); 724 } 725 726 public event EventHandler RecommendationModelChanged; 727 private void OnRecommenderModelChanged() { 728 var handler = RecommendationModelChanged; 729 if (handler != null) handler(this, EventArgs.Empty); 724 730 } 725 731 … … 809 815 return mean; 810 816 } 817 818 public IEnumerable<Tuple<IAlgorithm, double>> GetAlgorithmInstanceRanking() { 819 return RecommendationModel.GetRanking(this); 820 } 811 821 } 812 822 } -
branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem.Common/3.3/Recommenders/DistanceWeightedRecommender.cs
r13786 r13787 35 35 [StorableClass] 36 36 public class DistanceWeightedRecommender : ParameterizedNamedItem, IAlgorithmInstanceRecommender { 37 private KnowledgeCenter okc;38 39 private IFixedValueParameter<EnumValue<ProblemInstanceProximityType>> ProximityTypeParameter {40 get { return (IFixedValueParameter<EnumValue<ProblemInstanceProximityType>>)Parameters["ProximityType"]; }41 }42 37 43 38 private IFixedValueParameter<DoubleValue> NeighborhoodFactorParameter { 44 39 get { return (IFixedValueParameter<DoubleValue>)Parameters["NeighborhoodFactor"]; } 45 }46 47 public ProblemInstanceProximityType ProximityType {48 get { return ProximityTypeParameter.Value.Value; }49 set { ProximityTypeParameter.Value.Value = value; }50 40 } 51 41 … … 59 49 private DistanceWeightedRecommender(DistanceWeightedRecommender original, Cloner cloner) 60 50 : base(original, cloner) { } 61 public DistanceWeightedRecommender(KnowledgeCenter okc) { 62 this.okc = okc; 63 Parameters.Add(new FixedValueParameter<EnumValue<ProblemInstanceProximityType>>("ProximityType", "The type of neighbor proximity.", new EnumValue<ProblemInstanceProximityType>(ProblemInstanceProximityType.FeatureSpace))); 51 public DistanceWeightedRecommender() { 64 52 Parameters.Add(new FixedValueParameter<DoubleValue>("NeighborhoodFactor", "Penalize neighbors that are far away.", new DoubleValue(5))); 65 53 } … … 69 57 } 70 58 71 public IEnumerable<IAlgorithm> GetRanking() { 72 if (okc.Problem.ProblemId == -1) yield break; 73 74 var piDistances = okc.GetProblemDistances(ProximityType); 59 public IRecommendationModel TrainModel(KnowledgeCenter okc, string[] characteristics) { 60 var piDistances = okc.GetProblemDistances(characteristics); 75 61 var maxDist = piDistances.Max(x => x.Value); 76 62 var instances = new SortedList<double, IAlgorithm>(); … … 109 95 avgERT += new System.Random().NextDouble(); 110 96 } 111 instances.Add(avgERT, algorithm);97 instances.Add(avgERT, (IAlgorithm)algorithm.Clone()); 112 98 } 113 99 114 foreach (var alg in instances.Select(x => (IAlgorithm)x.Value.Clone())) 115 yield return alg; 100 return new FixedRankModel(instances.Select(x => Tuple.Create(x.Value, x.Key))); 116 101 } 117 102 } -
branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem.Common/3.3/Recommenders/KNearestNeighborRecommender.cs
r13786 r13787 23 23 using HeuristicLab.Core; 24 24 using HeuristicLab.Data; 25 using HeuristicLab.Optimization;26 25 using HeuristicLab.Parameters; 27 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 28 using System.Collections.Generic;29 using System.Linq;30 27 31 28 namespace HeuristicLab.OptimizationExpertSystem.Common { … … 33 30 [StorableClass] 34 31 public sealed class KNearestNeighborRecommender : ParameterizedNamedItem, IAlgorithmInstanceRecommender { 35 private KnowledgeCenter okc; 36 37 private IFixedValueParameter<EnumValue<ProblemInstanceProximityType>> ProximityTypeParameter { 38 get { return (IFixedValueParameter<EnumValue<ProblemInstanceProximityType>>)Parameters["ProximityType"]; } 39 } 40 41 public ProblemInstanceProximityType ProximityType { 42 get { return ProximityTypeParameter.Value.Value; } 43 set { ProximityTypeParameter.Value.Value = value; } 44 } 45 32 46 33 private IFixedValueParameter<IntValue> KParameter { 47 34 get { return (IFixedValueParameter<IntValue>)Parameters["K"]; } … … 52 39 private KNearestNeighborRecommender(KNearestNeighborRecommender original, Cloner cloner) 53 40 : base(original, cloner) { } 54 public KNearestNeighborRecommender(KnowledgeCenter okc) { 55 this.okc = okc; 56 Parameters.Add(new FixedValueParameter<EnumValue<ProblemInstanceProximityType>>("ProximityType", "The type of neighbor proximity.", new EnumValue<ProblemInstanceProximityType>(ProblemInstanceProximityType.FeatureSpace))); 41 public KNearestNeighborRecommender() { 57 42 Parameters.Add(new FixedValueParameter<IntValue>("K", "The number of nearest neighbors to consider.", new IntValue(5))); 58 43 } … … 62 47 } 63 48 64 public IEnumerable<IAlgorithm> GetRanking() { 65 if (okc.Problem.ProblemId == -1) yield break; 66 67 var distances = okc.GetProblemDistances(ProximityType); 68 var K = KParameter.Value.Value; 69 var performances = new Dictionary<IAlgorithm, List<double>>(); 70 for (var k = 0; k < K; k++) { 71 if (distances.Count == 0) break; 72 var min = distances.MinItems(x => x.Value).First(); 73 // lookup algorithm performances in min 74 var perfs = okc.GetAlgorithmPerformance(min.Key); 75 if (perfs.Count == 0) { 76 k--; 77 continue; 78 } 79 foreach (var p in perfs) { 80 var ert = p.Value; 81 if (double.IsNaN(ert)) ert = int.MaxValue; 82 List<double> erts; 83 if (!performances.TryGetValue(p.Key, out erts)) { 84 performances[p.Key] = new List<double>() { ert }; ; 85 } else erts.Add(ert); 86 } 87 distances.Remove(min.Key); 88 } 89 foreach (var alg in performances.Select(x => new { Alg = x.Key, Perf = x.Value.Average() }) 90 .OrderBy(x => x.Perf) 91 .Select(x => x.Alg)) 92 yield return alg; 49 public IRecommendationModel TrainModel(KnowledgeCenter kc, string[] characteristics) { 50 return new KNearestNeighborModel(KParameter.Value.Value, characteristics); 93 51 } 94 52 } -
branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem.Common/3.3/Recommenders/OverallBestRecommender.cs
r13786 r13787 35 35 [StorableClass] 36 36 public class OverallBestRecommender : ParameterizedNamedItem, IAlgorithmInstanceRecommender { 37 private KnowledgeCenter okc;38 39 private IFixedValueParameter<EnumValue<ProblemInstanceProximityType>> ProximityTypeParameter {40 get { return (IFixedValueParameter<EnumValue<ProblemInstanceProximityType>>)Parameters["ProximityType"]; }41 }42 37 43 38 private IFixedValueParameter<DoubleValue> NeighborhoodFactorParameter { 44 39 get { return (IFixedValueParameter<DoubleValue>)Parameters["NeighborhoodFactor"]; } 45 }46 47 public ProblemInstanceProximityType ProximityType {48 get { return ProximityTypeParameter.Value.Value; }49 set { ProximityTypeParameter.Value.Value = value; }50 40 } 51 41 … … 59 49 private OverallBestRecommender(OverallBestRecommender original, Cloner cloner) 60 50 : base(original, cloner) { } 61 public OverallBestRecommender(KnowledgeCenter okc) { 62 this.okc = okc; 63 Parameters.Add(new FixedValueParameter<EnumValue<ProblemInstanceProximityType>>("ProximityType", "The type of neighbor proximity.", new EnumValue<ProblemInstanceProximityType>(ProblemInstanceProximityType.FeatureSpace))); 51 public OverallBestRecommender() { 64 52 Parameters.Add(new FixedValueParameter<DoubleValue>("NeighborhoodFactor", "Penalize neighbors that are far away.", new DoubleValue(5))); 65 53 } … … 69 57 } 70 58 71 public IEnumerable<IAlgorithm> GetRanking() { 72 if (okc.Problem.ProblemId == -1) yield break; 73 59 public IRecommendationModel TrainModel(KnowledgeCenter kc, string[] characteristics) { 74 60 var instances = new List<Tuple<IAlgorithm, double>>(); 75 foreach (var relevantRuns in okc.GetKnowledgeBaseByAlgorithm()) {61 foreach (var relevantRuns in kc.GetKnowledgeBaseByAlgorithm()) { 76 62 var algorithm = relevantRuns.Key; 77 63 var pis = relevantRuns.Value.Select(x => ((StringValue)x.Parameters["Problem Name"]).Value).Distinct() 78 .Select(x => Tuple.Create(x, okc.ProblemInstances.SingleOrDefault(y => ((StringValue)y.Parameters["Problem Name"]).Value == x)))64 .Select(x => Tuple.Create(x, kc.ProblemInstances.SingleOrDefault(y => ((StringValue)y.Parameters["Problem Name"]).Value == x))) 79 65 .Where(x => x.Item2 != null) 80 66 .Select(x => Tuple.Create(x.Item1, ((DoubleValue)x.Item2.Parameters["BestKnownQuality"]).Value)) … … 84 70 foreach (var problemRuns in relevantRuns.Value.GroupBy(x => ((StringValue)x.Parameters["Problem Name"]).Value)) { 85 71 var bkq = pis[problemRuns.Key]; 86 var ert = ExpectedRuntimeHelper.CalculateErt(problemRuns.ToList(), "QualityPerEvaluations", ( okc.Maximization ? (1 - okc.MinimumTarget.Value) : (1 + okc.MinimumTarget.Value)) * bkq, okc.Maximization).ExpectedRuntime;72 var ert = ExpectedRuntimeHelper.CalculateErt(problemRuns.ToList(), "QualityPerEvaluations", (kc.Maximization ? (1 - kc.MinimumTarget.Value) : (1 + kc.MinimumTarget.Value)) * bkq, kc.Maximization).ExpectedRuntime; 87 73 if (double.IsNaN(ert)) ert = int.MaxValue; 88 74 avgERT += ert; … … 90 76 } 91 77 avgERT /= count; 92 instances.Add(Tuple.Create( algorithm, avgERT));78 instances.Add(Tuple.Create((IAlgorithm)algorithm.Clone(), avgERT)); 93 79 } 94 80 95 foreach (var alg in instances.OrderBy(x => x.Item2).Select(x => (IAlgorithm)x.Item1.Clone())) 96 yield return alg; 81 return new FixedRankModel(instances.OrderBy(x => x.Item2)); 97 82 } 98 83 } -
branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem/3.3/HeuristicLab.OptimizationExpertSystem-3.3.csproj
r13748 r13787 191 191 <DependentUpon>AlgorithmControlForm.cs</DependentUpon> 192 192 </Compile> 193 <Compile Include="Menu\200_Solving\210_PerformanceModelingMenuItem.cs" /> 193 194 <Compile Include="Toolbar\DownloadFromOKBToolbarItem.cs" /> 194 195 <Compile Include="Toolbar\ToolbarItemBase.cs" /> … … 209 210 <Compile Include="Menu\0_Config\30_DownloadFromOkbMenuItem.cs" /> 210 211 <Compile Include="Menu\0_Config\10_SetCredentialsMenuItem.cs" /> 211 <Compile Include="Menu\200_Solving\2 10_SolverMenuItem.cs" />212 <Compile Include="Menu\200_Solving\220_SolverMenuItem.cs" /> 212 213 <Compile Include="Menu\300_Learning\310_KnowledgeBaseMenuItem.cs" /> 213 214 <Compile Include="Menu\900_Tools\900_CSharpScriptMenuItem.cs" /> … … 227 228 </Compile> 228 229 <Compile Include="Plugin.cs" /> 230 <Compile Include="Views\PerformanceModelingView.cs"> 231 <SubType>UserControl</SubType> 232 </Compile> 233 <Compile Include="Views\PerformanceModelingView.Designer.cs"> 234 <DependentUpon>PerformanceModelingView.cs</DependentUpon> 235 </Compile> 229 236 <Compile Include="Views\SolverView.cs"> 230 237 <SubType>UserControl</SubType> … … 297 304 <EmbeddedResource Include="OptimizationKnowledgeCenter.resx"> 298 305 <DependentUpon>OptimizationKnowledgeCenter.cs</DependentUpon> 306 </EmbeddedResource> 307 <EmbeddedResource Include="Views\PerformanceModelingView.resx"> 308 <DependentUpon>PerformanceModelingView.cs</DependentUpon> 299 309 </EmbeddedResource> 300 310 <EmbeddedResource Include="Views\SolverView.resx"> -
branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem/3.3/Menu/200_Solving/210_PerformanceModelingMenuItem.cs
r13772 r13787 27 27 28 28 namespace HeuristicLab.OptimizationExpertSystem.Menu { 29 internal class SolverMenuItem : MenuItemBase {29 internal class PerformanceModelingMenuItem : MenuItemBase { 30 30 public override Image Image { get { return VSImageLibrary.Event; } } 31 31 32 32 public override string Name { 33 get { return " Solver"; }33 get { return "Performance Modeling"; } 34 34 } 35 35 … … 42 42 } 43 43 44 public override string ToolTipText { get { return " Solve the problem instance."; } }44 public override string ToolTipText { get { return "Modeling algorithm performance to suggest well-suited instances."; } } 45 45 46 46 public override void Execute() { 47 var viewType = typeof( SolverView);47 var viewType = typeof(PerformanceModelingView); 48 48 var view = MainForm.Views.FirstOrDefault(x => viewType == ((x is ViewHost) ? ((ViewHost)x).ActiveView : x).GetType()); 49 49 if (view != null) view.Show(); -
branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem/3.3/Menu/200_Solving/220_SolverMenuItem.cs
r13786 r13787 39 39 40 40 public override int Position { 41 get { return 2 10; }41 get { return 220; } 42 42 } 43 43 -
branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem/3.3/Views/KnowledgeCenterViewBase.cs
r13774 r13787 48 48 Content.DownloadStarted += ContentOnDownloadStarted; 49 49 Content.AlgorithmInstanceStarted += ContentOnAlgorithmInstanceStarted; 50 Content.RecommendationModelChanged += ContentOnRecommendationModelChanged; 50 51 RegisterContentProblemEvents(); 51 52 RegisterContentProblemInstancesEvents(); 52 RegisterContentProblemCharacteristicsEvents();53 53 RegisterContentSolutionSeedingPoolEvents(); 54 54 RegisterContentSuggestedInstancesEvents(); … … 71 71 } 72 72 73 private void RegisterContentProblemCharacteristicsEvents() {74 Content.ProblemCharacteristics.ItemsAdded += ContentOnProblemCharacteristicsChanged;75 Content.ProblemCharacteristics.ItemsReplaced += ContentOnProblemCharacteristicsChanged;76 Content.ProblemCharacteristics.ItemsRemoved += ContentOnProblemCharacteristicsChanged;77 Content.ProblemCharacteristics.CheckedItemsChanged += ContentOnProblemCharacteristicsChanged;78 Content.ProblemCharacteristics.CollectionReset += ContentOnProblemCharacteristicsChanged;79 }80 81 73 private void RegisterContentSolutionSeedingPoolEvents() { 82 74 Content.SolutionSeedingPool.CheckedItemsChanged += ContentOnSolutionSeedingPoolChanged; … … 88 80 89 81 private void RegisterContentSuggestedInstancesEvents() { 90 Content.AlgorithmInstances.CollectionReset += ContentOn SuggestedInstancesChanged;91 Content.AlgorithmInstances.ItemsAdded += ContentOn SuggestedInstancesChanged;92 Content.AlgorithmInstances.ItemsMoved += ContentOn SuggestedInstancesChanged;93 Content.AlgorithmInstances.ItemsRemoved += ContentOn SuggestedInstancesChanged;94 Content.AlgorithmInstances.ItemsReplaced += ContentOn SuggestedInstancesChanged;82 Content.AlgorithmInstances.CollectionReset += ContentOnAlgorithmInstancesChanged; 83 Content.AlgorithmInstances.ItemsAdded += ContentOnAlgorithmInstancesChanged; 84 Content.AlgorithmInstances.ItemsMoved += ContentOnAlgorithmInstancesChanged; 85 Content.AlgorithmInstances.ItemsRemoved += ContentOnAlgorithmInstancesChanged; 86 Content.AlgorithmInstances.ItemsReplaced += ContentOnAlgorithmInstancesChanged; 95 87 } 96 88 … … 99 91 Content.DownloadStarted -= ContentOnDownloadStarted; 100 92 Content.AlgorithmInstanceStarted -= ContentOnAlgorithmInstanceStarted; 93 Content.RecommendationModelChanged -= ContentOnRecommendationModelChanged; 101 94 DeregisterContentProblemEvents(); 102 95 DeregisterContentProblemInstancesEvents(); 103 DeregisterContentProblemCharacteristicsEvents();104 96 DeregisterContentSolutionSeedingPoolEvents(); 105 97 DeregisterContentSuggestedInstancesEvents(); … … 122 114 } 123 115 124 private void DeregisterContentProblemCharacteristicsEvents() {125 Content.ProblemCharacteristics.ItemsAdded -= ContentOnProblemCharacteristicsChanged;126 Content.ProblemCharacteristics.ItemsReplaced -= ContentOnProblemCharacteristicsChanged;127 Content.ProblemCharacteristics.ItemsRemoved -= ContentOnProblemCharacteristicsChanged;128 Content.ProblemCharacteristics.CheckedItemsChanged -= ContentOnProblemCharacteristicsChanged;129 Content.ProblemCharacteristics.CollectionReset -= ContentOnProblemCharacteristicsChanged;130 }131 132 116 private void DeregisterContentSolutionSeedingPoolEvents() { 133 117 Content.SolutionSeedingPool.CheckedItemsChanged -= ContentOnSolutionSeedingPoolChanged; … … 139 123 140 124 private void DeregisterContentSuggestedInstancesEvents() { 141 Content.AlgorithmInstances.CollectionReset -= ContentOn SuggestedInstancesChanged;142 Content.AlgorithmInstances.ItemsAdded -= ContentOn SuggestedInstancesChanged;143 Content.AlgorithmInstances.ItemsMoved -= ContentOn SuggestedInstancesChanged;144 Content.AlgorithmInstances.ItemsRemoved -= ContentOn SuggestedInstancesChanged;145 Content.AlgorithmInstances.ItemsReplaced -= ContentOn SuggestedInstancesChanged;125 Content.AlgorithmInstances.CollectionReset -= ContentOnAlgorithmInstancesChanged; 126 Content.AlgorithmInstances.ItemsAdded -= ContentOnAlgorithmInstancesChanged; 127 Content.AlgorithmInstances.ItemsMoved -= ContentOnAlgorithmInstancesChanged; 128 Content.AlgorithmInstances.ItemsRemoved -= ContentOnAlgorithmInstancesChanged; 129 Content.AlgorithmInstances.ItemsReplaced -= ContentOnAlgorithmInstancesChanged; 146 130 } 147 131 #endregion … … 150 134 protected virtual void OnDownloadEnded() { } 151 135 protected virtual void OnAlgorithmInstanceStarted(IAlgorithm algorithm) { } 136 protected virtual void OnRecommendationModelChanged() { } 152 137 protected virtual void OnPropertyChanged(string propertyName) { } 153 138 protected virtual void OnProblemChanged() { } 154 139 protected virtual void OnProblemSolutionsChanged() { } 155 140 protected virtual void OnProblemInstancesChanged() { } 156 protected virtual void OnProblemCharacteristicsChanged() { }157 141 protected virtual void OnSolutionSeedingPoolChanged() { } 158 protected virtual void On SuggestedInstancesChanged() { }142 protected virtual void OnAlgorithmInstancesChanged() { } 159 143 protected virtual void OnKnowledgeBaseChanged() { } 160 144 … … 170 154 if (InvokeRequired) { Invoke((Action<object, EventArgs<IAlgorithm>>)ContentOnAlgorithmInstanceStarted, sender, e); return; } 171 155 OnAlgorithmInstanceStarted(e.Value); 156 } 157 158 private void ContentOnRecommendationModelChanged(object sender, EventArgs e) { 159 if (InvokeRequired) { Invoke((Action<object, EventArgs<IAlgorithm>>)ContentOnRecommendationModelChanged, sender, e); return; } 160 OnRecommendationModelChanged(); 172 161 } 173 162 … … 194 183 } 195 184 196 private void ContentOnProblemCharacteristicsChanged(object sender, EventArgs e) {197 if (InvokeRequired) Invoke((Action)OnProblemCharacteristicsChanged);198 else OnProblemCharacteristicsChanged();199 }200 201 185 private void ContentOnSolutionSeedingPoolChanged(object sender, EventArgs e) { 202 186 if (InvokeRequired) Invoke((Action)OnSolutionSeedingPoolChanged); … … 204 188 } 205 189 206 private void ContentOn SuggestedInstancesChanged(object sender, EventArgs e) {207 if (InvokeRequired) Invoke((Action)On SuggestedInstancesChanged);208 else On SuggestedInstancesChanged();190 private void ContentOnAlgorithmInstancesChanged(object sender, EventArgs e) { 191 if (InvokeRequired) Invoke((Action)OnAlgorithmInstancesChanged); 192 else OnAlgorithmInstancesChanged(); 209 193 } 210 194 #endregion -
branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem/3.3/Views/SolverView.Designer.cs
r13774 r13787 45 45 /// </summary> 46 46 private void InitializeComponent() { 47 WeifenLuo.WinFormsUI.Docking.DockPanelSkin dockPanelSkin 2= new WeifenLuo.WinFormsUI.Docking.DockPanelSkin();48 WeifenLuo.WinFormsUI.Docking.AutoHideStripSkin autoHideStripSkin 2= new WeifenLuo.WinFormsUI.Docking.AutoHideStripSkin();49 WeifenLuo.WinFormsUI.Docking.DockPanelGradient dockPanelGradient 4= new WeifenLuo.WinFormsUI.Docking.DockPanelGradient();50 WeifenLuo.WinFormsUI.Docking.TabGradient tabGradient 8= new WeifenLuo.WinFormsUI.Docking.TabGradient();51 WeifenLuo.WinFormsUI.Docking.DockPaneStripSkin dockPaneStripSkin 2= new WeifenLuo.WinFormsUI.Docking.DockPaneStripSkin();52 WeifenLuo.WinFormsUI.Docking.DockPaneStripGradient dockPaneStripGradient 2= new WeifenLuo.WinFormsUI.Docking.DockPaneStripGradient();53 WeifenLuo.WinFormsUI.Docking.TabGradient tabGradient 9= new WeifenLuo.WinFormsUI.Docking.TabGradient();54 WeifenLuo.WinFormsUI.Docking.DockPanelGradient dockPanelGradient 5= new WeifenLuo.WinFormsUI.Docking.DockPanelGradient();55 WeifenLuo.WinFormsUI.Docking.TabGradient tabGradient 10= new WeifenLuo.WinFormsUI.Docking.TabGradient();56 WeifenLuo.WinFormsUI.Docking.DockPaneStripToolWindowGradient dockPaneStripToolWindowGradient 2= new WeifenLuo.WinFormsUI.Docking.DockPaneStripToolWindowGradient();57 WeifenLuo.WinFormsUI.Docking.TabGradient tabGradient 11= new WeifenLuo.WinFormsUI.Docking.TabGradient();58 WeifenLuo.WinFormsUI.Docking.TabGradient tabGradient 12= new WeifenLuo.WinFormsUI.Docking.TabGradient();59 WeifenLuo.WinFormsUI.Docking.DockPanelGradient dockPanelGradient 6= new WeifenLuo.WinFormsUI.Docking.DockPanelGradient();60 WeifenLuo.WinFormsUI.Docking.TabGradient tabGradient 13= new WeifenLuo.WinFormsUI.Docking.TabGradient();61 WeifenLuo.WinFormsUI.Docking.TabGradient tabGradient 14= new WeifenLuo.WinFormsUI.Docking.TabGradient();47 WeifenLuo.WinFormsUI.Docking.DockPanelSkin dockPanelSkin4 = new WeifenLuo.WinFormsUI.Docking.DockPanelSkin(); 48 WeifenLuo.WinFormsUI.Docking.AutoHideStripSkin autoHideStripSkin4 = new WeifenLuo.WinFormsUI.Docking.AutoHideStripSkin(); 49 WeifenLuo.WinFormsUI.Docking.DockPanelGradient dockPanelGradient10 = new WeifenLuo.WinFormsUI.Docking.DockPanelGradient(); 50 WeifenLuo.WinFormsUI.Docking.TabGradient tabGradient22 = new WeifenLuo.WinFormsUI.Docking.TabGradient(); 51 WeifenLuo.WinFormsUI.Docking.DockPaneStripSkin dockPaneStripSkin4 = new WeifenLuo.WinFormsUI.Docking.DockPaneStripSkin(); 52 WeifenLuo.WinFormsUI.Docking.DockPaneStripGradient dockPaneStripGradient4 = new WeifenLuo.WinFormsUI.Docking.DockPaneStripGradient(); 53 WeifenLuo.WinFormsUI.Docking.TabGradient tabGradient23 = new WeifenLuo.WinFormsUI.Docking.TabGradient(); 54 WeifenLuo.WinFormsUI.Docking.DockPanelGradient dockPanelGradient11 = new WeifenLuo.WinFormsUI.Docking.DockPanelGradient(); 55 WeifenLuo.WinFormsUI.Docking.TabGradient tabGradient24 = new WeifenLuo.WinFormsUI.Docking.TabGradient(); 56 WeifenLuo.WinFormsUI.Docking.DockPaneStripToolWindowGradient dockPaneStripToolWindowGradient4 = new WeifenLuo.WinFormsUI.Docking.DockPaneStripToolWindowGradient(); 57 WeifenLuo.WinFormsUI.Docking.TabGradient tabGradient25 = new WeifenLuo.WinFormsUI.Docking.TabGradient(); 58 WeifenLuo.WinFormsUI.Docking.TabGradient tabGradient26 = new WeifenLuo.WinFormsUI.Docking.TabGradient(); 59 WeifenLuo.WinFormsUI.Docking.DockPanelGradient dockPanelGradient12 = new WeifenLuo.WinFormsUI.Docking.DockPanelGradient(); 60 WeifenLuo.WinFormsUI.Docking.TabGradient tabGradient27 = new WeifenLuo.WinFormsUI.Docking.TabGradient(); 61 WeifenLuo.WinFormsUI.Docking.TabGradient tabGradient28 = new WeifenLuo.WinFormsUI.Docking.TabGradient(); 62 62 this.minTargetView = new HeuristicLab.Data.Views.StringConvertibleValueView(); 63 63 this.maxEvaluationsView = new HeuristicLab.Data.Views.StringConvertibleValueView(); 64 64 this.algorithmCloneButton = new System.Windows.Forms.Button(); 65 65 this.seedingStrategyPanel = new System.Windows.Forms.Panel(); 66 this.algorithmStartButton = new System.Windows.Forms.Button(); 67 this.minimumTargetLabel = new System.Windows.Forms.Label(); 68 this.seedingStrategyLabel = new System.Windows.Forms.Label(); 69 this.evaluationsLimitabel = new System.Windows.Forms.Label(); 70 this.suggestedInstancesComboBox = new System.Windows.Forms.ComboBox(); 71 this.instanceLabel = new System.Windows.Forms.Label(); 66 72 this.solverTabControl = new HeuristicLab.MainForm.WindowsForms.DragOverTabControl(); 67 73 this.resultsTabPage = new System.Windows.Forms.TabPage(); … … 77 83 this.operatorGraphTabPage = new System.Windows.Forms.TabPage(); 78 84 this.operatorGraphViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost(); 79 this.algorithmStartButton = new System.Windows.Forms.Button();80 this.minimumTargetLabel = new System.Windows.Forms.Label();81 this.seedingStrategyLabel = new System.Windows.Forms.Label();82 this.evaluationsLimitabel = new System.Windows.Forms.Label();83 this.recommenderLabel = new System.Windows.Forms.Label();84 this.suggestedInstancesComboBox = new System.Windows.Forms.ComboBox();85 this.recommenderComboBox = new System.Windows.Forms.ComboBox();86 this.solverSplitContainer = new System.Windows.Forms.SplitContainer();87 this.recommenderViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost();88 this.instanceLabel = new System.Windows.Forms.Label();89 this.recommendRefreshButton = new System.Windows.Forms.Button();90 85 this.solverTabControl.SuspendLayout(); 91 86 this.resultsTabPage.SuspendLayout(); … … 94 89 this.parametersTabPage.SuspendLayout(); 95 90 this.operatorGraphTabPage.SuspendLayout(); 96 ((System.ComponentModel.ISupportInitialize)(this.solverSplitContainer)).BeginInit();97 this.solverSplitContainer.Panel1.SuspendLayout();98 this.solverSplitContainer.Panel2.SuspendLayout();99 this.solverSplitContainer.SuspendLayout();100 91 this.SuspendLayout(); 101 92 // … … 124 115 // algorithmCloneButton 125 116 // 126 this.algorithmCloneButton.Location = new System.Drawing.Point( 123, 60);117 this.algorithmCloneButton.Location = new System.Drawing.Point(518, 56); 127 118 this.algorithmCloneButton.Name = "algorithmCloneButton"; 128 119 this.algorithmCloneButton.Size = new System.Drawing.Size(26, 23); 129 120 this.algorithmCloneButton.TabIndex = 15; 130 this.algorithmCloneButton.Text = " Clone";121 this.algorithmCloneButton.Text = "c"; 131 122 this.algorithmCloneButton.UseVisualStyleBackColor = true; 132 123 this.algorithmCloneButton.Click += new System.EventHandler(this.AlgorithmCloneButtonOnClick); … … 141 132 this.seedingStrategyPanel.TabIndex = 12; 142 133 // 134 // algorithmStartButton 135 // 136 this.algorithmStartButton.Location = new System.Drawing.Point(486, 56); 137 this.algorithmStartButton.Name = "algorithmStartButton"; 138 this.algorithmStartButton.Size = new System.Drawing.Size(26, 23); 139 this.algorithmStartButton.TabIndex = 10; 140 this.algorithmStartButton.Text = "Start"; 141 this.algorithmStartButton.UseVisualStyleBackColor = true; 142 this.algorithmStartButton.Click += new System.EventHandler(this.AlgorithmStartButtonOnClick); 143 // 144 // minimumTargetLabel 145 // 146 this.minimumTargetLabel.AutoSize = true; 147 this.minimumTargetLabel.Location = new System.Drawing.Point(384, 6); 148 this.minimumTargetLabel.Name = "minimumTargetLabel"; 149 this.minimumTargetLabel.Size = new System.Drawing.Size(41, 13); 150 this.minimumTargetLabel.TabIndex = 13; 151 this.minimumTargetLabel.Text = "Target:"; 152 // 153 // seedingStrategyLabel 154 // 155 this.seedingStrategyLabel.AutoSize = true; 156 this.seedingStrategyLabel.Location = new System.Drawing.Point(3, 33); 157 this.seedingStrategyLabel.Name = "seedingStrategyLabel"; 158 this.seedingStrategyLabel.Size = new System.Drawing.Size(91, 13); 159 this.seedingStrategyLabel.TabIndex = 8; 160 this.seedingStrategyLabel.Text = "Seeding Strategy:"; 161 // 162 // evaluationsLimitabel 163 // 164 this.evaluationsLimitabel.AutoSize = true; 165 this.evaluationsLimitabel.Location = new System.Drawing.Point(3, 6); 166 this.evaluationsLimitabel.Name = "evaluationsLimitabel"; 167 this.evaluationsLimitabel.Size = new System.Drawing.Size(66, 13); 168 this.evaluationsLimitabel.TabIndex = 13; 169 this.evaluationsLimitabel.Text = "Budget (FE):"; 170 // 171 // suggestedInstancesComboBox 172 // 173 this.suggestedInstancesComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 174 this.suggestedInstancesComboBox.FormattingEnabled = true; 175 this.suggestedInstancesComboBox.Location = new System.Drawing.Point(108, 56); 176 this.suggestedInstancesComboBox.Name = "suggestedInstancesComboBox"; 177 this.suggestedInstancesComboBox.Size = new System.Drawing.Size(372, 21); 178 this.suggestedInstancesComboBox.TabIndex = 7; 179 this.suggestedInstancesComboBox.SelectedIndexChanged += new System.EventHandler(this.SuggestedInstancesComboBoxOnSelectedIndexChanged); 180 // 181 // instanceLabel 182 // 183 this.instanceLabel.AutoSize = true; 184 this.instanceLabel.Location = new System.Drawing.Point(3, 59); 185 this.instanceLabel.Name = "instanceLabel"; 186 this.instanceLabel.Size = new System.Drawing.Size(51, 13); 187 this.instanceLabel.TabIndex = 9; 188 this.instanceLabel.Text = "Instance:"; 189 // 143 190 // solverTabControl 144 191 // 145 this.solverTabControl.AllowDrop = true; 192 this.solverTabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 193 | System.Windows.Forms.AnchorStyles.Left) 194 | System.Windows.Forms.AnchorStyles.Right))); 146 195 this.solverTabControl.Controls.Add(this.resultsTabPage); 147 196 this.solverTabControl.Controls.Add(this.runsTabPage); … … 150 199 this.solverTabControl.Controls.Add(this.parametersTabPage); 151 200 this.solverTabControl.Controls.Add(this.operatorGraphTabPage); 152 this.solverTabControl.Dock = System.Windows.Forms.DockStyle.Fill; 153 this.solverTabControl.Location = new System.Drawing.Point(3, 3); 201 this.solverTabControl.Location = new System.Drawing.Point(6, 85); 154 202 this.solverTabControl.Name = "solverTabControl"; 155 203 this.solverTabControl.SelectedIndex = 0; 156 this.solverTabControl.Size = new System.Drawing.Size( 556, 502);157 this.solverTabControl.TabIndex = 1 1;204 this.solverTabControl.Size = new System.Drawing.Size(843, 479); 205 this.solverTabControl.TabIndex = 17; 158 206 // 159 207 // resultsTabPage … … 164 212 this.resultsTabPage.Name = "resultsTabPage"; 165 213 this.resultsTabPage.Padding = new System.Windows.Forms.Padding(3); 166 this.resultsTabPage.Size = new System.Drawing.Size( 548, 476);214 this.resultsTabPage.Size = new System.Drawing.Size(835, 453); 167 215 this.resultsTabPage.TabIndex = 2; 168 216 this.resultsTabPage.Text = "Results"; … … 189 237 this.resultsDockPanel.Location = new System.Drawing.Point(3, 29); 190 238 this.resultsDockPanel.Name = "resultsDockPanel"; 191 this.resultsDockPanel.Size = new System.Drawing.Size( 542, 444);192 dockPanelGradient 4.EndColor = System.Drawing.SystemColors.ControlLight;193 dockPanelGradient 4.StartColor = System.Drawing.SystemColors.ControlLight;194 autoHideStripSkin 2.DockStripGradient = dockPanelGradient4;195 tabGradient 8.EndColor = System.Drawing.SystemColors.Control;196 tabGradient 8.StartColor = System.Drawing.SystemColors.Control;197 tabGradient 8.TextColor = System.Drawing.SystemColors.ControlDarkDark;198 autoHideStripSkin 2.TabGradient = tabGradient8;199 autoHideStripSkin 2.TextFont = new System.Drawing.Font("Segoe UI", 9F);200 dockPanelSkin 2.AutoHideStripSkin = autoHideStripSkin2;201 tabGradient 9.EndColor = System.Drawing.SystemColors.ControlLightLight;202 tabGradient 9.StartColor = System.Drawing.SystemColors.ControlLightLight;203 tabGradient 9.TextColor = System.Drawing.SystemColors.ControlText;204 dockPaneStripGradient 2.ActiveTabGradient = tabGradient9;205 dockPanelGradient 5.EndColor = System.Drawing.SystemColors.Control;206 dockPanelGradient 5.StartColor = System.Drawing.SystemColors.Control;207 dockPaneStripGradient 2.DockStripGradient = dockPanelGradient5;208 tabGradient 10.EndColor = System.Drawing.SystemColors.ControlLight;209 tabGradient 10.StartColor = System.Drawing.SystemColors.ControlLight;210 tabGradient 10.TextColor = System.Drawing.SystemColors.ControlText;211 dockPaneStripGradient 2.InactiveTabGradient = tabGradient10;212 dockPaneStripSkin 2.DocumentGradient = dockPaneStripGradient2;213 dockPaneStripSkin 2.TextFont = new System.Drawing.Font("Segoe UI", 9F);214 tabGradient 11.EndColor = System.Drawing.SystemColors.ActiveCaption;215 tabGradient 11.LinearGradientMode = System.Drawing.Drawing2D.LinearGradientMode.Vertical;216 tabGradient 11.StartColor = System.Drawing.SystemColors.GradientActiveCaption;217 tabGradient 11.TextColor = System.Drawing.SystemColors.ActiveCaptionText;218 dockPaneStripToolWindowGradient 2.ActiveCaptionGradient = tabGradient11;219 tabGradient 12.EndColor = System.Drawing.SystemColors.Control;220 tabGradient 12.StartColor = System.Drawing.SystemColors.Control;221 tabGradient 12.TextColor = System.Drawing.SystemColors.ControlText;222 dockPaneStripToolWindowGradient 2.ActiveTabGradient = tabGradient12;223 dockPanelGradient 6.EndColor = System.Drawing.SystemColors.ControlLight;224 dockPanelGradient 6.StartColor = System.Drawing.SystemColors.ControlLight;225 dockPaneStripToolWindowGradient 2.DockStripGradient = dockPanelGradient6;226 tabGradient 13.EndColor = System.Drawing.SystemColors.InactiveCaption;227 tabGradient 13.LinearGradientMode = System.Drawing.Drawing2D.LinearGradientMode.Vertical;228 tabGradient 13.StartColor = System.Drawing.SystemColors.GradientInactiveCaption;229 tabGradient 13.TextColor = System.Drawing.SystemColors.InactiveCaptionText;230 dockPaneStripToolWindowGradient 2.InactiveCaptionGradient = tabGradient13;231 tabGradient 14.EndColor = System.Drawing.Color.Transparent;232 tabGradient 14.StartColor = System.Drawing.Color.Transparent;233 tabGradient 14.TextColor = System.Drawing.SystemColors.ControlDarkDark;234 dockPaneStripToolWindowGradient 2.InactiveTabGradient = tabGradient14;235 dockPaneStripSkin 2.ToolWindowGradient = dockPaneStripToolWindowGradient2;236 dockPanelSkin 2.DockPaneStripSkin = dockPaneStripSkin2;237 this.resultsDockPanel.Skin = dockPanelSkin 2;239 this.resultsDockPanel.Size = new System.Drawing.Size(829, 421); 240 dockPanelGradient10.EndColor = System.Drawing.SystemColors.ControlLight; 241 dockPanelGradient10.StartColor = System.Drawing.SystemColors.ControlLight; 242 autoHideStripSkin4.DockStripGradient = dockPanelGradient10; 243 tabGradient22.EndColor = System.Drawing.SystemColors.Control; 244 tabGradient22.StartColor = System.Drawing.SystemColors.Control; 245 tabGradient22.TextColor = System.Drawing.SystemColors.ControlDarkDark; 246 autoHideStripSkin4.TabGradient = tabGradient22; 247 autoHideStripSkin4.TextFont = new System.Drawing.Font("Segoe UI", 9F); 248 dockPanelSkin4.AutoHideStripSkin = autoHideStripSkin4; 249 tabGradient23.EndColor = System.Drawing.SystemColors.ControlLightLight; 250 tabGradient23.StartColor = System.Drawing.SystemColors.ControlLightLight; 251 tabGradient23.TextColor = System.Drawing.SystemColors.ControlText; 252 dockPaneStripGradient4.ActiveTabGradient = tabGradient23; 253 dockPanelGradient11.EndColor = System.Drawing.SystemColors.Control; 254 dockPanelGradient11.StartColor = System.Drawing.SystemColors.Control; 255 dockPaneStripGradient4.DockStripGradient = dockPanelGradient11; 256 tabGradient24.EndColor = System.Drawing.SystemColors.ControlLight; 257 tabGradient24.StartColor = System.Drawing.SystemColors.ControlLight; 258 tabGradient24.TextColor = System.Drawing.SystemColors.ControlText; 259 dockPaneStripGradient4.InactiveTabGradient = tabGradient24; 260 dockPaneStripSkin4.DocumentGradient = dockPaneStripGradient4; 261 dockPaneStripSkin4.TextFont = new System.Drawing.Font("Segoe UI", 9F); 262 tabGradient25.EndColor = System.Drawing.SystemColors.ActiveCaption; 263 tabGradient25.LinearGradientMode = System.Drawing.Drawing2D.LinearGradientMode.Vertical; 264 tabGradient25.StartColor = System.Drawing.SystemColors.GradientActiveCaption; 265 tabGradient25.TextColor = System.Drawing.SystemColors.ActiveCaptionText; 266 dockPaneStripToolWindowGradient4.ActiveCaptionGradient = tabGradient25; 267 tabGradient26.EndColor = System.Drawing.SystemColors.Control; 268 tabGradient26.StartColor = System.Drawing.SystemColors.Control; 269 tabGradient26.TextColor = System.Drawing.SystemColors.ControlText; 270 dockPaneStripToolWindowGradient4.ActiveTabGradient = tabGradient26; 271 dockPanelGradient12.EndColor = System.Drawing.SystemColors.ControlLight; 272 dockPanelGradient12.StartColor = System.Drawing.SystemColors.ControlLight; 273 dockPaneStripToolWindowGradient4.DockStripGradient = dockPanelGradient12; 274 tabGradient27.EndColor = System.Drawing.SystemColors.InactiveCaption; 275 tabGradient27.LinearGradientMode = System.Drawing.Drawing2D.LinearGradientMode.Vertical; 276 tabGradient27.StartColor = System.Drawing.SystemColors.GradientInactiveCaption; 277 tabGradient27.TextColor = System.Drawing.SystemColors.InactiveCaptionText; 278 dockPaneStripToolWindowGradient4.InactiveCaptionGradient = tabGradient27; 279 tabGradient28.EndColor = System.Drawing.Color.Transparent; 280 tabGradient28.StartColor = System.Drawing.Color.Transparent; 281 tabGradient28.TextColor = System.Drawing.SystemColors.ControlDarkDark; 282 dockPaneStripToolWindowGradient4.InactiveTabGradient = tabGradient28; 283 dockPaneStripSkin4.ToolWindowGradient = dockPaneStripToolWindowGradient4; 284 dockPanelSkin4.DockPaneStripSkin = dockPaneStripSkin4; 285 this.resultsDockPanel.Skin = dockPanelSkin4; 238 286 this.resultsDockPanel.TabIndex = 0; 239 287 // … … 244 292 this.runsTabPage.Name = "runsTabPage"; 245 293 this.runsTabPage.Padding = new System.Windows.Forms.Padding(3); 246 this.runsTabPage.Size = new System.Drawing.Size(548, 4 76);294 this.runsTabPage.Size = new System.Drawing.Size(548, 418); 247 295 this.runsTabPage.TabIndex = 4; 248 296 this.runsTabPage.Text = "Runs"; … … 257 305 this.runsView.Name = "runsView"; 258 306 this.runsView.ReadOnly = false; 259 this.runsView.Size = new System.Drawing.Size(542, 4 70);307 this.runsView.Size = new System.Drawing.Size(542, 412); 260 308 this.runsView.TabIndex = 0; 261 309 // … … 266 314 this.seededRunsTabPage.Name = "seededRunsTabPage"; 267 315 this.seededRunsTabPage.Padding = new System.Windows.Forms.Padding(3); 268 this.seededRunsTabPage.Size = new System.Drawing.Size(548, 4 76);316 this.seededRunsTabPage.Size = new System.Drawing.Size(548, 418); 269 317 this.seededRunsTabPage.TabIndex = 5; 270 318 this.seededRunsTabPage.Text = "Seeded Runs"; … … 279 327 this.seededRunsView.Name = "seededRunsView"; 280 328 this.seededRunsView.ReadOnly = false; 281 this.seededRunsView.Size = new System.Drawing.Size(542, 4 70);329 this.seededRunsView.Size = new System.Drawing.Size(542, 412); 282 330 this.seededRunsView.TabIndex = 1; 283 331 // … … 287 335 this.solutionSeedingTabPage.Name = "solutionSeedingTabPage"; 288 336 this.solutionSeedingTabPage.Padding = new System.Windows.Forms.Padding(3); 289 this.solutionSeedingTabPage.Size = new System.Drawing.Size(548, 4 76);337 this.solutionSeedingTabPage.Size = new System.Drawing.Size(548, 418); 290 338 this.solutionSeedingTabPage.TabIndex = 1; 291 339 this.solutionSeedingTabPage.Text = "Seeding Pool"; … … 298 346 this.parametersTabPage.Name = "parametersTabPage"; 299 347 this.parametersTabPage.Padding = new System.Windows.Forms.Padding(3); 300 this.parametersTabPage.Size = new System.Drawing.Size(548, 4 76);348 this.parametersTabPage.Size = new System.Drawing.Size(548, 418); 301 349 this.parametersTabPage.TabIndex = 0; 302 350 this.parametersTabPage.Text = "Parameters"; … … 313 361 this.solverParametersView.ReadOnly = true; 314 362 this.solverParametersView.ShowDetails = true; 315 this.solverParametersView.Size = new System.Drawing.Size(542, 4 70);363 this.solverParametersView.Size = new System.Drawing.Size(542, 412); 316 364 this.solverParametersView.TabIndex = 0; 317 365 // … … 322 370 this.operatorGraphTabPage.Name = "operatorGraphTabPage"; 323 371 this.operatorGraphTabPage.Padding = new System.Windows.Forms.Padding(3); 324 this.operatorGraphTabPage.Size = new System.Drawing.Size(548, 4 76);372 this.operatorGraphTabPage.Size = new System.Drawing.Size(548, 418); 325 373 this.operatorGraphTabPage.TabIndex = 3; 326 374 this.operatorGraphTabPage.Text = "Operator Graph"; … … 336 384 this.operatorGraphViewHost.Name = "operatorGraphViewHost"; 337 385 this.operatorGraphViewHost.ReadOnly = true; 338 this.operatorGraphViewHost.Size = new System.Drawing.Size(542, 4 70);386 this.operatorGraphViewHost.Size = new System.Drawing.Size(542, 412); 339 387 this.operatorGraphViewHost.TabIndex = 0; 340 388 this.operatorGraphViewHost.ViewsLabelVisible = true; 341 389 this.operatorGraphViewHost.ViewType = null; 342 390 // 343 // algorithmStartButton344 //345 this.algorithmStartButton.Location = new System.Drawing.Point(91, 60);346 this.algorithmStartButton.Name = "algorithmStartButton";347 this.algorithmStartButton.Size = new System.Drawing.Size(26, 23);348 this.algorithmStartButton.TabIndex = 10;349 this.algorithmStartButton.Text = "Start";350 this.algorithmStartButton.UseVisualStyleBackColor = true;351 this.algorithmStartButton.Click += new System.EventHandler(this.AlgorithmStartButtonOnClick);352 //353 // minimumTargetLabel354 //355 this.minimumTargetLabel.AutoSize = true;356 this.minimumTargetLabel.Location = new System.Drawing.Point(384, 6);357 this.minimumTargetLabel.Name = "minimumTargetLabel";358 this.minimumTargetLabel.Size = new System.Drawing.Size(41, 13);359 this.minimumTargetLabel.TabIndex = 13;360 this.minimumTargetLabel.Text = "Target:";361 //362 // seedingStrategyLabel363 //364 this.seedingStrategyLabel.AutoSize = true;365 this.seedingStrategyLabel.Location = new System.Drawing.Point(3, 33);366 this.seedingStrategyLabel.Name = "seedingStrategyLabel";367 this.seedingStrategyLabel.Size = new System.Drawing.Size(91, 13);368 this.seedingStrategyLabel.TabIndex = 8;369 this.seedingStrategyLabel.Text = "Seeding Strategy:";370 //371 // evaluationsLimitabel372 //373 this.evaluationsLimitabel.AutoSize = true;374 this.evaluationsLimitabel.Location = new System.Drawing.Point(3, 6);375 this.evaluationsLimitabel.Name = "evaluationsLimitabel";376 this.evaluationsLimitabel.Size = new System.Drawing.Size(66, 13);377 this.evaluationsLimitabel.TabIndex = 13;378 this.evaluationsLimitabel.Text = "Budget (FE):";379 //380 // recommenderLabel381 //382 this.recommenderLabel.AutoSize = true;383 this.recommenderLabel.Location = new System.Drawing.Point(6, 9);384 this.recommenderLabel.Name = "recommenderLabel";385 this.recommenderLabel.Size = new System.Drawing.Size(79, 13);386 this.recommenderLabel.TabIndex = 9;387 this.recommenderLabel.Text = "Recommender:";388 //389 // suggestedInstancesComboBox390 //391 this.suggestedInstancesComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)392 | System.Windows.Forms.AnchorStyles.Right)));393 this.suggestedInstancesComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;394 this.suggestedInstancesComboBox.FormattingEnabled = true;395 this.suggestedInstancesComboBox.Location = new System.Drawing.Point(91, 33);396 this.suggestedInstancesComboBox.Name = "suggestedInstancesComboBox";397 this.suggestedInstancesComboBox.Size = new System.Drawing.Size(186, 21);398 this.suggestedInstancesComboBox.TabIndex = 7;399 this.suggestedInstancesComboBox.SelectedIndexChanged += new System.EventHandler(this.SuggestedInstancesComboBoxOnSelectedIndexChanged);400 //401 // recommenderComboBox402 //403 this.recommenderComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)404 | System.Windows.Forms.AnchorStyles.Right)));405 this.recommenderComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;406 this.recommenderComboBox.FormattingEnabled = true;407 this.recommenderComboBox.Location = new System.Drawing.Point(91, 6);408 this.recommenderComboBox.Name = "recommenderComboBox";409 this.recommenderComboBox.Size = new System.Drawing.Size(154, 21);410 this.recommenderComboBox.TabIndex = 7;411 this.recommenderComboBox.SelectedIndexChanged += new System.EventHandler(this.RecommenderComboBoxOnSelectedIndexChanged);412 //413 // solverSplitContainer414 //415 this.solverSplitContainer.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)416 | System.Windows.Forms.AnchorStyles.Left)417 | System.Windows.Forms.AnchorStyles.Right)));418 this.solverSplitContainer.Location = new System.Drawing.Point(0, 56);419 this.solverSplitContainer.Name = "solverSplitContainer";420 //421 // solverSplitContainer.Panel1422 //423 this.solverSplitContainer.Panel1.Controls.Add(this.recommenderViewHost);424 this.solverSplitContainer.Panel1.Controls.Add(this.instanceLabel);425 this.solverSplitContainer.Panel1.Controls.Add(this.recommenderLabel);426 this.solverSplitContainer.Panel1.Controls.Add(this.recommenderComboBox);427 this.solverSplitContainer.Panel1.Controls.Add(this.algorithmCloneButton);428 this.solverSplitContainer.Panel1.Controls.Add(this.suggestedInstancesComboBox);429 this.solverSplitContainer.Panel1.Controls.Add(this.recommendRefreshButton);430 this.solverSplitContainer.Panel1.Controls.Add(this.algorithmStartButton);431 this.solverSplitContainer.Panel1.Padding = new System.Windows.Forms.Padding(3);432 //433 // solverSplitContainer.Panel2434 //435 this.solverSplitContainer.Panel2.Controls.Add(this.solverTabControl);436 this.solverSplitContainer.Panel2.Padding = new System.Windows.Forms.Padding(3);437 this.solverSplitContainer.Size = new System.Drawing.Size(849, 508);438 this.solverSplitContainer.SplitterDistance = 283;439 this.solverSplitContainer.TabIndex = 17;440 //441 // recommenderViewHost442 //443 this.recommenderViewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)444 | System.Windows.Forms.AnchorStyles.Left)445 | System.Windows.Forms.AnchorStyles.Right)));446 this.recommenderViewHost.Caption = "View";447 this.recommenderViewHost.Content = null;448 this.recommenderViewHost.Enabled = false;449 this.recommenderViewHost.Location = new System.Drawing.Point(6, 89);450 this.recommenderViewHost.Name = "recommenderViewHost";451 this.recommenderViewHost.ReadOnly = false;452 this.recommenderViewHost.Size = new System.Drawing.Size(271, 412);453 this.recommenderViewHost.TabIndex = 16;454 this.recommenderViewHost.ViewsLabelVisible = true;455 this.recommenderViewHost.ViewType = null;456 //457 // instanceLabel458 //459 this.instanceLabel.AutoSize = true;460 this.instanceLabel.Location = new System.Drawing.Point(6, 36);461 this.instanceLabel.Name = "instanceLabel";462 this.instanceLabel.Size = new System.Drawing.Size(51, 13);463 this.instanceLabel.TabIndex = 9;464 this.instanceLabel.Text = "Instance:";465 //466 // recommendRefreshButton467 //468 this.recommendRefreshButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));469 this.recommendRefreshButton.Location = new System.Drawing.Point(251, 6);470 this.recommendRefreshButton.Name = "recommendRefreshButton";471 this.recommendRefreshButton.Size = new System.Drawing.Size(26, 23);472 this.recommendRefreshButton.TabIndex = 10;473 this.recommendRefreshButton.Text = "Start";474 this.recommendRefreshButton.UseVisualStyleBackColor = true;475 this.recommendRefreshButton.Click += new System.EventHandler(this.button1_Click);476 //477 391 // SolverView 478 392 // 479 393 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 480 394 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 481 this.Controls.Add(this.solverSplitContainer); 395 this.Controls.Add(this.solverTabControl); 396 this.Controls.Add(this.algorithmCloneButton); 397 this.Controls.Add(this.instanceLabel); 398 this.Controls.Add(this.algorithmStartButton); 482 399 this.Controls.Add(this.minTargetView); 483 400 this.Controls.Add(this.maxEvaluationsView); 401 this.Controls.Add(this.suggestedInstancesComboBox); 484 402 this.Controls.Add(this.seedingStrategyPanel); 485 403 this.Controls.Add(this.minimumTargetLabel); … … 495 413 this.parametersTabPage.ResumeLayout(false); 496 414 this.operatorGraphTabPage.ResumeLayout(false); 497 this.solverSplitContainer.Panel1.ResumeLayout(false);498 this.solverSplitContainer.Panel1.PerformLayout();499 this.solverSplitContainer.Panel2.ResumeLayout(false);500 ((System.ComponentModel.ISupportInitialize)(this.solverSplitContainer)).EndInit();501 this.solverSplitContainer.ResumeLayout(false);502 415 this.ResumeLayout(false); 503 416 this.PerformLayout(); … … 508 421 509 422 private System.Windows.Forms.Panel seedingStrategyPanel; 423 private System.Windows.Forms.Button algorithmStartButton; 424 private System.Windows.Forms.Label seedingStrategyLabel; 425 private System.Windows.Forms.Label evaluationsLimitabel; 426 private System.Windows.Forms.ComboBox suggestedInstancesComboBox; 427 private System.Windows.Forms.Button algorithmCloneButton; 428 private Data.Views.StringConvertibleValueView maxEvaluationsView; 429 private System.Windows.Forms.Label minimumTargetLabel; 430 private Data.Views.StringConvertibleValueView minTargetView; 431 private System.Windows.Forms.Label instanceLabel; 510 432 private MainForm.WindowsForms.DragOverTabControl solverTabControl; 511 433 private System.Windows.Forms.TabPage resultsTabPage; 434 private System.Windows.Forms.CheckBox showOnlyFinalResultCheckBox; 435 private WeifenLuo.WinFormsUI.Docking.DockPanel resultsDockPanel; 436 private System.Windows.Forms.TabPage runsTabPage; 437 private Optimization.Views.RunCollectionView runsView; 438 private System.Windows.Forms.TabPage seededRunsTabPage; 439 private Optimization.Views.RunCollectionView seededRunsView; 512 440 private System.Windows.Forms.TabPage solutionSeedingTabPage; 513 441 private System.Windows.Forms.TabPage parametersTabPage; … … 515 443 private System.Windows.Forms.TabPage operatorGraphTabPage; 516 444 private MainForm.WindowsForms.ViewHost operatorGraphViewHost; 517 private System.Windows.Forms.Button algorithmStartButton;518 private System.Windows.Forms.Label seedingStrategyLabel;519 private System.Windows.Forms.Label evaluationsLimitabel;520 private System.Windows.Forms.Label recommenderLabel;521 private System.Windows.Forms.ComboBox suggestedInstancesComboBox;522 private System.Windows.Forms.Button algorithmCloneButton;523 private System.Windows.Forms.TabPage runsTabPage;524 private Optimization.Views.RunCollectionView runsView;525 private Data.Views.StringConvertibleValueView maxEvaluationsView;526 private WeifenLuo.WinFormsUI.Docking.DockPanel resultsDockPanel;527 private System.Windows.Forms.CheckBox showOnlyFinalResultCheckBox;528 private System.Windows.Forms.TabPage seededRunsTabPage;529 private Optimization.Views.RunCollectionView seededRunsView;530 private System.Windows.Forms.Label minimumTargetLabel;531 private Data.Views.StringConvertibleValueView minTargetView;532 private System.Windows.Forms.ComboBox recommenderComboBox;533 private System.Windows.Forms.SplitContainer solverSplitContainer;534 private MainForm.WindowsForms.ViewHost recommenderViewHost;535 private System.Windows.Forms.Label instanceLabel;536 private System.Windows.Forms.Button recommendRefreshButton;537 445 } 538 446 } -
branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem/3.3/Views/SolverView.cs
r13774 r13787 28 28 using HeuristicLab.OptimizationExpertSystem.Common; 29 29 using System; 30 using System.Linq; 30 31 using System.Windows.Forms; 31 32 … … 44 45 algorithmCloneButton.Text = string.Empty; 45 46 algorithmCloneButton.Image = VSImageLibrary.Clone; 46 recommendRefreshButton.Text = string.Empty;47 recommendRefreshButton.Image = VSImageLibrary.Refresh;48 47 seedingStrategyView = new EnumValueView<SeedingStrategyTypes>() { 49 48 Dock = DockStyle.Fill … … 68 67 seedingStrategyView.Content = null; 69 68 seedingSolutionsView.Content = null; 70 recommenderViewHost.Content = null;71 69 } else { 72 70 maxEvaluationsView.Content = Content.MaximumEvaluations; … … 76 74 seedingStrategyView.Content = Content.SeedingStrategy; 77 75 seedingSolutionsView.Content = Content.SolutionSeedingPool; 78 recommenderViewHost.Content = Content.AlgorithmInstanceRecommender;79 76 } 80 77 } finally { SuppressEvents = false; } 81 78 UpdateSuggestedInstancesCombobox(); 82 UpdateRecommenderCombobox();83 79 } 84 80 … … 91 87 } 92 88 89 #region Update Controls 90 private void UpdateSuggestedInstancesCombobox() { 91 var prevSelection = (AlgorithmInstanceItem)suggestedInstancesComboBox.SelectedItem; 92 var prevNewIndex = -1; 93 suggestedInstancesComboBox.Items.Clear(); 94 if (Content == null) return; 95 96 var ranking = Content.GetAlgorithmInstanceRanking().ToList(); 97 98 for (var i = 0; i < ranking.Count; i++) { 99 suggestedInstancesComboBox.Items.Add(new AlgorithmInstanceItem(ranking[i])); 100 if (prevSelection == null || ranking[i].Item1.Name == prevSelection.Item.Item1.Name) 101 prevNewIndex = prevSelection == null ? 0 : i; 102 } 103 suggestedInstancesComboBox.SelectedIndex = prevNewIndex; 104 } 105 #endregion 106 107 #region Content Event Handlers 93 108 protected override void OnAlgorithmInstanceStarted(IAlgorithm algorithm) { 94 109 base.OnAlgorithmInstanceStarted(algorithm); … … 97 112 } 98 113 99 protected override void On SuggestedInstancesChanged() {100 base.On SuggestedInstancesChanged();114 protected override void OnRecommendationModelChanged() { 115 base.OnRecommendationModelChanged(); 101 116 UpdateSuggestedInstancesCombobox(); 102 117 } 118 #endregion 103 119 104 private void UpdateSuggestedInstancesCombobox() { 105 var prevSelection = (IAlgorithm)suggestedInstancesComboBox.SelectedItem; 106 var prevNewIndex = -1; 107 suggestedInstancesComboBox.Items.Clear(); 108 if (Content == null) return; 109 110 for (var i = 0; i < Content.AlgorithmInstances.Count; i++) { 111 suggestedInstancesComboBox.Items.Add(Content.AlgorithmInstances[i]); 112 if (prevSelection == null || Content.AlgorithmInstances[i].Name == prevSelection.Name) 113 prevNewIndex = prevSelection == null ? 0 : i; 114 } 115 if (prevNewIndex >= 0) suggestedInstancesComboBox.SelectedIndex = prevNewIndex; 116 } 117 118 private void UpdateRecommenderCombobox() { 119 var prevSelection = Content.AlgorithmInstanceRecommender; 120 var prevNewIndex = -1; 121 recommenderComboBox.Items.Clear(); 122 if (Content == null) return; 123 124 /*var i = 0; 125 foreach (var type in ApplicationManager.Manager.GetTypes(typeof (IAlgorithmInstanceRecommender))) { 126 var r = (IAlgorithmInstanceRecommender)Activator.CreateInstance(type, BindingFlags.CreateInstance, Content); 127 recommenderComboBox.Items.Add(r); 128 if (prevSelection == null || type == prevSelection.GetType()) 129 prevNewIndex = prevSelection == null ? 0 : i; 130 i++; 131 } 132 if (prevNewIndex >= 0) recommenderComboBox.SelectedIndex = prevNewIndex;*/ 133 recommenderComboBox.Items.Add(new OverallBestRecommender(Content)); 134 if (prevSelection is OverallBestRecommender) recommenderComboBox.SelectedIndex = recommenderComboBox.Items.Count - 1; 135 recommenderComboBox.Items.Add(new KNearestNeighborRecommender(Content)); 136 if (prevSelection is KNearestNeighborRecommender) recommenderComboBox.SelectedIndex = recommenderComboBox.Items.Count - 1; 137 recommenderComboBox.Items.Add(new DistanceWeightedRecommender(Content)); 138 if (prevSelection is DistanceWeightedRecommender) recommenderComboBox.SelectedIndex = recommenderComboBox.Items.Count - 1; 139 } 140 120 #region Control Event Handlers 141 121 private void AlgorithmStartButtonOnClick(object sender, EventArgs e) { 142 122 if (suggestedInstancesComboBox.SelectedIndex >= 0) 143 Content.StartAlgorithmAsync( suggestedInstancesComboBox.SelectedIndex);123 Content.StartAlgorithmAsync(Content.AlgorithmInstances.Select((a, i) => new { Alg = a, Index = i}).Single(x => x.Alg.Name == ((AlgorithmInstanceItem)suggestedInstancesComboBox.SelectedItem).Item.Item1.Name).Index); 144 124 } 145 125 146 126 private void AlgorithmCloneButtonOnClick(object sender, EventArgs e) { 147 127 if (suggestedInstancesComboBox.SelectedIndex >= 0) 148 MainForm.ShowContent((IAlgorithm)Content.AlgorithmInstances[ suggestedInstancesComboBox.SelectedIndex].Clone());128 MainForm.ShowContent((IAlgorithm)Content.AlgorithmInstances[Content.AlgorithmInstances.Select((a, i) => new { Alg = a, Index = i }).Single(x => x.Alg.Name == ((AlgorithmInstanceItem)suggestedInstancesComboBox.SelectedItem).Item.Item1.Name).Index].Clone()); 149 129 } 150 130 … … 152 132 if (InvokeRequired) { Invoke((Action<object, EventArgs>)SuggestedInstancesComboBoxOnSelectedIndexChanged, sender, e); return; } 153 133 if (suggestedInstancesComboBox.SelectedIndex >= 0) { 154 var alg = Content.AlgorithmInstances[ suggestedInstancesComboBox.SelectedIndex];134 var alg = Content.AlgorithmInstances[Content.AlgorithmInstances.Select((a, i) => new { Alg = a, Index = i }).Single(x => x.Alg.Name == ((AlgorithmInstanceItem)suggestedInstancesComboBox.SelectedItem).Item.Item1.Name).Index]; 155 135 solverParametersView.Content = alg.Parameters; 156 136 var engineAlg = alg as EngineAlgorithm; … … 163 143 SetEnabledStateOfControls(); 164 144 } 145 #endregion 165 146 166 private void RecommenderComboBoxOnSelectedIndexChanged(object sender, EventArgs e) { 167 if (InvokeRequired) { Invoke((Action<object, EventArgs>)RecommenderComboBoxOnSelectedIndexChanged, sender, e); return; } 168 if (recommenderComboBox.SelectedIndex < 0) return; 169 Content.AlgorithmInstanceRecommender = (IAlgorithmInstanceRecommender)recommenderComboBox.SelectedItem; 170 recommenderViewHost.Content = Content.AlgorithmInstanceRecommender; 171 Content.UpdateSuggestions(); 147 #region Helper Classes and Methods 148 private class AlgorithmInstanceItem { 149 private readonly Tuple<IAlgorithm, double> item; 150 public Tuple<IAlgorithm, double> Item { get { return item; } } 151 152 public AlgorithmInstanceItem(Tuple<IAlgorithm, double> item) { 153 this.item = item; 154 } 155 156 public override string ToString() { 157 return item.Item2.ToString("F0") + ": " + item.Item1.Name; 158 } 172 159 } 173 174 private void button1_Click(object sender, EventArgs e) { 175 Content.UpdateSuggestions(); 176 } 160 #endregion 177 161 } 178 162 } -
branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem/3.3/Views/UnderstandingProblemInstanceView.cs
r13757 r13787 22 22 using HeuristicLab.Common.Resources; 23 23 using HeuristicLab.Core; 24 using HeuristicLab.Core.Views;25 24 using HeuristicLab.Data; 26 25 using HeuristicLab.MainForm; 26 using HeuristicLab.MainForm.WindowsForms; 27 27 using HeuristicLab.OptimizationExpertSystem.Common; 28 28 using System; … … 39 39 public sealed partial class UnderstandingProblemInstanceView : KnowledgeCenterViewBase { 40 40 private bool SuppressEvents { get; set; } 41 private readonly CheckedItemList View<StringValue> characteristicsView;41 private readonly CheckedItemList<StringValue> characteristics; 42 42 43 43 public UnderstandingProblemInstanceView() { … … 45 45 showCharacteristicsCheckBox.Text = string.Empty; 46 46 showCharacteristicsCheckBox.Image = VSImageLibrary.Properties; 47 characteristicsView = new CheckedItemListView<StringValue>() { 48 Dock = DockStyle.Fill 49 }; 50 mapSplitContainer.Panel2.Controls.Add(characteristicsView); 47 characteristics = new CheckedItemList<StringValue>(); 48 characteristics.CheckedItemsChanged += CharacteristicsOnCheckedItemsChanged; 49 mapSplitContainer.Panel2.Controls.Add(new ViewHost() { 50 Dock = DockStyle.Fill, 51 Content = characteristics 52 }); 51 53 } 52 54 53 55 protected override void OnContentChanged() { 54 56 base.OnContentChanged(); 57 characteristics.Clear(); 55 58 if (Content == null) { 56 59 problemInstancesView.Content = null; 57 characteristicsView.Content = null;58 60 instanceMapChart.Series["InstancesSeries"].Points.Clear(); 59 61 instanceMapChart.Series["CurrentInstanceSeries"].Points.Clear(); 60 62 } else { 61 63 problemInstancesView.Content = Content.ProblemInstances; 62 characteristicsView.Content = Content.ProblemCharacteristics;64 UpdateCharacteristics(); 63 65 UpdateProjectionComboBox(); 64 66 UpdateSizeComboBox(); … … 67 69 } 68 70 69 #region Content Event Handlers 70 protected override void OnProblemChanged() { 71 base.OnProblemChanged(); 72 SetEnabledStateOfControls(); 73 } 74 75 protected override void OnProblemInstancesChanged() { 76 base.OnProblemInstancesChanged(); 77 if (Content.ProblemInstances.UpdateOfRunsInProgress) return; 78 UpdateProjectionComboBox(); 79 UpdateSizeComboBox(); 80 UpdateColorComboBox(); 81 UpdateProjection(); 82 } 83 #endregion 71 protected override void SetEnabledStateOfControls() { 72 base.SetEnabledStateOfControls(); 73 } 74 75 #region Update Controls 76 private void UpdateCharacteristics() { 77 var @checked = new HashSet<string>(characteristics.CheckedItems.Select(x => x.Value.Value)); 78 characteristics.Clear(); 79 foreach (var c in Content.ProblemInstances.ResultNames) { 80 characteristics.Add(new StringValue(c), @checked.Contains(c)); 81 } 82 } 84 83 85 84 private void UpdateProjectionComboBox() { … … 126 125 } finally { SuppressEvents = false; } 127 126 } 128 129 private IEnumerable<string> GetProjections() {130 return Content.ProblemInstances131 .SelectMany(x => x.Results.Where(y => Regex.IsMatch(y.Key, "^Projection[.].*[.][XY]$")))132 .Select(x => Regex.Match(x.Key, "Projection[.](?<g>.*)[.][XY]").Groups["g"].Value)133 .Distinct();134 }135 127 136 128 private void UpdateProjection() { … … 153 145 size, color, invPropCheckBox.Checked, fromZeroCheckBox.Checked); 154 146 } 147 #endregion 148 149 #region Content Event Handlers 150 protected override void OnProblemChanged() { 151 base.OnProblemChanged(); 152 SetEnabledStateOfControls(); 153 } 154 155 protected override void OnProblemInstancesChanged() { 156 base.OnProblemInstancesChanged(); 157 if (Content.ProblemInstances.UpdateOfRunsInProgress) return; 158 try { 159 SuppressEvents = true; 160 UpdateCharacteristics(); 161 } finally { SuppressEvents = false; } 162 UpdateProjectionComboBox(); 163 UpdateSizeComboBox(); 164 UpdateColorComboBox(); 165 UpdateProjection(); 166 } 167 #endregion 168 169 #region Control Event Handlers 170 private void ProjectionComboBoxOnSelectedIndexChanged(object sender, EventArgs e) { 171 UpdateProjection(); 172 } 173 174 private void SizeComboBoxOnSelectedIndexChanged(object sender, EventArgs e) { 175 UpdateProjection(); 176 } 177 178 private void colorComboBox_SelectedIndexChanged(object sender, EventArgs e) { 179 UpdateProjection(); 180 } 181 182 private void InvPropCheckBoxOnCheckedChanged(object sender, EventArgs e) { 183 UpdateProjection(); 184 } 185 186 private void fromZeroCheckBox_CheckedChanged(object sender, EventArgs e) { 187 UpdateProjection(); 188 } 189 190 private void showCharacteristicsCheckBox_CheckedChanged(object sender, EventArgs e) { 191 mapSplitContainer.Panel2Collapsed = !showCharacteristicsCheckBox.Checked; 192 } 193 #endregion 194 195 #region Other Event Handlers 196 private void CharacteristicsOnCheckedItemsChanged(object sender, EventArgs e) { 197 if (SuppressEvents) return; 198 if (characteristics.CheckedItems.Any()) 199 Content.UpdateInstanceProjection(characteristics.CheckedItems.Select(x => x.Value.Value).ToArray()); 200 } 201 #endregion 202 203 #region Helper Classes and Methods 204 private IEnumerable<string> GetProjections() { 205 return Content.ProblemInstances.ResultNames 206 .Where(x => Regex.IsMatch(x, "^Projection[.].*[.][XY]$")) 207 .Select(x => Regex.Match(x, "Projection[.](?<g>.*)[.][XY]").Groups["g"].Value) 208 .Distinct(); 209 } 155 210 156 211 private void DoProjectProblemInstances(Series instancesSeries, Series currentInstanceSeries, string projection, string size, string color, bool invProp, bool fromZero) { … … 160 215 double maxSize = 0, minSize = 0; 161 216 if (!string.IsNullOrEmpty(size)) { 162 var sizes = Content.ProblemInstances.Where(x => x.Results.ContainsKey(size)).Select(x => x.Results[size]).OfType<D ata.DoubleValue>().Where(x => !double.IsNaN(x.Value)).ToList();217 var sizes = Content.ProblemInstances.Where(x => x.Results.ContainsKey(size)).Select(x => x.Results[size]).OfType<DoubleValue>().Where(x => !double.IsNaN(x.Value)).ToList(); 163 218 if (sizes.Count > 0) { 164 219 maxSize = sizes.Max(x => x.Value); … … 177 232 var yKey = "Projection." + projection + ".Y"; 178 233 if (!run.Results.ContainsKey(xKey) || !run.Results.ContainsKey(yKey) 179 || !(run.Results[xKey] is D ata.DoubleValue) || !(run.Results[yKey] is Data.DoubleValue)) continue;180 var x = ((D ata.DoubleValue)run.Results[xKey]).Value;181 var y = ((D ata.DoubleValue)run.Results[yKey]).Value;234 || !(run.Results[xKey] is DoubleValue) || !(run.Results[yKey] is DoubleValue)) continue; 235 var x = ((DoubleValue)run.Results[xKey]).Value; 236 var y = ((DoubleValue)run.Results[yKey]).Value; 182 237 var dataPoint = new DataPoint(x, y) { 183 238 Label = run.Name, … … 185 240 IItem item; 186 241 if (maxSize > minSize && run.Results.TryGetValue(size, out item)) { 187 var dItem = item as D ata.DoubleValue;242 var dItem = item as DoubleValue; 188 243 if (dItem == null && item is IntValue) dItem = new DoubleValue(((IntValue)item).Value); 189 244 if (dItem != null) { … … 216 271 } 217 272 } 218 219 #region Control Event Handlers220 private void ProjectionComboBoxOnSelectedIndexChanged(object sender, EventArgs e) {221 UpdateProjection();222 }223 224 private void SizeComboBoxOnSelectedIndexChanged(object sender, EventArgs e) {225 UpdateProjection();226 }227 228 private void colorComboBox_SelectedIndexChanged(object sender, EventArgs e) {229 UpdateProjection();230 }231 232 private void InvPropCheckBoxOnCheckedChanged(object sender, EventArgs e) {233 UpdateProjection();234 }235 236 private void fromZeroCheckBox_CheckedChanged(object sender, EventArgs e) {237 UpdateProjection();238 }239 240 private void showCharacteristicsCheckBox_CheckedChanged(object sender, EventArgs e) {241 mapSplitContainer.Panel2Collapsed = !showCharacteristicsCheckBox.Checked;242 }243 273 #endregion 244 274 } -
branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem/3.3/Views/UnderstandingSolutionsView.cs
r13750 r13787 54 54 UpdateSolutionVisualization(); 55 55 } 56 57 protected override void OnProblemChanged() { 58 base.OnProblemInstancesChanged(); 59 UpdateSimilarityCalculators(); 60 UpdateNamesComboboxes(); 61 UpdateSolutionVisualization(); 62 } 63 64 protected override void OnProblemSolutionsChanged() { 65 base.OnProblemSolutionsChanged(); 66 UpdateNamesComboboxes(); 67 UpdateSolutionVisualization(); 68 } 69 70 protected override void OnSolutionSeedingPoolChanged() { 71 base.OnSolutionSeedingPoolChanged(); 72 UpdateSolutionNetworkAnalysis(similarityComboBox.SelectedItem as ISolutionSimilarityCalculator, (string)solutionNetworkProjectionComboBox.SelectedItem, linesCheckBox.Checked, contrastTrackBar.Value, minimumTrackBar.Value); 73 } 74 56 57 #region Update Controls 75 58 private void UpdateSimilarityCalculators() { 76 59 var selected = (ISolutionSimilarityCalculator)(similarityComboBox.SelectedIndex >= 0 ? similarityComboBox.SelectedItem : null); … … 280 263 } 281 264 } 282 265 #endregion 266 267 #region Content Event Handlers 268 protected override void OnProblemChanged() { 269 base.OnProblemInstancesChanged(); 270 UpdateSimilarityCalculators(); 271 UpdateNamesComboboxes(); 272 UpdateSolutionVisualization(); 273 } 274 275 protected override void OnProblemSolutionsChanged() { 276 base.OnProblemSolutionsChanged(); 277 UpdateNamesComboboxes(); 278 UpdateSolutionVisualization(); 279 } 280 281 protected override void OnSolutionSeedingPoolChanged() { 282 base.OnSolutionSeedingPoolChanged(); 283 UpdateSolutionNetworkAnalysis(similarityComboBox.SelectedItem as ISolutionSimilarityCalculator, (string)solutionNetworkProjectionComboBox.SelectedItem, linesCheckBox.Checked, contrastTrackBar.Value, minimumTrackBar.Value); 284 } 285 #endregion 286 287 #region Control Event Handlers 283 288 private void SimilarityComboBoxOnSelectedIndexChanged(object sender, EventArgs e) { 284 289 if (InvokeRequired) { Invoke((Action<object, EventArgs>)SimilarityComboBoxOnSelectedIndexChanged, sender, e); return; } … … 370 375 } 371 376 } 372 373 #region Helpers 377 #endregion 378 379 #region Helper Classes and Methods 374 380 private List<IScope> GetSolutionScopes() { 375 381 return Content.Problem.Solutions.Select(x => x.Solution).OfType<IScope>().ToList();
Note: See TracChangeset
for help on using the changeset viewer.