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/Various/FriedmanOne.cs

    r14185 r14228  
    4242    protected override int TestPartitionStart { get { return 5000; } }
    4343    protected override int TestPartitionEnd { get { return 10000; } }
     44    public int Seed { get; }
    4445
    45     protected static FastRandom rand = new FastRandom();
     46    public FriedmanOne() : this((int)DateTime.Now.Ticks) { }
     47
     48    public FriedmanOne(int seed) : base() {
     49      Seed = seed;
     50    }
    4651
    4752    protected override List<List<double>> GenerateValues() {
    4853      List<List<double>> data = new List<List<double>>();
     54      var rand = new MersenneTwister((uint)Seed);
    4955      for (int i = 0; i < AllowedInputVariables.Count(); i++) {
    50         data.Add(ValueGenerator.GenerateUniformDistributedValues(10000, 0, 1).ToList());
     56        data.Add(ValueGenerator.GenerateUniformDistributedValues(rand.Next(), 10000, 0, 1).ToList());
    5157      }
    5258
Note: See TracChangeset for help on using the changeset viewer.