Changeset 14035
 Timestamp:
 07/11/16 14:32:35 (7 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

branches/PerformanceComparison/HeuristicLab.Optimization.Views/3.3/RunCollectionViews/RunCollectionRLDView.cs
r13745 r14035 324 324 var lineStyleCount = 0; 325 325 326 var maxEfforts = new Dictionary<ProblemDescription, double>(); 327 foreach (var group in groupedRuns) { 328 foreach (var problem in group.Value) { 329 double eff; 330 if (!maxEfforts.TryGetValue(problem.Key, out eff)) { 331 eff = 0.0; 332 } 333 foreach (var run in problem.Value.Item2) { 334 var maxEff = ((IndexedDataTable<double>)run.Results[table]).Rows.First().Values.Last().Item1; 335 if (maxEff > eff) eff = maxEff; 336 } 337 maxEfforts[problem.Key] = eff; 338 } 339 } 340 // if the group contains multiple different problems we want to use the minimal maximal observed effort 341 // otherwise we run into situations where we don't have data for a certain problem instance anymore 342 // this is a special case when aggregating over multiple problem instances 343 var maxEffort = maxEfforts.Values.Min(); 344 326 345 foreach (var group in groupedRuns) { 327 346 // hits describes the number of target hits at a certain time for a certain group … … 340 359 341 360 if (eachOrAllTargetCheckBox.Checked) { 342 CalculateHitsForEachTarget(hits, misses, resultsTable.Rows.First(), problem.Key, group.Key, problem.Value.Item1 );361 CalculateHitsForEachTarget(hits, misses, resultsTable.Rows.First(), problem.Key, group.Key, problem.Value.Item1, maxEffort); 343 362 // achiving each target can be seen as a separate run for that target only 344 363 noRuns += targets.Length; 345 364 } else { 346 var length = CalculateHitsForAllTargets(hits, misses, resultsTable.Rows.First(), problem.Key, group.Key, problem.Value.Item1 );365 var length = CalculateHitsForAllTargets(hits, misses, resultsTable.Rows.First(), problem.Key, group.Key, problem.Value.Item1, maxEffort); 347 366 maxLength = Math.Max(length, maxLength); 348 367 noRuns++; … … 403 422 Dictionary<string, SortedList<double, int>> misses, 404 423 IndexedDataRow<double> row, ProblemDescription problem, 405 string group, double bestTarget ) {424 string group, double bestTarget, double maxEffort) { 406 425 foreach (var l in targets.Select(x => (problem.IsMaximization() ? (1  x) : (1 + x)) * bestTarget)) { 407 426 var key = group + "" + l; … … 412 431 var hit = false; 413 432 foreach (var v in row.Values) { 433 if (v.Item1 > maxEffort) break; 414 434 if (problem.IsMaximization() && v.Item2 >= l  !problem.IsMaximization() && v.Item2 <= l) { 415 435 if (hits[key].ContainsKey(v.Item1)) … … 421 441 } 422 442 if (!hit) { 423 var max = row.Values.Last();424 if (misses[key].ContainsKey(max .Item1))425 misses[key][max .Item1]++;426 else misses[key][max .Item1] = 1;443 var max = Math.Min(row.Values.Last().Item1, maxEffort); 444 if (misses[key].ContainsKey(max)) 445 misses[key][max]++; 446 else misses[key][max] = 1; 427 447 } 428 448 } … … 432 452 Dictionary<string, SortedList<double, int>> misses, 433 453 IndexedDataRow<double> row, ProblemDescription problem, 434 string group, double bestTarget ) {454 string group, double bestTarget, double maxEffort) { 435 455 var values = row.Values; 436 456 if (!hits.ContainsKey(group)) { … … 444 464 var target = (problem.IsMaximization() ? (1  targets[i]) : (1 + targets[i])) * bestTarget; 445 465 var current = values[j]; 466 if (current.Item1 > maxEffort) break; 446 467 if (problem.IsMaximization() && current.Item2 >= target 447 468  !problem.IsMaximization() && current.Item2 <= target) { … … 454 475 } 455 476 if (j == values.Count) j; 477 var effort = Math.Min(values[j].Item1, maxEffort); 456 478 if (i < targets.Length) { 457 if (misses[group].ContainsKey( values[j].Item1))458 misses[group][ values[j].Item1] += targets.Length  i;459 else misses[group][ values[j].Item1] = targets.Length  i;460 } 461 return values[j].Item1;479 if (misses[group].ContainsKey(effort)) 480 misses[group][effort] += targets.Length  i; 481 else misses[group][effort] = targets.Length  i; 482 } 483 return effort; 462 484 } 463 485
Note: See TracChangeset
for help on using the changeset viewer.