Changeset 13794 for branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem.Common/3.3/Recommenders/OverallBestRecommender.cs
- Timestamp:
- 04/26/16 00:02:05 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem.Common/3.3/Recommenders/OverallBestRecommender.cs
r13791 r13794 49 49 50 50 public IRecommendationModel TrainModel(IRun[] problemInstances, KnowledgeCenter kc, string[] characteristics) { 51 var instances = new List< Tuple<IAlgorithm, double>>();51 var instances = new List<KeyValuePair<IAlgorithm, double>>(); 52 52 foreach (var relevantRuns in kc.GetKnowledgeBaseByAlgorithm()) { 53 53 var algorithm = relevantRuns.Key; … … 60 60 var count = 0; 61 61 foreach (var problemRuns in relevantRuns.Value.GroupBy(x => ((StringValue)x.Parameters["Problem Name"]).Value)) { 62 var bkq = pis[problemRuns.Key]; 62 double bkq; 63 if (!pis.TryGetValue(problemRuns.Key, out bkq)) continue; 63 64 var ert = ExpectedRuntimeHelper.CalculateErt(problemRuns.ToList(), "QualityPerEvaluations", kc.GetTarget(bkq, kc.Maximization), kc.Maximization).ExpectedRuntime; 64 65 if (double.IsNaN(ert)) ert = int.MaxValue; … … 67 68 } 68 69 avgERT /= count; 69 instances.Add( Tuple.Create((IAlgorithm)algorithm.Clone(), avgERT));70 instances.Add(new KeyValuePair<IAlgorithm, double>(algorithm, avgERT)); 70 71 } 71 72 72 return new FixedRankModel(instances.OrderBy(x => x. Item2));73 return new FixedRankModel(instances.OrderBy(x => x.Value)); 73 74 } 74 75 }
Note: See TracChangeset
for help on using the changeset viewer.