Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/29/18 09:07:03 (6 years ago)
Author:
jkarder
Message:

#2745: worked on EGO implementation

  • added parameter for initial sample set (only for D-EGO)
  • fixed project references and output paths
  • minor changes
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/DiscreteEGO/DiscreteSampleCollector.cs

    r15343 r15976  
    2020#endregion
    2121
     22using System.Collections.Generic;
     23using System.Linq;
    2224using HeuristicLab.Common;
    2325using HeuristicLab.Core;
     
    5961      if (data.Columns != vector.Length + 1) {
    6062        if (data.Columns != 0 || data.Rows != 0) throw new OperatorExecutionException(this, "dataset columns do not match samplesize+1");
    61         for (var i = 0; i < vector.Length; i++)
    62           data.AddVariable("input" + i, new double[0]);
    63         data.AddVariable("output", new double[0]);
    64       }
    65       AddRow(data, vector, quality);
    66       return base.InstrumentedApply(); ;
     63        var variableNames = vector.Select((x, i) => string.Format("input" + i)).Concat("output".ToEnumerable());
     64        var variableValues = vector.Select(x => (double)x).Concat(quality.ToEnumerable()).Select(x => new List<double> { x });
     65        data = DatasetParameter.ActualValue = new ModifiableDataset(variableNames, variableValues);
     66      } else AddRow(data, vector, quality);
     67
     68      return base.InstrumentedApply();
    6769    }
    6870
Note: See TracChangeset for help on using the changeset viewer.