Last change
on this file since 12009 was
11895,
checked in by gkronber, 10 years ago
|
#2283: constant opt, expressioncompiler, autodiff, fixes in GP solvers
|
File size:
1.3 KB
|
Line | |
---|
1 | using System;
|
---|
2 | using System.Linq;
|
---|
3 | using HeuristicLab.Algorithms.GeneticProgramming;
|
---|
4 | using HeuristicLab.Algorithms.GrammaticalOptimization;
|
---|
5 | using HeuristicLab.Problems.GrammaticalOptimization.SymbReg;
|
---|
6 | using Microsoft.VisualStudio.TestTools.UnitTesting;
|
---|
7 |
|
---|
8 | namespace HeuristicLab.Problems.GrammaticalOptimization.Test {
|
---|
9 | // tests for the brige to the HL symb-reg instances
|
---|
10 | [TestClass]
|
---|
11 | public class TestSymbRegInstances {
|
---|
12 | [TestMethod]
|
---|
13 | public void TestGetDataDescriptors() {
|
---|
14 |
|
---|
15 | var problem = new SymbolicRegressionProblem(new Random(), "Tower");
|
---|
16 | double r2;
|
---|
17 | Assert.AreEqual(problem.Evaluate("a*b"), problem.OptimizeConstantsAndEvaluate("a*b"));
|
---|
18 | Assert.AreEqual(problem.OptimizeConstantsAndEvaluate("a*b"), problem.Evaluate("a*b"));
|
---|
19 | Assert.AreEqual(problem.OptimizeConstantsAndEvaluate("0*a*b"), problem.Evaluate("a*b"), 1E-6);
|
---|
20 | Assert.AreEqual(problem.OptimizeConstantsAndEvaluate("0*a*b+1"), problem.Evaluate("a*b"), 1E-6);
|
---|
21 | Assert.IsTrue(problem.OptimizeConstantsAndEvaluate("0*a+b") >= problem.Evaluate("a+b"));
|
---|
22 | Assert.AreEqual(problem.OptimizeConstantsAndEvaluate("0*a+0*b"), problem.Evaluate("a+b"), 1E-6);
|
---|
23 | Assert.IsTrue(problem.OptimizeConstantsAndEvaluate("0*a+1*b") >= problem.Evaluate("a+b"));
|
---|
24 | }
|
---|
25 | }
|
---|
26 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.