Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/02/16 18:09:47 (8 years ago)
Author:
gkronber
Message:

#2371: added constructors to allow specification of random seeds for randomly generated regression problem instances (primarily for unit tests)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/Vladislavleva/UnwrappedBallFunctionFiveDimensional.cs

    r14185 r14228  
    2323using System.Collections.Generic;
    2424using System.Linq;
     25using HeuristicLab.Random;
    2526
    2627namespace HeuristicLab.Problems.Instances.DataAnalysis {
     
    4546    protected override int TestPartitionStart { get { return 1024; } }
    4647    protected override int TestPartitionEnd { get { return 6024; } }
     48    public int Seed { get; }
    4749
     50    public UnwrappedBallFunctionFiveDimensional() : this((int)DateTime.Now.Ticks) { }
     51
     52    public UnwrappedBallFunctionFiveDimensional(int seed) : base() {
     53      Seed = seed;
     54    }
    4855    protected override List<List<double>> GenerateValues() {
    4956      List<List<double>> data = new List<List<double>>();
     57      var rand = new MersenneTwister((uint)Seed);
    5058      for (int i = 0; i < AllowedInputVariables.Count(); i++) {
    51         data.Add(ValueGenerator.GenerateUniformDistributedValues(1024, 0.05, 6.05).ToList());
    52         data[i].AddRange(ValueGenerator.GenerateUniformDistributedValues(5000, -0.25, 6.35));
     59        data.Add(ValueGenerator.GenerateUniformDistributedValues(rand.Next(), 1024, 0.05, 6.05).ToList());
     60        data[i].AddRange(ValueGenerator.GenerateUniformDistributedValues(rand.Next(), 5000, -0.25, 6.35));
    5361      }
    5462
Note: See TracChangeset for help on using the changeset viewer.