Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/03/15 14:00:39 (10 years ago)
Author:
mkommend
Message:

#2259: Merged r11434, r11435, r11441 and r11313, r11348 into stable.

Location:
stable
Files:
24 edited

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.Problems.Instances.DataAnalysis

  • stable/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/Keijzer/KeijzerFunctionEight.cs

    r11170 r11868  
    4848    protected override List<List<double>> GenerateValues() {
    4949      List<List<double>> data = new List<List<double>>();
    50       data.Add(ValueGenerator.GenerateSteps(0, 100, 1).ToList());
    51       data[0].AddRange(ValueGenerator.GenerateSteps(0, 100, 0.1));
     50      data.Add(ValueGenerator.GenerateSteps(0m, 100, 1).Select(v => (double)v).ToList());
     51      data[0].AddRange(ValueGenerator.GenerateSteps(0m, 100, 0.1m).Select(v => (double)v));
    5252
    5353      double x;
  • stable/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/Keijzer/KeijzerFunctionEleven.cs

    r11170 r11868  
    4949    protected override List<List<double>> GenerateValues() {
    5050      List<List<double>> data = new List<List<double>>();
    51       List<double> oneVariableTestData = ValueGenerator.GenerateSteps(-3, 3, 0.01).ToList();
     51      List<double> oneVariableTestData = ValueGenerator.GenerateSteps(-3, 3, 0.01m).Select(v => (double)v).ToList();
    5252      List<List<double>> testData = new List<List<double>>() { oneVariableTestData, oneVariableTestData };
    5353
  • stable/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/Keijzer/KeijzerFunctionFifteen.cs

    r11170 r11868  
    4848    protected override List<List<double>> GenerateValues() {
    4949      List<List<double>> data = new List<List<double>>();
    50       List<double> oneVariableTestData = ValueGenerator.GenerateSteps(-3, 3, 0.01).ToList();
     50      List<double> oneVariableTestData = ValueGenerator.GenerateSteps(-3, 3, 0.01m).Select(v => (double)v).ToList();
    5151      List<List<double>> testData = new List<List<double>>() { oneVariableTestData, oneVariableTestData };
    5252
  • stable/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/Keijzer/KeijzerFunctionFour.cs

    r11170 r11868  
    4949    protected override List<List<double>> GenerateValues() {
    5050      List<List<double>> data = new List<List<double>>();
    51       data.Add(ValueGenerator.GenerateSteps(0, 10, 0.05).ToList());
    52       data[0].AddRange(ValueGenerator.GenerateSteps(0.05, 10.05, 0.05));
     51      data.Add(ValueGenerator.GenerateSteps(0, 10, 0.05m).Select(v => (double)v).ToList());
     52      data[0].AddRange(ValueGenerator.GenerateSteps(0.05m, 10.05m, 0.05m).Select(v => (double)v));
    5353
    5454      double x;
  • stable/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/Keijzer/KeijzerFunctionFourteen.cs

    r11170 r11868  
    4848    protected override List<List<double>> GenerateValues() {
    4949      List<List<double>> data = new List<List<double>>();
    50       List<double> oneVariableTestData = ValueGenerator.GenerateSteps(-3, 3, 0.01).ToList();
     50      List<double> oneVariableTestData = ValueGenerator.GenerateSteps(-3, 3, 0.01m).Select(v => (double) v).ToList();
    5151      List<List<double>> testData = new List<List<double>>() { oneVariableTestData, oneVariableTestData };
    5252
  • stable/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/Keijzer/KeijzerFunctionNine.cs

    r11170 r11868  
    4848    protected override List<List<double>> GenerateValues() {
    4949      List<List<double>> data = new List<List<double>>();
    50       data.Add(ValueGenerator.GenerateSteps(0, 100, 1).ToList());
    51       data[0].AddRange(ValueGenerator.GenerateSteps(0, 100, 0.1));
     50      data.Add(ValueGenerator.GenerateSteps(0m, 100, 1).Select(v => (double)v).ToList());
     51      data[0].AddRange(ValueGenerator.GenerateSteps(0, 100, 0.1m).Select(v => (double)v));
    5252
    5353      double x;
  • stable/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/Keijzer/KeijzerFunctionOne.cs

    r11170 r11868  
    4848    protected override List<List<double>> GenerateValues() {
    4949      List<List<double>> data = new List<List<double>>();
    50       data.Add(ValueGenerator.GenerateSteps(-1, 1, 0.1).ToList());
    51       data[0].AddRange(ValueGenerator.GenerateSteps(-1, 1, 0.001));
     50      data.Add(ValueGenerator.GenerateSteps(-1, 1, 0.1m).Select(v => (double)v).ToList());
     51      data[0].AddRange(ValueGenerator.GenerateSteps(-1, 1, 0.001m).Select(v => (double)v));
    5252
    5353      double x;
  • stable/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/Keijzer/KeijzerFunctionSeven.cs

    r11170 r11868  
    4949    protected override List<List<double>> GenerateValues() {
    5050      List<List<double>> data = new List<List<double>>();
    51       data.Add(ValueGenerator.GenerateSteps(1, 100, 1).ToList());
    52       data[0].AddRange(ValueGenerator.GenerateSteps(1, 100, 0.1));
     51      data.Add(ValueGenerator.GenerateSteps(1m, 100, 1).Select(v => (double)v).ToList());
     52      data[0].AddRange(ValueGenerator.GenerateSteps(1m, 100, 0.1m).Select(v => (double)v));
    5353
    5454      double x;
  • stable/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/Keijzer/KeijzerFunctionSix.cs

    r11170 r11868  
    4848    protected override List<List<double>> GenerateValues() {
    4949      List<List<double>> data = new List<List<double>>();
    50       data.Add(ValueGenerator.GenerateSteps(1, 50, 1).ToList());
    51       data[0].AddRange(ValueGenerator.GenerateSteps(1, 120, 1));
     50      data.Add(ValueGenerator.GenerateSteps(1m, 50, 1).Select(v => (double)v).ToList());
     51      data[0].AddRange(ValueGenerator.GenerateSteps(1m, 120, 1).Select(v => (double)v));
    5252
    5353      double x;
  • stable/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/Keijzer/KeijzerFunctionTen.cs

    r11170 r11868  
    4949      List<List<double>> data = new List<List<double>>();
    5050
    51       List<double> oneVariableTestData = ValueGenerator.GenerateSteps(0, 1, 0.01).ToList();
     51      List<double> oneVariableTestData = ValueGenerator.GenerateSteps(0, 1, 0.01m).Select(v => (double)v).ToList();
    5252      List<List<double>> testData = new List<List<double>>() { oneVariableTestData, oneVariableTestData };
    5353
  • stable/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/Keijzer/KeijzerFunctionThirteen.cs

    r11170 r11868  
    4848    protected override List<List<double>> GenerateValues() {
    4949      List<List<double>> data = new List<List<double>>();
    50       List<double> oneVariableTestData = ValueGenerator.GenerateSteps(-3, 3, 0.01).ToList();
     50      List<double> oneVariableTestData = ValueGenerator.GenerateSteps(-3, 3, 0.01m).Select(v => (double)v).ToList();
    5151      List<List<double>> testData = new List<List<double>>() { oneVariableTestData, oneVariableTestData };
    5252
  • stable/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/Keijzer/KeijzerFunctionThree.cs

    r11170 r11868  
    4848    protected override List<List<double>> GenerateValues() {
    4949      List<List<double>> data = new List<List<double>>();
    50       data.Add(ValueGenerator.GenerateSteps(-3, 3, 0.1).ToList());
    51       data[0].AddRange(ValueGenerator.GenerateSteps(-3, 3, 0.001));
     50      data.Add(ValueGenerator.GenerateSteps(-3, 3, 0.1m).Select(v => (double)v).ToList());
     51      data[0].AddRange(ValueGenerator.GenerateSteps(-3, 3, 0.001m).Select(v => (double)v));
    5252
    5353      double x;
  • stable/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/Keijzer/KeijzerFunctionTwelve.cs

    r11170 r11868  
    4848    protected override List<List<double>> GenerateValues() {
    4949      List<List<double>> data = new List<List<double>>();
    50       List<double> oneVariableTestData = ValueGenerator.GenerateSteps(-3, 3, 0.01).ToList();
     50      List<double> oneVariableTestData = ValueGenerator.GenerateSteps(-3, 3, 0.01m).Select(v => (double)v).ToList();
    5151      List<List<double>> testData = new List<List<double>>() { oneVariableTestData, oneVariableTestData };
    5252
  • stable/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/Keijzer/KeijzerFunctionTwo.cs

    r11170 r11868  
    4848    protected override List<List<double>> GenerateValues() {
    4949      List<List<double>> data = new List<List<double>>();
    50       data.Add(ValueGenerator.GenerateSteps(-2, 2, 0.1).ToList());
    51       data[0].AddRange(ValueGenerator.GenerateSteps(-2, 2, 0.001));
     50      data.Add(ValueGenerator.GenerateSteps(-2, 2, 0.1m).Select(v => (double)v).ToList());
     51      data[0].AddRange(ValueGenerator.GenerateSteps(-2, 2, 0.001m).Select(v => (double)v));
    5252
    5353      double x;
  • stable/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/ValueGenerator.cs

    r11170 r11868  
    3131
    3232    /// <summary>
    33     /// Generates a sequence of evenly spaced points between start and end (inclusive!).
     33    /// Generates a sequence of evenly spaced points by returning the start value and adding the stepwidth until the end is reached or surpassed.
     34    ///
    3435    /// </summary>
    3536    /// <param name="start">The smallest and first value of the sequence.</param>
    3637    /// <param name="end">The largest and last value of the sequence.</param>
    3738    /// <param name="stepWidth">The step size between subsequent values.</param>
    38     /// <returns>An sequence of values from start to end (inclusive)</returns>
    39     public static IEnumerable<double> GenerateSteps(double start, double end, double stepWidth) {
    40       if (start > end) throw new ArgumentException("start must be less than or equal end.");
    41       if (stepWidth <= 0) throw new ArgumentException("stepwith must be larger than zero.", "stepWidth");
    42       double x = start;
    43       // x<=end could skip the last value because of numerical problems
    44       while (x < end || x.IsAlmost(end)) {
     39    /// <param name="includeEnd">Determines if the end should be included in the sequence regardless if the end is divisible by the stepwidth.</param>
     40    /// <returns>A sequence of values from start to end (inclusive)</returns>
     41    [Obsolete("It is recommended to use the decimal overload to achieve a higher numerical accuracy.")]
     42    public static IEnumerable<double> GenerateSteps(double start, double end, double stepWidth, bool includeEnd = false) {
     43      //mkommend: IEnumerable.Cast fails due to boxing and unboxing of the involved types
     44      // http://referencesource.microsoft.com/#System.Core/System/Linq/Enumerable.cs#27bb217a6d5457ec
     45      // http://blogs.msdn.com/b/ericlippert/archive/2009/03/19/representation-and-identity.aspx     
     46
     47      return GenerateSteps((decimal)start, (decimal)end, (decimal)stepWidth, includeEnd).Select(x => (double)x);
     48    }
     49
     50    /// <summary>
     51    /// Generates a sequence of evenly spaced points by returning the start value and adding the stepwidth until the end is reached or surpassed.
     52    /// </summary>
     53    /// <param name="start">The smallest and first value of the sequence.</param>
     54    /// <param name="end">The largest and last value of the sequence.</param>
     55    /// <param name="stepWidth">The step size between subsequent values.</param>
     56    /// /// <param name="includeEnd">Determines if the end should be included in the sequence regardless if the end is divisible by the stepwidth.</param>
     57    /// <returns>A sequence of values from start to end</returns>
     58    public static IEnumerable<decimal> GenerateSteps(decimal start, decimal end, decimal stepWidth, bool includeEnd = false) {
     59      if (stepWidth == 0)
     60        throw new ArgumentException("The step width cannot be zero.");
     61      if (start < end && stepWidth < 0)
     62        throw new ArgumentException("The step width must be larger than zero for increasing sequences (start < end).");
     63      if (start > end && stepWidth > 0)
     64        throw new ArgumentException("The step width must be smaller than zero for decreasing sequences (start > end).");
     65
     66      decimal x = start;
     67      while (x <= end) {
    4568        yield return x;
    4669        x += stepWidth;
    4770      }
     71      if (x - stepWidth < end && includeEnd) yield return end;
    4872    }
    4973
  • stable/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/Various/SpatialCoevolution.cs

    r11170 r11868  
    5353      List<List<double>> data = new List<List<double>>();
    5454
    55       List<double> evenlySpacedSequence = ValueGenerator.GenerateSteps(-5, 5, 0.4).ToList();
     55      List<double> evenlySpacedSequence = ValueGenerator.GenerateSteps(-5, 5, 0.4m).Select(v => (double)v).ToList();
    5656      List<List<double>> trainingData = new List<List<double>>() { evenlySpacedSequence, evenlySpacedSequence };
    5757      var combinations = ValueGenerator.GenerateAllCombinationsOfValuesInLists(trainingData).ToList();
  • stable/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/Vladislavleva/KotanchekFunction.cs

    r11170 r11868  
    4949      List<List<double>> data = new List<List<double>>();
    5050
    51       List<double> oneVariableTestData = ValueGenerator.GenerateSteps(-0.2, 4.2, 0.1).ToList();
     51      List<double> oneVariableTestData = ValueGenerator.GenerateSteps(-0.2m, 4.2m, 0.1m).Select(v => (double)v).ToList();
    5252      List<List<double>> testData = new List<List<double>>() { oneVariableTestData, oneVariableTestData };
    5353      var combinations = ValueGenerator.GenerateAllCombinationsOfValuesInLists(testData).ToList<IEnumerable<double>>();
  • stable/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/Vladislavleva/RationalPolynomialThreeDimensional.cs

    r11170 r11868  
    5555
    5656      List<List<double>> testData = new List<List<double>>() {
    57         ValueGenerator.GenerateSteps(-0.05, 2.05, 0.15).ToList(),
    58         ValueGenerator.GenerateSteps( 0.95, 2.05, 0.1).ToList(),
    59         ValueGenerator.GenerateSteps(-0.05, 2.05, 0.15).ToList()
     57        ValueGenerator.GenerateSteps(-0.05m, 2.05m, 0.15m).Select(v => (double)v).ToList(),
     58        ValueGenerator.GenerateSteps( 0.95m, 2.05m, 0.1m).Select(v => (double)v).ToList(),
     59        ValueGenerator.GenerateSteps(-0.05m, 2.05m, 0.15m).Select(v => (double)v).ToList()
    6060      };
    6161
  • stable/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/Vladislavleva/RationalPolynomialTwoDimensional.cs

    r11170 r11868  
    4949      List<List<double>> data = new List<List<double>>();
    5050
    51       List<double> oneVariableTestData = ValueGenerator.GenerateSteps(-0.25, 6.35, 0.2).ToList();
     51      List<double> oneVariableTestData = ValueGenerator.GenerateSteps(-0.25m, 6.35m, 0.2m).Select(v => (double)v).ToList();
    5252
    5353      List<List<double>> testData = new List<List<double>>() { oneVariableTestData, oneVariableTestData };
  • stable/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/Vladislavleva/SalutowiczFunctionOneDimensional.cs

    r11170 r11868  
    4848    protected override List<List<double>> GenerateValues() {
    4949      List<List<double>> data = new List<List<double>>();
    50       data.Add(ValueGenerator.GenerateSteps(0.05, 10, 0.1).ToList());
    51       data[0].AddRange(ValueGenerator.GenerateSteps(-0.5, 10.5, 0.05));
     50      data.Add(ValueGenerator.GenerateSteps(0.05m, 10, 0.1m).Select(v => (double)v).ToList());
     51      data[0].AddRange(ValueGenerator.GenerateSteps(-0.5m, 10.5m, 0.05m).Select(v => (double)v));
    5252
    5353      double x;
  • stable/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/Vladislavleva/SalutowiczFunctionTwoDimensional.cs

    r11170 r11868  
    4949      List<List<double>> data = new List<List<double>>();
    5050      List<List<double>> trainingData = new List<List<double>>() {
    51         ValueGenerator.GenerateSteps(0.05, 10, 0.1).ToList(),
    52         ValueGenerator.GenerateSteps(0.05, 10.05, 2).ToList()
     51        ValueGenerator.GenerateSteps(0.05m, 10, 0.1m).Select(v => (double)v).ToList(),
     52        ValueGenerator.GenerateSteps(0.05m, 10.05m, 2).Select(v => (double)v).ToList()
    5353      };
    5454
    5555      List<List<double>> testData = new List<List<double>>() {
    56         ValueGenerator.GenerateSteps(-0.5, 10.5, 0.05).ToList(),
    57         ValueGenerator.GenerateSteps(-0.5, 10.5, 0.5).ToList()
     56        ValueGenerator.GenerateSteps(-0.5m, 10.5m, 0.05m).Select(v => (double)v).ToList(),
     57        ValueGenerator.GenerateSteps(-0.5m, 10.5m, 0.5m).Select(v => (double)v).ToList()
    5858      };
    5959
  • stable/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/Vladislavleva/SineCosineFunction.cs

    r11170 r11868  
    4848    protected override List<List<double>> GenerateValues() {
    4949      List<List<double>> data = new List<List<double>>();
    50       List<double> oneVariableTestData = ValueGenerator.GenerateSteps(-0.05, 6.05, 0.02).ToList();
     50      List<double> oneVariableTestData = ValueGenerator.GenerateSteps(-0.05m, 6.05m, 0.02m).Select(v => (double)v).ToList();
    5151      List<List<double>> testData = new List<List<double>>() { oneVariableTestData, oneVariableTestData };
    5252      var combinations = ValueGenerator.GenerateAllCombinationsOfValuesInLists(testData).ToList<IEnumerable<double>>();
Note: See TracChangeset for help on using the changeset viewer.