Free cookie consent management tool by TermsFeed Policy Generator

Changeset 3690


Ignore:
Timestamp:
05/07/10 02:21:01 (14 years ago)
Author:
swagner
Message:

Fixed bug in DataTableValuesCollector and ResultsCollector (#999)

Location:
trunk/sources
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Analysis/3.3/DataTableValuesCollector.cs

    r3687 r3690  
    2222using System;
    2323using System.Collections.Generic;
     24using System.Linq;
    2425using HeuristicLab.Common;
    2526using HeuristicLab.Core;
     
    5960          AddValue(table, (param.ActualValue as DoubleValue).Value, name, param.Description);
    6061        } else if (param.ActualValue is IEnumerable<DoubleValue>) {
    61           int counter = 0;
    62           foreach (DoubleValue data in (param.ActualValue as IEnumerable<DoubleValue>)) {
    63             AddValue(table, data.Value, name + " " + counter.ToString(), param.Description);
    64             counter++;
     62          IEnumerable<DoubleValue> values = (IEnumerable<DoubleValue>)param.ActualValue;
     63          if (values.Count() <= 1) {
     64            foreach (DoubleValue data in values)
     65              AddValue(table, data != null ? data.Value : double.NaN, name, param.Description);
     66          } else {
     67            int counter = 1;
     68            foreach (DoubleValue data in values) {
     69              AddValue(table, data != null ? data.Value : double.NaN, name + " " + counter.ToString(), param.Description);
     70              counter++;
     71            }
    6572          }
    6673        } else {
  • trunk/sources/HeuristicLab.Optimization.Operators/3.3/ResultsCollector.cs

    r3687 r3690  
    2020#endregion
    2121
     22using System.Collections;
    2223using HeuristicLab.Common;
    2324using HeuristicLab.Core;
     
    6263          string name = lookupParam != null ? lookupParam.TranslatedName : param.Name;
    6364
     65          IScopeTreeLookupParameter scopeTreeLookupParam = param as IScopeTreeLookupParameter;
     66          if ((scopeTreeLookupParam != null) && (scopeTreeLookupParam.Depth == 0)) {
     67            IEnumerator enumerator = ((IEnumerable)value).GetEnumerator();
     68            if (enumerator.MoveNext())
     69              value = (IItem)enumerator.Current;
     70          }
     71
    6472          results.TryGetValue(name, out result);
    6573          if (result != null)
Note: See TracChangeset for help on using the changeset viewer.