- Timestamp:
- 04/26/16 13:07:26 (8 years ago)
- Location:
- branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem.Common/3.3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem.Common/3.3/KnowledgeCenter.cs
r13794 r13797 421 421 var characteristics = new HashSet<string>(); 422 422 var totalProblems = adminClient.Problems.Count(x => x.ProblemClassId == probClassId); 423 Parallel.ForEach(adminClient.Problems.Where(x => x.ProblemClassId == probClassId), new ParallelOptions { MaxDegreeOfParallelism = 3}, (pInst) => {423 Parallel.ForEach(adminClient.Problems.Where(x => x.ProblemClassId == probClassId), new ParallelOptions { MaxDegreeOfParallelism = 8 }, (pInst) => { 424 424 var charas = new List<string>(); 425 425 IRun probRun = null; … … 457 457 progress.ProgressValue = 0; 458 458 p[0] = 0; 459 Parallel.ForEach(adminClient.Algorithms, new ParallelOptions { MaxDegreeOfParallelism = 3}, (algInst) => {459 Parallel.ForEach(adminClient.Algorithms, new ParallelOptions { MaxDegreeOfParallelism = 8 }, (algInst) => { 460 460 IAlgorithm alg = null; 461 461 var data = Clients.OKB.Administration.AdministrationClient.GetAlgorithmData(algInst.Id); … … 490 490 var runIds = queryClient.GetRunIds(problemClassFilter).ToList(); 491 491 var batches = runIds.Select((v, i) => new { Idx = i, Val = v }).GroupBy(x => x.Idx / 500, x => x.Val); 492 Parallel.ForEach(batches.Select(x => x.ToList()), new ParallelOptions { MaxDegreeOfParallelism = 3}, (batch) => {492 Parallel.ForEach(batches.Select(x => x.ToList()), new ParallelOptions { MaxDegreeOfParallelism = 4 }, (batch) => { 493 493 var okbRuns = queryClient.GetRunsWithValues(batch, true, interestingValues); 494 494 var hlRuns = okbRuns.AsParallel().Select(x => new { AlgorithmId = x.Algorithm.Id, Run = queryClient.ConvertToOptimizationRun(x) }).ToList(); … … 535 535 536 536 // add algorithm instance ranks as features to the problem instances for a range of targets 537 foreach (var target in new[] { 1, 1.01, 1.05, 1.1, 1.2, 1.5}) {537 foreach (var target in new[] {0, 0.01, 0.05, 0.1, 0.2, 0.5}) { 538 538 var cls = GetPerformanceClasses(target, 5); 539 539 foreach (var kvp in cls) { 540 540 var prob = kvp.Key; 541 541 foreach (var kvp2 in kvp.Value) { 542 var resultName = "Rank." + algorithmId2AlgorithmInstanceMapping.GetByFirst(kvp2.Key) + "@" + ( (target - 1)* 100) + "%";542 var resultName = "Rank." + algorithmId2AlgorithmInstanceMapping.GetByFirst(kvp2.Key) + "@" + (target * 100) + "%"; 543 543 prob.Results[resultName] = new IntValue(kvp2.Value); 544 544 } … … 617 617 public Dictionary<IAlgorithm, double> GetAlgorithmPerformance(IRun problemInstance) { 618 618 if (!problemInstance.Parameters.ContainsKey("BestKnownQuality")) return new Dictionary<IAlgorithm, double>(); 619 var target = GetTarget(((DoubleValue)problemInstance.Parameters["BestKnownQuality"]).Value, M aximization);619 var target = GetTarget(((DoubleValue)problemInstance.Parameters["BestKnownQuality"]).Value, MinimumTarget.Value, Maximization); 620 620 return knowledgeBase.Where(x => ((StringValue)x.Parameters["Problem Name"]).Value == ((StringValue)problemInstance.Parameters["Problem Name"]).Value) 621 621 .GroupBy(x => algorithmId2AlgorithmInstanceMapping.GetByFirst(algorithmId2RunMapping.GetBySecond(x).Single())) … … 653 653 var max = ((BoolValue)prob.Parameters["Maximization"]).Value; 654 654 var bkq = ((DoubleValue)prob.Parameters["BestKnownQuality"]).Value; 655 var ert = ExpectedRuntimeHelper.CalculateErt(pr.ToList(), "QualityPerEvaluations", GetTarget(bkq, max), max).ExpectedRuntime;655 var ert = ExpectedRuntimeHelper.CalculateErt(pr.ToList(), "QualityPerEvaluations", GetTarget(bkq, target, max), max).ExpectedRuntime; 656 656 if (double.IsNaN(ert)) ert = int.MaxValue; 657 657 ds.AddRow(new object[] { pr.Key }.Concat(f.Cast<object>()).Concat(new object[] { ert })); … … 719 719 720 720 var values = pr.GroupBy(x => algorithmId2RunMapping.GetBySecond(x).Single()) 721 .ToDictionary(x => x.Key, x => ExpectedRuntimeHelper.CalculateErt(x.ToList(), "QualityPerEvaluations", GetTarget(bkq, max), max).ExpectedRuntime);721 .ToDictionary(x => x.Key, x => ExpectedRuntimeHelper.CalculateErt(x.ToList(), "QualityPerEvaluations", GetTarget(bkq, target, max), max).ExpectedRuntime); 722 722 var ranks = ClusteringHelper<long>.Cluster(nClasses, values, x => double.IsNaN(x.Value)) 723 723 .GetByCluster().ToList(); 724 var minRank = ranks.Min(x => x.Key);725 724 foreach (var c in ranks) { 726 725 foreach (var a in c.Value) 727 result[problemMap[pr.Key]][a.Key] = c.Key == nClasses ? c.Key : c.Key - minRank;726 result[problemMap[pr.Key]][a.Key] = c.Key; 728 727 } 729 728 } … … 731 730 } 732 731 733 public double GetTarget(double bestKnownQuality, bool maximization) {734 return bestKnownQuality * (maximization ? (1 - MinimumTarget.Value) : (1 + MinimumTarget.Value));732 public double GetTarget(double bestKnownQuality, double target, bool maximization) { 733 return bestKnownQuality * (maximization ? (1 - target) : (1 + target)); 735 734 } 736 735 -
branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem.Common/3.3/Recommenders/OverallBestRecommender.cs
r13794 r13797 62 62 double bkq; 63 63 if (!pis.TryGetValue(problemRuns.Key, out bkq)) continue; 64 var ert = ExpectedRuntimeHelper.CalculateErt(problemRuns.ToList(), "QualityPerEvaluations", kc.GetTarget(bkq, kc.M aximization), kc.Maximization).ExpectedRuntime;64 var ert = ExpectedRuntimeHelper.CalculateErt(problemRuns.ToList(), "QualityPerEvaluations", kc.GetTarget(bkq, kc.MinimumTarget.Value, kc.Maximization), kc.Maximization).ExpectedRuntime; 65 65 if (double.IsNaN(ert)) ert = int.MaxValue; 66 66 avgERT += ert;
Note: See TracChangeset
for help on using the changeset viewer.