Changeset 11895 for branches/HeuristicLab.Problems.GrammaticalOptimization/Test/TestSymbRegInstances.cs
- Timestamp:
- 02/05/15 07:03:15 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Problems.GrammaticalOptimization/Test/TestSymbRegInstances.cs
r11832 r11895 1 1 using System; 2 2 using System.Linq; 3 using HeuristicLab.Algorithms.GeneticProgramming; 3 4 using HeuristicLab.Algorithms.GrammaticalOptimization; 4 5 using HeuristicLab.Problems.GrammaticalOptimization.SymbReg; … … 13 14 14 15 var problem = new SymbolicRegressionProblem(new Random(), "Tower"); 15 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")); 16 24 } 17 25 }
Note: See TracChangeset
for help on using the changeset viewer.