Changeset 13791
- Timestamp:
- 04/25/16 12:56:17 (8 years ago)
- Location:
- branches/PerformanceComparison
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem.Common/3.3/HeuristicLab.OptimizationExpertSystem.Common-3.3.csproj
r13787 r13791 161 161 <Compile Include="Recommenders\KNearestNeighborModel.cs" /> 162 162 <Compile Include="Recommenders\OverallBestRecommender.cs" /> 163 <Compile Include="Recommenders\DistanceWeightedRecommender.cs" />164 163 <Compile Include="Interfaces\IAlgorithmInstanceRecommender.cs" /> 165 164 <Compile Include="Recommenders\KNearestNeighborRecommender.cs" /> -
branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem.Common/3.3/Interfaces/IAlgorithmInstanceRecommender.cs
r13787 r13791 21 21 22 22 using HeuristicLab.Core; 23 using HeuristicLab.Optimization; 23 24 24 25 namespace HeuristicLab.OptimizationExpertSystem.Common { 25 26 public interface IAlgorithmInstanceRecommender : IParameterizedItem { 26 IRecommendationModel TrainModel( KnowledgeCenter kc, string[] characteristics);27 IRecommendationModel TrainModel(IRun[] problemInstances, KnowledgeCenter kc, string[] characteristics); 27 28 } 28 29 } -
branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem.Common/3.3/Interfaces/IRecommendationModel.cs
r13787 r13791 27 27 namespace HeuristicLab.OptimizationExpertSystem.Common { 28 28 public interface IRecommendationModel : IContent { 29 IEnumerable<Tuple<IAlgorithm, double>> GetRanking( KnowledgeCenter kc);29 IEnumerable<Tuple<IAlgorithm, double>> GetRanking(IRun problemInstance); 30 30 } 31 31 } -
branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem.Common/3.3/KnowledgeCenter.cs
r13787 r13791 212 212 #endregion 213 213 #region PCA 214 double[,] v = null; 214 215 var ds = new double[instances.Count, characteristics.Length]; 215 foreach (var instance in instances) { 216 var arr = instance.Value; 217 for (var feature = 0; feature < arr.Length; feature++) 218 ds[key2Idx.GetByFirst(instance.Key), feature] = arr[feature]; 219 } 220 221 int info; 222 double[] s2; 223 double[,] v; 224 alglib.pcabuildbasis(ds, ds.GetLength(0), ds.GetLength(1), out info, out s2, out v); 216 if (characteristics.Length > 1) { 217 foreach (var instance in instances) { 218 var arr = instance.Value; 219 for (var feature = 0; feature < arr.Length; feature++) 220 ds[key2Idx.GetByFirst(instance.Key), feature] = arr[feature]; 221 } 222 223 int info; 224 double[] s2; 225 alglib.pcabuildbasis(ds, ds.GetLength(0), ds.GetLength(1), out info, out s2, out v); 226 } 225 227 #endregion 226 228 #region SOM … … 231 233 features[feature, key2Idx.GetByFirst(instance.Key)] = arr[feature]; 232 234 } 233 var somCoords = SOM.Map(features, new MersenneTwister(42), somSize: 20, learningRadius: 20, iterations: 200, jittering: true);235 var somCoords = SOM.Map(features, new MersenneTwister(42), somSize: 10, learningRadius: 20, iterations: 200, jittering: true); 234 236 #endregion 235 237 … … 237 239 try { 238 240 foreach (var instance in ProblemInstances) { 239 double x = 0, y = 0;240 for (var feature = 0; feature < ds.GetLength(1); feature++) {241 x += ds[key2Idx.GetByFirst(instance), feature] * v[feature, 0];242 y += ds[key2Idx.GetByFirst(instance), feature] * v[feature, 1];243 }244 245 241 IItem item; 246 if (instance.Results.TryGetValue("Projection.PCA.X", out item)) { 247 ((DoubleValue)item).Value = x; 248 } else instance.Results.Add("Projection.PCA.X", new DoubleValue(x)); 249 if (instance.Results.TryGetValue("Projection.PCA.Y", out item)) { 250 ((DoubleValue)item).Value = y; 251 } else instance.Results.Add("Projection.PCA.Y", new DoubleValue(y)); 242 if (v != null) { 243 double x = 0, y = 0; 244 for (var feature = 0; feature < ds.GetLength(1); feature++) { 245 x += ds[key2Idx.GetByFirst(instance), feature] * v[feature, 0]; 246 y += ds[key2Idx.GetByFirst(instance), feature] * v[feature, 1]; 247 } 248 249 if (instance.Results.TryGetValue("Projection.PCA.X", out item)) { 250 ((DoubleValue)item).Value = x; 251 } else instance.Results.Add("Projection.PCA.X", new DoubleValue(x)); 252 if (instance.Results.TryGetValue("Projection.PCA.Y", out item)) { 253 ((DoubleValue)item).Value = y; 254 } else instance.Results.Add("Projection.PCA.Y", new DoubleValue(y)); 255 } else { 256 instance.Results.Remove("Projection.PCA.X"); 257 instance.Results.Remove("Projection.PCA.Y"); 258 } 252 259 253 260 if (instance.Results.TryGetValue("Projection.MDS.X", out item)) { … … 266 273 } 267 274 } finally { ProblemInstances.UpdateOfRunsInProgress = false; } 268 }269 270 public Dictionary<IRun, double[]> GetProblemCharacteristics(string[] characteristics) {271 var instances = new Dictionary<IRun, double[]>();272 var values = new List<double>[characteristics.Length];273 foreach (var run in ProblemInstances) {274 var f = 0;275 instances[run] = new double[characteristics.Length];276 foreach (var c in characteristics) {277 if (values[f] == null) values[f] = new List<double>(ProblemInstances.Count);278 IItem item;279 if (run.Results.TryGetValue(c, out item)) {280 var val = (double)((dynamic)item).Value;281 if (!double.IsNaN(val)) values[f].Add(val);282 instances[run][f] = val;283 } else instances[run][f] = double.NaN;284 f++;285 }286 }287 var median = values.Select(x => x.Count == 0 ? 0.0 : x.Median()).ToList();288 289 var allValues = instances.Values.Select(x => x.Select((f, i) => new {Idx = i, Val = double.IsNaN(f) ? median[i] : f}).ToList())290 .SelectMany(x => x)291 .GroupBy(x => x.Idx, x => x.Val)292 .OrderBy(x => x.Key).ToList();293 var avg = allValues.Select(x => x.Average()).ToList();294 var stdev = allValues.Select(x => x.StandardDeviation()).ToList();295 296 // normalize characteristic values by transforming them to their z-score297 foreach (var key in instances.Keys.ToList()) {298 var arr = instances[key];299 for (var i = 0; i < arr.Length; i++) {300 if (double.IsNaN(arr[i])) arr[i] = median[i];301 if (stdev[i] > 0) arr[i] = (arr[i] - avg[i]) / stdev[i];302 }303 }304 return instances;305 275 } 306 276 … … 579 549 } 580 550 551 public static double[][] GetFeatures(IRun[] problemInstances, string[] characteristics, double[] medianValues = null) { 552 var instances = new double[problemInstances.Length][]; 553 for (var p = 0; p < problemInstances.Length; p++) { 554 instances[p] = new double[characteristics.Length]; 555 for (var f = 0; f < characteristics.Length; f++) { 556 IItem item; 557 if (problemInstances[p].Results.TryGetValue(characteristics[f], out item)) { 558 double val = 0; 559 var dItem = item as DoubleValue; 560 if (dItem != null) { 561 val = dItem.Value; 562 } else { 563 var iItem = item as IntValue; 564 if (iItem != null) val = iItem.Value; 565 else val = double.NaN; 566 } 567 if (double.IsNaN(val) && medianValues != null) 568 instances[p][f] = medianValues[f]; 569 else instances[p][f] = val; 570 } else instances[p][f] = medianValues != null ? medianValues[f] : double.NaN; 571 } 572 } 573 return instances; 574 } 575 576 public static double[] GetMedianValues(IRun[] problemInstances, string[] characteristics) { 577 var values = new List<double>[characteristics.Length]; 578 foreach (var problemInstance in problemInstances) { 579 for (var f = 0; f < characteristics.Length; f++) { 580 if (values[f] == null) values[f] = new List<double>(problemInstances.Length); 581 IItem item; 582 if (problemInstance.Results.TryGetValue(characteristics[f], out item)) { 583 var dItem = item as DoubleValue; 584 if (dItem != null) values[f].Add(dItem.Value); 585 else { 586 var iItem = item as IntValue; 587 if (iItem != null) values[f].Add(iItem.Value); 588 } 589 } 590 } 591 } 592 return values.Select(x => x.Count == 0 ? 0.0 : x.Median()).ToArray(); 593 } 594 595 public Dictionary<IRun, double[]> GetProblemCharacteristics(string[] characteristics) { 596 var map = ProblemInstances.Select((v, i) => new { Index = i, ProblemInstance = v }).ToDictionary(x => x.Index, x => x.ProblemInstance); 597 var instances = GetFeatures(ProblemInstances.ToArray(), characteristics); 598 var median = GetMedianValues(ProblemInstances.ToArray(), characteristics); 599 600 var allValues = instances.Select(x => x.Select((f, i) => new { Idx = i, Val = double.IsNaN(f) ? median[i] : f }).ToList()) 601 .SelectMany(x => x) 602 .GroupBy(x => x.Idx, x => x.Val) 603 .OrderBy(x => x.Key).ToList(); 604 var avg = allValues.Select(x => x.Average()).ToList(); 605 var stdev = allValues.Select(x => x.StandardDeviation()).ToList(); 606 607 // normalize characteristic values by transforming them to their z-score 608 foreach (var features in instances) { 609 for (var i = 0; i < features.Length; i++) { 610 if (double.IsNaN(features[i])) features[i] = median[i]; 611 if (stdev[i] > 0) features[i] = (features[i] - avg[i]) / stdev[i]; 612 } 613 } 614 return instances.Select((v, i) => new { ProblemInstance = map[i], Features = v }).ToDictionary(x => x.ProblemInstance, x => x.Features); 615 } 616 581 617 public Dictionary<IAlgorithm, double> GetAlgorithmPerformance(IRun problemInstance) { 582 618 if (!problemInstance.Parameters.ContainsKey("BestKnownQuality")) return new Dictionary<IAlgorithm, double>(); … … 586 622 .ToDictionary(x => x.Key, x => ExpectedRuntimeHelper.CalculateErt(x.ToList(), "QualityPerEvaluations", target, Maximization).ExpectedRuntime); 587 623 } 624 625 public Dictionary<IAlgorithm, List<IRun>> GetAlgorithmRuns(IRun problemInstance) { 626 return knowledgeBase.Where(x => ((StringValue)x.Parameters["Problem Name"]).Value == ((StringValue)problemInstance.Parameters["Problem Name"]).Value) 627 .GroupBy(x => algorithmId2AlgorithmInstanceMapping.GetByFirst(algorithmId2RunMapping.GetBySecond(x).Single())) 628 .ToDictionary(x => x.Key, x => x.ToList()); 629 } 588 630 589 631 public Dictionary<IAlgorithm, List<IRun>> GetKnowledgeBaseByAlgorithm() { … … 708 750 } 709 751 710 p rivatedouble GetTarget(double bestKnownQuality, bool maximization) {752 public double GetTarget(double bestKnownQuality, bool maximization) { 711 753 return bestKnownQuality * (maximization ? (1 - MinimumTarget.Value) : (1 + MinimumTarget.Value)); 712 754 } … … 817 859 818 860 public IEnumerable<Tuple<IAlgorithm, double>> GetAlgorithmInstanceRanking() { 819 return RecommendationModel.GetRanking( this);861 return RecommendationModel.GetRanking(ProblemInstances.Single(IsCurrentInstance)); 820 862 } 821 863 } -
branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem.Common/3.3/Recommenders/FixedRankModel.cs
r13787 r13791 26 26 namespace HeuristicLab.OptimizationExpertSystem.Common { 27 27 public class FixedRankModel : IRecommendationModel { 28 private List<Tuple<IAlgorithm, double>> ranking;28 private readonly List<Tuple<IAlgorithm, double>> ranking; 29 29 30 30 public FixedRankModel(IEnumerable<Tuple<IAlgorithm, double>> ranking) { … … 33 33 } 34 34 35 public IEnumerable<Tuple<IAlgorithm, double>> GetRanking(KnowledgeCenter kc) { 36 if (kc.Problem.ProblemId == -1) return new Tuple<IAlgorithm, double>[0]; 35 public IEnumerable<Tuple<IAlgorithm, double>> GetRanking(IRun problemInstance) { 37 36 return ranking; 38 37 } -
branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem.Common/3.3/Recommenders/KNearestNeighborModel.cs
r13787 r13791 20 20 #endregion 21 21 22 using HeuristicLab.Co mmon;22 using HeuristicLab.Collections; 23 23 using HeuristicLab.Optimization; 24 24 using System; … … 30 30 private readonly int K; 31 31 private readonly string[] characteristics; 32 private readonly Dictionary<IRun, Dictionary<IAlgorithm, double>> performance; 33 private readonly BidirectionalDictionary<int, IRun> problemInstanceMap; 34 private readonly double[] medianValues; 32 35 33 public KNearestNeighborModel(int k, string[] characteristics) {36 public KNearestNeighborModel(int k, Dictionary<IRun, Dictionary<IAlgorithm, double>> perfData, string[] characteristics) { 34 37 this.K = k; 38 this.performance = perfData; 35 39 this.characteristics = characteristics; 40 problemInstanceMap = new BidirectionalDictionary<int, IRun>(); 41 var i = 0; 42 foreach (var pi in perfData.Keys) { 43 problemInstanceMap.Add(i++, pi); 44 } 45 this.medianValues = KnowledgeCenter.GetMedianValues(perfData.Keys.OrderBy(problemInstanceMap.GetBySecond).ToArray(), characteristics); 36 46 } 37 47 38 public IEnumerable<Tuple<IAlgorithm, double>> GetRanking(KnowledgeCenter kc) { 39 var distances = kc.GetProblemDistances(characteristics); 48 public IEnumerable<Tuple<IAlgorithm, double>> GetRanking(IRun problemInstance) { 49 var features = KnowledgeCenter.GetFeatures(performance.Keys.OrderBy(problemInstanceMap.GetBySecond).ToArray(), characteristics, medianValues); 50 var feature = KnowledgeCenter.GetFeatures(new [] { problemInstance }, characteristics, medianValues)[0]; 51 var nearestK = features.Select((f, i) => new { ProblemInstanceIndex = i, Feature = f }) 52 .OrderBy(x => x.Feature.Select((f, i) => (f - feature[i]) * (f - feature[i])).Sum()) 53 .Take(K); 54 40 55 var performances = new Dictionary<IAlgorithm, List<double>>(); 41 for (var k = 0; k < K; k++) { 42 if (distances.Count == 0) break; 43 var min = distances.MinItems(x => x.Value).First(); 44 // lookup algorithm performances in min 45 var perfs = kc.GetAlgorithmPerformance(min.Key); 46 if (perfs.Count == 0) { 47 k--; 48 continue; 49 } 56 foreach (var next in nearestK) { 57 var perfs = performance[problemInstanceMap.GetByFirst(next.ProblemInstanceIndex)]; 58 if (perfs.Count == 0) continue; 59 50 60 foreach (var p in perfs) { 51 61 var ert = p.Value; … … 56 66 } else erts.Add(ert); 57 67 } 58 distances.Remove(min.Key);59 68 } 60 69 -
branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem.Common/3.3/Recommenders/KNearestNeighborRecommender.cs
r13787 r13791 23 23 using HeuristicLab.Core; 24 24 using HeuristicLab.Data; 25 using HeuristicLab.Optimization; 25 26 using HeuristicLab.Parameters; 26 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 28 using System.Linq; 27 29 28 30 namespace HeuristicLab.OptimizationExpertSystem.Common { … … 37 39 [StorableConstructor] 38 40 private KNearestNeighborRecommender(bool deserializing) : base(deserializing) { } 39 private KNearestNeighborRecommender(KNearestNeighborRecommender original, Cloner cloner) 40 : base(original, cloner) { } 41 private KNearestNeighborRecommender(KNearestNeighborRecommender original, Cloner cloner) : base(original, cloner) { } 41 42 public KNearestNeighborRecommender() { 42 Parameters.Add(new FixedValueParameter<IntValue>("K", "The number of nearest neighbors to consider.", new IntValue( 5)));43 Parameters.Add(new FixedValueParameter<IntValue>("K", "The number of nearest neighbors to consider.", new IntValue(3))); 43 44 } 44 45 … … 47 48 } 48 49 49 public IRecommendationModel TrainModel(KnowledgeCenter kc, string[] characteristics) { 50 return new KNearestNeighborModel(KParameter.Value.Value, characteristics); 50 public IRecommendationModel TrainModel(IRun[] problemInstances, KnowledgeCenter kc, string[] characteristics) { 51 var perfData = problemInstances.Select(pi => new { ProblemInstance = pi, Performance = kc.GetAlgorithmPerformance(pi) }) 52 .ToDictionary(x => x.ProblemInstance, x => x.Performance); 53 return new KNearestNeighborModel(KParameter.Value.Value, perfData, characteristics); 51 54 } 52 55 } -
branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem.Common/3.3/Recommenders/OverallBestRecommender.cs
r13787 r13791 25 25 using HeuristicLab.Data; 26 26 using HeuristicLab.Optimization; 27 using HeuristicLab.Parameters;28 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 29 28 using System; … … 39 38 get { return (IFixedValueParameter<DoubleValue>)Parameters["NeighborhoodFactor"]; } 40 39 } 41 42 public double NeighborhoodFactor {43 get { return NeighborhoodFactorParameter.Value.Value; }44 set { NeighborhoodFactorParameter.Value.Value = value; }45 }46 40 47 41 [StorableConstructor] 48 42 private OverallBestRecommender(bool deserializing) : base(deserializing) { } 49 private OverallBestRecommender(OverallBestRecommender original, Cloner cloner) 50 : base(original, cloner) { } 51 public OverallBestRecommender() { 52 Parameters.Add(new FixedValueParameter<DoubleValue>("NeighborhoodFactor", "Penalize neighbors that are far away.", new DoubleValue(5))); 53 } 43 private OverallBestRecommender(OverallBestRecommender original, Cloner cloner) : base(original, cloner) { } 44 public OverallBestRecommender() { } 54 45 55 46 public override IDeepCloneable Clone(Cloner cloner) { … … 57 48 } 58 49 59 public IRecommendationModel TrainModel( KnowledgeCenter kc, string[] characteristics) {50 public IRecommendationModel TrainModel(IRun[] problemInstances, KnowledgeCenter kc, string[] characteristics) { 60 51 var instances = new List<Tuple<IAlgorithm, double>>(); 61 52 foreach (var relevantRuns in kc.GetKnowledgeBaseByAlgorithm()) { 62 53 var algorithm = relevantRuns.Key; 63 54 var pis = relevantRuns.Value.Select(x => ((StringValue)x.Parameters["Problem Name"]).Value).Distinct() 64 .Select(x => Tuple.Create(x, kc.ProblemInstances.SingleOrDefault(y => ((StringValue)y.Parameters["Problem Name"]).Value == x)))55 .Select(x => Tuple.Create(x, problemInstances.SingleOrDefault(y => ((StringValue)y.Parameters["Problem Name"]).Value == x))) 65 56 .Where(x => x.Item2 != null) 66 57 .Select(x => Tuple.Create(x.Item1, ((DoubleValue)x.Item2.Parameters["BestKnownQuality"]).Value)) … … 70 61 foreach (var problemRuns in relevantRuns.Value.GroupBy(x => ((StringValue)x.Parameters["Problem Name"]).Value)) { 71 62 var bkq = pis[problemRuns.Key]; 72 var ert = ExpectedRuntimeHelper.CalculateErt(problemRuns.ToList(), "QualityPerEvaluations", (kc.Maximization ? (1 - kc.MinimumTarget.Value) : (1 + kc.MinimumTarget.Value)) * bkq, kc.Maximization).ExpectedRuntime;63 var ert = ExpectedRuntimeHelper.CalculateErt(problemRuns.ToList(), "QualityPerEvaluations", kc.GetTarget(bkq, kc.Maximization), kc.Maximization).ExpectedRuntime; 73 64 if (double.IsNaN(ert)) ert = int.MaxValue; 74 65 avgERT += ert; -
branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem/3.3/Menu/100_Understanding/110_ProblemInstanceMenuItem.cs
r13720 r13791 28 28 namespace HeuristicLab.OptimizationExpertSystem.Menu { 29 29 internal class ProblemInstanceMenuItem : MenuItemBase { 30 public override Image Image { get { return VSImageLibrary. Statistics; } }30 public override Image Image { get { return VSImageLibrary.RadialChart; } } 31 31 32 32 public override string Name { -
branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem/3.3/Menu/200_Solving/210_PerformanceModelingMenuItem.cs
r13787 r13791 28 28 namespace HeuristicLab.OptimizationExpertSystem.Menu { 29 29 internal class PerformanceModelingMenuItem : MenuItemBase { 30 public override Image Image { get { return VSImageLibrary. Event; } }30 public override Image Image { get { return VSImageLibrary.Graph; } } 31 31 32 32 public override string Name { -
branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem/3.3/Views/PerformanceModelingView.Designer.cs
r13787 r13791 50 50 this.tabControl = new System.Windows.Forms.TabControl(); 51 51 this.characteristicsTabPage = new System.Windows.Forms.TabPage(); 52 this.characteristicsViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost(); 52 53 this.refreshCharacteristicsButton = new System.Windows.Forms.Button(); 53 54 this.parametersTabPage = new System.Windows.Forms.TabPage(); 54 55 this.parameterCollectionView = new HeuristicLab.Core.Views.ParameterCollectionView(); 55 this.resultsTabPage = new System.Windows.Forms.TabPage(); 56 this.characteristicsViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost(); 56 this.crossvalidationTabPage = new System.Windows.Forms.TabPage(); 57 this.xValidateButton = new System.Windows.Forms.Button(); 58 this.minTargetView = new HeuristicLab.Data.Views.StringConvertibleValueView(); 59 this.minimumTargetLabel = new System.Windows.Forms.Label(); 57 60 this.tabControl.SuspendLayout(); 58 61 this.characteristicsTabPage.SuspendLayout(); 59 62 this.parametersTabPage.SuspendLayout(); 63 this.crossvalidationTabPage.SuspendLayout(); 60 64 this.SuspendLayout(); 61 65 // … … 77 81 this.recommenderComboBox.Location = new System.Drawing.Point(90, 3); 78 82 this.recommenderComboBox.Name = "recommenderComboBox"; 79 this.recommenderComboBox.Size = new System.Drawing.Size(2 64, 21);83 this.recommenderComboBox.Size = new System.Drawing.Size(206, 21); 80 84 this.recommenderComboBox.TabIndex = 11; 81 85 this.recommenderComboBox.SelectedIndexChanged += new System.EventHandler(this.RecommenderComboBoxOnSelectedIndexChanged); … … 84 88 // 85 89 this.recommendStartButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); 86 this.recommendStartButton.Location = new System.Drawing.Point( 360, 3);90 this.recommendStartButton.Location = new System.Drawing.Point(442, 1); 87 91 this.recommendStartButton.Name = "recommendStartButton"; 88 92 this.recommendStartButton.Size = new System.Drawing.Size(26, 23); … … 99 103 this.tabControl.Controls.Add(this.characteristicsTabPage); 100 104 this.tabControl.Controls.Add(this.parametersTabPage); 101 this.tabControl.Controls.Add(this. resultsTabPage);105 this.tabControl.Controls.Add(this.crossvalidationTabPage); 102 106 this.tabControl.Location = new System.Drawing.Point(0, 30); 103 107 this.tabControl.Name = "tabControl"; … … 117 121 this.characteristicsTabPage.Text = "Characteristics"; 118 122 this.characteristicsTabPage.UseVisualStyleBackColor = true; 119 //120 // refreshCharacteristicsButton121 //122 this.refreshCharacteristicsButton.Location = new System.Drawing.Point(6, 6);123 this.refreshCharacteristicsButton.Name = "refreshCharacteristicsButton";124 this.refreshCharacteristicsButton.Size = new System.Drawing.Size(26, 23);125 this.refreshCharacteristicsButton.TabIndex = 0;126 this.refreshCharacteristicsButton.Text = "Refresh";127 this.refreshCharacteristicsButton.UseVisualStyleBackColor = true;128 this.refreshCharacteristicsButton.Click += new System.EventHandler(this.RefreshCharacteristicsButtonOnClick);129 //130 // parametersTabPage131 //132 this.parametersTabPage.Controls.Add(this.parameterCollectionView);133 this.parametersTabPage.Location = new System.Drawing.Point(4, 22);134 this.parametersTabPage.Name = "parametersTabPage";135 this.parametersTabPage.Padding = new System.Windows.Forms.Padding(3);136 this.parametersTabPage.Size = new System.Drawing.Size(692, 324);137 this.parametersTabPage.TabIndex = 0;138 this.parametersTabPage.Text = "Parameters";139 this.parametersTabPage.UseVisualStyleBackColor = true;140 //141 // parameterCollectionView142 //143 this.parameterCollectionView.AllowEditingOfHiddenParameters = true;144 this.parameterCollectionView.Caption = "ParameterCollection View";145 this.parameterCollectionView.Content = null;146 this.parameterCollectionView.Dock = System.Windows.Forms.DockStyle.Fill;147 this.parameterCollectionView.Location = new System.Drawing.Point(3, 3);148 this.parameterCollectionView.Name = "parameterCollectionView";149 this.parameterCollectionView.ReadOnly = false;150 this.parameterCollectionView.ShowDetails = true;151 this.parameterCollectionView.Size = new System.Drawing.Size(686, 318);152 this.parameterCollectionView.TabIndex = 0;153 //154 // resultsTabPage155 //156 this.resultsTabPage.Location = new System.Drawing.Point(4, 22);157 this.resultsTabPage.Name = "resultsTabPage";158 this.resultsTabPage.Padding = new System.Windows.Forms.Padding(3);159 this.resultsTabPage.Size = new System.Drawing.Size(692, 324);160 this.resultsTabPage.TabIndex = 1;161 this.resultsTabPage.Text = "Results";162 this.resultsTabPage.UseVisualStyleBackColor = true;163 123 // 164 124 // characteristicsViewHost … … 178 138 this.characteristicsViewHost.ViewType = null; 179 139 // 140 // refreshCharacteristicsButton 141 // 142 this.refreshCharacteristicsButton.Location = new System.Drawing.Point(6, 6); 143 this.refreshCharacteristicsButton.Name = "refreshCharacteristicsButton"; 144 this.refreshCharacteristicsButton.Size = new System.Drawing.Size(26, 23); 145 this.refreshCharacteristicsButton.TabIndex = 0; 146 this.refreshCharacteristicsButton.Text = "Refresh"; 147 this.refreshCharacteristicsButton.UseVisualStyleBackColor = true; 148 this.refreshCharacteristicsButton.Click += new System.EventHandler(this.RefreshCharacteristicsButtonOnClick); 149 // 150 // parametersTabPage 151 // 152 this.parametersTabPage.Controls.Add(this.parameterCollectionView); 153 this.parametersTabPage.Location = new System.Drawing.Point(4, 22); 154 this.parametersTabPage.Name = "parametersTabPage"; 155 this.parametersTabPage.Padding = new System.Windows.Forms.Padding(3); 156 this.parametersTabPage.Size = new System.Drawing.Size(692, 324); 157 this.parametersTabPage.TabIndex = 0; 158 this.parametersTabPage.Text = "Parameters"; 159 this.parametersTabPage.UseVisualStyleBackColor = true; 160 // 161 // parameterCollectionView 162 // 163 this.parameterCollectionView.AllowEditingOfHiddenParameters = true; 164 this.parameterCollectionView.Caption = "ParameterCollection View"; 165 this.parameterCollectionView.Content = null; 166 this.parameterCollectionView.Dock = System.Windows.Forms.DockStyle.Fill; 167 this.parameterCollectionView.Location = new System.Drawing.Point(3, 3); 168 this.parameterCollectionView.Name = "parameterCollectionView"; 169 this.parameterCollectionView.ReadOnly = false; 170 this.parameterCollectionView.ShowDetails = true; 171 this.parameterCollectionView.Size = new System.Drawing.Size(686, 318); 172 this.parameterCollectionView.TabIndex = 0; 173 // 174 // crossvalidationTabPage 175 // 176 this.crossvalidationTabPage.Controls.Add(this.xValidateButton); 177 this.crossvalidationTabPage.Location = new System.Drawing.Point(4, 22); 178 this.crossvalidationTabPage.Name = "crossvalidationTabPage"; 179 this.crossvalidationTabPage.Padding = new System.Windows.Forms.Padding(3); 180 this.crossvalidationTabPage.Size = new System.Drawing.Size(692, 324); 181 this.crossvalidationTabPage.TabIndex = 1; 182 this.crossvalidationTabPage.Text = "Crossvalidation"; 183 this.crossvalidationTabPage.UseVisualStyleBackColor = true; 184 // 185 // xValidateButton 186 // 187 this.xValidateButton.Location = new System.Drawing.Point(7, 7); 188 this.xValidateButton.Name = "xValidateButton"; 189 this.xValidateButton.Size = new System.Drawing.Size(163, 23); 190 this.xValidateButton.TabIndex = 0; 191 this.xValidateButton.Text = "X-Validate Leave One Out"; 192 this.xValidateButton.UseVisualStyleBackColor = true; 193 this.xValidateButton.Click += new System.EventHandler(this.xValidateButton_Click); 194 // 195 // minTargetView 196 // 197 this.minTargetView.Caption = "StringConvertibleValue View"; 198 this.minTargetView.Content = null; 199 this.minTargetView.LabelVisible = false; 200 this.minTargetView.Location = new System.Drawing.Point(350, 3); 201 this.minTargetView.Name = "minTargetView"; 202 this.minTargetView.ReadOnly = false; 203 this.minTargetView.Size = new System.Drawing.Size(86, 21); 204 this.minTargetView.TabIndex = 18; 205 // 206 // minimumTargetLabel 207 // 208 this.minimumTargetLabel.AutoSize = true; 209 this.minimumTargetLabel.Location = new System.Drawing.Point(311, 6); 210 this.minimumTargetLabel.Name = "minimumTargetLabel"; 211 this.minimumTargetLabel.Size = new System.Drawing.Size(41, 13); 212 this.minimumTargetLabel.TabIndex = 17; 213 this.minimumTargetLabel.Text = "Target:"; 214 // 180 215 // PerformanceModelingView 181 216 // 182 217 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 183 218 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 219 this.Controls.Add(this.minimumTargetLabel); 220 this.Controls.Add(this.minTargetView); 184 221 this.Controls.Add(this.tabControl); 185 222 this.Controls.Add(this.recommenderLabel); … … 190 227 this.characteristicsTabPage.ResumeLayout(false); 191 228 this.parametersTabPage.ResumeLayout(false); 229 this.crossvalidationTabPage.ResumeLayout(false); 192 230 this.ResumeLayout(false); 193 231 this.PerformLayout(); … … 202 240 private System.Windows.Forms.TabControl tabControl; 203 241 private System.Windows.Forms.TabPage parametersTabPage; 204 private System.Windows.Forms.TabPage resultsTabPage;242 private System.Windows.Forms.TabPage crossvalidationTabPage; 205 243 private Core.Views.ParameterCollectionView parameterCollectionView; 206 244 private System.Windows.Forms.TabPage characteristicsTabPage; 207 245 private System.Windows.Forms.Button refreshCharacteristicsButton; 208 246 private MainForm.WindowsForms.ViewHost characteristicsViewHost; 247 private System.Windows.Forms.Button xValidateButton; 248 private Data.Views.StringConvertibleValueView minTargetView; 249 private System.Windows.Forms.Label minimumTargetLabel; 209 250 } 210 251 } -
branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem/3.3/Views/PerformanceModelingView.cs
r13787 r13791 24 24 using HeuristicLab.Data; 25 25 using HeuristicLab.MainForm; 26 using HeuristicLab.Optimization; 26 27 using HeuristicLab.OptimizationExpertSystem.Common; 27 28 using HeuristicLab.PluginInfrastructure; … … 50 51 protected override void OnContentChanged() { 51 52 base.OnContentChanged(); 53 if (Content == null) { 54 minTargetView.Content = null; 55 } else { 56 minTargetView.Content = Content.MinimumTarget; 57 } 52 58 UpdateCharacteristics(); 53 59 } … … 58 64 recommendStartButton.Enabled = Content != null && recommenderComboBox.SelectedIndex >= 0 && characteristics.CheckedItems.Any(); 59 65 characteristicsViewHost.Enabled = Content != null; 66 xValidateButton.Enabled = Content != null && recommenderComboBox.SelectedIndex >= 0 && characteristics.CheckedItems.Any(); 60 67 } 61 68 … … 82 89 83 90 var @checked = new HashSet<string>(characteristics.CheckedItems.Select(x => x.Value.Value)); 91 if (@checked.Count == 0 && Content.ProblemInstances.ResultNames.Any(x => x.StartsWith("Characteristic."))) 92 @checked = new HashSet<string>(Content.ProblemInstances.ResultNames.Where(x => x.StartsWith("Characteristic."))); 93 84 94 characteristics.Clear(); 85 95 if (Content == null || Content.ProblemInstances.Count == 0) return; … … 109 119 private void RecommendStartButtonOnClick(object sender, EventArgs e) { 110 120 var rcmd = (IAlgorithmInstanceRecommender)recommenderComboBox.SelectedItem; 111 Content.RecommendationModel = rcmd.TrainModel(Content, characteristics.CheckedItems.Select(x => x.Value.Value).ToArray()); 121 var trainingSet = Content.ProblemInstances.Where(x => !Content.IsCurrentInstance(x)).ToArray(); 122 Content.RecommendationModel = rcmd.TrainModel(trainingSet, Content, characteristics.CheckedItems.Select(x => x.Value.Value).ToArray()); 112 123 } 113 124 … … 115 126 UpdateCharacteristics(); 116 127 SetEnabledStateOfControls(); 128 } 129 130 private void xValidateButton_Click(object sender, EventArgs e) { 131 var recommender = (IAlgorithmInstanceRecommender)recommenderComboBox.SelectedItem; 132 var features = characteristics.CheckedItems.Select(x => x.Value.Value).ToArray(); 133 134 var trainingSet = Content.ProblemInstances.Where(x => !Content.IsCurrentInstance(x)).ToArray(); 135 136 // leave one out crossvalidation 137 foreach (var pi in trainingSet) { 138 var model = recommender.TrainModel(trainingSet.Where(x => x != pi).ToArray(), Content, features); 139 var ranking = model.GetRanking(pi).ToList(); 140 var realPerformance = Content.GetAlgorithmPerformance(pi); 141 // absolute error predicting ert 142 // confusion matrix predicting class 143 // Kendall's tau 144 // average NCDG ... relevance determined by clustering (unsuccessful algorithms being penalized with negative relevance) 145 // mean reciprocal rank 146 // optional: expected reciprocal rank 147 } 148 } 149 150 private static double AbsoluteError(Dictionary<IAlgorithm, double> performance, List<Tuple<IAlgorithm, double>> ranking) { 151 var error = 0.0; 152 foreach (var tuple in ranking) { 153 double actual; 154 if (!performance.TryGetValue(tuple.Item1, out actual)) continue; 155 error += Math.Abs(actual - tuple.Item2); 156 } 157 return error; 158 } 159 160 private static int[,] ConfusionMatrix(Dictionary<IAlgorithm, double> performance, List<Tuple<IAlgorithm, double>> ranking) { 161 var confMatrix = new int[5,5]; 162 return confMatrix; 117 163 } 118 164 #endregion -
branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem/3.3/Views/SolverView.Designer.cs
r13787 r13791 45 45 /// </summary> 46 46 private void InitializeComponent() { 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 this.minTargetView = new HeuristicLab.Data.Views.StringConvertibleValueView(); 47 WeifenLuo.WinFormsUI.Docking.DockPanelSkin dockPanelSkin1 = new WeifenLuo.WinFormsUI.Docking.DockPanelSkin(); 48 WeifenLuo.WinFormsUI.Docking.AutoHideStripSkin autoHideStripSkin1 = new WeifenLuo.WinFormsUI.Docking.AutoHideStripSkin(); 49 WeifenLuo.WinFormsUI.Docking.DockPanelGradient dockPanelGradient1 = new WeifenLuo.WinFormsUI.Docking.DockPanelGradient(); 50 WeifenLuo.WinFormsUI.Docking.TabGradient tabGradient1 = new WeifenLuo.WinFormsUI.Docking.TabGradient(); 51 WeifenLuo.WinFormsUI.Docking.DockPaneStripSkin dockPaneStripSkin1 = new WeifenLuo.WinFormsUI.Docking.DockPaneStripSkin(); 52 WeifenLuo.WinFormsUI.Docking.DockPaneStripGradient dockPaneStripGradient1 = new WeifenLuo.WinFormsUI.Docking.DockPaneStripGradient(); 53 WeifenLuo.WinFormsUI.Docking.TabGradient tabGradient2 = new WeifenLuo.WinFormsUI.Docking.TabGradient(); 54 WeifenLuo.WinFormsUI.Docking.DockPanelGradient dockPanelGradient2 = new WeifenLuo.WinFormsUI.Docking.DockPanelGradient(); 55 WeifenLuo.WinFormsUI.Docking.TabGradient tabGradient3 = new WeifenLuo.WinFormsUI.Docking.TabGradient(); 56 WeifenLuo.WinFormsUI.Docking.DockPaneStripToolWindowGradient dockPaneStripToolWindowGradient1 = new WeifenLuo.WinFormsUI.Docking.DockPaneStripToolWindowGradient(); 57 WeifenLuo.WinFormsUI.Docking.TabGradient tabGradient4 = new WeifenLuo.WinFormsUI.Docking.TabGradient(); 58 WeifenLuo.WinFormsUI.Docking.TabGradient tabGradient5 = new WeifenLuo.WinFormsUI.Docking.TabGradient(); 59 WeifenLuo.WinFormsUI.Docking.DockPanelGradient dockPanelGradient3 = new WeifenLuo.WinFormsUI.Docking.DockPanelGradient(); 60 WeifenLuo.WinFormsUI.Docking.TabGradient tabGradient6 = new WeifenLuo.WinFormsUI.Docking.TabGradient(); 61 WeifenLuo.WinFormsUI.Docking.TabGradient tabGradient7 = new WeifenLuo.WinFormsUI.Docking.TabGradient(); 63 62 this.maxEvaluationsView = new HeuristicLab.Data.Views.StringConvertibleValueView(); 64 63 this.algorithmCloneButton = new System.Windows.Forms.Button(); 65 64 this.seedingStrategyPanel = new System.Windows.Forms.Panel(); 66 65 this.algorithmStartButton = new System.Windows.Forms.Button(); 67 this.minimumTargetLabel = new System.Windows.Forms.Label();68 66 this.seedingStrategyLabel = new System.Windows.Forms.Label(); 69 67 this.evaluationsLimitabel = new System.Windows.Forms.Label(); … … 91 89 this.SuspendLayout(); 92 90 // 93 // minTargetView94 //95 this.minTargetView.Caption = "StringConvertibleValue View";96 this.minTargetView.Content = null;97 this.minTargetView.LabelVisible = false;98 this.minTargetView.Location = new System.Drawing.Point(431, 3);99 this.minTargetView.Name = "minTargetView";100 this.minTargetView.ReadOnly = false;101 this.minTargetView.Size = new System.Drawing.Size(255, 21);102 this.minTargetView.TabIndex = 16;103 //104 91 // maxEvaluationsView 105 92 // … … 142 129 this.algorithmStartButton.Click += new System.EventHandler(this.AlgorithmStartButtonOnClick); 143 130 // 144 // minimumTargetLabel145 //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 131 // seedingStrategyLabel 154 132 // … … 190 168 // solverTabControl 191 169 // 170 this.solverTabControl.AllowDrop = true; 192 171 this.solverTabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 193 172 | System.Windows.Forms.AnchorStyles.Left) … … 238 217 this.resultsDockPanel.Name = "resultsDockPanel"; 239 218 this.resultsDockPanel.Size = new System.Drawing.Size(829, 421); 240 dockPanelGradient1 0.EndColor = System.Drawing.SystemColors.ControlLight;241 dockPanelGradient1 0.StartColor = System.Drawing.SystemColors.ControlLight;242 autoHideStripSkin 4.DockStripGradient = dockPanelGradient10;243 tabGradient 22.EndColor = System.Drawing.SystemColors.Control;244 tabGradient 22.StartColor = System.Drawing.SystemColors.Control;245 tabGradient 22.TextColor = System.Drawing.SystemColors.ControlDarkDark;246 autoHideStripSkin 4.TabGradient = tabGradient22;247 autoHideStripSkin 4.TextFont = new System.Drawing.Font("Segoe UI", 9F);248 dockPanelSkin 4.AutoHideStripSkin = autoHideStripSkin4;249 tabGradient2 3.EndColor = System.Drawing.SystemColors.ControlLightLight;250 tabGradient2 3.StartColor = System.Drawing.SystemColors.ControlLightLight;251 tabGradient2 3.TextColor = System.Drawing.SystemColors.ControlText;252 dockPaneStripGradient 4.ActiveTabGradient = tabGradient23;253 dockPanelGradient 11.EndColor = System.Drawing.SystemColors.Control;254 dockPanelGradient 11.StartColor = System.Drawing.SystemColors.Control;255 dockPaneStripGradient 4.DockStripGradient = dockPanelGradient11;256 tabGradient 24.EndColor = System.Drawing.SystemColors.ControlLight;257 tabGradient 24.StartColor = System.Drawing.SystemColors.ControlLight;258 tabGradient 24.TextColor = System.Drawing.SystemColors.ControlText;259 dockPaneStripGradient 4.InactiveTabGradient = tabGradient24;260 dockPaneStripSkin 4.DocumentGradient = dockPaneStripGradient4;261 dockPaneStripSkin 4.TextFont = new System.Drawing.Font("Segoe UI", 9F);262 tabGradient 25.EndColor = System.Drawing.SystemColors.ActiveCaption;263 tabGradient 25.LinearGradientMode = System.Drawing.Drawing2D.LinearGradientMode.Vertical;264 tabGradient 25.StartColor = System.Drawing.SystemColors.GradientActiveCaption;265 tabGradient 25.TextColor = System.Drawing.SystemColors.ActiveCaptionText;266 dockPaneStripToolWindowGradient 4.ActiveCaptionGradient = tabGradient25;267 tabGradient 26.EndColor = System.Drawing.SystemColors.Control;268 tabGradient 26.StartColor = System.Drawing.SystemColors.Control;269 tabGradient 26.TextColor = System.Drawing.SystemColors.ControlText;270 dockPaneStripToolWindowGradient 4.ActiveTabGradient = tabGradient26;271 dockPanelGradient 12.EndColor = System.Drawing.SystemColors.ControlLight;272 dockPanelGradient 12.StartColor = System.Drawing.SystemColors.ControlLight;273 dockPaneStripToolWindowGradient 4.DockStripGradient = dockPanelGradient12;274 tabGradient 27.EndColor = System.Drawing.SystemColors.InactiveCaption;275 tabGradient 27.LinearGradientMode = System.Drawing.Drawing2D.LinearGradientMode.Vertical;276 tabGradient 27.StartColor = System.Drawing.SystemColors.GradientInactiveCaption;277 tabGradient 27.TextColor = System.Drawing.SystemColors.InactiveCaptionText;278 dockPaneStripToolWindowGradient 4.InactiveCaptionGradient = tabGradient27;279 tabGradient 28.EndColor = System.Drawing.Color.Transparent;280 tabGradient 28.StartColor = System.Drawing.Color.Transparent;281 tabGradient 28.TextColor = System.Drawing.SystemColors.ControlDarkDark;282 dockPaneStripToolWindowGradient 4.InactiveTabGradient = tabGradient28;283 dockPaneStripSkin 4.ToolWindowGradient = dockPaneStripToolWindowGradient4;284 dockPanelSkin 4.DockPaneStripSkin = dockPaneStripSkin4;285 this.resultsDockPanel.Skin = dockPanelSkin 4;219 dockPanelGradient1.EndColor = System.Drawing.SystemColors.ControlLight; 220 dockPanelGradient1.StartColor = System.Drawing.SystemColors.ControlLight; 221 autoHideStripSkin1.DockStripGradient = dockPanelGradient1; 222 tabGradient1.EndColor = System.Drawing.SystemColors.Control; 223 tabGradient1.StartColor = System.Drawing.SystemColors.Control; 224 tabGradient1.TextColor = System.Drawing.SystemColors.ControlDarkDark; 225 autoHideStripSkin1.TabGradient = tabGradient1; 226 autoHideStripSkin1.TextFont = new System.Drawing.Font("Segoe UI", 9F); 227 dockPanelSkin1.AutoHideStripSkin = autoHideStripSkin1; 228 tabGradient2.EndColor = System.Drawing.SystemColors.ControlLightLight; 229 tabGradient2.StartColor = System.Drawing.SystemColors.ControlLightLight; 230 tabGradient2.TextColor = System.Drawing.SystemColors.ControlText; 231 dockPaneStripGradient1.ActiveTabGradient = tabGradient2; 232 dockPanelGradient2.EndColor = System.Drawing.SystemColors.Control; 233 dockPanelGradient2.StartColor = System.Drawing.SystemColors.Control; 234 dockPaneStripGradient1.DockStripGradient = dockPanelGradient2; 235 tabGradient3.EndColor = System.Drawing.SystemColors.ControlLight; 236 tabGradient3.StartColor = System.Drawing.SystemColors.ControlLight; 237 tabGradient3.TextColor = System.Drawing.SystemColors.ControlText; 238 dockPaneStripGradient1.InactiveTabGradient = tabGradient3; 239 dockPaneStripSkin1.DocumentGradient = dockPaneStripGradient1; 240 dockPaneStripSkin1.TextFont = new System.Drawing.Font("Segoe UI", 9F); 241 tabGradient4.EndColor = System.Drawing.SystemColors.ActiveCaption; 242 tabGradient4.LinearGradientMode = System.Drawing.Drawing2D.LinearGradientMode.Vertical; 243 tabGradient4.StartColor = System.Drawing.SystemColors.GradientActiveCaption; 244 tabGradient4.TextColor = System.Drawing.SystemColors.ActiveCaptionText; 245 dockPaneStripToolWindowGradient1.ActiveCaptionGradient = tabGradient4; 246 tabGradient5.EndColor = System.Drawing.SystemColors.Control; 247 tabGradient5.StartColor = System.Drawing.SystemColors.Control; 248 tabGradient5.TextColor = System.Drawing.SystemColors.ControlText; 249 dockPaneStripToolWindowGradient1.ActiveTabGradient = tabGradient5; 250 dockPanelGradient3.EndColor = System.Drawing.SystemColors.ControlLight; 251 dockPanelGradient3.StartColor = System.Drawing.SystemColors.ControlLight; 252 dockPaneStripToolWindowGradient1.DockStripGradient = dockPanelGradient3; 253 tabGradient6.EndColor = System.Drawing.SystemColors.InactiveCaption; 254 tabGradient6.LinearGradientMode = System.Drawing.Drawing2D.LinearGradientMode.Vertical; 255 tabGradient6.StartColor = System.Drawing.SystemColors.GradientInactiveCaption; 256 tabGradient6.TextColor = System.Drawing.SystemColors.InactiveCaptionText; 257 dockPaneStripToolWindowGradient1.InactiveCaptionGradient = tabGradient6; 258 tabGradient7.EndColor = System.Drawing.Color.Transparent; 259 tabGradient7.StartColor = System.Drawing.Color.Transparent; 260 tabGradient7.TextColor = System.Drawing.SystemColors.ControlDarkDark; 261 dockPaneStripToolWindowGradient1.InactiveTabGradient = tabGradient7; 262 dockPaneStripSkin1.ToolWindowGradient = dockPaneStripToolWindowGradient1; 263 dockPanelSkin1.DockPaneStripSkin = dockPaneStripSkin1; 264 this.resultsDockPanel.Skin = dockPanelSkin1; 286 265 this.resultsDockPanel.TabIndex = 0; 287 266 // … … 292 271 this.runsTabPage.Name = "runsTabPage"; 293 272 this.runsTabPage.Padding = new System.Windows.Forms.Padding(3); 294 this.runsTabPage.Size = new System.Drawing.Size( 548, 418);273 this.runsTabPage.Size = new System.Drawing.Size(835, 453); 295 274 this.runsTabPage.TabIndex = 4; 296 275 this.runsTabPage.Text = "Runs"; … … 305 284 this.runsView.Name = "runsView"; 306 285 this.runsView.ReadOnly = false; 307 this.runsView.Size = new System.Drawing.Size( 542, 412);286 this.runsView.Size = new System.Drawing.Size(829, 447); 308 287 this.runsView.TabIndex = 0; 309 288 // … … 314 293 this.seededRunsTabPage.Name = "seededRunsTabPage"; 315 294 this.seededRunsTabPage.Padding = new System.Windows.Forms.Padding(3); 316 this.seededRunsTabPage.Size = new System.Drawing.Size( 548, 418);295 this.seededRunsTabPage.Size = new System.Drawing.Size(835, 453); 317 296 this.seededRunsTabPage.TabIndex = 5; 318 297 this.seededRunsTabPage.Text = "Seeded Runs"; … … 327 306 this.seededRunsView.Name = "seededRunsView"; 328 307 this.seededRunsView.ReadOnly = false; 329 this.seededRunsView.Size = new System.Drawing.Size( 542, 412);308 this.seededRunsView.Size = new System.Drawing.Size(829, 447); 330 309 this.seededRunsView.TabIndex = 1; 331 310 // … … 335 314 this.solutionSeedingTabPage.Name = "solutionSeedingTabPage"; 336 315 this.solutionSeedingTabPage.Padding = new System.Windows.Forms.Padding(3); 337 this.solutionSeedingTabPage.Size = new System.Drawing.Size( 548, 418);316 this.solutionSeedingTabPage.Size = new System.Drawing.Size(835, 453); 338 317 this.solutionSeedingTabPage.TabIndex = 1; 339 318 this.solutionSeedingTabPage.Text = "Seeding Pool"; … … 346 325 this.parametersTabPage.Name = "parametersTabPage"; 347 326 this.parametersTabPage.Padding = new System.Windows.Forms.Padding(3); 348 this.parametersTabPage.Size = new System.Drawing.Size( 548, 418);327 this.parametersTabPage.Size = new System.Drawing.Size(835, 453); 349 328 this.parametersTabPage.TabIndex = 0; 350 329 this.parametersTabPage.Text = "Parameters"; … … 361 340 this.solverParametersView.ReadOnly = true; 362 341 this.solverParametersView.ShowDetails = true; 363 this.solverParametersView.Size = new System.Drawing.Size( 542, 412);342 this.solverParametersView.Size = new System.Drawing.Size(829, 447); 364 343 this.solverParametersView.TabIndex = 0; 365 344 // … … 370 349 this.operatorGraphTabPage.Name = "operatorGraphTabPage"; 371 350 this.operatorGraphTabPage.Padding = new System.Windows.Forms.Padding(3); 372 this.operatorGraphTabPage.Size = new System.Drawing.Size( 548, 418);351 this.operatorGraphTabPage.Size = new System.Drawing.Size(835, 453); 373 352 this.operatorGraphTabPage.TabIndex = 3; 374 353 this.operatorGraphTabPage.Text = "Operator Graph"; … … 384 363 this.operatorGraphViewHost.Name = "operatorGraphViewHost"; 385 364 this.operatorGraphViewHost.ReadOnly = true; 386 this.operatorGraphViewHost.Size = new System.Drawing.Size( 542, 412);365 this.operatorGraphViewHost.Size = new System.Drawing.Size(829, 447); 387 366 this.operatorGraphViewHost.TabIndex = 0; 388 367 this.operatorGraphViewHost.ViewsLabelVisible = true; … … 397 376 this.Controls.Add(this.instanceLabel); 398 377 this.Controls.Add(this.algorithmStartButton); 399 this.Controls.Add(this.minTargetView);400 378 this.Controls.Add(this.maxEvaluationsView); 401 379 this.Controls.Add(this.suggestedInstancesComboBox); 402 380 this.Controls.Add(this.seedingStrategyPanel); 403 this.Controls.Add(this.minimumTargetLabel);404 381 this.Controls.Add(this.seedingStrategyLabel); 405 382 this.Controls.Add(this.evaluationsLimitabel); … … 427 404 private System.Windows.Forms.Button algorithmCloneButton; 428 405 private Data.Views.StringConvertibleValueView maxEvaluationsView; 429 private System.Windows.Forms.Label minimumTargetLabel;430 private Data.Views.StringConvertibleValueView minTargetView;431 406 private System.Windows.Forms.Label instanceLabel; 432 407 private MainForm.WindowsForms.DragOverTabControl solverTabControl; -
branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem/3.3/Views/SolverView.cs
r13787 r13791 61 61 if (Content == null) { 62 62 maxEvaluationsView.Content = null; 63 minTargetView.Content = null;64 63 solverParametersView.Content = null; 65 64 runsView.Content = null; … … 69 68 } else { 70 69 maxEvaluationsView.Content = Content.MaximumEvaluations; 71 minTargetView.Content = Content.MinimumTarget;72 70 runsView.Content = Content.InstanceRuns; 73 71 seededRunsView.Content = Content.SeededRuns; … … 155 153 156 154 public override string ToString() { 157 return item.Item2.ToString(" F0") + ": " + item.Item1.Name;155 return item.Item2.ToString("N0") + ": " + item.Item1.Name; 158 156 } 159 157 } -
branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem/3.3/Views/UnderstandingProblemInstanceView.Designer.cs
r13757 r13791 54 54 this.mapSplitContainer = new System.Windows.Forms.SplitContainer(); 55 55 this.showCharacteristicsCheckBox = new System.Windows.Forms.CheckBox(); 56 this.fromZeroCheckBox = new System.Windows.Forms.CheckBox();57 56 this.invPropCheckBox = new System.Windows.Forms.CheckBox(); 57 this.colorLabel = new System.Windows.Forms.Label(); 58 58 this.sizeLabel = new System.Windows.Forms.Label(); 59 59 this.projectionLabel = new System.Windows.Forms.Label(); 60 60 this.instanceMapChart = new HeuristicLab.Visualization.ChartControlsExtensions.EnhancedChart(); 61 this.colorComboBox = new System.Windows.Forms.ComboBox(); 61 62 this.sizeComboBox = new System.Windows.Forms.ComboBox(); 62 63 this.projectionComboBox = new System.Windows.Forms.ComboBox(); 64 this.characteristicsPanel = new System.Windows.Forms.Panel(); 65 this.updateProjectionButton = new System.Windows.Forms.Button(); 63 66 this.instancesTabPage = new System.Windows.Forms.TabPage(); 64 67 this.problemInstancesView = new HeuristicLab.MainForm.WindowsForms.ViewHost(); 65 this.colorComboBox = new System.Windows.Forms.ComboBox();66 this.colorLabel = new System.Windows.Forms.Label();67 68 this.problemInstancesTabControl.SuspendLayout(); 68 69 this.mapTabPage.SuspendLayout(); 69 70 ((System.ComponentModel.ISupportInitialize)(this.mapSplitContainer)).BeginInit(); 70 71 this.mapSplitContainer.Panel1.SuspendLayout(); 72 this.mapSplitContainer.Panel2.SuspendLayout(); 71 73 this.mapSplitContainer.SuspendLayout(); 72 74 ((System.ComponentModel.ISupportInitialize)(this.instanceMapChart)).BeginInit(); … … 109 111 // 110 112 this.mapSplitContainer.Panel1.Controls.Add(this.showCharacteristicsCheckBox); 111 this.mapSplitContainer.Panel1.Controls.Add(this.fromZeroCheckBox);112 113 this.mapSplitContainer.Panel1.Controls.Add(this.invPropCheckBox); 113 114 this.mapSplitContainer.Panel1.Controls.Add(this.colorLabel); … … 119 120 this.mapSplitContainer.Panel1.Controls.Add(this.projectionComboBox); 120 121 this.mapSplitContainer.Panel1.Padding = new System.Windows.Forms.Padding(0, 3, 0, 0); 122 // 123 // mapSplitContainer.Panel2 124 // 125 this.mapSplitContainer.Panel2.Controls.Add(this.characteristicsPanel); 126 this.mapSplitContainer.Panel2.Controls.Add(this.updateProjectionButton); 121 127 this.mapSplitContainer.Panel2Collapsed = true; 122 128 this.mapSplitContainer.Size = new System.Drawing.Size(1094, 728); 123 this.mapSplitContainer.SplitterDistance = 84 7;129 this.mapSplitContainer.SplitterDistance = 843; 124 130 this.mapSplitContainer.TabIndex = 12; 125 131 // … … 135 141 this.showCharacteristicsCheckBox.UseVisualStyleBackColor = true; 136 142 this.showCharacteristicsCheckBox.CheckedChanged += new System.EventHandler(this.showCharacteristicsCheckBox_CheckedChanged); 137 //138 // fromZeroCheckBox139 //140 this.fromZeroCheckBox.AutoSize = true;141 this.fromZeroCheckBox.Checked = true;142 this.fromZeroCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;143 this.fromZeroCheckBox.Location = new System.Drawing.Point(639, 8);144 this.fromZeroCheckBox.Name = "fromZeroCheckBox";145 this.fromZeroCheckBox.Size = new System.Drawing.Size(69, 17);146 this.fromZeroCheckBox.TabIndex = 17;147 this.fromZeroCheckBox.Text = "from zero";148 this.fromZeroCheckBox.UseVisualStyleBackColor = true;149 this.fromZeroCheckBox.CheckedChanged += new System.EventHandler(this.fromZeroCheckBox_CheckedChanged);150 143 // 151 144 // invPropCheckBox … … 161 154 this.invPropCheckBox.UseVisualStyleBackColor = true; 162 155 this.invPropCheckBox.CheckedChanged += new System.EventHandler(this.InvPropCheckBoxOnCheckedChanged); 156 // 157 // colorLabel 158 // 159 this.colorLabel.AutoSize = true; 160 this.colorLabel.Location = new System.Drawing.Point(652, 9); 161 this.colorLabel.Name = "colorLabel"; 162 this.colorLabel.Size = new System.Drawing.Size(34, 13); 163 this.colorLabel.TabIndex = 15; 164 this.colorLabel.Text = "Color:"; 163 165 // 164 166 // sizeLabel … … 202 204 series1.MarkerSize = 10; 203 205 series1.Name = "InstancesSeries"; 206 series1.SmartLabelStyle.CalloutLineAnchorCapStyle = System.Windows.Forms.DataVisualization.Charting.LineAnchorCapStyle.None; 204 207 series2.ChartArea = "Default"; 205 208 series2.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Point; … … 209 212 series2.MarkerStyle = System.Windows.Forms.DataVisualization.Charting.MarkerStyle.Cross; 210 213 series2.Name = "CurrentInstanceSeries"; 214 series2.SmartLabelStyle.CalloutLineAnchorCapStyle = System.Windows.Forms.DataVisualization.Charting.LineAnchorCapStyle.None; 211 215 this.instanceMapChart.Series.Add(series1); 212 216 this.instanceMapChart.Series.Add(series2); 213 217 this.instanceMapChart.Size = new System.Drawing.Size(974, 692); 214 218 this.instanceMapChart.TabIndex = 12; 219 // 220 // colorComboBox 221 // 222 this.colorComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 223 this.colorComboBox.FormattingEnabled = true; 224 this.colorComboBox.Location = new System.Drawing.Point(692, 6); 225 this.colorComboBox.Name = "colorComboBox"; 226 this.colorComboBox.Size = new System.Drawing.Size(222, 21); 227 this.colorComboBox.TabIndex = 13; 228 this.colorComboBox.SelectedIndexChanged += new System.EventHandler(this.colorComboBox_SelectedIndexChanged); 215 229 // 216 230 // sizeComboBox … … 234 248 this.projectionComboBox.SelectedIndexChanged += new System.EventHandler(this.ProjectionComboBoxOnSelectedIndexChanged); 235 249 // 250 // characteristicsPanel 251 // 252 this.characteristicsPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 253 | System.Windows.Forms.AnchorStyles.Left) 254 | System.Windows.Forms.AnchorStyles.Right))); 255 this.characteristicsPanel.Location = new System.Drawing.Point(3, 33); 256 this.characteristicsPanel.Name = "characteristicsPanel"; 257 this.characteristicsPanel.Size = new System.Drawing.Size(241, 692); 258 this.characteristicsPanel.TabIndex = 20; 259 // 260 // updateProjectionButton 261 // 262 this.updateProjectionButton.Location = new System.Drawing.Point(3, 6); 263 this.updateProjectionButton.Name = "updateProjectionButton"; 264 this.updateProjectionButton.Size = new System.Drawing.Size(26, 23); 265 this.updateProjectionButton.TabIndex = 19; 266 this.updateProjectionButton.Text = "Update"; 267 this.updateProjectionButton.UseVisualStyleBackColor = true; 268 this.updateProjectionButton.Click += new System.EventHandler(this.updateProjectionButton_Click); 269 // 236 270 // instancesTabPage 237 271 // … … 240 274 this.instancesTabPage.Name = "instancesTabPage"; 241 275 this.instancesTabPage.Padding = new System.Windows.Forms.Padding(3); 242 this.instancesTabPage.Size = new System.Drawing.Size(110 6, 734);276 this.instancesTabPage.Size = new System.Drawing.Size(1100, 734); 243 277 this.instancesTabPage.TabIndex = 0; 244 278 this.instancesTabPage.Text = "Instances"; … … 254 288 this.problemInstancesView.Name = "problemInstancesView"; 255 289 this.problemInstancesView.ReadOnly = false; 256 this.problemInstancesView.Size = new System.Drawing.Size(1 100, 728);290 this.problemInstancesView.Size = new System.Drawing.Size(1094, 728); 257 291 this.problemInstancesView.TabIndex = 0; 258 292 this.problemInstancesView.ViewsLabelVisible = true; 259 293 this.problemInstancesView.ViewType = null; 260 //261 // colorComboBox262 //263 this.colorComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;264 this.colorComboBox.FormattingEnabled = true;265 this.colorComboBox.Location = new System.Drawing.Point(768, 6);266 this.colorComboBox.Name = "colorComboBox";267 this.colorComboBox.Size = new System.Drawing.Size(222, 21);268 this.colorComboBox.TabIndex = 13;269 this.colorComboBox.SelectedIndexChanged += new System.EventHandler(this.colorComboBox_SelectedIndexChanged);270 //271 // colorLabel272 //273 this.colorLabel.AutoSize = true;274 this.colorLabel.Location = new System.Drawing.Point(728, 9);275 this.colorLabel.Name = "colorLabel";276 this.colorLabel.Size = new System.Drawing.Size(34, 13);277 this.colorLabel.TabIndex = 15;278 this.colorLabel.Text = "Color:";279 294 // 280 295 // UnderstandingProblemInstanceView … … 289 304 this.mapSplitContainer.Panel1.ResumeLayout(false); 290 305 this.mapSplitContainer.Panel1.PerformLayout(); 306 this.mapSplitContainer.Panel2.ResumeLayout(false); 291 307 ((System.ComponentModel.ISupportInitialize)(this.mapSplitContainer)).EndInit(); 292 308 this.mapSplitContainer.ResumeLayout(false); … … 311 327 private System.Windows.Forms.ComboBox sizeComboBox; 312 328 private System.Windows.Forms.ComboBox projectionComboBox; 313 private System.Windows.Forms.CheckBox fromZeroCheckBox;314 329 private System.Windows.Forms.Label colorLabel; 315 330 private System.Windows.Forms.ComboBox colorComboBox; 331 private System.Windows.Forms.Button updateProjectionButton; 332 private System.Windows.Forms.Panel characteristicsPanel; 316 333 } 317 334 } -
branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem/3.3/Views/UnderstandingProblemInstanceView.cs
r13787 r13791 45 45 showCharacteristicsCheckBox.Text = string.Empty; 46 46 showCharacteristicsCheckBox.Image = VSImageLibrary.Properties; 47 updateProjectionButton.Text = string.Empty; 48 updateProjectionButton.Image = VSImageLibrary.Refresh; 47 49 characteristics = new CheckedItemList<StringValue>(); 48 50 characteristics.CheckedItemsChanged += CharacteristicsOnCheckedItemsChanged; 49 mapSplitContainer.Panel2.Controls.Add(new ViewHost() {51 characteristicsPanel.Controls.Add(new ViewHost() { 50 52 Dock = DockStyle.Fill, 51 53 Content = characteristics … … 55 57 protected override void OnContentChanged() { 56 58 base.OnContentChanged(); 57 characteristics.Clear();58 59 if (Content == null) { 59 60 problemInstancesView.Content = null; 60 instanceMapChart.Series["InstancesSeries"].Points.Clear();61 instanceMapChart.Series["CurrentInstanceSeries"].Points.Clear();62 61 } else { 63 62 problemInstancesView.Content = Content.ProblemInstances; 64 UpdateCharacteristics();65 UpdateProjectionComboBox();66 UpdateSizeComboBox();67 UpdateColorComboBox();68 }63 } 64 UpdateCharacteristics(); 65 UpdateProjectionComboBox(); 66 UpdateSizeComboBox(); 67 UpdateColorComboBox(); 69 68 } 70 69 71 70 protected override void SetEnabledStateOfControls() { 72 71 base.SetEnabledStateOfControls(); 72 updateProjectionButton.Enabled = Content != null && characteristics.CheckedItems.Any(); 73 73 } 74 74 75 75 #region Update Controls 76 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 } 77 if (InvokeRequired) { Invoke((Action)UpdateCharacteristics); return; } 78 try { 79 SuppressEvents = true; 80 var @checked = new HashSet<string>(characteristics.CheckedItems.Select(x => x.Value.Value)); 81 characteristics.Clear(); 82 83 if (Content == null) return; 84 if (@checked.Count == 0 && Content.ProblemInstances.ResultNames.Any(x => x.StartsWith("Characteristic."))) 85 @checked = new HashSet<string>(Content.ProblemInstances.ResultNames.Where(x => x.StartsWith("Characteristic."))); 86 87 foreach (var c in Content.ProblemInstances.ResultNames) { 88 characteristics.Add(new StringValue(c), @checked.Contains(c)); 89 } 90 } finally { SuppressEvents = false; } 82 91 } 83 92 84 93 private void UpdateProjectionComboBox() { 94 if (InvokeRequired) { Invoke((Action)UpdateProjectionComboBox); return; } 85 95 try { 86 96 SuppressEvents = true; … … 97 107 98 108 private void UpdateSizeComboBox() { 109 if (InvokeRequired) { Invoke((Action)UpdateSizeComboBox); return; } 99 110 try { 100 111 SuppressEvents = true; 101 112 var selected = sizeComboBox.SelectedIndex >= 0 ? (string)sizeComboBox.SelectedItem : null; 102 113 sizeComboBox.Items.Clear(); 114 115 if (Content == null) return; 116 103 117 sizeComboBox.Items.Add(string.Empty); 104 118 foreach (var str in Content.ProblemInstances.ResultNames.Where(x => !(x.StartsWith("Projection.") && (x.EndsWith(".X") || x.EndsWith(".Y"))))) { … … 112 126 113 127 private void UpdateColorComboBox() { 128 if (InvokeRequired) { Invoke((Action)UpdateColorComboBox); return; } 114 129 try { 115 130 SuppressEvents = true; 116 131 var selected = colorComboBox.SelectedIndex >= 0 ? (string)colorComboBox.SelectedItem : null; 117 132 colorComboBox.Items.Clear(); 133 134 if (Content == null) return; 135 118 136 colorComboBox.Items.Add(string.Empty); 119 137 foreach (var str in Content.ProblemInstances.ResultNames.Where(x => x.StartsWith("Rank."))) { … … 132 150 var currentInstanceSeries = instanceMapChart.Series["CurrentInstanceSeries"]; 133 151 134 if (projectionComboBox.SelectedIndex < 0 ) {152 if (projectionComboBox.SelectedIndex < 0 || Content == null) { 135 153 instancesSeries.Points.Clear(); 136 154 currentInstanceSeries.Points.Clear(); … … 142 160 var color = colorComboBox.SelectedIndex >= 0 ? (string)colorComboBox.SelectedItem : string.Empty; 143 161 144 DoProjectProblemInstances(instancesSeries, currentInstanceSeries, projection, 145 size, color, invPropCheckBox.Checked, fromZeroCheckBox.Checked); 162 DoProjectProblemInstances(instancesSeries, currentInstanceSeries, projection, size, color, invPropCheckBox.Checked); 146 163 } 147 164 #endregion … … 156 173 base.OnProblemInstancesChanged(); 157 174 if (Content.ProblemInstances.UpdateOfRunsInProgress) return; 158 try { 159 SuppressEvents = true; 160 UpdateCharacteristics(); 161 } finally { SuppressEvents = false; } 175 UpdateCharacteristics(); 162 176 UpdateProjectionComboBox(); 163 177 UpdateSizeComboBox(); … … 184 198 } 185 199 186 private void fromZeroCheckBox_CheckedChanged(object sender, EventArgs e) {187 UpdateProjection();188 }189 190 200 private void showCharacteristicsCheckBox_CheckedChanged(object sender, EventArgs e) { 191 201 mapSplitContainer.Panel2Collapsed = !showCharacteristicsCheckBox.Checked; 192 202 } 203 204 private void updateProjectionButton_Click(object sender, EventArgs e) { 205 Content.UpdateInstanceProjection(characteristics.CheckedItems.Select(x => x.Value.Value).ToArray()); 206 } 193 207 #endregion 194 208 195 209 #region Other Event Handlers 196 210 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()); 211 SetEnabledStateOfControls(); 200 212 } 201 213 #endregion … … 203 215 #region Helper Classes and Methods 204 216 private IEnumerable<string> GetProjections() { 217 if (Content == null) return new string[0]; 205 218 return Content.ProblemInstances.ResultNames 206 219 .Where(x => Regex.IsMatch(x, "^Projection[.].*[.][XY]$")) … … 209 222 } 210 223 211 private void DoProjectProblemInstances(Series instancesSeries, Series currentInstanceSeries, string projection, string size, string color, bool invProp , bool fromZero) {224 private void DoProjectProblemInstances(Series instancesSeries, Series currentInstanceSeries, string projection, string size, string color, bool invProp) { 212 225 instancesSeries.Points.Clear(); 213 226 currentInstanceSeries.Points.Clear(); … … 215 228 double maxSize = 0, minSize = 0; 216 229 if (!string.IsNullOrEmpty(size)) { 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(); 230 var sizes = Content.ProblemInstances 231 .Where(x => x.Results.ContainsKey(size)) 232 .Select(x => x.Results[size]) 233 .Select(x => x is DoubleValue ? ((DoubleValue)x).Value : (x is IntValue ? ((IntValue)x).Value : double.NaN)) 234 .Where(x => !double.IsNaN(x)).ToList(); 218 235 if (sizes.Count > 0) { 219 maxSize = sizes.Max( x => x.Value);220 if (maxSize < 0 && fromZero) {236 maxSize = sizes.Max(); 237 if (maxSize < 0) { 221 238 maxSize = 0; 222 minSize = sizes.Min(x => x.Value); 223 } else if (fromZero) { 224 minSize = 0; 239 minSize = sizes.Min(); 225 240 } else { 226 minSize = sizes.Min( x => x.Value);241 minSize = sizes.Min(); 227 242 } 228 243 }
Note: See TracChangeset
for help on using the changeset viewer.