source: branches/2886_SymRegGrammarEnumeration/Test/GrammarEnumerationTest.cs @ 15861

Last change on this file since 15861 was 15861, checked in by lkammere, 3 years ago

#2886: Make constant optimization toggleable in algorithm.

File size: 41.7 KB
Line 
1using System;
2using System.Collections;
3using System.Collections.Generic;
4using System.Linq;
5using HeuristicLab.Algorithms.DataAnalysis.SymRegGrammarEnumeration;
6using HeuristicLab.Algorithms.DataAnalysis.SymRegGrammarEnumeration.GrammarEnumeration;
7using HeuristicLab.Common;
8using HeuristicLab.Core;
9using HeuristicLab.Problems.DataAnalysis;
10using HeuristicLab.Problems.Instances.DataAnalysis;
11using HeuristicLab.Random;
12using Microsoft.VisualStudio.TestTools.UnitTesting;
13
14namespace HeuristicLab.Algorithms.DataAnalysis.MctsSymbolicRegression {
15  [TestClass]
16  public class MctsSymbolicRegressionTest {
17    private const int Seed = 1234;
18    private IRandom rand;
19
20    private const double SuccessThreshold = 0.9999999;
21
22    private GrammarEnumerationAlgorithm alg;
23    private RegressionProblem problem;
24
25    [TestInitialize]
26    public void InitTest() {
27      rand = new FastRandom(Seed);
28
29      alg = new GrammarEnumerationAlgorithm();
30      problem = new RegressionProblem();
31      alg.Problem = problem;
32      alg.GuiUpdateInterval = int.MaxValue;
33      foreach (IGrammarEnumerationAnalyzer grammarEnumerationAnalyzer in alg.Analyzers) {
34        alg.Analyzers.SetItemCheckedState(grammarEnumerationAnalyzer, grammarEnumerationAnalyzer is RSquaredEvaluator);
35      }
36    }
37
38    [TestCleanup]
39    public void Cleanup() {
40      if (alg.BestTrainingSentence != null) {
41        Console.WriteLine("Training: " + alg.Grammar.ToInfixString(alg.BestTrainingSentence));
42      }
43    }
44
45
46    private void EvaluateGrammarEnumeration() {
47      // Evaluate results
48      var eps = 1.0 - SuccessThreshold;
49
50      // Check if algorithm terminated correctly
51      Assert.IsTrue(alg.Results.ContainsKey("Best solution (Training)"), "No training solution returned!");
52
53      // Check resultss
54      Assert.AreEqual(1.0, ((IRegressionSolution)alg.Results["Best solution (Training)"].Value).TestRSquared, eps, "Test quality too low!");
55    }
56
57
58    [TestMethod]
59    [TestProperty("Goal", "structure search")]
60    public void NoConstants_Nguyen1() {
61      // x³ + x² + x
62      alg.OptimizeConstants = false;
63      alg.MaxComplexity = 6;
64      alg.Problem.ProblemData = new NguyenFunctionOne(Seed).GenerateRegressionData();
65
66      alg.Start();
67
68      TerminalSymbol constSymbol = alg.Grammar.Const;
69      TerminalSymbol varSymbol = alg.Grammar.VarTerminals.First();
70      TerminalSymbol mulSymbol = alg.Grammar.Multiplication;
71      TerminalSymbol addSymbol = alg.Grammar.Addition;
72
73      SymbolString targetSolution = new SymbolString(new[] {
74        constSymbol, varSymbol, varSymbol, varSymbol, mulSymbol, mulSymbol, mulSymbol,
75        constSymbol, varSymbol, varSymbol, mulSymbol, mulSymbol, addSymbol,
76        constSymbol, varSymbol, mulSymbol, addSymbol,
77        constSymbol, addSymbol
78      });
79
80      int targetSolutionHash = alg.Grammar.Hasher.CalcHashCode(targetSolution);
81      int actualSolutionHash = alg.Grammar.Hasher.CalcHashCode(alg.BestTrainingSentence);
82
83      Assert.IsTrue(alg.DistinctSentencesComplexity.ContainsKey(targetSolutionHash), "Actual solution was not generated!");
84
85      Assert.AreEqual(targetSolutionHash, actualSolutionHash, "Actual solution was not recognized as best one.");
86
87      // Evaluate
88      EvaluateGrammarEnumeration();
89    }
90
91    // Too "large" target model for now...
92    //[TestMethod]
93    [TestProperty("Goal", "structure search")]
94    public void NoConstants_Nguyen2() {
95      // x^4 + x³ + x² + x
96      alg.MaxComplexity = 11;
97      alg.Problem.ProblemData = new NguyenFunctionTwo(Seed).GenerateRegressionData();
98
99      alg.Start();
100      EvaluateGrammarEnumeration();
101    }
102
103    // Too "large" target model for now...
104    //[TestMethod]
105    [TestProperty("Goal", "structure search")]
106    public void NoConstants_Nguyen3() {
107      // x^5 + x^4 + x^3 + x^2 + x
108      alg.MaxComplexity = 32;
109      alg.Problem.ProblemData = new NguyenFunctionThree(Seed).GenerateRegressionData();
110
111      alg.Start();
112
113      EvaluateGrammarEnumeration();
114    }
115
116    [TestMethod]
117    [TestProperty("Goal", "structure search")]
118    public void NoConstants_Nguyen6() {
119      // sin(x) + sin(x + x²)
120      alg.OptimizeConstants = false;
121      alg.MaxComplexity = 4;
122      alg.Problem.ProblemData = new NguyenFunctionSix(Seed).GenerateRegressionData();
123
124      alg.Start();
125
126      TerminalSymbol constSymbol = alg.Grammar.Const;
127      TerminalSymbol varSymbol = alg.Grammar.VarTerminals.First();
128      TerminalSymbol mulSymbol = alg.Grammar.Multiplication;
129      TerminalSymbol addSymbol = alg.Grammar.Addition;
130      TerminalSymbol sinSymbol = alg.Grammar.Sin;
131
132      // c * sin(c x + c) + c * sin(c * x * x + c * x) + c
133      SymbolString targetSolution = new SymbolString(new[] {
134        varSymbol, constSymbol, mulSymbol, constSymbol, addSymbol, sinSymbol, constSymbol, mulSymbol,
135        varSymbol, varSymbol, mulSymbol, constSymbol, mulSymbol, varSymbol, constSymbol, mulSymbol, addSymbol, constSymbol, addSymbol, sinSymbol, constSymbol, mulSymbol, addSymbol,
136        constSymbol, addSymbol
137      });
138
139      int targetSolutionHash = alg.Grammar.Hasher.CalcHashCode(targetSolution);
140      int actualSolutionHash = alg.Grammar.Hasher.CalcHashCode(alg.BestTrainingSentence);
141
142      Assert.IsTrue(alg.DistinctSentencesComplexity.ContainsKey(targetSolutionHash), "Actual solution was not generated!");
143      Assert.AreEqual(targetSolutionHash, actualSolutionHash, "Actual solution was not recognized as best one.");
144
145      EvaluateGrammarEnumeration();
146    }
147
148    [TestMethod]
149    [TestProperty("Goal", "structure search")]
150    public void NoConstants_Nguyen9() {
151      // sin(x) + sin(y²)   
152      alg.OptimizeConstants = false;
153      alg.MaxComplexity = 3;
154      alg.Problem.ProblemData = new NguyenFunctionNine(Seed).GenerateRegressionData();
155
156      alg.Start();
157
158      TerminalSymbol xSymbol = alg.Grammar.VarTerminals.First(v => v.StringRepresentation == "X");
159      TerminalSymbol ySymbol = alg.Grammar.VarTerminals.First(v => v.StringRepresentation == "Y");
160      TerminalSymbol constSymbol = alg.Grammar.Const;
161      TerminalSymbol mulSymbol = alg.Grammar.Multiplication;
162      TerminalSymbol addSymbol = alg.Grammar.Addition;
163      TerminalSymbol sinSymbol = alg.Grammar.Sin;
164
165      // c*sin(c*x + c) + c*sin(c*y*y + c) + c
166      SymbolString targetSolution = new SymbolString(new[] {
167        xSymbol, constSymbol, mulSymbol, constSymbol, addSymbol, sinSymbol, constSymbol, mulSymbol,
168        ySymbol, ySymbol, mulSymbol, constSymbol, mulSymbol, constSymbol, addSymbol, sinSymbol, constSymbol, mulSymbol, addSymbol,
169        constSymbol, addSymbol
170      });
171
172      int targetSolutionHash = alg.Grammar.Hasher.CalcHashCode(targetSolution);
173      int actualSolutionHash = alg.Grammar.Hasher.CalcHashCode(alg.BestTrainingSentence);
174
175      Assert.IsTrue(alg.DistinctSentencesComplexity.ContainsKey(targetSolutionHash), "Actual solution was not generated!");
176      Assert.AreEqual(targetSolutionHash, actualSolutionHash, "Actual solution was not recognized as best one.");
177
178      EvaluateGrammarEnumeration();
179    }
180
181    // Too much variables for now...
182    //[TestMethod]
183    [TestProperty("Goal", "structure search")]
184    public void MctsSymbReg_NoConstants_Poly10() {
185      alg.MaxComplexity = 10;
186      alg.Problem.ProblemData = new PolyTen(Seed).GenerateRegressionData();
187
188      alg.Start();
189      EvaluateGrammarEnumeration();
190    }
191
192    [TestMethod]
193    [TestProperty("Goal", "structure search")]
194    public void NoConstants_Inverse() {
195      // x / (log(x)*x + x)
196      alg.OptimizeConstants = false;
197      alg.MaxComplexity = 4;
198
199      var x = Enumerable.Range(0, 100).Select(_ => rand.NextDouble() + 1.1).ToList();
200      var y = x.Select(xi => xi / (Math.Log(xi) * xi + xi)).ToList();
201      alg.Problem.ProblemData = new RegressionProblemData(new Dataset(new List<string>() { "x", "y" }, new List<IList>() { x, y }), "x".ToEnumerable(), "y");
202
203      alg.Start();
204      EvaluateGrammarEnumeration();
205    }
206
207    [TestMethod]
208    [TestProperty("Goal", "structure search + const op")]
209    public void Constants_Nguyen7() {
210      // log(x+1) + log(x*x + 1)
211      alg.MaxComplexity = 3;
212      alg.Problem.ProblemData = new NguyenFunctionSeven().GenerateRegressionData();
213
214      alg.Start();
215
216      TerminalSymbol constSymbol = alg.Grammar.Const;
217      TerminalSymbol varSymbol = alg.Grammar.VarTerminals.First();
218      TerminalSymbol mulSymbol = alg.Grammar.Multiplication;
219      TerminalSymbol addSymbol = alg.Grammar.Addition;
220      TerminalSymbol logSymbol = alg.Grammar.Log;
221
222      SymbolString targetSolution = new SymbolString(new[] {
223        varSymbol, constSymbol, mulSymbol, constSymbol, addSymbol, logSymbol, constSymbol, mulSymbol,
224        varSymbol, varSymbol, mulSymbol, constSymbol, mulSymbol, constSymbol, addSymbol, logSymbol, constSymbol, mulSymbol, addSymbol,
225        constSymbol, addSymbol
226      });
227
228      int targetSolutionHash = alg.Grammar.Hasher.CalcHashCode(targetSolution);
229      int actualSolutionHash = alg.Grammar.Hasher.CalcHashCode(alg.BestTrainingSentence);
230
231      Assert.IsTrue(alg.DistinctSentencesComplexity.ContainsKey(targetSolutionHash), "Actual solution was not generated!");
232      Assert.AreEqual(targetSolutionHash, actualSolutionHash, "Actual solution was not recognized as best one.");
233
234      // Evaluate
235      EvaluateGrammarEnumeration();
236    }
237
238    [TestMethod]
239    [TestProperty("Goal", "structure search + const op")]
240    public void Constants_Nguyen12() {
241      // x*x*x*x - x*x*x + y*y/2 -y
242      alg.MaxComplexity = 10;
243      alg.Problem.ProblemData = new NguyenFunctionTwelve().GenerateRegressionData();
244
245      alg.Start();
246
247      // Evaluate
248      EvaluateGrammarEnumeration();
249    }
250
251    [TestMethod]
252    [TestProperty("Goal", "structure search + const op")]
253    public void Constants_Keijzer3() {
254      // 0.3*x*sin(2*pi*x)
255      alg.MaxComplexity = 2;
256      alg.Problem.ProblemData = new KeijzerFunctionThree().GenerateRegressionData();
257
258      alg.Start();
259
260      TerminalSymbol constSymbol = alg.Grammar.Const;
261      TerminalSymbol varSymbol = alg.Grammar.VarTerminals.First();
262      TerminalSymbol mulSymbol = alg.Grammar.Multiplication;
263      TerminalSymbol addSymbol = alg.Grammar.Addition;
264
265      SymbolString targetSolution = new SymbolString(new[] {
266        constSymbol, varSymbol, mulSymbol, constSymbol, addSymbol, alg.Grammar.Sin,
267        varSymbol, mulSymbol,
268        constSymbol, mulSymbol,
269        constSymbol, addSymbol
270      });
271
272      int targetSolutionHash = alg.Grammar.Hasher.CalcHashCode(targetSolution);
273      int actualSolutionHash = alg.Grammar.Hasher.CalcHashCode(alg.BestTrainingSentence);
274
275      Assert.IsTrue(alg.DistinctSentencesComplexity.ContainsKey(targetSolutionHash), "Actual solution was not generated!");
276      Assert.AreEqual(targetSolutionHash, actualSolutionHash, "Actual solution was not recognized as best one.");
277
278      // Evaluate
279      EvaluateGrammarEnumeration();
280    }
281
282    [TestMethod]
283    [TestProperty("Goal", "structure search + const op")]
284    public void Constants_Keijzer5() {
285      // (30*x*z) / ((x - 10)*y*y)
286      alg.MaxComplexity = 5;
287      alg.Problem.ProblemData = new KeijzerFunctionFive().GenerateRegressionData();
288
289      alg.Start();
290
291      TerminalSymbol constSymbol = alg.Grammar.Const;
292      TerminalSymbol xSymbol = alg.Grammar.VarTerminals.First(s => s.StringRepresentation == "X");
293      TerminalSymbol ySymbol = alg.Grammar.VarTerminals.First(s => s.StringRepresentation == "Y");
294      TerminalSymbol zSymbol = alg.Grammar.VarTerminals.First(s => s.StringRepresentation == "Z");
295      TerminalSymbol mulSymbol = alg.Grammar.Multiplication;
296      TerminalSymbol addSymbol = alg.Grammar.Addition;
297      TerminalSymbol invSymbol = alg.Grammar.Inv;
298
299      // 30 * x * z * 1/(x*y*y - 10*y*y)
300      // --> x z * c *     x y * y * c *  y y * c * + c + inv c +
301      SymbolString targetSolution = new SymbolString(new[] {
302        xSymbol, zSymbol, mulSymbol, constSymbol, mulSymbol,
303        xSymbol, ySymbol, mulSymbol, ySymbol, mulSymbol, constSymbol, mulSymbol,
304        ySymbol, ySymbol, mulSymbol, constSymbol, mulSymbol, addSymbol, constSymbol, addSymbol, invSymbol,
305        constSymbol, addSymbol
306      });
307
308      int targetSolutionHash = alg.Grammar.Hasher.CalcHashCode(targetSolution);
309      int actualSolutionHash = alg.Grammar.Hasher.CalcHashCode(alg.BestTrainingSentence);
310
311      Assert.IsTrue(alg.DistinctSentencesComplexity.ContainsKey(targetSolutionHash), "Actual solution was not generated!");
312
313      Assert.AreEqual(targetSolutionHash, actualSolutionHash, "Actual solution was not recognized as best one.");
314
315      // Evaluate
316      EvaluateGrammarEnumeration();
317    }
318
319
320    [TestMethod]
321    [TestProperty("Goal", "structure search + const op")]
322    public void Constants_Keijzer12() {
323      // x*x*x*x - x*x*x + y*y/2 - y
324      alg.MaxComplexity = 10;
325      alg.Problem.ProblemData = new KeijzerFunctionTwelve().GenerateRegressionData();
326
327      alg.Start();
328
329      TerminalSymbol constSymbol = alg.Grammar.Const;
330      TerminalSymbol xSymbol = alg.Grammar.VarTerminals.First();
331      TerminalSymbol ySymbol = alg.Grammar.VarTerminals.Last();
332      TerminalSymbol mulSymbol = alg.Grammar.Multiplication;
333      TerminalSymbol addSymbol = alg.Grammar.Addition;
334
335      SymbolString targetSolution = new SymbolString(new[] {
336        xSymbol, xSymbol, mulSymbol, xSymbol, mulSymbol, xSymbol, mulSymbol, constSymbol, mulSymbol,
337        xSymbol, xSymbol, mulSymbol, xSymbol, mulSymbol, constSymbol, mulSymbol, addSymbol,
338        ySymbol, ySymbol, mulSymbol, constSymbol, mulSymbol, addSymbol,
339        ySymbol, constSymbol, mulSymbol, addSymbol,
340        constSymbol, addSymbol
341      });
342
343      var x = alg.Grammar.ToInfixString(targetSolution);
344
345      int targetSolutionHash = alg.Grammar.Hasher.CalcHashCode(targetSolution);
346      int actualSolutionHash = alg.Grammar.Hasher.CalcHashCode(alg.BestTrainingSentence);
347
348      Assert.IsTrue(alg.DistinctSentencesComplexity.ContainsKey(targetSolutionHash), "Actual solution was not generated!");
349      Assert.AreEqual(targetSolutionHash, actualSolutionHash, "Actual solution was not recognized as best one.");
350
351      // Evaluate
352      EvaluateGrammarEnumeration();
353    }
354
355    [TestMethod]
356    [TestProperty("Goal", "structure search + const op")]
357    public void Constants_Keijzer14() {
358      // 8 / (2 + x*x + y*y
359      alg.MaxComplexity = 4;
360      alg.Problem.ProblemData = new KeijzerFunctionFourteen().GenerateRegressionData();
361
362      alg.Start();
363     
364      TerminalSymbol constSymbol = alg.Grammar.Const;
365      TerminalSymbol xSymbol = alg.Grammar.VarTerminals.First();
366      TerminalSymbol ySymbol = alg.Grammar.VarTerminals.Last();
367      TerminalSymbol mulSymbol = alg.Grammar.Multiplication;
368      TerminalSymbol addSymbol = alg.Grammar.Addition;
369      TerminalSymbol divSymbol = alg.Grammar.Inv;
370
371     
372      // x x mul c mul y y mul c mul add const add inv const mul const add
373      SymbolString targetSolution = new SymbolString(new[] {
374        xSymbol, xSymbol, mulSymbol, constSymbol, mulSymbol, 
375        ySymbol, ySymbol, mulSymbol, constSymbol, mulSymbol, addSymbol,
376        constSymbol, addSymbol, divSymbol,
377        constSymbol, mulSymbol,
378        constSymbol, addSymbol
379      });
380
381      int targetSolutionHash = alg.Grammar.Hasher.CalcHashCode(targetSolution);
382      int actualSolutionHash = alg.Grammar.Hasher.CalcHashCode(alg.BestTrainingSentence);
383
384      Assert.IsTrue(alg.DistinctSentencesComplexity.ContainsKey(targetSolutionHash), "Actual solution was not generated!");
385      Assert.AreEqual(targetSolutionHash, actualSolutionHash, "Actual solution was not recognized as best one.");
386
387      // Evaluate
388      EvaluateGrammarEnumeration();
389    }
390
391
392    [TestMethod]
393    [TestProperty("Goal", "structure search + const op")]
394    public void Constants_Keijzer15() {
395      // x*x*x / 5 + y*y*y / 2 - y - x
396      alg.MaxComplexity = 8;
397      alg.Problem.ProblemData = new KeijzerFunctionFifteen().GenerateRegressionData();
398
399      alg.Start();
400
401      TerminalSymbol constSymbol = alg.Grammar.Const;
402      TerminalSymbol xSymbol = alg.Grammar.VarTerminals.First();
403      TerminalSymbol ySymbol = alg.Grammar.VarTerminals.Last();
404      TerminalSymbol mulSymbol = alg.Grammar.Multiplication;
405      TerminalSymbol addSymbol = alg.Grammar.Addition;
406
407      // x x * x * const * y y * y * const * + y const * + x const * const +
408      SymbolString targetSolution = new SymbolString(new[] {
409        xSymbol, xSymbol, mulSymbol, xSymbol, mulSymbol, constSymbol, mulSymbol,
410        ySymbol, ySymbol, mulSymbol, ySymbol, mulSymbol, constSymbol, mulSymbol, addSymbol,
411        ySymbol, constSymbol, mulSymbol, addSymbol,
412        xSymbol, constSymbol, mulSymbol, addSymbol,
413        constSymbol, addSymbol
414      });
415
416      int targetSolutionHash = alg.Grammar.Hasher.CalcHashCode(targetSolution);
417      int actualSolutionHash = alg.Grammar.Hasher.CalcHashCode(alg.BestTrainingSentence);
418
419      Assert.IsTrue(alg.DistinctSentencesComplexity.ContainsKey(targetSolutionHash), "Actual solution was not generated!");
420      Assert.AreEqual(targetSolutionHash, actualSolutionHash, "Actual solution was not recognized as best one.");
421
422      // Evaluate
423      EvaluateGrammarEnumeration();
424    }
425
426
427
428
429#if false
430
431    [TestMethod]
432    [TestProperty("Goal", "structure search")]
433    public void MctsSymbReg_NoConstants_15() {
434      alg.MaxTreeSize = 5;
435      var provider = new HeuristicLab.Problems.Instances.DataAnalysis.KeijzerInstanceProvider(Seed);
436      var regProblem = provider.LoadData(provider.GetDataDescriptors().Single(x => x.Name.Contains("15")));
437      alg.Problem.ProblemData = regProblem;
438
439      alg.Start();
440      EvaluateGrammarEnumeration();
441    }
442
443
444    [TestMethod]
445    [TestCategory("Algorithms.DataAnalysis")]
446    [TestProperty("Time", "short")]
447    public void MctsSymbReg_NoConstants_Nguyen7() {
448      // log(x + 1) + log(x² + 1)
449      var provider = new HeuristicLab.Problems.Instances.DataAnalysis.NguyenInstanceProvider(Seed);
450      var regProblem = provider.LoadData(provider.GetDataDescriptors().Single(x => x.Name.Contains("F7 ")));
451      TestGrammarEnumeration(regProblem);
452    }
453
454    [TestMethod]
455    [TestCategory("Algorithms.DataAnalysis")]
456    [TestProperty("Time", "short")]
457    public void MctsSymbReg_NoConstants_Poly10_Part1() {
458      var provider = new HeuristicLab.Problems.Instances.DataAnalysis.VariousInstanceProvider(Seed);
459      var regProblem = provider.LoadData(provider.GetDataDescriptors().Single(x => x.Name.Contains("Poly-10")));
460
461      //  Y = X1*X2 + X3*X4 + X5*X6 + X1*X7*X9 + X3*X6*X10
462      //  Y' = X1*X2 + X3*X4 + X5*X6
463      // simplify problem by changing target
464      var ds = ((Dataset)regProblem.Dataset).ToModifiable();
465      var ys = ds.GetDoubleValues("Y").ToArray();
466      var x1 = ds.GetDoubleValues("X1").ToArray();
467      var x2 = ds.GetDoubleValues("X2").ToArray();
468      var x3 = ds.GetDoubleValues("X3").ToArray();
469      var x4 = ds.GetDoubleValues("X4").ToArray();
470      var x5 = ds.GetDoubleValues("X5").ToArray();
471      var x6 = ds.GetDoubleValues("X6").ToArray();
472      var x7 = ds.GetDoubleValues("X7").ToArray();
473      var x8 = ds.GetDoubleValues("X8").ToArray();
474      var x9 = ds.GetDoubleValues("X9").ToArray();
475      var x10 = ds.GetDoubleValues("X10").ToArray();
476      for (int i = 0; i < ys.Length; i++) {
477        ys[i] -= x1[i] * x7[i] * x9[i];
478        ys[i] -= x3[i] * x6[i] * x10[i];
479      }
480      ds.ReplaceVariable("Y", ys.ToList());
481
482      var modifiedProblemData = new RegressionProblemData(ds, regProblem.AllowedInputVariables, regProblem.TargetVariable);
483
484      TestGrammarEnumeration(modifiedProblemData);
485    }
486
487    [TestMethod]
488    [TestCategory("Algorithms.DataAnalysis")]
489    [TestProperty("Time", "short")]
490    public void MctsSymbReg_NoConstants_Poly10_Part2() {
491      var provider = new HeuristicLab.Problems.Instances.DataAnalysis.VariousInstanceProvider(Seed);
492      var regProblem = provider.LoadData(provider.GetDataDescriptors().Single(x => x.Name.Contains("Poly-10")));
493
494      //  Y = X1*X2 + X3*X4 + X5*X6 + X1*X7*X9 + X3*X6*X10
495      //  Y' = X1*X7*X9 + X3*X6*X10
496      // simplify problem by changing target
497      var ds = ((Dataset)regProblem.Dataset).ToModifiable();
498      var ys = ds.GetDoubleValues("Y").ToArray();
499      var x1 = ds.GetDoubleValues("X1").ToArray();
500      var x2 = ds.GetDoubleValues("X2").ToArray();                                           
501      var x3 = ds.GetDoubleValues("X3").ToArray();
502      var x4 = ds.GetDoubleValues("X4").ToArray();
503      var x5 = ds.GetDoubleValues("X5").ToArray();
504      var x6 = ds.GetDoubleValues("X6").ToArray();
505      var x7 = ds.GetDoubleValues("X7").ToArray();
506      var x8 = ds.GetDoubleValues("X8").ToArray();
507      var x9 = ds.GetDoubleValues("X9").ToArray();
508      var x10 = ds.GetDoubleValues("X10").ToArray();
509      for (int i = 0; i < ys.Length; i++) {
510        ys[i] -= x1[i] * x2[i];
511        ys[i] -= x3[i] * x4[i];
512        ys[i] -= x5[i] * x6[i];
513      }
514      ds.ReplaceVariable("Y", ys.ToList());
515
516      var modifiedProblemData = new RegressionProblemData(ds, regProblem.AllowedInputVariables, regProblem.TargetVariable);
517
518      TestGrammarEnumeration(modifiedProblemData);
519    }
520
521    [TestMethod]
522    [TestCategory("Algorithms.DataAnalysis")]
523    [TestProperty("Time", "short")]
524    public void MctsSymbReg_NoConstants_Poly10_Part3() {
525      var provider = new HeuristicLab.Problems.Instances.DataAnalysis.VariousInstanceProvider(Seed);
526      var regProblem = provider.LoadData(provider.GetDataDescriptors().Single(x => x.Name.Contains("Poly-10")));
527
528      //  Y = X1*X2 + X3*X4 + X5*X6 + X1*X7*X9 + X3*X6*X10
529      //  Y' = X1*X2 + X1*X7*X9
530      // simplify problem by changing target
531      var ds = ((Dataset)regProblem.Dataset).ToModifiable();
532      var ys = ds.GetDoubleValues("Y").ToArray();
533      var x1 = ds.GetDoubleValues("X1").ToArray();
534      var x2 = ds.GetDoubleValues("X2").ToArray();
535      var x3 = ds.GetDoubleValues("X3").ToArray();
536      var x4 = ds.GetDoubleValues("X4").ToArray();
537      var x5 = ds.GetDoubleValues("X5").ToArray();
538      var x6 = ds.GetDoubleValues("X6").ToArray();
539      var x7 = ds.GetDoubleValues("X7").ToArray();
540      var x8 = ds.GetDoubleValues("X8").ToArray();
541      var x9 = ds.GetDoubleValues("X9").ToArray();
542      var x10 = ds.GetDoubleValues("X10").ToArray();
543      for (int i = 0; i < ys.Length; i++) {
544        ys[i] -= x3[i] * x4[i];
545        ys[i] -= x5[i] * x6[i];
546        ys[i] -= x3[i] * x6[i] * x10[i];
547      }
548      ds.ReplaceVariable("Y", ys.ToList());
549
550      var modifiedProblemData = new RegressionProblemData(ds, regProblem.AllowedInputVariables, regProblem.TargetVariable);
551
552      TestGrammarEnumeration(modifiedProblemData);
553    }
554
555    [TestMethod]
556    [TestCategory("Algorithms.DataAnalysis")]
557    [TestProperty("Time", "short")]
558    public void MctsSymbReg_NoConstants_Poly10_Part4() {
559      var provider = new HeuristicLab.Problems.Instances.DataAnalysis.VariousInstanceProvider(Seed);
560      var regProblem = provider.LoadData(provider.GetDataDescriptors().Single(x => x.Name.Contains("Poly-10")));
561
562      //  Y = X1*X2 + X3*X4 + X5*X6 + X1*X7*X9 + X3*X6*X10
563      //  Y' = X3*X4 + X5*X6 + X3*X6*X10
564      // simplify problem by changing target
565      var ds = ((Dataset)regProblem.Dataset).ToModifiable();
566      var ys = ds.GetDoubleValues("Y").ToArray();
567      var x1 = ds.GetDoubleValues("X1").ToArray();
568      var x2 = ds.GetDoubleValues("X2").ToArray();
569      var x3 = ds.GetDoubleValues("X3").ToArray();
570      var x4 = ds.GetDoubleValues("X4").ToArray();
571      var x5 = ds.GetDoubleValues("X5").ToArray();
572      var x6 = ds.GetDoubleValues("X6").ToArray();
573      var x7 = ds.GetDoubleValues("X7").ToArray();
574      var x8 = ds.GetDoubleValues("X8").ToArray();
575      var x9 = ds.GetDoubleValues("X9").ToArray();
576      var x10 = ds.GetDoubleValues("X10").ToArray();
577      for (int i = 0; i < ys.Length; i++) {
578        ys[i] -= x1[i] * x2[i];
579        ys[i] -= x1[i] * x7[i] * x9[i];
580      }
581      ds.ReplaceVariable("Y", ys.ToList());
582      var modifiedProblemData = new RegressionProblemData(ds, regProblem.AllowedInputVariables, regProblem.TargetVariable);
583
584
585      TestGrammarEnumeration(modifiedProblemData);
586    }
587
588    [TestMethod]
589    [TestCategory("Algorithms.DataAnalysis")]
590    [TestProperty("Time", "short")]
591    public void MctsSymbReg_NoConstants_Poly10_Part5() {
592      var provider = new HeuristicLab.Problems.Instances.DataAnalysis.VariousInstanceProvider(Seed);
593      var regProblem = provider.LoadData(provider.GetDataDescriptors().Single(x => x.Name.Contains("Poly-10")));
594
595      //  Y = X1*X2 + X3*X4 + X5*X6 + X1*X7*X9 + X3*X6*X10
596      //  Y' = X1*X2 + X3*X4 + X5*X6 + X1*X7*X9
597      // simplify problem by changing target
598      var ds = ((Dataset)regProblem.Dataset).ToModifiable();
599      var ys = ds.GetDoubleValues("Y").ToArray();
600      var x1 = ds.GetDoubleValues("X1").ToArray();
601      var x2 = ds.GetDoubleValues("X2").ToArray();
602      var x3 = ds.GetDoubleValues("X3").ToArray();
603      var x4 = ds.GetDoubleValues("X4").ToArray();
604      var x5 = ds.GetDoubleValues("X5").ToArray();
605      var x6 = ds.GetDoubleValues("X6").ToArray();
606      var x7 = ds.GetDoubleValues("X7").ToArray();
607      var x8 = ds.GetDoubleValues("X8").ToArray();
608      var x9 = ds.GetDoubleValues("X9").ToArray();
609      var x10 = ds.GetDoubleValues("X10").ToArray();
610      for (int i = 0; i < ys.Length; i++) {
611        ys[i] -= x3[i] * x6[i] * x10[i];
612      }
613      ds.ReplaceVariable("Y", ys.ToList());
614      var modifiedProblemData = new RegressionProblemData(ds, regProblem.AllowedInputVariables, regProblem.TargetVariable);
615
616
617      TestGrammarEnumeration(modifiedProblemData);
618    }
619
620    [TestMethod]
621    [TestCategory("Algorithms.DataAnalysis")]
622    [TestProperty("Time", "short")]
623    public void MctsSymbReg_NoConstants_Poly10_Part6() {
624      var provider = new HeuristicLab.Problems.Instances.DataAnalysis.VariousInstanceProvider(Seed);
625      var regProblem = provider.LoadData(provider.GetDataDescriptors().Single(x => x.Name.Contains("Poly-10")));
626
627      //  Y = X1*X2 + X3*X4 + X5*X6 + X1*X7*X9 + X3*X6*X10
628      //  Y' = X1*X2 + X3*X4 + X5*X6 + X3*X6*X10
629      // simplify problem by changing target
630      var ds = ((Dataset)regProblem.Dataset).ToModifiable();
631      var ys = ds.GetDoubleValues("Y").ToArray();
632      var x1 = ds.GetDoubleValues("X1").ToArray();
633      var x2 = ds.GetDoubleValues("X2").ToArray();
634      var x3 = ds.GetDoubleValues("X3").ToArray();
635      var x4 = ds.GetDoubleValues("X4").ToArray();
636      var x5 = ds.GetDoubleValues("X5").ToArray();
637      var x6 = ds.GetDoubleValues("X6").ToArray();
638      var x7 = ds.GetDoubleValues("X7").ToArray();
639      var x8 = ds.GetDoubleValues("X8").ToArray();
640      var x9 = ds.GetDoubleValues("X9").ToArray();
641      var x10 = ds.GetDoubleValues("X10").ToArray();
642      for (int i = 0; i < ys.Length; i++) {
643        ys[i] -= x1[i] * x7[i] * x9[i];
644      }
645      ds.ReplaceVariable("Y", ys.ToList());
646      var modifiedProblemData = new RegressionProblemData(ds, regProblem.AllowedInputVariables, regProblem.TargetVariable);
647
648      TestGrammarEnumeration(modifiedProblemData);
649    }
650
651
652    [TestMethod]
653    [TestCategory("Algorithms.DataAnalysis")]
654    [TestProperty("Time", "long")]
655    public void MctsSymbReg_NoConstants_Poly10_250rows() {
656      var provider = new HeuristicLab.Problems.Instances.DataAnalysis.VariousInstanceProvider(Seed);
657      var regProblem = provider.LoadData(provider.GetDataDescriptors().Single(x => x.Name.Contains("Poly-10")));
658      regProblem.TrainingPartition.Start = 0;
659      regProblem.TrainingPartition.End = regProblem.Dataset.Rows;
660      regProblem.TestPartition.Start = 0;
661      regProblem.TestPartition.End = 2;
662      TestGrammarEnumeration(regProblem);
663    }
664
665    [TestMethod]
666    [TestCategory("Algorithms.DataAnalysis")]
667    [TestProperty("Time", "long")]
668    public void MctsSymbReg_NoConstants_Poly10_10000rows() {
669      // as poly-10 but more rows
670      var x1 = Enumerable.Range(0, 10000).Select(_ => rand.NextDouble()).ToList();
671      var x2 = Enumerable.Range(0, 10000).Select(_ => rand.NextDouble()).ToList();
672      var x3 = Enumerable.Range(0, 10000).Select(_ => rand.NextDouble()).ToList();
673      var x4 = Enumerable.Range(0, 10000).Select(_ => rand.NextDouble()).ToList();
674      var x5 = Enumerable.Range(0, 10000).Select(_ => rand.NextDouble()).ToList();
675      var x6 = Enumerable.Range(0, 10000).Select(_ => rand.NextDouble()).ToList();
676      var x7 = Enumerable.Range(0, 10000).Select(_ => rand.NextDouble()).ToList();
677      var x8 = Enumerable.Range(0, 10000).Select(_ => rand.NextDouble()).ToList();
678      var x9 = Enumerable.Range(0, 10000).Select(_ => rand.NextDouble()).ToList();
679      var x10 = Enumerable.Range(0, 10000).Select(_ => rand.NextDouble()).ToList();
680      var ys = new List<double>();
681      for (int i = 0; i < x1.Count; i++) {
682        ys.Add(x1[i] * x2[i] + x3[i] * x4[i] + x5[i] * x6[i] + x1[i] * x7[i] * x9[i] + x3[i] * x6[i] * x10[i]);
683      }
684
685      var ds = new Dataset(new string[] { "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "y" },
686        new[] { x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, ys });
687
688
689      var problemData = new RegressionProblemData(ds, new string[] { "a", "b", "c", "d", "e", "f", "g", "h", "i", "j" }, "y");
690
691      problemData.TrainingPartition.Start = 0;
692      problemData.TrainingPartition.End = problemData.Dataset.Rows;
693      problemData.TestPartition.Start = 0;
694      problemData.TestPartition.End = 2; // must not be empty
695
696
697      TestGrammarEnumeration(problemData);
698    }
699
700    [TestMethod]
701    [TestCategory("Algorithms.DataAnalysis")]
702    [TestProperty("Time", "short")]
703    public void MctsSymbReg_NoConstants_TwoVars() {
704
705      // y = x1 + x2 + x1*x2 + x1*x2*x2 + x1*x1*x2
706      var x1 = Enumerable.Range(0, 100).Select(_ => rand.NextDouble()).ToList();
707      var x2 = Enumerable.Range(0, 100).Select(_ => rand.NextDouble()).ToList();
708      var ys = x1.Zip(x2, (x1i, x2i) => x1i + x2i + x1i * x2i + x1i * x2i * x2i + x1i * x1i * x2i).ToList();
709
710      var ds = new Dataset(new string[] { "a", "b", "y" }, new[] { x1, x2, ys });
711      var problemData = new RegressionProblemData(ds, new string[] { "a", "b" }, "y");
712
713      TestGrammarEnumeration(problemData);
714    }
715
716    [TestMethod]
717    [TestCategory("Algorithms.DataAnalysis")]
718    [TestProperty("Time", "short")]
719    public void MctsSymbReg_NoConstants_Misleading() {
720
721      // y = a + baaaaa (the effect of the second term should be very small)
722      // the alg will quickly find that a has big effect and will search below a
723      // since we prevent a + a... the algorithm must find the correct expression via a + b...
724      // however b has a small effect so the branch might not be identified as relevant
725      var @as = Enumerable.Range(0, 100).Select(_ => rand.NextDouble()).ToList();
726      var bs = Enumerable.Range(0, 100).Select(_ => rand.NextDouble()).ToList();
727      var cs = Enumerable.Range(0, 100).Select(_ => rand.NextDouble() * 1.0e-3).ToList();
728      var ds = Enumerable.Range(0, 100).Select(_ => rand.NextDouble()).ToList();
729      var es = Enumerable.Range(0, 100).Select(_ => rand.NextDouble()).ToList();
730      var ys = new double[@as.Count];
731      for (int i = 0; i < ys.Length; i++)
732        ys[i] = @as[i] + bs[i] + @as[i] * bs[i] * cs[i];
733
734      var dataset = new Dataset(new string[] { "a", "b", "c", "d", "e", "y" }, new[] { @as, bs, cs, ds, es, ys.ToList() });
735
736      var problemData = new RegressionProblemData(dataset, new string[] { "a", "b", "c", "d", "e" }, "y");
737
738      TestGrammarEnumeration(problemData);
739    }
740
741    [TestMethod]
742    [TestCategory("Algorithms.DataAnalysis")]
743    [TestProperty("Time", "short")]
744    public void MctsSymbRegKeijzer7() {
745      // ln(x)
746      var provider = new HeuristicLab.Problems.Instances.DataAnalysis.KeijzerInstanceProvider(Seed);
747      var regProblem = provider.LoadData(provider.GetDataDescriptors().Single(x => x.Name.Contains("Keijzer 7 f(")));
748      // some Keijzer problem instances have very large test partitions (here we are not concerened about test performance)
749      if (regProblem.TestPartition.End - regProblem.TestPartition.Start > 1000) regProblem.TestPartition.End = regProblem.TestPartition.Start + 1000;
750      TestGrammarEnumeration(regProblem);
751    }
752
753   
754    [TestMethod]
755    [TestCategory("Algorithms.DataAnalysis")]
756    [TestProperty("Time", "short")]
757    public void MctsSymbRegBenchmarkNguyen5() {
758      // sin(x²)cos(x) - 1
759      var provider = new HeuristicLab.Problems.Instances.DataAnalysis.NguyenInstanceProvider();
760      var regProblem = provider.LoadData(provider.GetDataDescriptors().Single(x => x.Name.Contains("F5 ")));
761      TestGrammarEnumeration(regProblem);
762    }
763
764    [TestMethod]
765    [TestCategory("Algorithms.DataAnalysis")]
766    [TestProperty("Time", "short")]
767    public void MctsSymbRegBenchmarkNguyen6() {
768      // sin(x) + sin(x + x²)
769      var provider = new HeuristicLab.Problems.Instances.DataAnalysis.NguyenInstanceProvider();
770      var regProblem = provider.LoadData(provider.GetDataDescriptors().Single(x => x.Name.Contains("F6 ")));
771      TestGrammarEnumeration(regProblem);
772    }
773   
774    [TestMethod]
775    [TestCategory("Algorithms.DataAnalysis")]
776    [TestProperty("Time", "short")]
777    public void MctsSymbRegBenchmarkNguyen7() {
778      //  log(x + 1) + log(x² + 1)
779      var provider = new HeuristicLab.Problems.Instances.DataAnalysis.NguyenInstanceProvider(Seed);
780      var regProblem = provider.LoadData(provider.GetDataDescriptors().Single(x => x.Name.Contains("F7 ")));
781      TestGrammarEnumeration(regProblem);
782    }
783    [TestMethod]
784    [TestCategory("Algorithms.DataAnalysis")]
785    [TestProperty("Time", "short")]
786    public void MctsSymbRegBenchmarkNguyen8() {
787      // Sqrt(x)
788      // = x ^ 0.5
789      // = exp(0.5 * log(x))
790      var provider = new HeuristicLab.Problems.Instances.DataAnalysis.NguyenInstanceProvider(Seed);
791      var regProblem = provider.LoadData(provider.GetDataDescriptors().Single(x => x.Name.Contains("F8 ")));
792      TestGrammarEnumeration(regProblem);
793    }
794   
795    // [TestMethod]
796    [TestCategory("Algorithms.DataAnalysis")]
797    [TestProperty("Time", "short")]
798    public void MctsSymbRegBenchmarkNguyen9() {
799      //  sin(x) + sin(y²)
800      var provider = new HeuristicLab.Problems.Instances.DataAnalysis.NguyenInstanceProvider();
801      var regProblem = provider.LoadData(provider.GetDataDescriptors().Single(x => x.Name.Contains("F9 ")));
802      TestGrammarEnumeration(regProblem);
803    }
804
805    // [TestMethod]
806    [TestCategory("Algorithms.DataAnalysis")]
807    [TestProperty("Time", "short")]
808    public void MctsSymbRegBenchmarkNguyen10() {
809      // 2sin(x)cos(y)
810      var provider = new HeuristicLab.Problems.Instances.DataAnalysis.NguyenInstanceProvider();
811      var regProblem = provider.LoadData(provider.GetDataDescriptors().Single(x => x.Name.Contains("F10 ")));
812      TestGrammarEnumeration(regProblem);
813    }
814   
815    [TestMethod]
816    [TestCategory("Algorithms.DataAnalysis")]
817    [TestProperty("Time", "short")]
818    public void MctsSymbRegBenchmarkNguyen11() {
819      // x ^ y  , x > 0, y > 0   
820      // = exp(y * log(x))
821      var provider = new HeuristicLab.Problems.Instances.DataAnalysis.NguyenInstanceProvider(Seed);
822      var regProblem = provider.LoadData(provider.GetDataDescriptors().Single(x => x.Name.Contains("F11 ")));
823      TestGrammarEnumeration(regProblem);
824    }
825    [TestMethod]
826    [TestCategory("Algorithms.DataAnalysis")]
827    [TestProperty("Time", "short")]
828    public void MctsSymbRegBenchmarkNguyen12() {
829      // x^4 - x³ + y²/2 - y
830      var provider = new HeuristicLab.Problems.Instances.DataAnalysis.NguyenInstanceProvider(Seed);
831      var regProblem = provider.LoadData(provider.GetDataDescriptors().Single(x => x.Name.Contains("F12 ")));
832      TestGrammarEnumeration(regProblem);
833    }
834
835    [TestMethod]
836    [TestCategory("Algorithms.DataAnalysis")]
837    [TestProperty("Time", "long")]
838    public void MctsSymbRegBenchmarkKeijzer5() {
839      // (30 * x * z) / ((x - 10)  * y²)
840      // = 30 x z / (xy² - y²)
841      var provider = new HeuristicLab.Problems.Instances.DataAnalysis.KeijzerInstanceProvider(Seed);
842      var regProblem = provider.LoadData(provider.GetDataDescriptors().Single(x => x.Name.Contains("Keijzer 5 f(")));
843      // some Keijzer problem instances have very large test partitions (here we are not concerened about test performance)
844      if (regProblem.TestPartition.End - regProblem.TestPartition.Start > 1000) regProblem.TestPartition.End = regProblem.TestPartition.Start + 1000;
845      TestGrammarEnumeration(regProblem);
846    }
847
848    [TestMethod]
849    [TestCategory("Algorithms.DataAnalysis")]
850    [TestProperty("Time", "short")]
851    public void MctsSymbRegBenchmarkKeijzer6() {
852      // Keijzer 6 f(x) = Sum(1 / i) From 1 to X  , x \in [0..120]
853      // we can only approximate this
854      var provider = new HeuristicLab.Problems.Instances.DataAnalysis.KeijzerInstanceProvider(Seed);
855      var regProblem = provider.LoadData(provider.GetDataDescriptors().Single(x => x.Name.Contains("Keijzer 6 f(")));
856      // some Keijzer problem instances have very large test partitions (here we are not concerened about test performance)
857      if (regProblem.TestPartition.End - regProblem.TestPartition.Start > 1000) regProblem.TestPartition.End = regProblem.TestPartition.Start + 1000;
858      TestGrammarEnumeration(regProblem);
859    }
860
861    [TestMethod]
862    [TestCategory("Algorithms.DataAnalysis")]
863    [TestProperty("Time", "short")]
864    public void MctsSymbRegBenchmarkKeijzer8() {
865      // sqrt(x)
866      var provider = new HeuristicLab.Problems.Instances.DataAnalysis.KeijzerInstanceProvider(Seed);
867      var regProblem = provider.LoadData(provider.GetDataDescriptors().Single(x => x.Name.Contains("Keijzer 8 f(")));
868      // some Keijzer problem instances have very large test partitions (here we are not concerened about test performance)
869      if (regProblem.TestPartition.End - regProblem.TestPartition.Start > 1000) regProblem.TestPartition.End = regProblem.TestPartition.Start + 1000;
870      TestGrammarEnumeration(regProblem);
871    }
872
873    [TestMethod]
874    [TestCategory("Algorithms.DataAnalysis")]
875    [TestProperty("Time", "short")]
876    public void MctsSymbRegBenchmarkKeijzer9() {
877      // arcsinh(x)  i.e. ln(x + sqrt(x² + 1))
878      var provider = new HeuristicLab.Problems.Instances.DataAnalysis.KeijzerInstanceProvider(Seed);
879      var regProblem = provider.LoadData(provider.GetDataDescriptors().Single(x => x.Name.Contains("Keijzer 9 f(")));
880      // some Keijzer problem instances have very large test partitions (here we are not concerened about test performance)
881      if (regProblem.TestPartition.End - regProblem.TestPartition.Start > 1000) regProblem.TestPartition.End = regProblem.TestPartition.Start + 1000;
882      TestGrammarEnumeration(regProblem);
883    }
884
885    [TestMethod]
886    [TestCategory("Algorithms.DataAnalysis")]
887    [TestProperty("Time", "short")]
888    public void MctsSymbRegBenchmarkKeijzer11() {
889      // xy + sin( (x-1) (y-1) )
890      var provider = new HeuristicLab.Problems.Instances.DataAnalysis.KeijzerInstanceProvider();
891      var regProblem = provider.LoadData(provider.GetDataDescriptors().Single(x => x.Name.Contains("Keijzer 11 f(")));
892      // some Keijzer problem instances have very large test partitions (here we are not concerened about test performance)
893      if (regProblem.TestPartition.End - regProblem.TestPartition.Start > 1000) regProblem.TestPartition.End = regProblem.TestPartition.Start + 1000;
894      TestGrammarEnumeration(regProblem);
895    }
896
897    [TestMethod]
898    [TestCategory("Algorithms.DataAnalysis")]
899    [TestProperty("Time", "short")]
900    public void MctsSymbRegBenchmarkKeijzer12() {
901      // x^4 - x³ + y² / 2 - y,  same as Nguyen 12             
902      var provider = new HeuristicLab.Problems.Instances.DataAnalysis.KeijzerInstanceProvider(Seed);
903      var regProblem = provider.LoadData(provider.GetDataDescriptors().Single(x => x.Name.Contains("Keijzer 12 f(")));
904      // some Keijzer problem instances have very large test partitions (here we are not concerened about test performance)
905      if (regProblem.TestPartition.End - regProblem.TestPartition.Start > 1000) regProblem.TestPartition.End = regProblem.TestPartition.Start + 1000;
906      TestGrammarEnumeration(regProblem);
907    }
908
909    [TestMethod]
910    [TestCategory("Algorithms.DataAnalysis")]
911    [TestProperty("Time", "short")]
912    public void MctsSymbRegBenchmarkKeijzer14() {
913      // 8 / (2 + x² + y²)
914      var provider = new HeuristicLab.Problems.Instances.DataAnalysis.KeijzerInstanceProvider(Seed);
915      var regProblem = provider.LoadData(provider.GetDataDescriptors().Single(x => x.Name.Contains("Keijzer 14 f(")));
916      // some Keijzer problem instances have very large test partitions (here we are not concerened about test performance)
917      if (regProblem.TestPartition.End - regProblem.TestPartition.Start > 1000) regProblem.TestPartition.End = regProblem.TestPartition.Start + 1000;
918      TestGrammarEnumeration(regProblem);
919    }
920
921    [TestMethod]
922    [TestCategory("Algorithms.DataAnalysis")]
923    [TestProperty("Time", "short")]
924    public void MctsSymbRegBenchmarkKeijzer15() {
925      // x³ / 5 + y³ / 2 - y - x
926      var provider = new HeuristicLab.Problems.Instances.DataAnalysis.KeijzerInstanceProvider(Seed);
927      var regProblem = provider.LoadData(provider.GetDataDescriptors().Single(x => x.Name.Contains("Keijzer 15 f(")));
928      // some Keijzer problem instances have very large test partitions (here we are not concerened about test performance)
929      if (regProblem.TestPartition.End - regProblem.TestPartition.Start > 1000) regProblem.TestPartition.End = regProblem.TestPartition.Start + 1000;
930      TestGrammarEnumeration(regProblem);
931    }
932#endif
933  }
934}
Note: See TracBrowser for help on using the repository browser.