Changeset 15699


Ignore:
Timestamp:
01/31/18 14:03:09 (19 months ago)
Author:
abeham
Message:

#1614: corrected RLD view to gracefully handle runs in which the convergence graph result is missing or contains bad values

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/1614_GeneralizedQAP/HeuristicLab.Optimization.Views/3.3/RunCollectionViews/RunCollectionRLDView.cs

    r15676 r15699  
    719719
    720720    private void GenerateDefaultBudgets(string table) {
    721       var runs = Content;
    722       var min = runs.Select(x => ((IndexedDataTable<double>)x.Results[table]).Rows.First().Values.Select(y => y.Item1).Min()).Min();
    723       var max = runs.Select(x => ((IndexedDataTable<double>)x.Results[table]).Rows.First().Values.Select(y => y.Item1).Max()).Max();
     721      var runs = Content.Where(x => x.Results.ContainsKey(table) && x.Results[table] is IndexedDataTable<double>
     722                                    && ((IndexedDataTable<double>)x.Results[table]).Rows.Count > 0
     723                                    && ((IndexedDataTable<double>)x.Results[table]).Rows.First().Values
     724                                      .Any(y => !double.IsNaN(y.Item2)))
     725                        .Select(x => ((IndexedDataTable<double>)x.Results[table]).Rows.First())
     726                        .ToList();
     727      if (runs.Count == 0) {
     728        budgets = new double[0];
     729        suppressBudgetsEvents = true;
     730        budgetsTextBox.Text = string.Empty;
     731        suppressBudgetsEvents = false;
     732        return;
     733      }
     734
     735      var min = runs.Select(x => x.Values.Where(y => !double.IsNaN(y.Item2)).Select(y => y.Item1).Min()).Min();
     736      var max = runs.Select(x => x.Values.Where(y => !double.IsNaN(y.Item2)).Select(y => y.Item1).Max()).Max();
    724737      var points = 3;
    725738      budgets = Enumerable.Range(1, points).Select(x => min + (x / (double)points) * (max - min)).ToArray();
Note: See TracChangeset for help on using the changeset viewer.