Index: /trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/ValueGenerator.cs =================================================================== --- /trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/ValueGenerator.cs (revision 11434) +++ /trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/ValueGenerator.cs (revision 11435) @@ -37,12 +37,13 @@ /// The largest and last value of the sequence. /// The step size between subsequent values. + /// Determines if the end should be included in the sequence regardless if the end is divisible by the stepwidth. /// A sequence of values from start to end (inclusive) [Obsolete("It is recommended to use the decimal overload to achieve a higher numerical accuracy.")] - public static IEnumerable GenerateSteps(double start, double end, double stepWidth) { + public static IEnumerable GenerateSteps(double start, double end, double stepWidth, bool includeEnd = false) { //mkommend: IEnumerable.Cast fails due to boxing and unboxing of the involved types // http://referencesource.microsoft.com/#System.Core/System/Linq/Enumerable.cs#27bb217a6d5457ec // http://blogs.msdn.com/b/ericlippert/archive/2009/03/19/representation-and-identity.aspx - return GenerateSteps((decimal)start, (decimal)end, (decimal)stepWidth).Select(x => (double)x); + return GenerateSteps((decimal)start, (decimal)end, (decimal)stepWidth, includeEnd).Select(x => (double)x); } @@ -53,6 +54,7 @@ /// The largest and last value of the sequence. /// The step size between subsequent values. + /// /// Determines if the end should be included in the sequence regardless if the end is divisible by the stepwidth. /// A sequence of values from start to end - public static IEnumerable GenerateSteps(decimal start, decimal end, decimal stepWidth) { + public static IEnumerable GenerateSteps(decimal start, decimal end, decimal stepWidth, bool includeEnd = false) { if (stepWidth == 0) throw new ArgumentException("The step width cannot be zero."); @@ -67,29 +69,5 @@ x += stepWidth; } - } - - /// - /// Generates a sequence of points between start and end according to given transformation - /// - /// The smallest and first value of the sequence. - /// The largest and last value of the sequence. - /// The step size between subsequent values (before transform) - /// The transform function - /// - [Obsolete("It is recommended to use the decimal overload to achieve a higher numerical accuracy.")] - public static IEnumerable GenerateSteps(double start, double end, double stepWidth, Func transform) { - return GenerateSteps(start,end, stepWidth).Select(transform); - } - - /// - /// Generates a sequence of points between start and end according to given transformation - /// - /// The smallest and first value of the sequence. - /// The largest and last value of the sequence. - /// The step size between subsequent values (before transform) - /// The transform function - /// - public static IEnumerable GenerateSteps(decimal start, decimal end, decimal stepWidth, Func transform) { - return GenerateSteps(start, end, stepWidth).Select(transform); + if (x - stepWidth < end && includeEnd) yield return end; }