Free cookie consent management tool by TermsFeed Policy Generator

Changeset 15776


Ignore:
Timestamp:
02/14/18 10:56:02 (7 years ago)
Author:
lkammere
Message:

#2886: Refactor data generation in unit tests.

Location:
branches/2886_SymRegGrammarEnumeration
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/2886_SymRegGrammarEnumeration/HeuristicLab.Algorithms.DataAnalysis.SymRegGrammarEnumeration/GrammarEnumeration/GrammarEnumerationAlgorithm.cs

    r15765 r15776  
    8484
    8585    public GrammarEnumerationAlgorithm() {
    86       var provider = new HeuristicLab.Problems.Instances.DataAnalysis.VariousInstanceProvider(seed: 1234);
    87       var regProblem = provider.LoadData(provider.GetDataDescriptors().Single(x => x.Name.Contains("Poly-10")));
     86      var provider = new HeuristicLab.Problems.Instances.DataAnalysis.NguyenInstanceProvider(seed: 1234);
     87      var regProblem = provider.LoadData(provider.GetDataDescriptors().Single(x => x.Name.Contains("F9 ")));
    8888
    8989      Problem = new RegressionProblem() {
  • branches/2886_SymRegGrammarEnumeration/Test/GrammarEnumerationTest.cs

    r15773 r15776  
    11using System;
    2 using System.Diagnostics;
    32using System.Linq;
    43using HeuristicLab.Algorithms.DataAnalysis.SymRegGrammarEnumeration;
    54using HeuristicLab.Algorithms.DataAnalysis.SymRegGrammarEnumeration.GrammarEnumeration;
    6 using HeuristicLab.Common;
    75using HeuristicLab.Core;
    8 using HeuristicLab.Data;
    9 using HeuristicLab.Optimization;
    106using HeuristicLab.Problems.DataAnalysis;
     7using HeuristicLab.Problems.Instances.DataAnalysis;
    118using HeuristicLab.Random;
    129using Microsoft.VisualStudio.TestTools.UnitTesting;
     
    5855      // x³ + x² + x
    5956      alg.MaxTreeSize = 15;
    60       Console.WriteLine(alg.MaxTreeSize);
    61       var provider = new HeuristicLab.Problems.Instances.DataAnalysis.NguyenInstanceProvider(Seed);
    62       var regProblem = provider.LoadData(provider.GetDataDescriptors().Single(x => x.Name.Contains("F1 ")));
    63       alg.Problem.ProblemData = regProblem;
     57      alg.Problem.ProblemData = new NguyenFunctionOne(Seed).GenerateRegressionData();
    6458
    6559      alg.Start();
     
    9286      // x^4 + x³ + x² + x
    9387      alg.MaxTreeSize = 20;
    94       var provider = new HeuristicLab.Problems.Instances.DataAnalysis.NguyenInstanceProvider(Seed);
    95       var regProblem = provider.LoadData(provider.GetDataDescriptors().Single(x => x.Name.Contains("F2 ")));
    96       alg.Problem.ProblemData = regProblem;
     88      alg.Problem.ProblemData = new NguyenFunctionTwo(Seed).GenerateRegressionData();
    9789
    9890      alg.Start();
     
    10698      // x^5 + x^4 + x^3 + x^2 + x
    10799      alg.MaxTreeSize = 32;
    108       var provider = new HeuristicLab.Problems.Instances.DataAnalysis.NguyenInstanceProvider(Seed);
    109       var regProblem = provider.LoadData(provider.GetDataDescriptors().Single(x => x.Name.Contains("F3 ")));
    110       alg.Problem.ProblemData = regProblem;
     100      alg.Problem.ProblemData = new NguyenFunctionThree(Seed).GenerateRegressionData();
    111101
    112102      alg.Start();
     
    120110      // sin(x) + sin(x + x²)
    121111      alg.MaxTreeSize = 15;
    122       var provider = new HeuristicLab.Problems.Instances.DataAnalysis.NguyenInstanceProvider(Seed);
    123       var regProblem = provider.LoadData(provider.GetDataDescriptors().Single(x => x.Name.Contains("F6 ")));
    124       alg.Problem.ProblemData = regProblem;
     112      alg.Problem.ProblemData = new NguyenFunctionSix(Seed).GenerateRegressionData();
    125113
    126114      alg.Start();
     
    133121      // sin(x) + sin(y²)
    134122      alg.MaxTreeSize = 10;
    135       var provider = new HeuristicLab.Problems.Instances.DataAnalysis.NguyenInstanceProvider(Seed);
    136       var regProblem = provider.LoadData(provider.GetDataDescriptors().Single(x => x.Name.Contains("F9 ")));
    137       alg.Problem.ProblemData = regProblem;
     123      alg.Problem.ProblemData = new NguyenFunctionNine(Seed).GenerateRegressionData();
    138124
    139125      alg.Start();
     
    146132    public void MctsSymbReg_NoConstants_Poly10() {
    147133      alg.MaxTreeSize = 10;
    148       var provider = new HeuristicLab.Problems.Instances.DataAnalysis.VariousInstanceProvider(Seed);
    149       var regProblem = provider.LoadData(provider.GetDataDescriptors().Single(x => x.Name.Contains("Poly")));
    150       alg.Problem.ProblemData = regProblem;
     134      alg.Problem.ProblemData = new PolyTen(Seed).GenerateRegressionData();
    151135
    152136      alg.Start();
Note: See TracChangeset for help on using the changeset viewer.