Free cookie consent management tool by TermsFeed Policy Generator

Changeset 13791


Ignore:
Timestamp:
04/25/16 12:56:17 (8 years ago)
Author:
abeham
Message:

#2457: working on recommendation algorithms

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  
    161161    <Compile Include="Recommenders\KNearestNeighborModel.cs" />
    162162    <Compile Include="Recommenders\OverallBestRecommender.cs" />
    163     <Compile Include="Recommenders\DistanceWeightedRecommender.cs" />
    164163    <Compile Include="Interfaces\IAlgorithmInstanceRecommender.cs" />
    165164    <Compile Include="Recommenders\KNearestNeighborRecommender.cs" />
  • branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem.Common/3.3/Interfaces/IAlgorithmInstanceRecommender.cs

    r13787 r13791  
    2121
    2222using HeuristicLab.Core;
     23using HeuristicLab.Optimization;
    2324
    2425namespace HeuristicLab.OptimizationExpertSystem.Common {
    2526  public interface IAlgorithmInstanceRecommender : IParameterizedItem {
    26     IRecommendationModel TrainModel(KnowledgeCenter kc, string[] characteristics);
     27    IRecommendationModel TrainModel(IRun[] problemInstances, KnowledgeCenter kc, string[] characteristics);
    2728  }
    2829}
  • branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem.Common/3.3/Interfaces/IRecommendationModel.cs

    r13787 r13791  
    2727namespace HeuristicLab.OptimizationExpertSystem.Common {
    2828  public interface IRecommendationModel : IContent {
    29     IEnumerable<Tuple<IAlgorithm, double>> GetRanking(KnowledgeCenter kc);
     29    IEnumerable<Tuple<IAlgorithm, double>> GetRanking(IRun problemInstance);
    3030  }
    3131}
  • branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem.Common/3.3/KnowledgeCenter.cs

    r13787 r13791  
    212212      #endregion
    213213      #region PCA
     214      double[,] v = null;
    214215      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      }
    225227      #endregion
    226228      #region SOM
     
    231233          features[feature, key2Idx.GetByFirst(instance.Key)] = arr[feature];
    232234      }
    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);
    234236      #endregion
    235237
     
    237239      try {
    238240        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 
    245241          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          }
    252259
    253260          if (instance.Results.TryGetValue("Projection.MDS.X", out item)) {
     
    266273        }
    267274      } 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-score
    297       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;
    305275    }
    306276
     
    579549    }
    580550
     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
    581617    public Dictionary<IAlgorithm, double> GetAlgorithmPerformance(IRun problemInstance) {
    582618      if (!problemInstance.Parameters.ContainsKey("BestKnownQuality")) return new Dictionary<IAlgorithm, double>();
     
    586622                          .ToDictionary(x => x.Key, x => ExpectedRuntimeHelper.CalculateErt(x.ToList(), "QualityPerEvaluations", target, Maximization).ExpectedRuntime);
    587623    }
     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    }
    588630
    589631    public Dictionary<IAlgorithm, List<IRun>> GetKnowledgeBaseByAlgorithm() {
     
    708750    }
    709751
    710     private double GetTarget(double bestKnownQuality, bool maximization) {
     752    public double GetTarget(double bestKnownQuality, bool maximization) {
    711753      return bestKnownQuality * (maximization ? (1 - MinimumTarget.Value) : (1 + MinimumTarget.Value));
    712754    }
     
    817859
    818860    public IEnumerable<Tuple<IAlgorithm, double>> GetAlgorithmInstanceRanking() {
    819       return RecommendationModel.GetRanking(this);
     861      return RecommendationModel.GetRanking(ProblemInstances.Single(IsCurrentInstance));
    820862    }
    821863  }
  • branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem.Common/3.3/Recommenders/FixedRankModel.cs

    r13787 r13791  
    2626namespace HeuristicLab.OptimizationExpertSystem.Common {
    2727  public class FixedRankModel : IRecommendationModel {
    28     private List<Tuple<IAlgorithm, double>> ranking;
     28    private readonly List<Tuple<IAlgorithm, double>> ranking;
    2929
    3030    public FixedRankModel(IEnumerable<Tuple<IAlgorithm, double>> ranking) {
     
    3333    }
    3434 
    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) {
    3736      return ranking;
    3837    }
  • branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem.Common/3.3/Recommenders/KNearestNeighborModel.cs

    r13787 r13791  
    2020#endregion
    2121
    22 using HeuristicLab.Common;
     22using HeuristicLab.Collections;
    2323using HeuristicLab.Optimization;
    2424using System;
     
    3030    private readonly int K;
    3131    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;
    3235
    33     public KNearestNeighborModel(int k, string[] characteristics) {
     36    public KNearestNeighborModel(int k, Dictionary<IRun, Dictionary<IAlgorithm, double>> perfData, string[] characteristics) {
    3437      this.K = k;
     38      this.performance = perfData;
    3539      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);
    3646    }
    3747
    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     
    4055      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       
    5060        foreach (var p in perfs) {
    5161          var ert = p.Value;
     
    5666          } else erts.Add(ert);
    5767        }
    58         distances.Remove(min.Key);
    5968      }
    6069
  • branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem.Common/3.3/Recommenders/KNearestNeighborRecommender.cs

    r13787 r13791  
    2323using HeuristicLab.Core;
    2424using HeuristicLab.Data;
     25using HeuristicLab.Optimization;
    2526using HeuristicLab.Parameters;
    2627using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     28using System.Linq;
    2729
    2830namespace HeuristicLab.OptimizationExpertSystem.Common {
     
    3739    [StorableConstructor]
    3840    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) { }
    4142    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)));
    4344    }
    4445
     
    4748    }
    4849
    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);
    5154    }
    5255  }
  • branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem.Common/3.3/Recommenders/OverallBestRecommender.cs

    r13787 r13791  
    2525using HeuristicLab.Data;
    2626using HeuristicLab.Optimization;
    27 using HeuristicLab.Parameters;
    2827using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2928using System;
     
    3938      get { return (IFixedValueParameter<DoubleValue>)Parameters["NeighborhoodFactor"]; }
    4039    }
    41 
    42     public double NeighborhoodFactor {
    43       get { return NeighborhoodFactorParameter.Value.Value; }
    44       set { NeighborhoodFactorParameter.Value.Value = value; }
    45     }
    4640   
    4741    [StorableConstructor]
    4842    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() { }
    5445
    5546    public override IDeepCloneable Clone(Cloner cloner) {
     
    5748    }
    5849
    59     public IRecommendationModel TrainModel(KnowledgeCenter kc, string[] characteristics) {
     50    public IRecommendationModel TrainModel(IRun[] problemInstances, KnowledgeCenter kc, string[] characteristics) {
    6051      var instances = new List<Tuple<IAlgorithm, double>>();
    6152      foreach (var relevantRuns in kc.GetKnowledgeBaseByAlgorithm()) {
    6253        var algorithm = relevantRuns.Key;
    6354        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)))
    6556                              .Where(x => x.Item2 != null)
    6657                              .Select(x => Tuple.Create(x.Item1, ((DoubleValue)x.Item2.Parameters["BestKnownQuality"]).Value))
     
    7061        foreach (var problemRuns in relevantRuns.Value.GroupBy(x => ((StringValue)x.Parameters["Problem Name"]).Value)) {
    7162          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;
    7364          if (double.IsNaN(ert)) ert = int.MaxValue;
    7465          avgERT += ert;
  • branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem/3.3/Menu/100_Understanding/110_ProblemInstanceMenuItem.cs

    r13720 r13791  
    2828namespace HeuristicLab.OptimizationExpertSystem.Menu {
    2929  internal class ProblemInstanceMenuItem : MenuItemBase {
    30     public override Image Image { get { return VSImageLibrary.Statistics; } }
     30    public override Image Image { get { return VSImageLibrary.RadialChart; } }
    3131
    3232    public override string Name {
  • branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem/3.3/Menu/200_Solving/210_PerformanceModelingMenuItem.cs

    r13787 r13791  
    2828namespace HeuristicLab.OptimizationExpertSystem.Menu {
    2929  internal class PerformanceModelingMenuItem : MenuItemBase {
    30     public override Image Image { get { return VSImageLibrary.Event; } }
     30    public override Image Image { get { return VSImageLibrary.Graph; } }
    3131
    3232    public override string Name {
  • branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem/3.3/Views/PerformanceModelingView.Designer.cs

    r13787 r13791  
    5050      this.tabControl = new System.Windows.Forms.TabControl();
    5151      this.characteristicsTabPage = new System.Windows.Forms.TabPage();
     52      this.characteristicsViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost();
    5253      this.refreshCharacteristicsButton = new System.Windows.Forms.Button();
    5354      this.parametersTabPage = new System.Windows.Forms.TabPage();
    5455      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();
    5760      this.tabControl.SuspendLayout();
    5861      this.characteristicsTabPage.SuspendLayout();
    5962      this.parametersTabPage.SuspendLayout();
     63      this.crossvalidationTabPage.SuspendLayout();
    6064      this.SuspendLayout();
    6165      //
     
    7781      this.recommenderComboBox.Location = new System.Drawing.Point(90, 3);
    7882      this.recommenderComboBox.Name = "recommenderComboBox";
    79       this.recommenderComboBox.Size = new System.Drawing.Size(264, 21);
     83      this.recommenderComboBox.Size = new System.Drawing.Size(206, 21);
    8084      this.recommenderComboBox.TabIndex = 11;
    8185      this.recommenderComboBox.SelectedIndexChanged += new System.EventHandler(this.RecommenderComboBoxOnSelectedIndexChanged);
     
    8488      //
    8589      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);
    8791      this.recommendStartButton.Name = "recommendStartButton";
    8892      this.recommendStartButton.Size = new System.Drawing.Size(26, 23);
     
    99103      this.tabControl.Controls.Add(this.characteristicsTabPage);
    100104      this.tabControl.Controls.Add(this.parametersTabPage);
    101       this.tabControl.Controls.Add(this.resultsTabPage);
     105      this.tabControl.Controls.Add(this.crossvalidationTabPage);
    102106      this.tabControl.Location = new System.Drawing.Point(0, 30);
    103107      this.tabControl.Name = "tabControl";
     
    117121      this.characteristicsTabPage.Text = "Characteristics";
    118122      this.characteristicsTabPage.UseVisualStyleBackColor = true;
    119       //
    120       // refreshCharacteristicsButton
    121       //
    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       // parametersTabPage
    131       //
    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       // parameterCollectionView
    142       //
    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       // resultsTabPage
    155       //
    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;
    163123      //
    164124      // characteristicsViewHost
     
    178138      this.characteristicsViewHost.ViewType = null;
    179139      //
     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      //
    180215      // PerformanceModelingView
    181216      //
    182217      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    183218      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
     219      this.Controls.Add(this.minimumTargetLabel);
     220      this.Controls.Add(this.minTargetView);
    184221      this.Controls.Add(this.tabControl);
    185222      this.Controls.Add(this.recommenderLabel);
     
    190227      this.characteristicsTabPage.ResumeLayout(false);
    191228      this.parametersTabPage.ResumeLayout(false);
     229      this.crossvalidationTabPage.ResumeLayout(false);
    192230      this.ResumeLayout(false);
    193231      this.PerformLayout();
     
    202240    private System.Windows.Forms.TabControl tabControl;
    203241    private System.Windows.Forms.TabPage parametersTabPage;
    204     private System.Windows.Forms.TabPage resultsTabPage;
     242    private System.Windows.Forms.TabPage crossvalidationTabPage;
    205243    private Core.Views.ParameterCollectionView parameterCollectionView;
    206244    private System.Windows.Forms.TabPage characteristicsTabPage;
    207245    private System.Windows.Forms.Button refreshCharacteristicsButton;
    208246    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;
    209250  }
    210251}
  • branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem/3.3/Views/PerformanceModelingView.cs

    r13787 r13791  
    2424using HeuristicLab.Data;
    2525using HeuristicLab.MainForm;
     26using HeuristicLab.Optimization;
    2627using HeuristicLab.OptimizationExpertSystem.Common;
    2728using HeuristicLab.PluginInfrastructure;
     
    5051    protected override void OnContentChanged() {
    5152      base.OnContentChanged();
     53      if (Content == null) {
     54        minTargetView.Content = null;
     55      } else {
     56        minTargetView.Content = Content.MinimumTarget;
     57      }
    5258      UpdateCharacteristics();
    5359    }
     
    5864      recommendStartButton.Enabled = Content != null && recommenderComboBox.SelectedIndex >= 0 && characteristics.CheckedItems.Any();
    5965      characteristicsViewHost.Enabled = Content != null;
     66      xValidateButton.Enabled = Content != null && recommenderComboBox.SelectedIndex >= 0 && characteristics.CheckedItems.Any();
    6067    }
    6168
     
    8289
    8390      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
    8494      characteristics.Clear();
    8595      if (Content == null || Content.ProblemInstances.Count == 0) return;
     
    109119    private void RecommendStartButtonOnClick(object sender, EventArgs e) {
    110120      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());
    112123    }
    113124
     
    115126      UpdateCharacteristics();
    116127      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;
    117163    }
    118164    #endregion
  • branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem/3.3/Views/SolverView.Designer.cs

    r13787 r13791  
    4545    /// </summary>
    4646    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();
    6362      this.maxEvaluationsView = new HeuristicLab.Data.Views.StringConvertibleValueView();
    6463      this.algorithmCloneButton = new System.Windows.Forms.Button();
    6564      this.seedingStrategyPanel = new System.Windows.Forms.Panel();
    6665      this.algorithmStartButton = new System.Windows.Forms.Button();
    67       this.minimumTargetLabel = new System.Windows.Forms.Label();
    6866      this.seedingStrategyLabel = new System.Windows.Forms.Label();
    6967      this.evaluationsLimitabel = new System.Windows.Forms.Label();
     
    9189      this.SuspendLayout();
    9290      //
    93       // minTargetView
    94       //
    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       //
    10491      // maxEvaluationsView
    10592      //
     
    142129      this.algorithmStartButton.Click += new System.EventHandler(this.AlgorithmStartButtonOnClick);
    143130      //
    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       //
    153131      // seedingStrategyLabel
    154132      //
     
    190168      // solverTabControl
    191169      //
     170      this.solverTabControl.AllowDrop = true;
    192171      this.solverTabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    193172            | System.Windows.Forms.AnchorStyles.Left)
     
    238217      this.resultsDockPanel.Name = "resultsDockPanel";
    239218      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;
     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;
    286265      this.resultsDockPanel.TabIndex = 0;
    287266      //
     
    292271      this.runsTabPage.Name = "runsTabPage";
    293272      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);
    295274      this.runsTabPage.TabIndex = 4;
    296275      this.runsTabPage.Text = "Runs";
     
    305284      this.runsView.Name = "runsView";
    306285      this.runsView.ReadOnly = false;
    307       this.runsView.Size = new System.Drawing.Size(542, 412);
     286      this.runsView.Size = new System.Drawing.Size(829, 447);
    308287      this.runsView.TabIndex = 0;
    309288      //
     
    314293      this.seededRunsTabPage.Name = "seededRunsTabPage";
    315294      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);
    317296      this.seededRunsTabPage.TabIndex = 5;
    318297      this.seededRunsTabPage.Text = "Seeded Runs";
     
    327306      this.seededRunsView.Name = "seededRunsView";
    328307      this.seededRunsView.ReadOnly = false;
    329       this.seededRunsView.Size = new System.Drawing.Size(542, 412);
     308      this.seededRunsView.Size = new System.Drawing.Size(829, 447);
    330309      this.seededRunsView.TabIndex = 1;
    331310      //
     
    335314      this.solutionSeedingTabPage.Name = "solutionSeedingTabPage";
    336315      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);
    338317      this.solutionSeedingTabPage.TabIndex = 1;
    339318      this.solutionSeedingTabPage.Text = "Seeding Pool";
     
    346325      this.parametersTabPage.Name = "parametersTabPage";
    347326      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);
    349328      this.parametersTabPage.TabIndex = 0;
    350329      this.parametersTabPage.Text = "Parameters";
     
    361340      this.solverParametersView.ReadOnly = true;
    362341      this.solverParametersView.ShowDetails = true;
    363       this.solverParametersView.Size = new System.Drawing.Size(542, 412);
     342      this.solverParametersView.Size = new System.Drawing.Size(829, 447);
    364343      this.solverParametersView.TabIndex = 0;
    365344      //
     
    370349      this.operatorGraphTabPage.Name = "operatorGraphTabPage";
    371350      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);
    373352      this.operatorGraphTabPage.TabIndex = 3;
    374353      this.operatorGraphTabPage.Text = "Operator Graph";
     
    384363      this.operatorGraphViewHost.Name = "operatorGraphViewHost";
    385364      this.operatorGraphViewHost.ReadOnly = true;
    386       this.operatorGraphViewHost.Size = new System.Drawing.Size(542, 412);
     365      this.operatorGraphViewHost.Size = new System.Drawing.Size(829, 447);
    387366      this.operatorGraphViewHost.TabIndex = 0;
    388367      this.operatorGraphViewHost.ViewsLabelVisible = true;
     
    397376      this.Controls.Add(this.instanceLabel);
    398377      this.Controls.Add(this.algorithmStartButton);
    399       this.Controls.Add(this.minTargetView);
    400378      this.Controls.Add(this.maxEvaluationsView);
    401379      this.Controls.Add(this.suggestedInstancesComboBox);
    402380      this.Controls.Add(this.seedingStrategyPanel);
    403       this.Controls.Add(this.minimumTargetLabel);
    404381      this.Controls.Add(this.seedingStrategyLabel);
    405382      this.Controls.Add(this.evaluationsLimitabel);
     
    427404    private System.Windows.Forms.Button algorithmCloneButton;
    428405    private Data.Views.StringConvertibleValueView maxEvaluationsView;
    429     private System.Windows.Forms.Label minimumTargetLabel;
    430     private Data.Views.StringConvertibleValueView minTargetView;
    431406    private System.Windows.Forms.Label instanceLabel;
    432407    private MainForm.WindowsForms.DragOverTabControl solverTabControl;
  • branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem/3.3/Views/SolverView.cs

    r13787 r13791  
    6161        if (Content == null) {
    6262          maxEvaluationsView.Content = null;
    63           minTargetView.Content = null;
    6463          solverParametersView.Content = null;
    6564          runsView.Content = null;
     
    6968        } else {
    7069          maxEvaluationsView.Content = Content.MaximumEvaluations;
    71           minTargetView.Content = Content.MinimumTarget;
    7270          runsView.Content = Content.InstanceRuns;
    7371          seededRunsView.Content = Content.SeededRuns;
     
    155153
    156154      public override string ToString() {
    157         return item.Item2.ToString("F0") + ": " + item.Item1.Name;
     155        return item.Item2.ToString("N0") + ": " + item.Item1.Name;
    158156      }
    159157    }
  • branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem/3.3/Views/UnderstandingProblemInstanceView.Designer.cs

    r13757 r13791  
    5454      this.mapSplitContainer = new System.Windows.Forms.SplitContainer();
    5555      this.showCharacteristicsCheckBox = new System.Windows.Forms.CheckBox();
    56       this.fromZeroCheckBox = new System.Windows.Forms.CheckBox();
    5756      this.invPropCheckBox = new System.Windows.Forms.CheckBox();
     57      this.colorLabel = new System.Windows.Forms.Label();
    5858      this.sizeLabel = new System.Windows.Forms.Label();
    5959      this.projectionLabel = new System.Windows.Forms.Label();
    6060      this.instanceMapChart = new HeuristicLab.Visualization.ChartControlsExtensions.EnhancedChart();
     61      this.colorComboBox = new System.Windows.Forms.ComboBox();
    6162      this.sizeComboBox = new System.Windows.Forms.ComboBox();
    6263      this.projectionComboBox = new System.Windows.Forms.ComboBox();
     64      this.characteristicsPanel = new System.Windows.Forms.Panel();
     65      this.updateProjectionButton = new System.Windows.Forms.Button();
    6366      this.instancesTabPage = new System.Windows.Forms.TabPage();
    6467      this.problemInstancesView = new HeuristicLab.MainForm.WindowsForms.ViewHost();
    65       this.colorComboBox = new System.Windows.Forms.ComboBox();
    66       this.colorLabel = new System.Windows.Forms.Label();
    6768      this.problemInstancesTabControl.SuspendLayout();
    6869      this.mapTabPage.SuspendLayout();
    6970      ((System.ComponentModel.ISupportInitialize)(this.mapSplitContainer)).BeginInit();
    7071      this.mapSplitContainer.Panel1.SuspendLayout();
     72      this.mapSplitContainer.Panel2.SuspendLayout();
    7173      this.mapSplitContainer.SuspendLayout();
    7274      ((System.ComponentModel.ISupportInitialize)(this.instanceMapChart)).BeginInit();
     
    109111      //
    110112      this.mapSplitContainer.Panel1.Controls.Add(this.showCharacteristicsCheckBox);
    111       this.mapSplitContainer.Panel1.Controls.Add(this.fromZeroCheckBox);
    112113      this.mapSplitContainer.Panel1.Controls.Add(this.invPropCheckBox);
    113114      this.mapSplitContainer.Panel1.Controls.Add(this.colorLabel);
     
    119120      this.mapSplitContainer.Panel1.Controls.Add(this.projectionComboBox);
    120121      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);
    121127      this.mapSplitContainer.Panel2Collapsed = true;
    122128      this.mapSplitContainer.Size = new System.Drawing.Size(1094, 728);
    123       this.mapSplitContainer.SplitterDistance = 847;
     129      this.mapSplitContainer.SplitterDistance = 843;
    124130      this.mapSplitContainer.TabIndex = 12;
    125131      //
     
    135141      this.showCharacteristicsCheckBox.UseVisualStyleBackColor = true;
    136142      this.showCharacteristicsCheckBox.CheckedChanged += new System.EventHandler(this.showCharacteristicsCheckBox_CheckedChanged);
    137       //
    138       // fromZeroCheckBox
    139       //
    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);
    150143      //
    151144      // invPropCheckBox
     
    161154      this.invPropCheckBox.UseVisualStyleBackColor = true;
    162155      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:";
    163165      //
    164166      // sizeLabel
     
    202204      series1.MarkerSize = 10;
    203205      series1.Name = "InstancesSeries";
     206      series1.SmartLabelStyle.CalloutLineAnchorCapStyle = System.Windows.Forms.DataVisualization.Charting.LineAnchorCapStyle.None;
    204207      series2.ChartArea = "Default";
    205208      series2.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Point;
     
    209212      series2.MarkerStyle = System.Windows.Forms.DataVisualization.Charting.MarkerStyle.Cross;
    210213      series2.Name = "CurrentInstanceSeries";
     214      series2.SmartLabelStyle.CalloutLineAnchorCapStyle = System.Windows.Forms.DataVisualization.Charting.LineAnchorCapStyle.None;
    211215      this.instanceMapChart.Series.Add(series1);
    212216      this.instanceMapChart.Series.Add(series2);
    213217      this.instanceMapChart.Size = new System.Drawing.Size(974, 692);
    214218      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);
    215229      //
    216230      // sizeComboBox
     
    234248      this.projectionComboBox.SelectedIndexChanged += new System.EventHandler(this.ProjectionComboBoxOnSelectedIndexChanged);
    235249      //
     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      //
    236270      // instancesTabPage
    237271      //
     
    240274      this.instancesTabPage.Name = "instancesTabPage";
    241275      this.instancesTabPage.Padding = new System.Windows.Forms.Padding(3);
    242       this.instancesTabPage.Size = new System.Drawing.Size(1106, 734);
     276      this.instancesTabPage.Size = new System.Drawing.Size(1100, 734);
    243277      this.instancesTabPage.TabIndex = 0;
    244278      this.instancesTabPage.Text = "Instances";
     
    254288      this.problemInstancesView.Name = "problemInstancesView";
    255289      this.problemInstancesView.ReadOnly = false;
    256       this.problemInstancesView.Size = new System.Drawing.Size(1100, 728);
     290      this.problemInstancesView.Size = new System.Drawing.Size(1094, 728);
    257291      this.problemInstancesView.TabIndex = 0;
    258292      this.problemInstancesView.ViewsLabelVisible = true;
    259293      this.problemInstancesView.ViewType = null;
    260       //
    261       // colorComboBox
    262       //
    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       // colorLabel
    272       //
    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:";
    279294      //
    280295      // UnderstandingProblemInstanceView
     
    289304      this.mapSplitContainer.Panel1.ResumeLayout(false);
    290305      this.mapSplitContainer.Panel1.PerformLayout();
     306      this.mapSplitContainer.Panel2.ResumeLayout(false);
    291307      ((System.ComponentModel.ISupportInitialize)(this.mapSplitContainer)).EndInit();
    292308      this.mapSplitContainer.ResumeLayout(false);
     
    311327    private System.Windows.Forms.ComboBox sizeComboBox;
    312328    private System.Windows.Forms.ComboBox projectionComboBox;
    313     private System.Windows.Forms.CheckBox fromZeroCheckBox;
    314329    private System.Windows.Forms.Label colorLabel;
    315330    private System.Windows.Forms.ComboBox colorComboBox;
     331    private System.Windows.Forms.Button updateProjectionButton;
     332    private System.Windows.Forms.Panel characteristicsPanel;
    316333  }
    317334}
  • branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem/3.3/Views/UnderstandingProblemInstanceView.cs

    r13787 r13791  
    4545      showCharacteristicsCheckBox.Text = string.Empty;
    4646      showCharacteristicsCheckBox.Image = VSImageLibrary.Properties;
     47      updateProjectionButton.Text = string.Empty;
     48      updateProjectionButton.Image = VSImageLibrary.Refresh;
    4749      characteristics = new CheckedItemList<StringValue>();
    4850      characteristics.CheckedItemsChanged += CharacteristicsOnCheckedItemsChanged;
    49       mapSplitContainer.Panel2.Controls.Add(new ViewHost() {
     51      characteristicsPanel.Controls.Add(new ViewHost() {
    5052        Dock = DockStyle.Fill,
    5153        Content = characteristics
     
    5557    protected override void OnContentChanged() {
    5658      base.OnContentChanged();
    57       characteristics.Clear();
    5859      if (Content == null) {
    5960        problemInstancesView.Content = null;
    60         instanceMapChart.Series["InstancesSeries"].Points.Clear();
    61         instanceMapChart.Series["CurrentInstanceSeries"].Points.Clear();
    6261      } else {
    6362        problemInstancesView.Content = Content.ProblemInstances;
    64         UpdateCharacteristics();
    65         UpdateProjectionComboBox();
    66         UpdateSizeComboBox();
    67         UpdateColorComboBox();
    68       }
     63      }
     64      UpdateCharacteristics();
     65      UpdateProjectionComboBox();
     66      UpdateSizeComboBox();
     67      UpdateColorComboBox();
    6968    }
    7069
    7170    protected override void SetEnabledStateOfControls() {
    7271      base.SetEnabledStateOfControls();
     72      updateProjectionButton.Enabled = Content != null && characteristics.CheckedItems.Any();
    7373    }
    7474
    7575    #region Update Controls
    7676    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; }
    8291    }
    8392
    8493    private void UpdateProjectionComboBox() {
     94      if (InvokeRequired) { Invoke((Action)UpdateProjectionComboBox); return; }
    8595      try {
    8696        SuppressEvents = true;
     
    97107
    98108    private void UpdateSizeComboBox() {
     109      if (InvokeRequired) { Invoke((Action)UpdateSizeComboBox); return; }
    99110      try {
    100111        SuppressEvents = true;
    101112        var selected = sizeComboBox.SelectedIndex >= 0 ? (string)sizeComboBox.SelectedItem : null;
    102113        sizeComboBox.Items.Clear();
     114       
     115        if (Content == null) return;
     116
    103117        sizeComboBox.Items.Add(string.Empty);
    104118        foreach (var str in Content.ProblemInstances.ResultNames.Where(x => !(x.StartsWith("Projection.") && (x.EndsWith(".X") || x.EndsWith(".Y"))))) {
     
    112126
    113127    private void UpdateColorComboBox() {
     128      if (InvokeRequired) { Invoke((Action)UpdateColorComboBox); return; }
    114129      try {
    115130        SuppressEvents = true;
    116131        var selected = colorComboBox.SelectedIndex >= 0 ? (string)colorComboBox.SelectedItem : null;
    117132        colorComboBox.Items.Clear();
     133
     134        if (Content == null) return;
     135
    118136        colorComboBox.Items.Add(string.Empty);
    119137        foreach (var str in Content.ProblemInstances.ResultNames.Where(x => x.StartsWith("Rank."))) {
     
    132150      var currentInstanceSeries = instanceMapChart.Series["CurrentInstanceSeries"];
    133151
    134       if (projectionComboBox.SelectedIndex < 0) {
     152      if (projectionComboBox.SelectedIndex < 0 || Content == null) {
    135153        instancesSeries.Points.Clear();
    136154        currentInstanceSeries.Points.Clear();
     
    142160      var color = colorComboBox.SelectedIndex >= 0 ? (string)colorComboBox.SelectedItem : string.Empty;
    143161
    144       DoProjectProblemInstances(instancesSeries, currentInstanceSeries, projection,
    145         size, color, invPropCheckBox.Checked, fromZeroCheckBox.Checked);
     162      DoProjectProblemInstances(instancesSeries, currentInstanceSeries, projection, size, color, invPropCheckBox.Checked);
    146163    }
    147164    #endregion
     
    156173      base.OnProblemInstancesChanged();
    157174      if (Content.ProblemInstances.UpdateOfRunsInProgress) return;
    158       try {
    159         SuppressEvents = true;
    160         UpdateCharacteristics();
    161       } finally { SuppressEvents = false; }
     175      UpdateCharacteristics();
    162176      UpdateProjectionComboBox();
    163177      UpdateSizeComboBox();
     
    184198    }
    185199
    186     private void fromZeroCheckBox_CheckedChanged(object sender, EventArgs e) {
    187       UpdateProjection();
    188     }
    189 
    190200    private void showCharacteristicsCheckBox_CheckedChanged(object sender, EventArgs e) {
    191201      mapSplitContainer.Panel2Collapsed = !showCharacteristicsCheckBox.Checked;
    192202    }
     203
     204    private void updateProjectionButton_Click(object sender, EventArgs e) {
     205      Content.UpdateInstanceProjection(characteristics.CheckedItems.Select(x => x.Value.Value).ToArray());
     206    }
    193207    #endregion
    194208
    195209    #region Other Event Handlers
    196210    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();
    200212    }
    201213    #endregion
     
    203215    #region Helper Classes and Methods
    204216    private IEnumerable<string> GetProjections() {
     217      if (Content == null) return new string[0];
    205218      return Content.ProblemInstances.ResultNames
    206219        .Where(x => Regex.IsMatch(x, "^Projection[.].*[.][XY]$"))
     
    209222    }
    210223
    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) {
    212225      instancesSeries.Points.Clear();
    213226      currentInstanceSeries.Points.Clear();
     
    215228      double maxSize = 0, minSize = 0;
    216229      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();
    218235        if (sizes.Count > 0) {
    219           maxSize = sizes.Max(x => x.Value);
    220           if (maxSize < 0 && fromZero) {
     236          maxSize = sizes.Max();
     237          if (maxSize < 0) {
    221238            maxSize = 0;
    222             minSize = sizes.Min(x => x.Value);
    223           } else if (fromZero) {
    224             minSize = 0;
     239            minSize = sizes.Min();
    225240          } else {
    226             minSize = sizes.Min(x => x.Value);
     241            minSize = sizes.Min();
    227242          }
    228243        }
Note: See TracChangeset for help on using the changeset viewer.