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/VariousInstanceProvider.cs

    r14185 r14228  
    2222using System;
    2323using System.Collections.Generic;
     24using HeuristicLab.Random;
    2425
    2526namespace HeuristicLab.Problems.Instances.DataAnalysis {
     
    3738      get { return ""; }
    3839    }
     40    public int Seed { get; }
    3941
     42    public VariousInstanceProvider() : this((int)DateTime.Now.Ticks) { }
     43
     44    public VariousInstanceProvider(int seed) : base() {
     45      Seed = seed;
     46    }
    4047    public override IEnumerable<IDataDescriptor> GetDataDescriptors() {
    4148      List<IDataDescriptor> descriptorList = new List<IDataDescriptor>();
    42       descriptorList.Add(new BreimanOne());
    43       descriptorList.Add(new FriedmanOne());
    44       descriptorList.Add(new FriedmanTwo());
    45       descriptorList.Add(new PolyTen());
    46       descriptorList.Add(new SpatialCoevolution());
     49      var rand = new MersenneTwister((uint)Seed);
     50      descriptorList.Add(new BreimanOne(rand.Next()));
     51      descriptorList.Add(new FriedmanOne(rand.Next()));
     52      descriptorList.Add(new FriedmanTwo(rand.Next()));
     53      descriptorList.Add(new PolyTen(rand.Next()));
     54      descriptorList.Add(new SpatialCoevolution(rand.Next()));
    4755      return descriptorList;
    4856    }
Note: See TracChangeset for help on using the changeset viewer.