Changeset 13787


Ignore:
Timestamp:
04/24/16 10:03:52 (6 years ago)
Author:
abeham
Message:

#2457: worked on performance modeling

Location:
branches/PerformanceComparison
Files:
8 added
9 edited
1 copied
5 moved

Legend:

Unmodified
Added
Removed
  • branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem.Common/3.3/Enums.cs

    r13757 r13787  
    2626    SeedByCloning
    2727  }
    28 
    29   public enum ProblemInstanceProximityType {
    30     FeatureSpace,
    31     PCA,
    32     MDS,
    33     SOM
    34   }
    3528}
  • branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem.Common/3.3/HeuristicLab.OptimizationExpertSystem.Common-3.3.csproj

    r13774 r13787  
    158158  </ItemGroup>
    159159  <ItemGroup>
    160     <Compile Include="OverallBestRecommender.cs" />
    161     <Compile Include="DistanceWeightedRecommender.cs" />
    162     <Compile Include="IAlgorithmInstanceRecommender.cs" />
    163     <Compile Include="KNearestNeighborRecommender.cs" />
     160    <Compile Include="Interfaces\IRecommendationModel.cs" />
     161    <Compile Include="Recommenders\KNearestNeighborModel.cs" />
     162    <Compile Include="Recommenders\OverallBestRecommender.cs" />
     163    <Compile Include="Recommenders\DistanceWeightedRecommender.cs" />
     164    <Compile Include="Interfaces\IAlgorithmInstanceRecommender.cs" />
     165    <Compile Include="Recommenders\KNearestNeighborRecommender.cs" />
    164166    <Compile Include="KnowledgeCenter.cs" />
    165167    <Compile Include="Plugin.cs" />
    166168    <Compile Include="Enums.cs" />
     169    <Compile Include="Recommenders\FixedRankModel.cs" />
    167170    <None Include="Properties\AssemblyInfo.cs.frame" />
    168171    <Compile Include="ProblemCharacteristicAnalysis\CharacteristicCalculator.cs" />
  • branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem.Common/3.3/Interfaces/IAlgorithmInstanceRecommender.cs

    r13786 r13787  
    2020#endregion
    2121
    22 using HeuristicLab.Common;
    23 using HeuristicLab.Optimization;
    24 using System.Collections.Generic;
     22using HeuristicLab.Core;
    2523
    2624namespace HeuristicLab.OptimizationExpertSystem.Common {
    27   public interface IAlgorithmInstanceRecommender : IContent {
    28     IEnumerable<IAlgorithm> GetRanking();
     25  public interface IAlgorithmInstanceRecommender : IParameterizedItem {
     26    IRecommendationModel TrainModel(KnowledgeCenter kc, string[] characteristics);
    2927  }
    3028}
  • branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem.Common/3.3/KnowledgeCenter.cs

    r13774 r13787  
    9696    }
    9797
    98     private readonly CheckedItemList<StringValue> problemCharacteristics;
    99     private readonly ReadOnlyCheckedItemList<StringValue> readonlyProblemCharacteristics;
    100     public ReadOnlyCheckedItemList<StringValue> ProblemCharacteristics {
    101       get { return readonlyProblemCharacteristics; }
    102     }
    103 
    104     private IAlgorithmInstanceRecommender algorithmInstanceRecommender;
    105     public IAlgorithmInstanceRecommender AlgorithmInstanceRecommender {
    106       get { return algorithmInstanceRecommender; }
    107       set { algorithmInstanceRecommender = value; }
     98    private IRecommendationModel recommendationModel;
     99    public IRecommendationModel RecommendationModel {
     100      get { return recommendationModel; }
     101      set {
     102        if (recommendationModel == value) return;
     103        recommendationModel = value;
     104        OnRecommenderModelChanged();
     105      }
    108106    }
    109107
     
    135133      readonlyAlgorithmInstances = algorithmInstances.AsReadOnly();
    136134      problemInstances = new RunCollection();
    137       problemCharacteristics = new CheckedItemList<StringValue>();
    138       readonlyProblemCharacteristics = problemCharacteristics.AsReadOnly();
    139       algorithmInstanceRecommender = new OverallBestRecommender(this);
     135      recommendationModel = FixedRankModel.GetEmpty();
    140136      problem = new SingleObjectiveOKBProblem();
    141137      algorithmId2RunMapping = new BidirectionalLookup<long, IRun>();
     
    167163      knowledgeBase.ItemsAdded += InformationChanged;
    168164      knowledgeBase.ItemsRemoved += InformationChanged;
    169       problemCharacteristics.ItemsAdded += CharacteristicChanged;
    170       problemCharacteristics.ItemsReplaced += CharacteristicChanged;
    171       problemCharacteristics.ItemsRemoved += CharacteristicChanged;
    172       problemCharacteristics.CollectionReset += CharacteristicChanged;
    173       problemCharacteristics.CheckedItemsChanged += CharacteristicChanged;
    174165    }
    175166
    176167    private void MaximumEvaluationsOnValueChanged(object sender, EventArgs eventArgs) {
    177       UpdateSuggestions();
     168
    178169    }
    179170
    180171    private void MinimumTargetOnValueChanged(object sender, EventArgs e) {
    181       UpdateSuggestions();
     172
    182173    }
    183174
     
    192183      var runCollection = sender as RunCollection;
    193184      if (runCollection != null && runCollection.UpdateOfRunsInProgress) return;
    194       UpdateSuggestions();
    195     }
    196 
    197     private void CharacteristicChanged(object sender, EventArgs e) {
    198       if (SuppressEvents) return;
    199       UpdateInstanceProjection();
    200185    }
    201186   
     
    205190    }
    206191
    207     public void UpdateInstanceProjection() {
    208       if (ProblemCharacteristics.Count == 0) return;
    209 
    210       var instances = GetProblemCharacteristics();
     192    public void UpdateInstanceProjection(string[] characteristics) {
     193      if (characteristics.Length == 0) return;
     194
     195      var instances = GetProblemCharacteristics(characteristics);
    211196
    212197      var key2Idx = new BidirectionalDictionary<IRun, int>();
     
    227212      #endregion
    228213      #region PCA
    229       var ds = new double[instances.Count, ProblemCharacteristics.CheckedItems.Count()];
     214      var ds = new double[instances.Count, characteristics.Length];
    230215      foreach (var instance in instances) {
    231216        var arr = instance.Value;
     
    240225      #endregion
    241226      #region SOM
    242       var features = new DoubleMatrix(ProblemCharacteristics.CheckedItems.Count(), instances.Count);
     227      var features = new DoubleMatrix(characteristics.Length, instances.Count);
    243228      foreach (var instance in instances) {
    244229        var arr = instance.Value;
     
    283268    }
    284269
    285     private Dictionary<IRun, double[]> GetProblemCharacteristics() {
     270    public Dictionary<IRun, double[]> GetProblemCharacteristics(string[] characteristics) {
    286271      var instances = new Dictionary<IRun, double[]>();
    287       var values = new List<double>[ProblemCharacteristics.CheckedItems.Count()];
     272      var values = new List<double>[characteristics.Length];
    288273      foreach (var run in ProblemInstances) {
    289274        var f = 0;
    290         instances[run] = new double[ProblemCharacteristics.CheckedItems.Count()];
    291         foreach (var c in ProblemCharacteristics.CheckedItems.Select(x => x.Value.Value)) {
     275        instances[run] = new double[characteristics.Length];
     276        foreach (var c in characteristics) {
    292277          if (values[f] == null) values[f] = new List<double>(ProblemInstances.Count);
    293278          IItem item;
     
    514499            if (alg != null) {
    515500              lock (algorithmId2AlgorithmInstanceMapping) {
     501                algorithmInstances.Add(alg);
    516502                algorithmId2AlgorithmInstanceMapping.Add(algInst.Id, alg);
    517503                progress.Status = string.Format("Downloaded algorithm {0} (okb-id: {1})...", algInst.Name, algInst.Id);
     
    549535
    550536        progress.Status = "Finishing...";
    551         var algInstRunDict = runList.Where(x => x.Parameters.ContainsKey("Problem Name") && x.Parameters["Problem Name"] is StringValue)
    552                                           .GroupBy(x => ((StringValue)x.Parameters["Problem Name"]).Value)
    553                                           .ToDictionary(x => x.Key, x => x.GroupBy(y => ((StringValue)y.Parameters["Algorithm Name"]).Value)
    554                                                                                   .ToDictionary(y => y.Key, y => y.ToList()));
    555 
    556         foreach (var instance in ProblemInstances) {
    557           IItem probNameParam;
    558           if (!instance.Parameters.TryGetValue("Problem Name", out probNameParam)) continue;
    559 
    560           var probInstanceName = ((StringValue)probNameParam).Value;
    561           var maximization = ((BoolValue)instance.Parameters["Maximization"]).Value;
    562          
    563           IItem bkParam;
    564           if (!instance.Parameters.TryGetValue("BestKnownQuality", out bkParam) || !(bkParam is DoubleValue)) {
    565             Dictionary<string, List<IRun>> algRuns;
    566             if (!algInstRunDict.TryGetValue(probInstanceName, out algRuns)) continue;
    567             var list = algRuns.SelectMany(x => x.Value)
    568                               .Where(x => x.Results.ContainsKey("QualityPerEvaluations"))
    569                               .Select(x => ((IndexedDataTable<double>)x.Results["QualityPerEvaluations"]).Rows.First().Values.Last().Item2);
    570             bkParam = new DoubleValue(maximization ? list.Max() : list.Min());
    571             instance.Parameters["BestKnownQuality"] = bkParam;
    572           } else bkParam = instance.Parameters["BestKnownQuality"];
    573 
    574           var bkQuality = ((DoubleValue)bkParam).Value;
    575 
    576           if (!algInstRunDict.ContainsKey(probInstanceName)) continue;
    577           // TODO: Things needs to be configurable here (table name, targets)
    578           foreach (var target in new[] { 1, 1.01, 1.05, 1.1, 1.2, 1.5 }) {
    579             var indexMap = new BidirectionalDictionary<string, int>();
    580             var dict = new Dictionary<string, double>();
    581             var idx = 0;
    582             foreach (var kvp in algInstRunDict[probInstanceName]) {
    583               var result = ExpectedRuntimeHelper.CalculateErt(kvp.Value, "QualityPerEvaluations", bkQuality * target, maximization);
    584               indexMap.Add(kvp.Key, idx);
    585               dict[kvp.Key] = !double.IsNaN(result.ExpectedRuntime) ? result.ExpectedRuntime : int.MaxValue;
    586               idx++;
    587             }
    588             var points = dict.OrderBy(x => indexMap.GetByFirst(x.Key)).Select(x => x.Value > 0 ? Math.Log10(x.Value) : 0).ToArray();
    589             int[] clusters;
    590             Ckmeans1dClusters(points, 5, out clusters);
    591             var ranks = clusters.Select((c, i) => new { Cluster = c, Perf = dict[indexMap.GetBySecond(i)] })
    592                                 .GroupBy(x => x.Cluster, x => x.Perf)
    593                                 .Select(x => new { Cluster = x.Key, AvgPerf = x.Average() })
    594                                 .OrderBy(x => x.AvgPerf)
    595                                 .Select((c, i) => new { Cluster = c.Cluster, Rank = i })
    596                                 .ToDictionary(x => x.Cluster, x => x.Rank);
    597             for (var i = 0; i < clusters.Length; i++) {
    598               var resultName = "Rank." + indexMap.GetBySecond(i) + "@" + ((target - 1) * 100) + "%";
    599               instance.Results[resultName] = new IntValue(dict[indexMap.GetBySecond(i)] < int.MaxValue ? ranks[clusters[i]] : 6);
    600             }
    601           }
    602         }
    603         try {
    604           SuppressEvents = true;
    605           problemCharacteristics.Replace(characteristics.Select(x => new StringValue(x)));
    606           foreach (var pc in problemCharacteristics.Where(x => !x.Value.StartsWith("Characteristic.")))
    607             problemCharacteristics.SetItemCheckedState(pc, false);
    608         } finally { SuppressEvents = false; }
     537       
    609538        try {
    610539          KnowledgeBase.UpdateOfRunsInProgress = true;
     
    612541          KnowledgeBase.AddRange(runList);
    613542        } finally { KnowledgeBase.UpdateOfRunsInProgress = false; }
     543
     544        var algInstRunDict = runList.Where(x => x.Parameters.ContainsKey("Problem Name") && x.Parameters["Problem Name"] is StringValue)
     545                                          .GroupBy(x => ((StringValue)x.Parameters["Problem Name"]).Value)
     546                                          .ToDictionary(x => x.Key, x => x.GroupBy(y => ((StringValue)y.Parameters["Algorithm Name"]).Value)
     547                                                                                  .ToDictionary(y => y.Key, y => y.ToList()));
     548
     549        // set best-known quality to best-found in case it is not known
     550        foreach (var kvp in algInstRunDict) {
     551          var prob = ProblemInstances.SingleOrDefault(x => ((StringValue)x.Parameters["Problem Name"]).Value == kvp.Key);
     552          if (prob == null) continue;
     553          var maximization = ((BoolValue)prob.Parameters["Maximization"]).Value;
     554
     555          IItem bkParam;
     556          if (!prob.Parameters.TryGetValue("BestKnownQuality", out bkParam) || !(bkParam is DoubleValue)) {
     557            var list = kvp.Value.SelectMany(x => x.Value)
     558              .Where(x => x.Results.ContainsKey("QualityPerEvaluations"))
     559              .Select(x => ((IndexedDataTable<double>)x.Results["QualityPerEvaluations"]).Rows.First().Values.Last().Item2);
     560            if (!list.Any()) continue;
     561            bkParam = new DoubleValue(maximization ? list.Max() : list.Min());
     562            prob.Parameters["BestKnownQuality"] = bkParam;
     563          }
     564        }
     565
     566        // add algorithm instance ranks as features to the problem instances for a range of targets
     567        foreach (var target in new[] {1, 1.01, 1.05, 1.1, 1.2, 1.5}) {
     568          var cls = GetPerformanceClasses(target, 5);
     569          foreach (var kvp in cls) {
     570            var prob = kvp.Key;
     571            foreach (var kvp2 in kvp.Value) {
     572              var resultName = "Rank." + algorithmId2AlgorithmInstanceMapping.GetByFirst(kvp2.Key) + "@" + ((target - 1) * 100) + "%";
     573              prob.Results[resultName] = new IntValue(kvp2.Value);
     574            }
     575          }
     576        }
    614577      } finally { progress.Finish(); ProblemInstances.UpdateOfRunsInProgress = false; }
    615       UpdateInstanceProjection();
    616       UpdateSuggestions();
    617     }
    618 
    619     public void UpdateSuggestions() {
    620       // TODO: Maintain a separate list of suggested instances
    621       // TODO: expose expected expected run time
    622       algorithmInstances.Replace(AlgorithmInstanceRecommender.GetRanking());
     578      UpdateInstanceProjection(ProblemInstances.ResultNames.Where(x => x.StartsWith("Characteristic.")).ToArray());
    623579    }
    624580
    625581    public Dictionary<IAlgorithm, double> GetAlgorithmPerformance(IRun problemInstance) {
    626582      if (!problemInstance.Parameters.ContainsKey("BestKnownQuality")) return new Dictionary<IAlgorithm, double>();
    627       var target = GetTarget(((DoubleValue)problemInstance.Parameters["BestKnownQuality"]).Value);
     583      var target = GetTarget(((DoubleValue)problemInstance.Parameters["BestKnownQuality"]).Value, Maximization);
    628584      return knowledgeBase.Where(x => ((StringValue)x.Parameters["Problem Name"]).Value == ((StringValue)problemInstance.Parameters["Problem Name"]).Value)
    629585                          .GroupBy(x => algorithmId2AlgorithmInstanceMapping.GetByFirst(algorithmId2RunMapping.GetBySecond(x).Single()))
     
    636592    }
    637593
    638     public IEnumerable<IRegressionProblem> GetDataAnalysisProblem(double target) {
     594    public IEnumerable<IRegressionProblem> GetRegressionProblemPerAlgorithmInstance(double target, string[] characteristics) {
    639595      if (Problem == null) yield break;
    640       var characteristics = GetProblemCharacteristics();
     596      var features = GetProblemCharacteristics(characteristics);
    641597      // TODO: knowledgebase only stores problem name as a string
    642598      // this doesn't work if there are two equally named problem instances
     
    647603        var ds = new ModifiableDataset();
    648604        ds.AddVariable("Problem Name", new List<string>());
    649         foreach (var pc in ProblemCharacteristics.CheckedItems)
    650           ds.AddVariable(pc.Value.Value, new List<double>());
     605        foreach (var pc in characteristics)
     606          ds.AddVariable(pc, new List<double>());
    651607        ds.AddVariable("ERT", new List<double>());
    652         var max = Maximization;
    653608        foreach (var pr in problemRuns) {
    654609          var prob = problemMap[pr.Key];
    655           var features = characteristics[prob];
     610          var f = features[prob];
     611          var max = ((BoolValue)prob.Parameters["Maximization"]).Value;
    656612          var bkq = ((DoubleValue)prob.Parameters["BestKnownQuality"]).Value;
    657           var ert = ExpectedRuntimeHelper.CalculateErt(pr.ToList(), "QualityPerEvaluations", GetTarget(bkq), max).ExpectedRuntime;
     613          var ert = ExpectedRuntimeHelper.CalculateErt(pr.ToList(), "QualityPerEvaluations", GetTarget(bkq, max), max).ExpectedRuntime;
    658614          if (double.IsNaN(ert)) ert = int.MaxValue;
    659           ds.AddRow(new object[] { pr.Key }.Concat(features.Cast<object>()).Concat(new object[] { ert }));
    660         }
    661         var datAnalysisData = new RegressionProblemData(ds, ProblemCharacteristics.CheckedItems.Select(x => x.Value.Value), "ERT");
     615          ds.AddRow(new object[] { pr.Key }.Concat(f.Cast<object>()).Concat(new object[] { ert }));
     616        }
     617        var datAnalysisData = new RegressionProblemData(ds, characteristics, "ERT");
    662618        var result = new RegressionProblem() {
    663619          Name = algorithmId2AlgorithmInstanceMapping.GetByFirst(relevantRuns.Key).Name
     
    668624    }
    669625
    670     private double GetTarget(double bestKnownQuality) {
    671       return bestKnownQuality * (Maximization ? (1 - MinimumTarget.Value) : (1 + MinimumTarget.Value));
    672     }
    673 
    674     public Dictionary<IRun, double> GetProblemDistances(ProblemInstanceProximityType proximityType) {
    675       var result = new Dictionary<IRun, double>();
     626    public IEnumerable<IClassificationProblem> GetClassificationProblemPerAlgorithmInstance(double target, string[] characteristics) {
     627      if (Problem == null) yield break;
     628
     629      var classes = GetPerformanceClasses(target, 5);
     630      var features = GetProblemCharacteristics(characteristics);
     631
     632      foreach (var alg in AlgorithmInstances) {
     633        var ds = new ModifiableDataset();
     634        ds.AddVariable("Problem Name", new List<string>());
     635        foreach (var pc in characteristics)
     636          ds.AddVariable(pc, new List<double>());
     637        ds.AddVariable("Class", new List<double>());
     638
     639        foreach (var c in classes) {
     640          int cls;
     641          if (c.Value.TryGetValue(algorithmId2AlgorithmInstanceMapping.GetBySecond(alg), out cls)) {
     642            ds.AddRow(new object[] { ((StringValue)c.Key.Parameters["Problem Name"]).Value }
     643              .Concat(features[c.Key].Cast<object>()).Concat(new object[] { cls }));
     644          }
     645        }
     646        var datAnalysisData = new ClassificationProblemData(ds, characteristics, "Class");
     647        var result = new ClassificationProblem() {
     648          Name = alg.Name
     649        };
     650        result.ProblemDataParameter.Value = datAnalysisData;
     651        yield return result;
     652      }
     653    }
     654
     655    public Dictionary<IRun, double> GetProblemDistances(string[] characteristics) {
     656      var result = new Dictionary<IRun, double>();
    676657      var currentInstance = problemId2ProblemInstanceMapping.GetByFirst(Problem.ProblemId);
    677       switch (proximityType) {
    678         case ProblemInstanceProximityType.MDS:
    679         case ProblemInstanceProximityType.PCA:
    680         case ProblemInstanceProximityType.SOM:
    681           double xa, ya;
    682           GetProjectionCoordinates(currentInstance, proximityType, out xa, out ya);
    683           foreach (var b in ProblemInstances) {
    684             if (b == currentInstance) continue;
    685             double xb, yb;
    686             GetProjectionCoordinates(b, proximityType, out xb, out yb);
    687             var d = Math.Sqrt((xa - xb) * (xa - xb) + (ya - yb) * (ya - yb));
    688             result[b] = d;
    689           }
    690           break;
    691         case ProblemInstanceProximityType.FeatureSpace:
    692           var features = GetProblemCharacteristics();
    693           var cF = features[currentInstance];
    694           foreach (var b in ProblemInstances) {
    695             if (b == currentInstance) continue;
    696             var sum = features[b].Select((t, f) => (cF[f] - t) * (cF[f] - t)).Sum();
    697             result[b] = Math.Sqrt(sum);
    698           }
    699           break;
    700         default: throw new InvalidOperationException(string.Format("Unkonwn proximity type {0}", proximityType));
     658      var features = GetProblemCharacteristics(characteristics);
     659      var cF = features[currentInstance];
     660      foreach (var b in ProblemInstances) {
     661        if (b == currentInstance) continue;
     662        var sum = features[b].Select((t, f) => (cF[f] - t) * (cF[f] - t)).Sum();
     663        result[b] = Math.Sqrt(sum);
    701664      }
    702665      return result;
    703666    }
    704667
    705     private void GetProjectionCoordinates(IRun problemInstance, ProblemInstanceProximityType proximityType, out double x, out double y) {
    706       x = ((DoubleValue)problemInstance.Results["Projection." + proximityType + ".X"]).Value;
    707       y = ((DoubleValue)problemInstance.Results["Projection." + proximityType + ".Y"]).Value;
    708       if (proximityType == ProblemInstanceProximityType.SOM) {
    709         x = Math.Floor(x);
    710         y = Math.Floor(y);
    711       }
     668    public Dictionary<IRun, Dictionary<long, int>> GetPerformanceClasses(double target, int nClasses) {
     669      var result = new Dictionary<IRun, Dictionary<long, int>>();
     670      var problemMap = ProblemInstances.Select(x => new { Key = ((StringValue)x.Parameters["Problem Name"]).Value, Value = x })
     671                                       .ToDictionary(x => x.Key, x => x.Value);
     672      foreach (var pr in KnowledgeBase.GroupBy(x => ((StringValue)x.Parameters["Problem Name"]).Value).ToList()) {
     673        var bkq = ((DoubleValue)problemMap[pr.Key].Parameters["BestKnownQuality"]).Value;
     674        var max = ((BoolValue)problemMap[pr.Key].Parameters["Maximization"]).Value;
     675
     676        result[problemMap[pr.Key]] = new Dictionary<long, int>();
     677
     678        var indexMap = new BidirectionalDictionary<long, int>();
     679        var perf = new Dictionary<long, double>();
     680        var idx = 0;
     681        foreach (var kvp in pr.GroupBy(x => algorithmId2RunMapping.GetBySecond(x).Single())) {
     682          var ert = ExpectedRuntimeHelper.CalculateErt(kvp.ToList(), "QualityPerEvaluations", GetTarget(bkq, max), max).ExpectedRuntime;
     683          if (double.IsNaN(ert)) {
     684            // algorithm can't solve that instance with the given target
     685            // these are put into their own additional class
     686            result[problemMap[pr.Key]][kvp.Key] = nClasses;
     687            continue;
     688          }
     689          indexMap.Add(kvp.Key, idx);
     690          perf[kvp.Key] = Math.Log10(ert);
     691          idx++;
     692        }
     693        if (perf.Count == 0) continue;
     694       
     695        var points = perf.OrderBy(x => indexMap.GetByFirst(x.Key)).Select(x => x.Value).ToArray();
     696        int[] clusters;
     697        Ckmeans1dClusters(points, nClasses, out clusters);
     698        var ranks = clusters.Select((c, i) => new { Cluster = c, Perf = perf[indexMap.GetBySecond(i)] })
     699                            .GroupBy(x => x.Cluster, x => x.Perf)
     700                            .Select(x => new { Cluster = x.Key, AvgPerf = x.Average() })
     701                            .OrderBy(x => x.AvgPerf)
     702                            .Select((c, i) => new { Cluster = c.Cluster, Rank = i })
     703                            .ToDictionary(x => x.Cluster, x => x.Rank);
     704        for (var i = 0; i < clusters.Length; i++)
     705          result[problemMap[pr.Key]][indexMap.GetBySecond(i)] = ranks[clusters[i]];
     706      }
     707      return result;
     708    }
     709
     710    private double GetTarget(double bestKnownQuality, bool maximization) {
     711      return bestKnownQuality * (maximization ? (1 - MinimumTarget.Value) : (1 + MinimumTarget.Value));
    712712    }
    713713
     
    722722      var handler = AlgorithmInstanceStarted;
    723723      if (handler != null) handler(this, new EventArgs<IAlgorithm>(instance));
     724    }
     725
     726    public event EventHandler RecommendationModelChanged;
     727    private void OnRecommenderModelChanged() {
     728      var handler = RecommendationModelChanged;
     729      if (handler != null) handler(this, EventArgs.Empty);
    724730    }
    725731
     
    809815      return mean;
    810816    }
     817
     818    public IEnumerable<Tuple<IAlgorithm, double>> GetAlgorithmInstanceRanking() {
     819      return RecommendationModel.GetRanking(this);
     820    }
    811821  }
    812822}
  • branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem.Common/3.3/Recommenders/DistanceWeightedRecommender.cs

    r13786 r13787  
    3535  [StorableClass]
    3636  public class DistanceWeightedRecommender : ParameterizedNamedItem, IAlgorithmInstanceRecommender {
    37     private KnowledgeCenter okc;
    38 
    39     private IFixedValueParameter<EnumValue<ProblemInstanceProximityType>> ProximityTypeParameter {
    40       get { return (IFixedValueParameter<EnumValue<ProblemInstanceProximityType>>)Parameters["ProximityType"]; }
    41     }
    4237
    4338    private IFixedValueParameter<DoubleValue> NeighborhoodFactorParameter {
    4439      get { return (IFixedValueParameter<DoubleValue>)Parameters["NeighborhoodFactor"]; }
    45     }
    46 
    47     public ProblemInstanceProximityType ProximityType {
    48       get { return ProximityTypeParameter.Value.Value; }
    49       set { ProximityTypeParameter.Value.Value = value; }
    5040    }
    5141
     
    5949    private DistanceWeightedRecommender(DistanceWeightedRecommender original, Cloner cloner)
    6050      : base(original, cloner) { }
    61     public DistanceWeightedRecommender(KnowledgeCenter okc) {
    62       this.okc = okc;
    63       Parameters.Add(new FixedValueParameter<EnumValue<ProblemInstanceProximityType>>("ProximityType", "The type of neighbor proximity.", new EnumValue<ProblemInstanceProximityType>(ProblemInstanceProximityType.FeatureSpace)));
     51    public DistanceWeightedRecommender() {
    6452      Parameters.Add(new FixedValueParameter<DoubleValue>("NeighborhoodFactor", "Penalize neighbors that are far away.", new DoubleValue(5)));
    6553    }
     
    6957    }
    7058
    71     public IEnumerable<IAlgorithm> GetRanking() {
    72       if (okc.Problem.ProblemId == -1) yield break;
    73 
    74       var piDistances = okc.GetProblemDistances(ProximityType);
     59    public IRecommendationModel TrainModel(KnowledgeCenter okc, string[] characteristics) {
     60      var piDistances = okc.GetProblemDistances(characteristics);
    7561      var maxDist = piDistances.Max(x => x.Value);
    7662      var instances = new SortedList<double, IAlgorithm>();
     
    10995          avgERT += new System.Random().NextDouble();
    11096        }
    111         instances.Add(avgERT, algorithm);
     97        instances.Add(avgERT, (IAlgorithm)algorithm.Clone());
    11298      }
    11399
    114       foreach (var alg in instances.Select(x => (IAlgorithm)x.Value.Clone()))
    115         yield return alg;
     100      return new FixedRankModel(instances.Select(x => Tuple.Create(x.Value, x.Key)));
    116101    }
    117102  }
  • branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem.Common/3.3/Recommenders/KNearestNeighborRecommender.cs

    r13786 r13787  
    2323using HeuristicLab.Core;
    2424using HeuristicLab.Data;
    25 using HeuristicLab.Optimization;
    2625using HeuristicLab.Parameters;
    2726using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    28 using System.Collections.Generic;
    29 using System.Linq;
    3027
    3128namespace HeuristicLab.OptimizationExpertSystem.Common {
     
    3330  [StorableClass]
    3431  public sealed class KNearestNeighborRecommender : ParameterizedNamedItem, IAlgorithmInstanceRecommender {
    35     private KnowledgeCenter okc;
    36 
    37     private IFixedValueParameter<EnumValue<ProblemInstanceProximityType>> ProximityTypeParameter {
    38       get { return (IFixedValueParameter<EnumValue<ProblemInstanceProximityType>>)Parameters["ProximityType"]; }
    39     }
    40 
    41     public ProblemInstanceProximityType ProximityType {
    42       get { return ProximityTypeParameter.Value.Value; }
    43       set { ProximityTypeParameter.Value.Value = value; }
    44     }
    45 
     32   
    4633    private IFixedValueParameter<IntValue> KParameter {
    4734      get { return (IFixedValueParameter<IntValue>)Parameters["K"]; }
     
    5239    private KNearestNeighborRecommender(KNearestNeighborRecommender original, Cloner cloner)
    5340      : base(original, cloner) { }
    54     public KNearestNeighborRecommender(KnowledgeCenter okc) {
    55       this.okc = okc;
    56       Parameters.Add(new FixedValueParameter<EnumValue<ProblemInstanceProximityType>>("ProximityType", "The type of neighbor proximity.", new EnumValue<ProblemInstanceProximityType>(ProblemInstanceProximityType.FeatureSpace)));
     41    public KNearestNeighborRecommender() {
    5742      Parameters.Add(new FixedValueParameter<IntValue>("K", "The number of nearest neighbors to consider.", new IntValue(5)));
    5843    }
     
    6247    }
    6348
    64     public IEnumerable<IAlgorithm> GetRanking() {
    65       if (okc.Problem.ProblemId == -1) yield break;
    66 
    67       var distances = okc.GetProblemDistances(ProximityType);
    68       var K = KParameter.Value.Value;
    69       var performances = new Dictionary<IAlgorithm, List<double>>();
    70       for (var k = 0; k < K; k++) {
    71         if (distances.Count == 0) break;
    72         var min = distances.MinItems(x => x.Value).First();
    73         // lookup algorithm performances in min
    74         var perfs = okc.GetAlgorithmPerformance(min.Key);
    75         if (perfs.Count == 0) {
    76           k--;
    77           continue;
    78         }
    79         foreach (var p in perfs) {
    80           var ert = p.Value;
    81           if (double.IsNaN(ert)) ert = int.MaxValue;
    82           List<double> erts;
    83           if (!performances.TryGetValue(p.Key, out erts)) {
    84             performances[p.Key] = new List<double>() { ert }; ;
    85           } else erts.Add(ert);
    86         }
    87         distances.Remove(min.Key);
    88       }
    89       foreach (var alg in performances.Select(x => new { Alg = x.Key, Perf = x.Value.Average() })
    90                          .OrderBy(x => x.Perf)
    91                          .Select(x => x.Alg))
    92         yield return alg;
     49    public IRecommendationModel TrainModel(KnowledgeCenter kc, string[] characteristics) {
     50      return new KNearestNeighborModel(KParameter.Value.Value, characteristics);
    9351    }
    9452  }
  • branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem.Common/3.3/Recommenders/OverallBestRecommender.cs

    r13786 r13787  
    3535  [StorableClass]
    3636  public class OverallBestRecommender : ParameterizedNamedItem, IAlgorithmInstanceRecommender {
    37     private KnowledgeCenter okc;
    38 
    39     private IFixedValueParameter<EnumValue<ProblemInstanceProximityType>> ProximityTypeParameter {
    40       get { return (IFixedValueParameter<EnumValue<ProblemInstanceProximityType>>)Parameters["ProximityType"]; }
    41     }
    4237
    4338    private IFixedValueParameter<DoubleValue> NeighborhoodFactorParameter {
    4439      get { return (IFixedValueParameter<DoubleValue>)Parameters["NeighborhoodFactor"]; }
    45     }
    46 
    47     public ProblemInstanceProximityType ProximityType {
    48       get { return ProximityTypeParameter.Value.Value; }
    49       set { ProximityTypeParameter.Value.Value = value; }
    5040    }
    5141
     
    5949    private OverallBestRecommender(OverallBestRecommender original, Cloner cloner)
    6050      : base(original, cloner) { }
    61     public OverallBestRecommender(KnowledgeCenter okc) {
    62       this.okc = okc;
    63       Parameters.Add(new FixedValueParameter<EnumValue<ProblemInstanceProximityType>>("ProximityType", "The type of neighbor proximity.", new EnumValue<ProblemInstanceProximityType>(ProblemInstanceProximityType.FeatureSpace)));
     51    public OverallBestRecommender() {
    6452      Parameters.Add(new FixedValueParameter<DoubleValue>("NeighborhoodFactor", "Penalize neighbors that are far away.", new DoubleValue(5)));
    6553    }
     
    6957    }
    7058
    71     public IEnumerable<IAlgorithm> GetRanking() {
    72       if (okc.Problem.ProblemId == -1) yield break;
    73 
     59    public IRecommendationModel TrainModel(KnowledgeCenter kc, string[] characteristics) {
    7460      var instances = new List<Tuple<IAlgorithm, double>>();
    75       foreach (var relevantRuns in okc.GetKnowledgeBaseByAlgorithm()) {
     61      foreach (var relevantRuns in kc.GetKnowledgeBaseByAlgorithm()) {
    7662        var algorithm = relevantRuns.Key;
    7763        var pis = relevantRuns.Value.Select(x => ((StringValue)x.Parameters["Problem Name"]).Value).Distinct()
    78                               .Select(x => Tuple.Create(x, okc.ProblemInstances.SingleOrDefault(y => ((StringValue)y.Parameters["Problem Name"]).Value == x)))
     64                              .Select(x => Tuple.Create(x, kc.ProblemInstances.SingleOrDefault(y => ((StringValue)y.Parameters["Problem Name"]).Value == x)))
    7965                              .Where(x => x.Item2 != null)
    8066                              .Select(x => Tuple.Create(x.Item1, ((DoubleValue)x.Item2.Parameters["BestKnownQuality"]).Value))
     
    8470        foreach (var problemRuns in relevantRuns.Value.GroupBy(x => ((StringValue)x.Parameters["Problem Name"]).Value)) {
    8571          var bkq = pis[problemRuns.Key];
    86           var ert = ExpectedRuntimeHelper.CalculateErt(problemRuns.ToList(), "QualityPerEvaluations", (okc.Maximization ? (1 - okc.MinimumTarget.Value) : (1 + okc.MinimumTarget.Value)) * bkq, okc.Maximization).ExpectedRuntime;
     72          var ert = ExpectedRuntimeHelper.CalculateErt(problemRuns.ToList(), "QualityPerEvaluations", (kc.Maximization ? (1 - kc.MinimumTarget.Value) : (1 + kc.MinimumTarget.Value)) * bkq, kc.Maximization).ExpectedRuntime;
    8773          if (double.IsNaN(ert)) ert = int.MaxValue;
    8874          avgERT += ert;
     
    9076        }
    9177        avgERT /= count;
    92         instances.Add(Tuple.Create(algorithm, avgERT));
     78        instances.Add(Tuple.Create((IAlgorithm)algorithm.Clone(), avgERT));
    9379      }
    9480
    95       foreach (var alg in instances.OrderBy(x => x.Item2).Select(x => (IAlgorithm)x.Item1.Clone()))
    96         yield return alg;
     81      return new FixedRankModel(instances.OrderBy(x => x.Item2));
    9782    }
    9883  }
  • branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem/3.3/HeuristicLab.OptimizationExpertSystem-3.3.csproj

    r13748 r13787  
    191191      <DependentUpon>AlgorithmControlForm.cs</DependentUpon>
    192192    </Compile>
     193    <Compile Include="Menu\200_Solving\210_PerformanceModelingMenuItem.cs" />
    193194    <Compile Include="Toolbar\DownloadFromOKBToolbarItem.cs" />
    194195    <Compile Include="Toolbar\ToolbarItemBase.cs" />
     
    209210    <Compile Include="Menu\0_Config\30_DownloadFromOkbMenuItem.cs" />
    210211    <Compile Include="Menu\0_Config\10_SetCredentialsMenuItem.cs" />
    211     <Compile Include="Menu\200_Solving\210_SolverMenuItem.cs" />
     212    <Compile Include="Menu\200_Solving\220_SolverMenuItem.cs" />
    212213    <Compile Include="Menu\300_Learning\310_KnowledgeBaseMenuItem.cs" />
    213214    <Compile Include="Menu\900_Tools\900_CSharpScriptMenuItem.cs" />
     
    227228    </Compile>
    228229    <Compile Include="Plugin.cs" />
     230    <Compile Include="Views\PerformanceModelingView.cs">
     231      <SubType>UserControl</SubType>
     232    </Compile>
     233    <Compile Include="Views\PerformanceModelingView.Designer.cs">
     234      <DependentUpon>PerformanceModelingView.cs</DependentUpon>
     235    </Compile>
    229236    <Compile Include="Views\SolverView.cs">
    230237      <SubType>UserControl</SubType>
     
    297304    <EmbeddedResource Include="OptimizationKnowledgeCenter.resx">
    298305      <DependentUpon>OptimizationKnowledgeCenter.cs</DependentUpon>
     306    </EmbeddedResource>
     307    <EmbeddedResource Include="Views\PerformanceModelingView.resx">
     308      <DependentUpon>PerformanceModelingView.cs</DependentUpon>
    299309    </EmbeddedResource>
    300310    <EmbeddedResource Include="Views\SolverView.resx">
  • branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem/3.3/Menu/200_Solving/210_PerformanceModelingMenuItem.cs

    r13772 r13787  
    2727
    2828namespace HeuristicLab.OptimizationExpertSystem.Menu {
    29   internal class SolverMenuItem : MenuItemBase {
     29  internal class PerformanceModelingMenuItem : MenuItemBase {
    3030    public override Image Image { get { return VSImageLibrary.Event; } }
    3131
    3232    public override string Name {
    33       get { return "Solver"; }
     33      get { return "Performance Modeling"; }
    3434    }
    3535
     
    4242    }
    4343
    44     public override string ToolTipText { get { return "Solve the problem instance."; } }
     44    public override string ToolTipText { get { return "Modeling algorithm performance to suggest well-suited instances."; } }
    4545
    4646    public override void Execute() {
    47       var viewType = typeof(SolverView);
     47      var viewType = typeof(PerformanceModelingView);
    4848      var view = MainForm.Views.FirstOrDefault(x => viewType == ((x is ViewHost) ? ((ViewHost)x).ActiveView : x).GetType());
    4949      if (view != null) view.Show();
  • branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem/3.3/Menu/200_Solving/220_SolverMenuItem.cs

    r13786 r13787  
    3939
    4040    public override int Position {
    41       get { return 210; }
     41      get { return 220; }
    4242    }
    4343
  • branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem/3.3/Views/KnowledgeCenterViewBase.cs

    r13774 r13787  
    4848      Content.DownloadStarted += ContentOnDownloadStarted;
    4949      Content.AlgorithmInstanceStarted += ContentOnAlgorithmInstanceStarted;
     50      Content.RecommendationModelChanged += ContentOnRecommendationModelChanged;
    5051      RegisterContentProblemEvents();
    5152      RegisterContentProblemInstancesEvents();
    52       RegisterContentProblemCharacteristicsEvents();
    5353      RegisterContentSolutionSeedingPoolEvents();
    5454      RegisterContentSuggestedInstancesEvents();
     
    7171    }
    7272
    73     private void RegisterContentProblemCharacteristicsEvents() {
    74       Content.ProblemCharacteristics.ItemsAdded += ContentOnProblemCharacteristicsChanged;
    75       Content.ProblemCharacteristics.ItemsReplaced += ContentOnProblemCharacteristicsChanged;
    76       Content.ProblemCharacteristics.ItemsRemoved += ContentOnProblemCharacteristicsChanged;
    77       Content.ProblemCharacteristics.CheckedItemsChanged += ContentOnProblemCharacteristicsChanged;
    78       Content.ProblemCharacteristics.CollectionReset += ContentOnProblemCharacteristicsChanged;
    79     }
    80 
    8173    private void RegisterContentSolutionSeedingPoolEvents() {
    8274      Content.SolutionSeedingPool.CheckedItemsChanged += ContentOnSolutionSeedingPoolChanged;
     
    8880
    8981    private void RegisterContentSuggestedInstancesEvents() {
    90       Content.AlgorithmInstances.CollectionReset += ContentOnSuggestedInstancesChanged;
    91       Content.AlgorithmInstances.ItemsAdded += ContentOnSuggestedInstancesChanged;
    92       Content.AlgorithmInstances.ItemsMoved += ContentOnSuggestedInstancesChanged;
    93       Content.AlgorithmInstances.ItemsRemoved += ContentOnSuggestedInstancesChanged;
    94       Content.AlgorithmInstances.ItemsReplaced += ContentOnSuggestedInstancesChanged;
     82      Content.AlgorithmInstances.CollectionReset += ContentOnAlgorithmInstancesChanged;
     83      Content.AlgorithmInstances.ItemsAdded += ContentOnAlgorithmInstancesChanged;
     84      Content.AlgorithmInstances.ItemsMoved += ContentOnAlgorithmInstancesChanged;
     85      Content.AlgorithmInstances.ItemsRemoved += ContentOnAlgorithmInstancesChanged;
     86      Content.AlgorithmInstances.ItemsReplaced += ContentOnAlgorithmInstancesChanged;
    9587    }
    9688
     
    9991      Content.DownloadStarted -= ContentOnDownloadStarted;
    10092      Content.AlgorithmInstanceStarted -= ContentOnAlgorithmInstanceStarted;
     93      Content.RecommendationModelChanged -= ContentOnRecommendationModelChanged;
    10194      DeregisterContentProblemEvents();
    10295      DeregisterContentProblemInstancesEvents();
    103       DeregisterContentProblemCharacteristicsEvents();
    10496      DeregisterContentSolutionSeedingPoolEvents();
    10597      DeregisterContentSuggestedInstancesEvents();
     
    122114    }
    123115
    124     private void DeregisterContentProblemCharacteristicsEvents() {
    125       Content.ProblemCharacteristics.ItemsAdded -= ContentOnProblemCharacteristicsChanged;
    126       Content.ProblemCharacteristics.ItemsReplaced -= ContentOnProblemCharacteristicsChanged;
    127       Content.ProblemCharacteristics.ItemsRemoved -= ContentOnProblemCharacteristicsChanged;
    128       Content.ProblemCharacteristics.CheckedItemsChanged -= ContentOnProblemCharacteristicsChanged;
    129       Content.ProblemCharacteristics.CollectionReset -= ContentOnProblemCharacteristicsChanged;
    130     }
    131 
    132116    private void DeregisterContentSolutionSeedingPoolEvents() {
    133117      Content.SolutionSeedingPool.CheckedItemsChanged -= ContentOnSolutionSeedingPoolChanged;
     
    139123
    140124    private void DeregisterContentSuggestedInstancesEvents() {
    141       Content.AlgorithmInstances.CollectionReset -= ContentOnSuggestedInstancesChanged;
    142       Content.AlgorithmInstances.ItemsAdded -= ContentOnSuggestedInstancesChanged;
    143       Content.AlgorithmInstances.ItemsMoved -= ContentOnSuggestedInstancesChanged;
    144       Content.AlgorithmInstances.ItemsRemoved -= ContentOnSuggestedInstancesChanged;
    145       Content.AlgorithmInstances.ItemsReplaced -= ContentOnSuggestedInstancesChanged;
     125      Content.AlgorithmInstances.CollectionReset -= ContentOnAlgorithmInstancesChanged;
     126      Content.AlgorithmInstances.ItemsAdded -= ContentOnAlgorithmInstancesChanged;
     127      Content.AlgorithmInstances.ItemsMoved -= ContentOnAlgorithmInstancesChanged;
     128      Content.AlgorithmInstances.ItemsRemoved -= ContentOnAlgorithmInstancesChanged;
     129      Content.AlgorithmInstances.ItemsReplaced -= ContentOnAlgorithmInstancesChanged;
    146130    }
    147131    #endregion
     
    150134    protected virtual void OnDownloadEnded() { }
    151135    protected virtual void OnAlgorithmInstanceStarted(IAlgorithm algorithm) { }
     136    protected virtual void OnRecommendationModelChanged() { }
    152137    protected virtual void OnPropertyChanged(string propertyName) { }
    153138    protected virtual void OnProblemChanged() { }
    154139    protected virtual void OnProblemSolutionsChanged() { }
    155140    protected virtual void OnProblemInstancesChanged() { }
    156     protected virtual void OnProblemCharacteristicsChanged() { }
    157141    protected virtual void OnSolutionSeedingPoolChanged() { }
    158     protected virtual void OnSuggestedInstancesChanged() { }
     142    protected virtual void OnAlgorithmInstancesChanged() { }
    159143    protected virtual void OnKnowledgeBaseChanged() { }
    160144
     
    170154      if (InvokeRequired) { Invoke((Action<object, EventArgs<IAlgorithm>>)ContentOnAlgorithmInstanceStarted, sender, e); return; }
    171155      OnAlgorithmInstanceStarted(e.Value);
     156    }
     157
     158    private void ContentOnRecommendationModelChanged(object sender, EventArgs e) {
     159      if (InvokeRequired) { Invoke((Action<object, EventArgs<IAlgorithm>>)ContentOnRecommendationModelChanged, sender, e); return; }
     160      OnRecommendationModelChanged();
    172161    }
    173162
     
    194183    }
    195184
    196     private void ContentOnProblemCharacteristicsChanged(object sender, EventArgs e) {
    197       if (InvokeRequired) Invoke((Action)OnProblemCharacteristicsChanged);
    198       else OnProblemCharacteristicsChanged();
    199     }
    200 
    201185    private void ContentOnSolutionSeedingPoolChanged(object sender, EventArgs e) {
    202186      if (InvokeRequired) Invoke((Action)OnSolutionSeedingPoolChanged);
     
    204188    }
    205189
    206     private void ContentOnSuggestedInstancesChanged(object sender, EventArgs e) {
    207       if (InvokeRequired) Invoke((Action)OnSuggestedInstancesChanged);
    208       else OnSuggestedInstancesChanged();
     190    private void ContentOnAlgorithmInstancesChanged(object sender, EventArgs e) {
     191      if (InvokeRequired) Invoke((Action)OnAlgorithmInstancesChanged);
     192      else OnAlgorithmInstancesChanged();
    209193    }
    210194    #endregion
  • branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem/3.3/Views/SolverView.Designer.cs

    r13774 r13787  
    4545    /// </summary>
    4646    private void InitializeComponent() {
    47       WeifenLuo.WinFormsUI.Docking.DockPanelSkin dockPanelSkin2 = new WeifenLuo.WinFormsUI.Docking.DockPanelSkin();
    48       WeifenLuo.WinFormsUI.Docking.AutoHideStripSkin autoHideStripSkin2 = new WeifenLuo.WinFormsUI.Docking.AutoHideStripSkin();
    49       WeifenLuo.WinFormsUI.Docking.DockPanelGradient dockPanelGradient4 = new WeifenLuo.WinFormsUI.Docking.DockPanelGradient();
    50       WeifenLuo.WinFormsUI.Docking.TabGradient tabGradient8 = new WeifenLuo.WinFormsUI.Docking.TabGradient();
    51       WeifenLuo.WinFormsUI.Docking.DockPaneStripSkin dockPaneStripSkin2 = new WeifenLuo.WinFormsUI.Docking.DockPaneStripSkin();
    52       WeifenLuo.WinFormsUI.Docking.DockPaneStripGradient dockPaneStripGradient2 = new WeifenLuo.WinFormsUI.Docking.DockPaneStripGradient();
    53       WeifenLuo.WinFormsUI.Docking.TabGradient tabGradient9 = new WeifenLuo.WinFormsUI.Docking.TabGradient();
    54       WeifenLuo.WinFormsUI.Docking.DockPanelGradient dockPanelGradient5 = new WeifenLuo.WinFormsUI.Docking.DockPanelGradient();
    55       WeifenLuo.WinFormsUI.Docking.TabGradient tabGradient10 = new WeifenLuo.WinFormsUI.Docking.TabGradient();
    56       WeifenLuo.WinFormsUI.Docking.DockPaneStripToolWindowGradient dockPaneStripToolWindowGradient2 = new WeifenLuo.WinFormsUI.Docking.DockPaneStripToolWindowGradient();
    57       WeifenLuo.WinFormsUI.Docking.TabGradient tabGradient11 = new WeifenLuo.WinFormsUI.Docking.TabGradient();
    58       WeifenLuo.WinFormsUI.Docking.TabGradient tabGradient12 = new WeifenLuo.WinFormsUI.Docking.TabGradient();
    59       WeifenLuo.WinFormsUI.Docking.DockPanelGradient dockPanelGradient6 = new WeifenLuo.WinFormsUI.Docking.DockPanelGradient();
    60       WeifenLuo.WinFormsUI.Docking.TabGradient tabGradient13 = new WeifenLuo.WinFormsUI.Docking.TabGradient();
    61       WeifenLuo.WinFormsUI.Docking.TabGradient tabGradient14 = new WeifenLuo.WinFormsUI.Docking.TabGradient();
     47      WeifenLuo.WinFormsUI.Docking.DockPanelSkin dockPanelSkin4 = new WeifenLuo.WinFormsUI.Docking.DockPanelSkin();
     48      WeifenLuo.WinFormsUI.Docking.AutoHideStripSkin autoHideStripSkin4 = new WeifenLuo.WinFormsUI.Docking.AutoHideStripSkin();
     49      WeifenLuo.WinFormsUI.Docking.DockPanelGradient dockPanelGradient10 = new WeifenLuo.WinFormsUI.Docking.DockPanelGradient();
     50      WeifenLuo.WinFormsUI.Docking.TabGradient tabGradient22 = new WeifenLuo.WinFormsUI.Docking.TabGradient();
     51      WeifenLuo.WinFormsUI.Docking.DockPaneStripSkin dockPaneStripSkin4 = new WeifenLuo.WinFormsUI.Docking.DockPaneStripSkin();
     52      WeifenLuo.WinFormsUI.Docking.DockPaneStripGradient dockPaneStripGradient4 = new WeifenLuo.WinFormsUI.Docking.DockPaneStripGradient();
     53      WeifenLuo.WinFormsUI.Docking.TabGradient tabGradient23 = new WeifenLuo.WinFormsUI.Docking.TabGradient();
     54      WeifenLuo.WinFormsUI.Docking.DockPanelGradient dockPanelGradient11 = new WeifenLuo.WinFormsUI.Docking.DockPanelGradient();
     55      WeifenLuo.WinFormsUI.Docking.TabGradient tabGradient24 = new WeifenLuo.WinFormsUI.Docking.TabGradient();
     56      WeifenLuo.WinFormsUI.Docking.DockPaneStripToolWindowGradient dockPaneStripToolWindowGradient4 = new WeifenLuo.WinFormsUI.Docking.DockPaneStripToolWindowGradient();
     57      WeifenLuo.WinFormsUI.Docking.TabGradient tabGradient25 = new WeifenLuo.WinFormsUI.Docking.TabGradient();
     58      WeifenLuo.WinFormsUI.Docking.TabGradient tabGradient26 = new WeifenLuo.WinFormsUI.Docking.TabGradient();
     59      WeifenLuo.WinFormsUI.Docking.DockPanelGradient dockPanelGradient12 = new WeifenLuo.WinFormsUI.Docking.DockPanelGradient();
     60      WeifenLuo.WinFormsUI.Docking.TabGradient tabGradient27 = new WeifenLuo.WinFormsUI.Docking.TabGradient();
     61      WeifenLuo.WinFormsUI.Docking.TabGradient tabGradient28 = new WeifenLuo.WinFormsUI.Docking.TabGradient();
    6262      this.minTargetView = new HeuristicLab.Data.Views.StringConvertibleValueView();
    6363      this.maxEvaluationsView = new HeuristicLab.Data.Views.StringConvertibleValueView();
    6464      this.algorithmCloneButton = new System.Windows.Forms.Button();
    6565      this.seedingStrategyPanel = new System.Windows.Forms.Panel();
     66      this.algorithmStartButton = new System.Windows.Forms.Button();
     67      this.minimumTargetLabel = new System.Windows.Forms.Label();
     68      this.seedingStrategyLabel = new System.Windows.Forms.Label();
     69      this.evaluationsLimitabel = new System.Windows.Forms.Label();
     70      this.suggestedInstancesComboBox = new System.Windows.Forms.ComboBox();
     71      this.instanceLabel = new System.Windows.Forms.Label();
    6672      this.solverTabControl = new HeuristicLab.MainForm.WindowsForms.DragOverTabControl();
    6773      this.resultsTabPage = new System.Windows.Forms.TabPage();
     
    7783      this.operatorGraphTabPage = new System.Windows.Forms.TabPage();
    7884      this.operatorGraphViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost();
    79       this.algorithmStartButton = new System.Windows.Forms.Button();
    80       this.minimumTargetLabel = new System.Windows.Forms.Label();
    81       this.seedingStrategyLabel = new System.Windows.Forms.Label();
    82       this.evaluationsLimitabel = new System.Windows.Forms.Label();
    83       this.recommenderLabel = new System.Windows.Forms.Label();
    84       this.suggestedInstancesComboBox = new System.Windows.Forms.ComboBox();
    85       this.recommenderComboBox = new System.Windows.Forms.ComboBox();
    86       this.solverSplitContainer = new System.Windows.Forms.SplitContainer();
    87       this.recommenderViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost();
    88       this.instanceLabel = new System.Windows.Forms.Label();
    89       this.recommendRefreshButton = new System.Windows.Forms.Button();
    9085      this.solverTabControl.SuspendLayout();
    9186      this.resultsTabPage.SuspendLayout();
     
    9489      this.parametersTabPage.SuspendLayout();
    9590      this.operatorGraphTabPage.SuspendLayout();
    96       ((System.ComponentModel.ISupportInitialize)(this.solverSplitContainer)).BeginInit();
    97       this.solverSplitContainer.Panel1.SuspendLayout();
    98       this.solverSplitContainer.Panel2.SuspendLayout();
    99       this.solverSplitContainer.SuspendLayout();
    10091      this.SuspendLayout();
    10192      //
     
    124115      // algorithmCloneButton
    125116      //
    126       this.algorithmCloneButton.Location = new System.Drawing.Point(123, 60);
     117      this.algorithmCloneButton.Location = new System.Drawing.Point(518, 56);
    127118      this.algorithmCloneButton.Name = "algorithmCloneButton";
    128119      this.algorithmCloneButton.Size = new System.Drawing.Size(26, 23);
    129120      this.algorithmCloneButton.TabIndex = 15;
    130       this.algorithmCloneButton.Text = "Clone";
     121      this.algorithmCloneButton.Text = "c";
    131122      this.algorithmCloneButton.UseVisualStyleBackColor = true;
    132123      this.algorithmCloneButton.Click += new System.EventHandler(this.AlgorithmCloneButtonOnClick);
     
    141132      this.seedingStrategyPanel.TabIndex = 12;
    142133      //
     134      // algorithmStartButton
     135      //
     136      this.algorithmStartButton.Location = new System.Drawing.Point(486, 56);
     137      this.algorithmStartButton.Name = "algorithmStartButton";
     138      this.algorithmStartButton.Size = new System.Drawing.Size(26, 23);
     139      this.algorithmStartButton.TabIndex = 10;
     140      this.algorithmStartButton.Text = "Start";
     141      this.algorithmStartButton.UseVisualStyleBackColor = true;
     142      this.algorithmStartButton.Click += new System.EventHandler(this.AlgorithmStartButtonOnClick);
     143      //
     144      // minimumTargetLabel
     145      //
     146      this.minimumTargetLabel.AutoSize = true;
     147      this.minimumTargetLabel.Location = new System.Drawing.Point(384, 6);
     148      this.minimumTargetLabel.Name = "minimumTargetLabel";
     149      this.minimumTargetLabel.Size = new System.Drawing.Size(41, 13);
     150      this.minimumTargetLabel.TabIndex = 13;
     151      this.minimumTargetLabel.Text = "Target:";
     152      //
     153      // seedingStrategyLabel
     154      //
     155      this.seedingStrategyLabel.AutoSize = true;
     156      this.seedingStrategyLabel.Location = new System.Drawing.Point(3, 33);
     157      this.seedingStrategyLabel.Name = "seedingStrategyLabel";
     158      this.seedingStrategyLabel.Size = new System.Drawing.Size(91, 13);
     159      this.seedingStrategyLabel.TabIndex = 8;
     160      this.seedingStrategyLabel.Text = "Seeding Strategy:";
     161      //
     162      // evaluationsLimitabel
     163      //
     164      this.evaluationsLimitabel.AutoSize = true;
     165      this.evaluationsLimitabel.Location = new System.Drawing.Point(3, 6);
     166      this.evaluationsLimitabel.Name = "evaluationsLimitabel";
     167      this.evaluationsLimitabel.Size = new System.Drawing.Size(66, 13);
     168      this.evaluationsLimitabel.TabIndex = 13;
     169      this.evaluationsLimitabel.Text = "Budget (FE):";
     170      //
     171      // suggestedInstancesComboBox
     172      //
     173      this.suggestedInstancesComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
     174      this.suggestedInstancesComboBox.FormattingEnabled = true;
     175      this.suggestedInstancesComboBox.Location = new System.Drawing.Point(108, 56);
     176      this.suggestedInstancesComboBox.Name = "suggestedInstancesComboBox";
     177      this.suggestedInstancesComboBox.Size = new System.Drawing.Size(372, 21);
     178      this.suggestedInstancesComboBox.TabIndex = 7;
     179      this.suggestedInstancesComboBox.SelectedIndexChanged += new System.EventHandler(this.SuggestedInstancesComboBoxOnSelectedIndexChanged);
     180      //
     181      // instanceLabel
     182      //
     183      this.instanceLabel.AutoSize = true;
     184      this.instanceLabel.Location = new System.Drawing.Point(3, 59);
     185      this.instanceLabel.Name = "instanceLabel";
     186      this.instanceLabel.Size = new System.Drawing.Size(51, 13);
     187      this.instanceLabel.TabIndex = 9;
     188      this.instanceLabel.Text = "Instance:";
     189      //
    143190      // solverTabControl
    144191      //
    145       this.solverTabControl.AllowDrop = true;
     192      this.solverTabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     193            | System.Windows.Forms.AnchorStyles.Left)
     194            | System.Windows.Forms.AnchorStyles.Right)));
    146195      this.solverTabControl.Controls.Add(this.resultsTabPage);
    147196      this.solverTabControl.Controls.Add(this.runsTabPage);
     
    150199      this.solverTabControl.Controls.Add(this.parametersTabPage);
    151200      this.solverTabControl.Controls.Add(this.operatorGraphTabPage);
    152       this.solverTabControl.Dock = System.Windows.Forms.DockStyle.Fill;
    153       this.solverTabControl.Location = new System.Drawing.Point(3, 3);
     201      this.solverTabControl.Location = new System.Drawing.Point(6, 85);
    154202      this.solverTabControl.Name = "solverTabControl";
    155203      this.solverTabControl.SelectedIndex = 0;
    156       this.solverTabControl.Size = new System.Drawing.Size(556, 502);
    157       this.solverTabControl.TabIndex = 11;
     204      this.solverTabControl.Size = new System.Drawing.Size(843, 479);
     205      this.solverTabControl.TabIndex = 17;
    158206      //
    159207      // resultsTabPage
     
    164212      this.resultsTabPage.Name = "resultsTabPage";
    165213      this.resultsTabPage.Padding = new System.Windows.Forms.Padding(3);
    166       this.resultsTabPage.Size = new System.Drawing.Size(548, 476);
     214      this.resultsTabPage.Size = new System.Drawing.Size(835, 453);
    167215      this.resultsTabPage.TabIndex = 2;
    168216      this.resultsTabPage.Text = "Results";
     
    189237      this.resultsDockPanel.Location = new System.Drawing.Point(3, 29);
    190238      this.resultsDockPanel.Name = "resultsDockPanel";
    191       this.resultsDockPanel.Size = new System.Drawing.Size(542, 444);
    192       dockPanelGradient4.EndColor = System.Drawing.SystemColors.ControlLight;
    193       dockPanelGradient4.StartColor = System.Drawing.SystemColors.ControlLight;
    194       autoHideStripSkin2.DockStripGradient = dockPanelGradient4;
    195       tabGradient8.EndColor = System.Drawing.SystemColors.Control;
    196       tabGradient8.StartColor = System.Drawing.SystemColors.Control;
    197       tabGradient8.TextColor = System.Drawing.SystemColors.ControlDarkDark;
    198       autoHideStripSkin2.TabGradient = tabGradient8;
    199       autoHideStripSkin2.TextFont = new System.Drawing.Font("Segoe UI", 9F);
    200       dockPanelSkin2.AutoHideStripSkin = autoHideStripSkin2;
    201       tabGradient9.EndColor = System.Drawing.SystemColors.ControlLightLight;
    202       tabGradient9.StartColor = System.Drawing.SystemColors.ControlLightLight;
    203       tabGradient9.TextColor = System.Drawing.SystemColors.ControlText;
    204       dockPaneStripGradient2.ActiveTabGradient = tabGradient9;
    205       dockPanelGradient5.EndColor = System.Drawing.SystemColors.Control;
    206       dockPanelGradient5.StartColor = System.Drawing.SystemColors.Control;
    207       dockPaneStripGradient2.DockStripGradient = dockPanelGradient5;
    208       tabGradient10.EndColor = System.Drawing.SystemColors.ControlLight;
    209       tabGradient10.StartColor = System.Drawing.SystemColors.ControlLight;
    210       tabGradient10.TextColor = System.Drawing.SystemColors.ControlText;
    211       dockPaneStripGradient2.InactiveTabGradient = tabGradient10;
    212       dockPaneStripSkin2.DocumentGradient = dockPaneStripGradient2;
    213       dockPaneStripSkin2.TextFont = new System.Drawing.Font("Segoe UI", 9F);
    214       tabGradient11.EndColor = System.Drawing.SystemColors.ActiveCaption;
    215       tabGradient11.LinearGradientMode = System.Drawing.Drawing2D.LinearGradientMode.Vertical;
    216       tabGradient11.StartColor = System.Drawing.SystemColors.GradientActiveCaption;
    217       tabGradient11.TextColor = System.Drawing.SystemColors.ActiveCaptionText;
    218       dockPaneStripToolWindowGradient2.ActiveCaptionGradient = tabGradient11;
    219       tabGradient12.EndColor = System.Drawing.SystemColors.Control;
    220       tabGradient12.StartColor = System.Drawing.SystemColors.Control;
    221       tabGradient12.TextColor = System.Drawing.SystemColors.ControlText;
    222       dockPaneStripToolWindowGradient2.ActiveTabGradient = tabGradient12;
    223       dockPanelGradient6.EndColor = System.Drawing.SystemColors.ControlLight;
    224       dockPanelGradient6.StartColor = System.Drawing.SystemColors.ControlLight;
    225       dockPaneStripToolWindowGradient2.DockStripGradient = dockPanelGradient6;
    226       tabGradient13.EndColor = System.Drawing.SystemColors.InactiveCaption;
    227       tabGradient13.LinearGradientMode = System.Drawing.Drawing2D.LinearGradientMode.Vertical;
    228       tabGradient13.StartColor = System.Drawing.SystemColors.GradientInactiveCaption;
    229       tabGradient13.TextColor = System.Drawing.SystemColors.InactiveCaptionText;
    230       dockPaneStripToolWindowGradient2.InactiveCaptionGradient = tabGradient13;
    231       tabGradient14.EndColor = System.Drawing.Color.Transparent;
    232       tabGradient14.StartColor = System.Drawing.Color.Transparent;
    233       tabGradient14.TextColor = System.Drawing.SystemColors.ControlDarkDark;
    234       dockPaneStripToolWindowGradient2.InactiveTabGradient = tabGradient14;
    235       dockPaneStripSkin2.ToolWindowGradient = dockPaneStripToolWindowGradient2;
    236       dockPanelSkin2.DockPaneStripSkin = dockPaneStripSkin2;
    237       this.resultsDockPanel.Skin = dockPanelSkin2;
     239      this.resultsDockPanel.Size = new System.Drawing.Size(829, 421);
     240      dockPanelGradient10.EndColor = System.Drawing.SystemColors.ControlLight;
     241      dockPanelGradient10.StartColor = System.Drawing.SystemColors.ControlLight;
     242      autoHideStripSkin4.DockStripGradient = dockPanelGradient10;
     243      tabGradient22.EndColor = System.Drawing.SystemColors.Control;
     244      tabGradient22.StartColor = System.Drawing.SystemColors.Control;
     245      tabGradient22.TextColor = System.Drawing.SystemColors.ControlDarkDark;
     246      autoHideStripSkin4.TabGradient = tabGradient22;
     247      autoHideStripSkin4.TextFont = new System.Drawing.Font("Segoe UI", 9F);
     248      dockPanelSkin4.AutoHideStripSkin = autoHideStripSkin4;
     249      tabGradient23.EndColor = System.Drawing.SystemColors.ControlLightLight;
     250      tabGradient23.StartColor = System.Drawing.SystemColors.ControlLightLight;
     251      tabGradient23.TextColor = System.Drawing.SystemColors.ControlText;
     252      dockPaneStripGradient4.ActiveTabGradient = tabGradient23;
     253      dockPanelGradient11.EndColor = System.Drawing.SystemColors.Control;
     254      dockPanelGradient11.StartColor = System.Drawing.SystemColors.Control;
     255      dockPaneStripGradient4.DockStripGradient = dockPanelGradient11;
     256      tabGradient24.EndColor = System.Drawing.SystemColors.ControlLight;
     257      tabGradient24.StartColor = System.Drawing.SystemColors.ControlLight;
     258      tabGradient24.TextColor = System.Drawing.SystemColors.ControlText;
     259      dockPaneStripGradient4.InactiveTabGradient = tabGradient24;
     260      dockPaneStripSkin4.DocumentGradient = dockPaneStripGradient4;
     261      dockPaneStripSkin4.TextFont = new System.Drawing.Font("Segoe UI", 9F);
     262      tabGradient25.EndColor = System.Drawing.SystemColors.ActiveCaption;
     263      tabGradient25.LinearGradientMode = System.Drawing.Drawing2D.LinearGradientMode.Vertical;
     264      tabGradient25.StartColor = System.Drawing.SystemColors.GradientActiveCaption;
     265      tabGradient25.TextColor = System.Drawing.SystemColors.ActiveCaptionText;
     266      dockPaneStripToolWindowGradient4.ActiveCaptionGradient = tabGradient25;
     267      tabGradient26.EndColor = System.Drawing.SystemColors.Control;
     268      tabGradient26.StartColor = System.Drawing.SystemColors.Control;
     269      tabGradient26.TextColor = System.Drawing.SystemColors.ControlText;
     270      dockPaneStripToolWindowGradient4.ActiveTabGradient = tabGradient26;
     271      dockPanelGradient12.EndColor = System.Drawing.SystemColors.ControlLight;
     272      dockPanelGradient12.StartColor = System.Drawing.SystemColors.ControlLight;
     273      dockPaneStripToolWindowGradient4.DockStripGradient = dockPanelGradient12;
     274      tabGradient27.EndColor = System.Drawing.SystemColors.InactiveCaption;
     275      tabGradient27.LinearGradientMode = System.Drawing.Drawing2D.LinearGradientMode.Vertical;
     276      tabGradient27.StartColor = System.Drawing.SystemColors.GradientInactiveCaption;
     277      tabGradient27.TextColor = System.Drawing.SystemColors.InactiveCaptionText;
     278      dockPaneStripToolWindowGradient4.InactiveCaptionGradient = tabGradient27;
     279      tabGradient28.EndColor = System.Drawing.Color.Transparent;
     280      tabGradient28.StartColor = System.Drawing.Color.Transparent;
     281      tabGradient28.TextColor = System.Drawing.SystemColors.ControlDarkDark;
     282      dockPaneStripToolWindowGradient4.InactiveTabGradient = tabGradient28;
     283      dockPaneStripSkin4.ToolWindowGradient = dockPaneStripToolWindowGradient4;
     284      dockPanelSkin4.DockPaneStripSkin = dockPaneStripSkin4;
     285      this.resultsDockPanel.Skin = dockPanelSkin4;
    238286      this.resultsDockPanel.TabIndex = 0;
    239287      //
     
    244292      this.runsTabPage.Name = "runsTabPage";
    245293      this.runsTabPage.Padding = new System.Windows.Forms.Padding(3);
    246       this.runsTabPage.Size = new System.Drawing.Size(548, 476);
     294      this.runsTabPage.Size = new System.Drawing.Size(548, 418);
    247295      this.runsTabPage.TabIndex = 4;
    248296      this.runsTabPage.Text = "Runs";
     
    257305      this.runsView.Name = "runsView";
    258306      this.runsView.ReadOnly = false;
    259       this.runsView.Size = new System.Drawing.Size(542, 470);
     307      this.runsView.Size = new System.Drawing.Size(542, 412);
    260308      this.runsView.TabIndex = 0;
    261309      //
     
    266314      this.seededRunsTabPage.Name = "seededRunsTabPage";
    267315      this.seededRunsTabPage.Padding = new System.Windows.Forms.Padding(3);
    268       this.seededRunsTabPage.Size = new System.Drawing.Size(548, 476);
     316      this.seededRunsTabPage.Size = new System.Drawing.Size(548, 418);
    269317      this.seededRunsTabPage.TabIndex = 5;
    270318      this.seededRunsTabPage.Text = "Seeded Runs";
     
    279327      this.seededRunsView.Name = "seededRunsView";
    280328      this.seededRunsView.ReadOnly = false;
    281       this.seededRunsView.Size = new System.Drawing.Size(542, 470);
     329      this.seededRunsView.Size = new System.Drawing.Size(542, 412);
    282330      this.seededRunsView.TabIndex = 1;
    283331      //
     
    287335      this.solutionSeedingTabPage.Name = "solutionSeedingTabPage";
    288336      this.solutionSeedingTabPage.Padding = new System.Windows.Forms.Padding(3);
    289       this.solutionSeedingTabPage.Size = new System.Drawing.Size(548, 476);
     337      this.solutionSeedingTabPage.Size = new System.Drawing.Size(548, 418);
    290338      this.solutionSeedingTabPage.TabIndex = 1;
    291339      this.solutionSeedingTabPage.Text = "Seeding Pool";
     
    298346      this.parametersTabPage.Name = "parametersTabPage";
    299347      this.parametersTabPage.Padding = new System.Windows.Forms.Padding(3);
    300       this.parametersTabPage.Size = new System.Drawing.Size(548, 476);
     348      this.parametersTabPage.Size = new System.Drawing.Size(548, 418);
    301349      this.parametersTabPage.TabIndex = 0;
    302350      this.parametersTabPage.Text = "Parameters";
     
    313361      this.solverParametersView.ReadOnly = true;
    314362      this.solverParametersView.ShowDetails = true;
    315       this.solverParametersView.Size = new System.Drawing.Size(542, 470);
     363      this.solverParametersView.Size = new System.Drawing.Size(542, 412);
    316364      this.solverParametersView.TabIndex = 0;
    317365      //
     
    322370      this.operatorGraphTabPage.Name = "operatorGraphTabPage";
    323371      this.operatorGraphTabPage.Padding = new System.Windows.Forms.Padding(3);
    324       this.operatorGraphTabPage.Size = new System.Drawing.Size(548, 476);
     372      this.operatorGraphTabPage.Size = new System.Drawing.Size(548, 418);
    325373      this.operatorGraphTabPage.TabIndex = 3;
    326374      this.operatorGraphTabPage.Text = "Operator Graph";
     
    336384      this.operatorGraphViewHost.Name = "operatorGraphViewHost";
    337385      this.operatorGraphViewHost.ReadOnly = true;
    338       this.operatorGraphViewHost.Size = new System.Drawing.Size(542, 470);
     386      this.operatorGraphViewHost.Size = new System.Drawing.Size(542, 412);
    339387      this.operatorGraphViewHost.TabIndex = 0;
    340388      this.operatorGraphViewHost.ViewsLabelVisible = true;
    341389      this.operatorGraphViewHost.ViewType = null;
    342390      //
    343       // algorithmStartButton
    344       //
    345       this.algorithmStartButton.Location = new System.Drawing.Point(91, 60);
    346       this.algorithmStartButton.Name = "algorithmStartButton";
    347       this.algorithmStartButton.Size = new System.Drawing.Size(26, 23);
    348       this.algorithmStartButton.TabIndex = 10;
    349       this.algorithmStartButton.Text = "Start";
    350       this.algorithmStartButton.UseVisualStyleBackColor = true;
    351       this.algorithmStartButton.Click += new System.EventHandler(this.AlgorithmStartButtonOnClick);
    352       //
    353       // minimumTargetLabel
    354       //
    355       this.minimumTargetLabel.AutoSize = true;
    356       this.minimumTargetLabel.Location = new System.Drawing.Point(384, 6);
    357       this.minimumTargetLabel.Name = "minimumTargetLabel";
    358       this.minimumTargetLabel.Size = new System.Drawing.Size(41, 13);
    359       this.minimumTargetLabel.TabIndex = 13;
    360       this.minimumTargetLabel.Text = "Target:";
    361       //
    362       // seedingStrategyLabel
    363       //
    364       this.seedingStrategyLabel.AutoSize = true;
    365       this.seedingStrategyLabel.Location = new System.Drawing.Point(3, 33);
    366       this.seedingStrategyLabel.Name = "seedingStrategyLabel";
    367       this.seedingStrategyLabel.Size = new System.Drawing.Size(91, 13);
    368       this.seedingStrategyLabel.TabIndex = 8;
    369       this.seedingStrategyLabel.Text = "Seeding Strategy:";
    370       //
    371       // evaluationsLimitabel
    372       //
    373       this.evaluationsLimitabel.AutoSize = true;
    374       this.evaluationsLimitabel.Location = new System.Drawing.Point(3, 6);
    375       this.evaluationsLimitabel.Name = "evaluationsLimitabel";
    376       this.evaluationsLimitabel.Size = new System.Drawing.Size(66, 13);
    377       this.evaluationsLimitabel.TabIndex = 13;
    378       this.evaluationsLimitabel.Text = "Budget (FE):";
    379       //
    380       // recommenderLabel
    381       //
    382       this.recommenderLabel.AutoSize = true;
    383       this.recommenderLabel.Location = new System.Drawing.Point(6, 9);
    384       this.recommenderLabel.Name = "recommenderLabel";
    385       this.recommenderLabel.Size = new System.Drawing.Size(79, 13);
    386       this.recommenderLabel.TabIndex = 9;
    387       this.recommenderLabel.Text = "Recommender:";
    388       //
    389       // suggestedInstancesComboBox
    390       //
    391       this.suggestedInstancesComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    392             | System.Windows.Forms.AnchorStyles.Right)));
    393       this.suggestedInstancesComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
    394       this.suggestedInstancesComboBox.FormattingEnabled = true;
    395       this.suggestedInstancesComboBox.Location = new System.Drawing.Point(91, 33);
    396       this.suggestedInstancesComboBox.Name = "suggestedInstancesComboBox";
    397       this.suggestedInstancesComboBox.Size = new System.Drawing.Size(186, 21);
    398       this.suggestedInstancesComboBox.TabIndex = 7;
    399       this.suggestedInstancesComboBox.SelectedIndexChanged += new System.EventHandler(this.SuggestedInstancesComboBoxOnSelectedIndexChanged);
    400       //
    401       // recommenderComboBox
    402       //
    403       this.recommenderComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    404             | System.Windows.Forms.AnchorStyles.Right)));
    405       this.recommenderComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
    406       this.recommenderComboBox.FormattingEnabled = true;
    407       this.recommenderComboBox.Location = new System.Drawing.Point(91, 6);
    408       this.recommenderComboBox.Name = "recommenderComboBox";
    409       this.recommenderComboBox.Size = new System.Drawing.Size(154, 21);
    410       this.recommenderComboBox.TabIndex = 7;
    411       this.recommenderComboBox.SelectedIndexChanged += new System.EventHandler(this.RecommenderComboBoxOnSelectedIndexChanged);
    412       //
    413       // solverSplitContainer
    414       //
    415       this.solverSplitContainer.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    416             | System.Windows.Forms.AnchorStyles.Left)
    417             | System.Windows.Forms.AnchorStyles.Right)));
    418       this.solverSplitContainer.Location = new System.Drawing.Point(0, 56);
    419       this.solverSplitContainer.Name = "solverSplitContainer";
    420       //
    421       // solverSplitContainer.Panel1
    422       //
    423       this.solverSplitContainer.Panel1.Controls.Add(this.recommenderViewHost);
    424       this.solverSplitContainer.Panel1.Controls.Add(this.instanceLabel);
    425       this.solverSplitContainer.Panel1.Controls.Add(this.recommenderLabel);
    426       this.solverSplitContainer.Panel1.Controls.Add(this.recommenderComboBox);
    427       this.solverSplitContainer.Panel1.Controls.Add(this.algorithmCloneButton);
    428       this.solverSplitContainer.Panel1.Controls.Add(this.suggestedInstancesComboBox);
    429       this.solverSplitContainer.Panel1.Controls.Add(this.recommendRefreshButton);
    430       this.solverSplitContainer.Panel1.Controls.Add(this.algorithmStartButton);
    431       this.solverSplitContainer.Panel1.Padding = new System.Windows.Forms.Padding(3);
    432       //
    433       // solverSplitContainer.Panel2
    434       //
    435       this.solverSplitContainer.Panel2.Controls.Add(this.solverTabControl);
    436       this.solverSplitContainer.Panel2.Padding = new System.Windows.Forms.Padding(3);
    437       this.solverSplitContainer.Size = new System.Drawing.Size(849, 508);
    438       this.solverSplitContainer.SplitterDistance = 283;
    439       this.solverSplitContainer.TabIndex = 17;
    440       //
    441       // recommenderViewHost
    442       //
    443       this.recommenderViewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    444             | System.Windows.Forms.AnchorStyles.Left)
    445             | System.Windows.Forms.AnchorStyles.Right)));
    446       this.recommenderViewHost.Caption = "View";
    447       this.recommenderViewHost.Content = null;
    448       this.recommenderViewHost.Enabled = false;
    449       this.recommenderViewHost.Location = new System.Drawing.Point(6, 89);
    450       this.recommenderViewHost.Name = "recommenderViewHost";
    451       this.recommenderViewHost.ReadOnly = false;
    452       this.recommenderViewHost.Size = new System.Drawing.Size(271, 412);
    453       this.recommenderViewHost.TabIndex = 16;
    454       this.recommenderViewHost.ViewsLabelVisible = true;
    455       this.recommenderViewHost.ViewType = null;
    456       //
    457       // instanceLabel
    458       //
    459       this.instanceLabel.AutoSize = true;
    460       this.instanceLabel.Location = new System.Drawing.Point(6, 36);
    461       this.instanceLabel.Name = "instanceLabel";
    462       this.instanceLabel.Size = new System.Drawing.Size(51, 13);
    463       this.instanceLabel.TabIndex = 9;
    464       this.instanceLabel.Text = "Instance:";
    465       //
    466       // recommendRefreshButton
    467       //
    468       this.recommendRefreshButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
    469       this.recommendRefreshButton.Location = new System.Drawing.Point(251, 6);
    470       this.recommendRefreshButton.Name = "recommendRefreshButton";
    471       this.recommendRefreshButton.Size = new System.Drawing.Size(26, 23);
    472       this.recommendRefreshButton.TabIndex = 10;
    473       this.recommendRefreshButton.Text = "Start";
    474       this.recommendRefreshButton.UseVisualStyleBackColor = true;
    475       this.recommendRefreshButton.Click += new System.EventHandler(this.button1_Click);
    476       //
    477391      // SolverView
    478392      //
    479393      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    480394      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
    481       this.Controls.Add(this.solverSplitContainer);
     395      this.Controls.Add(this.solverTabControl);
     396      this.Controls.Add(this.algorithmCloneButton);
     397      this.Controls.Add(this.instanceLabel);
     398      this.Controls.Add(this.algorithmStartButton);
    482399      this.Controls.Add(this.minTargetView);
    483400      this.Controls.Add(this.maxEvaluationsView);
     401      this.Controls.Add(this.suggestedInstancesComboBox);
    484402      this.Controls.Add(this.seedingStrategyPanel);
    485403      this.Controls.Add(this.minimumTargetLabel);
     
    495413      this.parametersTabPage.ResumeLayout(false);
    496414      this.operatorGraphTabPage.ResumeLayout(false);
    497       this.solverSplitContainer.Panel1.ResumeLayout(false);
    498       this.solverSplitContainer.Panel1.PerformLayout();
    499       this.solverSplitContainer.Panel2.ResumeLayout(false);
    500       ((System.ComponentModel.ISupportInitialize)(this.solverSplitContainer)).EndInit();
    501       this.solverSplitContainer.ResumeLayout(false);
    502415      this.ResumeLayout(false);
    503416      this.PerformLayout();
     
    508421
    509422    private System.Windows.Forms.Panel seedingStrategyPanel;
     423    private System.Windows.Forms.Button algorithmStartButton;
     424    private System.Windows.Forms.Label seedingStrategyLabel;
     425    private System.Windows.Forms.Label evaluationsLimitabel;
     426    private System.Windows.Forms.ComboBox suggestedInstancesComboBox;
     427    private System.Windows.Forms.Button algorithmCloneButton;
     428    private Data.Views.StringConvertibleValueView maxEvaluationsView;
     429    private System.Windows.Forms.Label minimumTargetLabel;
     430    private Data.Views.StringConvertibleValueView minTargetView;
     431    private System.Windows.Forms.Label instanceLabel;
    510432    private MainForm.WindowsForms.DragOverTabControl solverTabControl;
    511433    private System.Windows.Forms.TabPage resultsTabPage;
     434    private System.Windows.Forms.CheckBox showOnlyFinalResultCheckBox;
     435    private WeifenLuo.WinFormsUI.Docking.DockPanel resultsDockPanel;
     436    private System.Windows.Forms.TabPage runsTabPage;
     437    private Optimization.Views.RunCollectionView runsView;
     438    private System.Windows.Forms.TabPage seededRunsTabPage;
     439    private Optimization.Views.RunCollectionView seededRunsView;
    512440    private System.Windows.Forms.TabPage solutionSeedingTabPage;
    513441    private System.Windows.Forms.TabPage parametersTabPage;
     
    515443    private System.Windows.Forms.TabPage operatorGraphTabPage;
    516444    private MainForm.WindowsForms.ViewHost operatorGraphViewHost;
    517     private System.Windows.Forms.Button algorithmStartButton;
    518     private System.Windows.Forms.Label seedingStrategyLabel;
    519     private System.Windows.Forms.Label evaluationsLimitabel;
    520     private System.Windows.Forms.Label recommenderLabel;
    521     private System.Windows.Forms.ComboBox suggestedInstancesComboBox;
    522     private System.Windows.Forms.Button algorithmCloneButton;
    523     private System.Windows.Forms.TabPage runsTabPage;
    524     private Optimization.Views.RunCollectionView runsView;
    525     private Data.Views.StringConvertibleValueView maxEvaluationsView;
    526     private WeifenLuo.WinFormsUI.Docking.DockPanel resultsDockPanel;
    527     private System.Windows.Forms.CheckBox showOnlyFinalResultCheckBox;
    528     private System.Windows.Forms.TabPage seededRunsTabPage;
    529     private Optimization.Views.RunCollectionView seededRunsView;
    530     private System.Windows.Forms.Label minimumTargetLabel;
    531     private Data.Views.StringConvertibleValueView minTargetView;
    532     private System.Windows.Forms.ComboBox recommenderComboBox;
    533     private System.Windows.Forms.SplitContainer solverSplitContainer;
    534     private MainForm.WindowsForms.ViewHost recommenderViewHost;
    535     private System.Windows.Forms.Label instanceLabel;
    536     private System.Windows.Forms.Button recommendRefreshButton;
    537445  }
    538446}
  • branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem/3.3/Views/SolverView.cs

    r13774 r13787  
    2828using HeuristicLab.OptimizationExpertSystem.Common;
    2929using System;
     30using System.Linq;
    3031using System.Windows.Forms;
    3132
     
    4445      algorithmCloneButton.Text = string.Empty;
    4546      algorithmCloneButton.Image = VSImageLibrary.Clone;
    46       recommendRefreshButton.Text = string.Empty;
    47       recommendRefreshButton.Image = VSImageLibrary.Refresh;
    4847      seedingStrategyView = new EnumValueView<SeedingStrategyTypes>() {
    4948        Dock = DockStyle.Fill
     
    6867          seedingStrategyView.Content = null;
    6968          seedingSolutionsView.Content = null;
    70           recommenderViewHost.Content = null;
    7169        } else {
    7270          maxEvaluationsView.Content = Content.MaximumEvaluations;
     
    7674          seedingStrategyView.Content = Content.SeedingStrategy;
    7775          seedingSolutionsView.Content = Content.SolutionSeedingPool;
    78           recommenderViewHost.Content = Content.AlgorithmInstanceRecommender;
    7976        }
    8077      } finally { SuppressEvents = false; }
    8178      UpdateSuggestedInstancesCombobox();
    82       UpdateRecommenderCombobox();
    8379    }
    8480
     
    9187    }
    9288
     89    #region Update Controls
     90    private void UpdateSuggestedInstancesCombobox() {
     91      var prevSelection = (AlgorithmInstanceItem)suggestedInstancesComboBox.SelectedItem;
     92      var prevNewIndex = -1;
     93      suggestedInstancesComboBox.Items.Clear();
     94      if (Content == null) return;
     95
     96      var ranking = Content.GetAlgorithmInstanceRanking().ToList();
     97
     98      for (var i = 0; i < ranking.Count; i++) {
     99        suggestedInstancesComboBox.Items.Add(new AlgorithmInstanceItem(ranking[i]));
     100        if (prevSelection == null || ranking[i].Item1.Name == prevSelection.Item.Item1.Name)
     101          prevNewIndex = prevSelection == null ? 0 : i;
     102      }
     103      suggestedInstancesComboBox.SelectedIndex = prevNewIndex;
     104    }
     105    #endregion
     106
     107    #region Content Event Handlers
    93108    protected override void OnAlgorithmInstanceStarted(IAlgorithm algorithm) {
    94109      base.OnAlgorithmInstanceStarted(algorithm);
     
    97112    }
    98113
    99     protected override void OnSuggestedInstancesChanged() {
    100       base.OnSuggestedInstancesChanged();
     114    protected override void OnRecommendationModelChanged() {
     115      base.OnRecommendationModelChanged();
    101116      UpdateSuggestedInstancesCombobox();
    102117    }
     118    #endregion
    103119
    104     private void UpdateSuggestedInstancesCombobox() {
    105       var prevSelection = (IAlgorithm)suggestedInstancesComboBox.SelectedItem;
    106       var prevNewIndex = -1;
    107       suggestedInstancesComboBox.Items.Clear();
    108       if (Content == null) return;
    109 
    110       for (var i = 0; i < Content.AlgorithmInstances.Count; i++) {
    111         suggestedInstancesComboBox.Items.Add(Content.AlgorithmInstances[i]);
    112         if (prevSelection == null || Content.AlgorithmInstances[i].Name == prevSelection.Name)
    113           prevNewIndex = prevSelection == null ? 0 : i;
    114       }
    115       if (prevNewIndex >= 0) suggestedInstancesComboBox.SelectedIndex = prevNewIndex;
    116     }
    117 
    118     private void UpdateRecommenderCombobox() {
    119       var prevSelection = Content.AlgorithmInstanceRecommender;
    120       var prevNewIndex = -1;
    121       recommenderComboBox.Items.Clear();
    122       if (Content == null) return;
    123 
    124       /*var i = 0;
    125       foreach (var type in ApplicationManager.Manager.GetTypes(typeof (IAlgorithmInstanceRecommender))) {
    126         var r = (IAlgorithmInstanceRecommender)Activator.CreateInstance(type, BindingFlags.CreateInstance, Content);
    127         recommenderComboBox.Items.Add(r);
    128         if (prevSelection == null || type == prevSelection.GetType())
    129           prevNewIndex = prevSelection == null ? 0 : i;
    130         i++;
    131       }
    132       if (prevNewIndex >= 0) recommenderComboBox.SelectedIndex = prevNewIndex;*/
    133       recommenderComboBox.Items.Add(new OverallBestRecommender(Content));
    134       if (prevSelection is OverallBestRecommender) recommenderComboBox.SelectedIndex = recommenderComboBox.Items.Count - 1;
    135       recommenderComboBox.Items.Add(new KNearestNeighborRecommender(Content));
    136       if (prevSelection is KNearestNeighborRecommender) recommenderComboBox.SelectedIndex = recommenderComboBox.Items.Count - 1;
    137       recommenderComboBox.Items.Add(new DistanceWeightedRecommender(Content));
    138       if (prevSelection is DistanceWeightedRecommender) recommenderComboBox.SelectedIndex = recommenderComboBox.Items.Count - 1;
    139     }
    140 
     120    #region Control Event Handlers
    141121    private void AlgorithmStartButtonOnClick(object sender, EventArgs e) {
    142122      if (suggestedInstancesComboBox.SelectedIndex >= 0)
    143         Content.StartAlgorithmAsync(suggestedInstancesComboBox.SelectedIndex);
     123        Content.StartAlgorithmAsync(Content.AlgorithmInstances.Select((a, i) => new { Alg = a, Index = i}).Single(x => x.Alg.Name == ((AlgorithmInstanceItem)suggestedInstancesComboBox.SelectedItem).Item.Item1.Name).Index);
    144124    }
    145125
    146126    private void AlgorithmCloneButtonOnClick(object sender, EventArgs e) {
    147127      if (suggestedInstancesComboBox.SelectedIndex >= 0)
    148         MainForm.ShowContent((IAlgorithm)Content.AlgorithmInstances[suggestedInstancesComboBox.SelectedIndex].Clone());
     128        MainForm.ShowContent((IAlgorithm)Content.AlgorithmInstances[Content.AlgorithmInstances.Select((a, i) => new { Alg = a, Index = i }).Single(x => x.Alg.Name == ((AlgorithmInstanceItem)suggestedInstancesComboBox.SelectedItem).Item.Item1.Name).Index].Clone());
    149129    }
    150130
     
    152132      if (InvokeRequired) { Invoke((Action<object, EventArgs>)SuggestedInstancesComboBoxOnSelectedIndexChanged, sender, e); return; }
    153133      if (suggestedInstancesComboBox.SelectedIndex >= 0) {
    154         var alg = Content.AlgorithmInstances[suggestedInstancesComboBox.SelectedIndex];
     134        var alg = Content.AlgorithmInstances[Content.AlgorithmInstances.Select((a, i) => new { Alg = a, Index = i }).Single(x => x.Alg.Name == ((AlgorithmInstanceItem)suggestedInstancesComboBox.SelectedItem).Item.Item1.Name).Index];
    155135        solverParametersView.Content = alg.Parameters;
    156136        var engineAlg = alg as EngineAlgorithm;
     
    163143      SetEnabledStateOfControls();
    164144    }
     145    #endregion
    165146
    166     private void RecommenderComboBoxOnSelectedIndexChanged(object sender, EventArgs e) {
    167       if (InvokeRequired) { Invoke((Action<object, EventArgs>)RecommenderComboBoxOnSelectedIndexChanged, sender, e); return; }
    168       if (recommenderComboBox.SelectedIndex < 0) return;
    169       Content.AlgorithmInstanceRecommender = (IAlgorithmInstanceRecommender)recommenderComboBox.SelectedItem;
    170       recommenderViewHost.Content = Content.AlgorithmInstanceRecommender;
    171       Content.UpdateSuggestions();
     147    #region Helper Classes and Methods
     148    private class AlgorithmInstanceItem {
     149      private readonly Tuple<IAlgorithm, double> item;
     150      public Tuple<IAlgorithm, double> Item { get { return item; } }
     151
     152      public AlgorithmInstanceItem(Tuple<IAlgorithm, double> item) {
     153        this.item = item;
     154      }
     155
     156      public override string ToString() {
     157        return item.Item2.ToString("F0") + ": " + item.Item1.Name;
     158      }
    172159    }
    173 
    174     private void button1_Click(object sender, EventArgs e) {
    175       Content.UpdateSuggestions();
    176     }
     160    #endregion
    177161  }
    178162}
  • branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem/3.3/Views/UnderstandingProblemInstanceView.cs

    r13757 r13787  
    2222using HeuristicLab.Common.Resources;
    2323using HeuristicLab.Core;
    24 using HeuristicLab.Core.Views;
    2524using HeuristicLab.Data;
    2625using HeuristicLab.MainForm;
     26using HeuristicLab.MainForm.WindowsForms;
    2727using HeuristicLab.OptimizationExpertSystem.Common;
    2828using System;
     
    3939  public sealed partial class UnderstandingProblemInstanceView : KnowledgeCenterViewBase {
    4040    private bool SuppressEvents { get; set; }
    41     private readonly CheckedItemListView<StringValue> characteristicsView;
     41    private readonly CheckedItemList<StringValue> characteristics;
    4242 
    4343    public UnderstandingProblemInstanceView() {
     
    4545      showCharacteristicsCheckBox.Text = string.Empty;
    4646      showCharacteristicsCheckBox.Image = VSImageLibrary.Properties;
    47       characteristicsView = new CheckedItemListView<StringValue>() {
    48         Dock = DockStyle.Fill
    49       };
    50       mapSplitContainer.Panel2.Controls.Add(characteristicsView);
     47      characteristics = new CheckedItemList<StringValue>();
     48      characteristics.CheckedItemsChanged += CharacteristicsOnCheckedItemsChanged;
     49      mapSplitContainer.Panel2.Controls.Add(new ViewHost() {
     50        Dock = DockStyle.Fill,
     51        Content = characteristics
     52      });
    5153    }
    5254
    5355    protected override void OnContentChanged() {
    5456      base.OnContentChanged();
     57      characteristics.Clear();
    5558      if (Content == null) {
    5659        problemInstancesView.Content = null;
    57         characteristicsView.Content = null;
    5860        instanceMapChart.Series["InstancesSeries"].Points.Clear();
    5961        instanceMapChart.Series["CurrentInstanceSeries"].Points.Clear();
    6062      } else {
    6163        problemInstancesView.Content = Content.ProblemInstances;
    62         characteristicsView.Content = Content.ProblemCharacteristics;
     64        UpdateCharacteristics();
    6365        UpdateProjectionComboBox();
    6466        UpdateSizeComboBox();
     
    6769    }
    6870
    69     #region Content Event Handlers
    70     protected override void OnProblemChanged() {
    71       base.OnProblemChanged();
    72       SetEnabledStateOfControls();
    73     }
    74 
    75     protected override void OnProblemInstancesChanged() {
    76       base.OnProblemInstancesChanged();
    77       if (Content.ProblemInstances.UpdateOfRunsInProgress) return;
    78       UpdateProjectionComboBox();
    79       UpdateSizeComboBox();
    80       UpdateColorComboBox();
    81       UpdateProjection();
    82     }
    83     #endregion
     71    protected override void SetEnabledStateOfControls() {
     72      base.SetEnabledStateOfControls();
     73    }
     74
     75    #region Update Controls
     76    private void UpdateCharacteristics() {
     77      var @checked = new HashSet<string>(characteristics.CheckedItems.Select(x => x.Value.Value));
     78      characteristics.Clear();
     79      foreach (var c in Content.ProblemInstances.ResultNames) {
     80        characteristics.Add(new StringValue(c), @checked.Contains(c));
     81      }
     82    }
    8483
    8584    private void UpdateProjectionComboBox() {
     
    126125      } finally { SuppressEvents = false; }
    127126    }
    128    
    129     private IEnumerable<string> GetProjections() {
    130       return Content.ProblemInstances
    131         .SelectMany(x => x.Results.Where(y => Regex.IsMatch(y.Key, "^Projection[.].*[.][XY]$")))
    132         .Select(x => Regex.Match(x.Key, "Projection[.](?<g>.*)[.][XY]").Groups["g"].Value)
    133         .Distinct();
    134     }
    135127
    136128    private void UpdateProjection() {
     
    153145        size, color, invPropCheckBox.Checked, fromZeroCheckBox.Checked);
    154146    }
     147    #endregion
     148
     149    #region Content Event Handlers
     150    protected override void OnProblemChanged() {
     151      base.OnProblemChanged();
     152      SetEnabledStateOfControls();
     153    }
     154
     155    protected override void OnProblemInstancesChanged() {
     156      base.OnProblemInstancesChanged();
     157      if (Content.ProblemInstances.UpdateOfRunsInProgress) return;
     158      try {
     159        SuppressEvents = true;
     160        UpdateCharacteristics();
     161      } finally { SuppressEvents = false; }
     162      UpdateProjectionComboBox();
     163      UpdateSizeComboBox();
     164      UpdateColorComboBox();
     165      UpdateProjection();
     166    }
     167    #endregion
     168
     169    #region Control Event Handlers
     170    private void ProjectionComboBoxOnSelectedIndexChanged(object sender, EventArgs e) {
     171      UpdateProjection();
     172    }
     173
     174    private void SizeComboBoxOnSelectedIndexChanged(object sender, EventArgs e) {
     175      UpdateProjection();
     176    }
     177
     178    private void colorComboBox_SelectedIndexChanged(object sender, EventArgs e) {
     179      UpdateProjection();
     180    }
     181
     182    private void InvPropCheckBoxOnCheckedChanged(object sender, EventArgs e) {
     183      UpdateProjection();
     184    }
     185
     186    private void fromZeroCheckBox_CheckedChanged(object sender, EventArgs e) {
     187      UpdateProjection();
     188    }
     189
     190    private void showCharacteristicsCheckBox_CheckedChanged(object sender, EventArgs e) {
     191      mapSplitContainer.Panel2Collapsed = !showCharacteristicsCheckBox.Checked;
     192    }
     193    #endregion
     194
     195    #region Other Event Handlers
     196    private void CharacteristicsOnCheckedItemsChanged(object sender, EventArgs e) {
     197      if (SuppressEvents) return;
     198      if (characteristics.CheckedItems.Any())
     199        Content.UpdateInstanceProjection(characteristics.CheckedItems.Select(x => x.Value.Value).ToArray());
     200    }
     201    #endregion
     202
     203    #region Helper Classes and Methods
     204    private IEnumerable<string> GetProjections() {
     205      return Content.ProblemInstances.ResultNames
     206        .Where(x => Regex.IsMatch(x, "^Projection[.].*[.][XY]$"))
     207        .Select(x => Regex.Match(x, "Projection[.](?<g>.*)[.][XY]").Groups["g"].Value)
     208        .Distinct();
     209    }
    155210
    156211    private void DoProjectProblemInstances(Series instancesSeries, Series currentInstanceSeries, string projection, string size, string color, bool invProp, bool fromZero) {
     
    160215      double maxSize = 0, minSize = 0;
    161216      if (!string.IsNullOrEmpty(size)) {
    162         var sizes = Content.ProblemInstances.Where(x => x.Results.ContainsKey(size)).Select(x => x.Results[size]).OfType<Data.DoubleValue>().Where(x => !double.IsNaN(x.Value)).ToList();
     217        var sizes = Content.ProblemInstances.Where(x => x.Results.ContainsKey(size)).Select(x => x.Results[size]).OfType<DoubleValue>().Where(x => !double.IsNaN(x.Value)).ToList();
    163218        if (sizes.Count > 0) {
    164219          maxSize = sizes.Max(x => x.Value);
     
    177232        var yKey = "Projection." + projection + ".Y";
    178233        if (!run.Results.ContainsKey(xKey) || !run.Results.ContainsKey(yKey)
    179             || !(run.Results[xKey] is Data.DoubleValue) || !(run.Results[yKey] is Data.DoubleValue)) continue;
    180         var x = ((Data.DoubleValue)run.Results[xKey]).Value;
    181         var y = ((Data.DoubleValue)run.Results[yKey]).Value;
     234            || !(run.Results[xKey] is DoubleValue) || !(run.Results[yKey] is DoubleValue)) continue;
     235        var x = ((DoubleValue)run.Results[xKey]).Value;
     236        var y = ((DoubleValue)run.Results[yKey]).Value;
    182237        var dataPoint = new DataPoint(x, y) {
    183238          Label = run.Name,
     
    185240        IItem item;
    186241        if (maxSize > minSize && run.Results.TryGetValue(size, out item)) {
    187           var dItem = item as Data.DoubleValue;
     242          var dItem = item as DoubleValue;
    188243          if (dItem == null && item is IntValue) dItem = new DoubleValue(((IntValue)item).Value);
    189244          if (dItem != null) {
     
    216271      }
    217272    }
    218 
    219     #region Control Event Handlers
    220     private void ProjectionComboBoxOnSelectedIndexChanged(object sender, EventArgs e) {
    221       UpdateProjection();
    222     }
    223 
    224     private void SizeComboBoxOnSelectedIndexChanged(object sender, EventArgs e) {
    225       UpdateProjection();
    226     }
    227 
    228     private void colorComboBox_SelectedIndexChanged(object sender, EventArgs e) {
    229       UpdateProjection();
    230     }
    231 
    232     private void InvPropCheckBoxOnCheckedChanged(object sender, EventArgs e) {
    233       UpdateProjection();
    234     }
    235 
    236     private void fromZeroCheckBox_CheckedChanged(object sender, EventArgs e) {
    237       UpdateProjection();
    238     }
    239 
    240     private void showCharacteristicsCheckBox_CheckedChanged(object sender, EventArgs e) {
    241       mapSplitContainer.Panel2Collapsed = !showCharacteristicsCheckBox.Checked;
    242     }
    243273    #endregion
    244274  }
  • branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem/3.3/Views/UnderstandingSolutionsView.cs

    r13750 r13787  
    5454      UpdateSolutionVisualization();
    5555    }
    56 
    57     protected override void OnProblemChanged() {
    58       base.OnProblemInstancesChanged();
    59       UpdateSimilarityCalculators();
    60       UpdateNamesComboboxes();
    61       UpdateSolutionVisualization();
    62     }
    63 
    64     protected override void OnProblemSolutionsChanged() {
    65       base.OnProblemSolutionsChanged();
    66       UpdateNamesComboboxes();
    67       UpdateSolutionVisualization();
    68     }
    69 
    70     protected override void OnSolutionSeedingPoolChanged() {
    71       base.OnSolutionSeedingPoolChanged();
    72       UpdateSolutionNetworkAnalysis(similarityComboBox.SelectedItem as ISolutionSimilarityCalculator, (string)solutionNetworkProjectionComboBox.SelectedItem, linesCheckBox.Checked, contrastTrackBar.Value, minimumTrackBar.Value);
    73     }
    74 
     56   
     57    #region Update Controls
    7558    private void UpdateSimilarityCalculators() {
    7659      var selected = (ISolutionSimilarityCalculator)(similarityComboBox.SelectedIndex >= 0 ? similarityComboBox.SelectedItem : null);
     
    280263      }
    281264    }
    282 
     265    #endregion
     266
     267    #region Content Event Handlers
     268    protected override void OnProblemChanged() {
     269      base.OnProblemInstancesChanged();
     270      UpdateSimilarityCalculators();
     271      UpdateNamesComboboxes();
     272      UpdateSolutionVisualization();
     273    }
     274
     275    protected override void OnProblemSolutionsChanged() {
     276      base.OnProblemSolutionsChanged();
     277      UpdateNamesComboboxes();
     278      UpdateSolutionVisualization();
     279    }
     280
     281    protected override void OnSolutionSeedingPoolChanged() {
     282      base.OnSolutionSeedingPoolChanged();
     283      UpdateSolutionNetworkAnalysis(similarityComboBox.SelectedItem as ISolutionSimilarityCalculator, (string)solutionNetworkProjectionComboBox.SelectedItem, linesCheckBox.Checked, contrastTrackBar.Value, minimumTrackBar.Value);
     284    }
     285    #endregion
     286
     287    #region Control Event Handlers
    283288    private void SimilarityComboBoxOnSelectedIndexChanged(object sender, EventArgs e) {
    284289      if (InvokeRequired) { Invoke((Action<object, EventArgs>)SimilarityComboBoxOnSelectedIndexChanged, sender, e); return; }
     
    370375      }
    371376    }
    372 
    373     #region Helpers
     377    #endregion
     378
     379    #region Helper Classes and Methods
    374380    private List<IScope> GetSolutionScopes() {
    375381      return Content.Problem.Solutions.Select(x => x.Solution).OfType<IScope>().ToList();
Note: See TracChangeset for help on using the changeset viewer.