Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/31/13 14:47:13 (11 years ago)
Author:
mkommend
Message:

#2021: Integrated the linear interpreter in the trunk and restructed interpreter unit tests.

Location:
trunk/sources/HeuristicLab.Tests
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Tests/HeuristicLab.Problems.DataAnalysis.Symbolic-3.4/SymbolicDataAnalysisExpressionTreeInterpreterTest.cs

    r9785 r9828  
    3030
    3131
    32   [TestClass()]
     32  [TestClass]
    3333  public class SymbolicDataAnalysisExpressionTreeInterpreterTest {
    3434    private const int N = 1000;
    3535    private const int Rows = 1000;
    3636    private const int Columns = 50;
    37     private TestContext testContextInstance;
    38 
    39     /// <summary>
    40     ///Gets or sets the test context which provides
    41     ///information about and functionality for the current test run.
    42     ///</summary>
    43     public TestContext TestContext {
    44       get {
    45         return testContextInstance;
    46       }
    47       set {
    48         testContextInstance = value;
    49       }
    50     }
    51 
    52     [TestMethod]
    53     [TestCategory("Problems.DataAnalysis")]
    54     [TestProperty("Time", "long")]
    55     public void SymbolicDataAnalysisExpressionTreeInterpreterTypeCoherentGrammarPerformanceTest() {
    56       TypeCoherentGrammarPerformanceTest(new SymbolicDataAnalysisExpressionTreeInterpreter(), 12.5e6);
    57     }
    58 
    59     [TestMethod]
    60     [TestCategory("Problems.DataAnalysis")]
    61     [TestProperty("Time", "long")]
    62     public void SymbolicDataAnalysisExpressionTreeInterpreterFullGrammarPerformanceTest() {
    63       FullGrammarPerformanceTest(new SymbolicDataAnalysisExpressionTreeInterpreter(), 12.5e6);
    64     }
    65 
    66     [TestMethod]
    67     [TestCategory("Problems.DataAnalysis")]
    68     [TestProperty("Time", "long")]
    69     public void SymbolicDataAnalysisExpressionTreeInterpreterArithmeticGrammarPerformanceTest() {
    70       ArithmeticGrammarPerformanceTest(new SymbolicDataAnalysisExpressionTreeInterpreter(), 12.5e6);
    71     }
    72 
    73     [TestMethod]
    74     [TestCategory("Problems.DataAnalysis")]
    75     [TestProperty("Time", "long")]
    76     public void SymbolicDataAnalysisExpressionTreeILEmittingInterpreterTypeCoherentGrammarPerformanceTest() {
    77       TypeCoherentGrammarPerformanceTest(new SymbolicDataAnalysisExpressionTreeILEmittingInterpreter(), 7.5e6);
    78     }
    79 
    80     [TestMethod]
    81     [TestCategory("Problems.DataAnalysis")]
    82     [TestProperty("Time", "long")]
    83     public void SymbolicDataAnalysisExpressionTreeILEmittingInterpreterFullGrammarPerformanceTest() {
    84       FullGrammarPerformanceTest(new SymbolicDataAnalysisExpressionTreeILEmittingInterpreter(), 7.5e6);
    85     }
    86 
    87     [TestCategory("Problems.DataAnalysis")]
    88     [TestProperty("Time", "long")]
    89     [TestMethod]
    90     public void SymbolicDataAnalysisExpressionTreeILEmittingInterpreterArithmeticGrammarPerformanceTest() {
    91       ArithmeticGrammarPerformanceTest(new SymbolicDataAnalysisExpressionTreeILEmittingInterpreter(), 7.5e6);
    92     }
    93 
    94     private void TypeCoherentGrammarPerformanceTest(ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, double nodesPerSecThreshold) {
     37
     38    private static Dataset ds = new Dataset(new string[] { "Y", "A", "B" }, new double[,] {
     39        { 1.0, 1.0, 1.0 },
     40        { 2.0, 2.0, 2.0 },
     41        { 3.0, 1.0, 2.0 },
     42        { 4.0, 1.0, 1.0 },
     43        { 5.0, 2.0, 2.0 },
     44        { 6.0, 1.0, 2.0 },
     45        { 7.0, 1.0, 1.0 },
     46        { 8.0, 2.0, 2.0 },
     47        { 9.0, 1.0, 2.0 },
     48        { 10.0, 1.0, 1.0 },
     49        { 11.0, 2.0, 2.0 },
     50        { 12.0, 1.0, 2.0 }
     51      });
     52
     53    [TestMethod]
     54    [TestCategory("Problems.DataAnalysis.Symbolic")]
     55    [TestProperty("Time", "long")]
     56    public void StandardInterpreterTestTypeCoherentGrammarPerformance() {
     57      TestTypeCoherentGrammarPerformance(new SymbolicDataAnalysisExpressionTreeInterpreter(), 12.5e6);
     58    }
     59    [TestMethod]
     60    [TestCategory("Problems.DataAnalysis.Symbolic")]
     61    [TestProperty("Time", "long")]
     62    public void StandardInterpreterTestFullGrammarPerformance() {
     63      TestFullGrammarPerformance(new SymbolicDataAnalysisExpressionTreeInterpreter(), 12.5e6);
     64    }
     65    [TestMethod]
     66    [TestCategory("Problems.DataAnalysis.Symbolic")]
     67    [TestProperty("Time", "long")]
     68    public void StandardInterpreterTestArithmeticGrammarPerformance() {
     69      TestArithmeticGrammarPerformance(new SymbolicDataAnalysisExpressionTreeInterpreter(), 12.5e6);
     70    }
     71
     72
     73    [TestMethod]
     74    [TestCategory("Problems.DataAnalysis.Symbolic")]
     75    [TestProperty("Time", "long")]
     76    public void ILEmittingInterpreterTestTypeCoherentGrammarPerformance() {
     77      TestTypeCoherentGrammarPerformance(new SymbolicDataAnalysisExpressionTreeILEmittingInterpreter(), 7.5e6);
     78    }
     79    [TestMethod]
     80    [TestCategory("Problems.DataAnalysis.Symbolic")]
     81    [TestProperty("Time", "long")]
     82    public void ILEmittingInterpreterTestFullGrammarPerformance() {
     83      TestFullGrammarPerformance(new SymbolicDataAnalysisExpressionTreeILEmittingInterpreter(), 7.5e6);
     84    }
     85    [TestMethod]
     86    [TestCategory("Problems.DataAnalysis.Symbolic")]
     87    [TestProperty("Time", "long")]
     88    public void ILEmittingInterpreterTestArithmeticGrammarPerformance() {
     89      TestArithmeticGrammarPerformance(new SymbolicDataAnalysisExpressionTreeILEmittingInterpreter(), 7.5e6);
     90    }
     91
     92
     93    [TestMethod]
     94    [TestCategory("Problems.DataAnalysis.Symbolic")]
     95    [TestProperty("Time", "long")]
     96    public void LinearInterpreterTestTypeCoherentGrammarPerformance() {
     97      TestTypeCoherentGrammarPerformance(new SymbolicDataAnalysisExpressionTreeLinearInterpreter(), 12.5e6);
     98    }
     99    [TestMethod]
     100    [TestCategory("Problems.DataAnalysis.Symbolic")]
     101    [TestProperty("Time", "long")]
     102    public void LinearInterpreterTestFullGrammarPerformance() {
     103      TestFullGrammarPerformance(new SymbolicDataAnalysisExpressionTreeLinearInterpreter(), 12.5e6);
     104    }
     105    [TestMethod]
     106    [TestCategory("Problems.DataAnalysis.Symbolic")]
     107    [TestProperty("Time", "long")]
     108    public void LinearInterpreterTestArithmeticGrammarPerformance() {
     109      TestArithmeticGrammarPerformance(new SymbolicDataAnalysisExpressionTreeLinearInterpreter(), 12.5e6);
     110    }
     111
     112    private void TestTypeCoherentGrammarPerformance(ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, double nodesPerSecThreshold) {
    95113      var twister = new MersenneTwister(31415);
    96114      var dataset = Util.CreateRandomDataset(twister, Rows, Columns);
     
    110128    }
    111129
    112     private void FullGrammarPerformanceTest(ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, double nodesPerSecThreshold) {
     130    private void TestFullGrammarPerformance(ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, double nodesPerSecThreshold) {
    113131      var twister = new MersenneTwister(31415);
    114132      var dataset = Util.CreateRandomDataset(twister, Rows, Columns);
     
    127145    }
    128146
    129     private void ArithmeticGrammarPerformanceTest(ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, double nodesPerSecThreshold) {
     147    private void TestArithmeticGrammarPerformance(ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, double nodesPerSecThreshold) {
    130148      var twister = new MersenneTwister(31415);
    131149      var dataset = Util.CreateRandomDataset(twister, Rows, Columns);
     
    150168    ///</summary>
    151169    [TestMethod]
    152     [TestCategory("Problems.DataAnalysis")]
     170    [TestCategory("Problems.DataAnalysis.Symbolic")]
    153171    [TestProperty("Time", "short")]
    154     public void SymbolicDataAnalysisExpressionTreeInterpreterEvaluateTest() {
    155       Dataset ds = new Dataset(new string[] { "Y", "A", "B" }, new double[,] {
    156         { 1.0, 1.0, 1.0 },
    157         { 2.0, 2.0, 2.0 },
    158         { 3.0, 1.0, 2.0 },
    159         { 4.0, 1.0, 1.0 },
    160         { 5.0, 2.0, 2.0 },
    161         { 6.0, 1.0, 2.0 },
    162         { 7.0, 1.0, 1.0 },
    163         { 8.0, 2.0, 2.0 },
    164         { 9.0, 1.0, 2.0 },
    165         { 10.0, 1.0, 1.0 },
    166         { 11.0, 2.0, 2.0 },
    167         { 12.0, 1.0, 2.0 }
    168       });
    169 
     172    public void StandardInterpreterTestEvaluation() {
    170173      var interpreter = new SymbolicDataAnalysisExpressionTreeInterpreter();
    171174      EvaluateTerminals(interpreter, ds);
     
    175178
    176179    [TestMethod]
    177     [TestCategory("Problems.DataAnalysis")]
     180    [TestCategory("Problems.DataAnalysis.Symbolic")]
    178181    [TestProperty("Time", "short")]
    179     public void SymbolicDataAnalysisExpressionILEmittingTreeInterpreterEvaluateTest() {
    180       Dataset ds = new Dataset(new string[] { "Y", "A", "B" }, new double[,] {
    181         { 1.0, 1.0, 1.0 },
    182         { 2.0, 2.0, 2.0 },
    183         { 3.0, 1.0, 2.0 },
    184         { 4.0, 1.0, 1.0 },
    185         { 5.0, 2.0, 2.0 },
    186         { 6.0, 1.0, 2.0 },
    187         { 7.0, 1.0, 1.0 },
    188         { 8.0, 2.0, 2.0 },
    189         { 9.0, 1.0, 2.0 },
    190         { 10.0, 1.0, 1.0 },
    191         { 11.0, 2.0, 2.0 },
    192         { 12.0, 1.0, 2.0 }
    193       });
    194 
     182    public void ILEmittingInterpreterTestEvaluation() {
    195183      var interpreter = new SymbolicDataAnalysisExpressionTreeILEmittingInterpreter();
     184      EvaluateTerminals(interpreter, ds);
     185      EvaluateOperations(interpreter, ds);
     186    }
     187
     188    [TestMethod]
     189    [TestCategory("Problems.DataAnalysis.Symbolic")]
     190    [TestProperty("Time", "short")]
     191    public void LinearInterpreterTestEvaluation() {
     192      var interpreter = new SymbolicDataAnalysisExpressionTreeLinearInterpreter();
     193
     194      //ADFs are not supported by the linear interpreter
    196195      EvaluateTerminals(interpreter, ds);
    197196      EvaluateOperations(interpreter, ds);
     
    430429          try {
    431430            Evaluate(interpreter, ds, "(psi " + x + ")", 0, alglib.psi(x));
    432           } catch (alglib.alglibexception) { // ignore cases where alglib throws an exception
     431          }
     432          catch (alglib.alglibexception) { // ignore cases where alglib throws an exception
    433433          }
    434434        };
  • trunk/sources/HeuristicLab.Tests/HeuristicLab.Problems.DataAnalysis.Symbolic.TimeSeriesPrognosis-3.4/SymbolicDataAnalysisExpressionTreeInterpreterTest.cs

    r9785 r9828  
    3737
    3838    [TestMethod]
    39     [TestCategory("Problems.DataAnalysis")]
     39    [TestCategory("Problems.DataAnalysis.Symbolic")]
    4040    [TestProperty("Time", "long")]
    41     public void SymbolicTimeSeriesPrognosisTreeInterpreterTypeCoherentGrammarPerformanceTest() {
    42       TypeCoherentGrammarPerformanceTest(new SymbolicTimeSeriesPrognosisExpressionTreeInterpreter("y"), 12.5e6);
     41    public void TimeSeriesPrognosisInterpreterTestTypeCoherentGrammarPerformance() {
     42      TestTypeCoherentGrammarPerformance(new SymbolicTimeSeriesPrognosisExpressionTreeInterpreter("y"), 12.5e6);
    4343    }
    4444
    4545    [TestMethod]
    46     [TestCategory("Problems.DataAnalysis")]
     46    [TestCategory("Problems.DataAnalysis.Symbolic")]
    4747    [TestProperty("Time", "long")]
    48     public void SymbolicTimeSeriesPrognosisTreeInterpreterFullGrammarPerformanceTest() {
    49       FullGrammarPerformanceTest(new SymbolicTimeSeriesPrognosisExpressionTreeInterpreter("y"), 12.5e6);
     48    public void TimeSeriesPrognosisInterpreterTestFullGrammarPerformance() {
     49      TestFullGrammarPerformance(new SymbolicTimeSeriesPrognosisExpressionTreeInterpreter("y"), 12.5e6);
    5050    }
    5151
    5252    [TestMethod]
    53     [TestCategory("Problems.DataAnalysis")]
     53    [TestCategory("Problems.DataAnalysis.Symbolic")]
    5454    [TestProperty("Time", "long")]
    55     public void SymbolicTimeSeriesPrognosisTreeInterpreterArithmeticGrammarPerformanceTest() {
    56       ArithmeticGrammarPerformanceTest(new SymbolicTimeSeriesPrognosisExpressionTreeInterpreter("y"), 12.5e6);
    57     }
    58 
    59     private void TypeCoherentGrammarPerformanceTest(ISymbolicTimeSeriesPrognosisExpressionTreeInterpreter interpreter, double nodesPerSecThreshold) {
     55    public void TimeSeriesPrognosisInterpreterTestArithmeticGrammarPerformance() {
     56      TestArithmeticGrammarPerformance(new SymbolicTimeSeriesPrognosisExpressionTreeInterpreter("y"), 12.5e6);
     57    }
     58
     59    private void TestTypeCoherentGrammarPerformance(ISymbolicTimeSeriesPrognosisExpressionTreeInterpreter interpreter, double nodesPerSecThreshold) {
    6060      var twister = new MersenneTwister(31415);
    6161      var dataset = Util.CreateRandomDataset(twister, Rows, Columns);
     
    7575    }
    7676
    77     private void FullGrammarPerformanceTest(ISymbolicTimeSeriesPrognosisExpressionTreeInterpreter interpreter, double nodesPerSecThreshold) {
     77    private void TestFullGrammarPerformance(ISymbolicTimeSeriesPrognosisExpressionTreeInterpreter interpreter, double nodesPerSecThreshold) {
    7878      var twister = new MersenneTwister(31415);
    7979      var dataset = Util.CreateRandomDataset(twister, Rows, Columns);
     
    9292    }
    9393
    94     private void ArithmeticGrammarPerformanceTest(ISymbolicTimeSeriesPrognosisExpressionTreeInterpreter interpreter, double nodesPerSecThreshold) {
     94    private void TestArithmeticGrammarPerformance(ISymbolicTimeSeriesPrognosisExpressionTreeInterpreter interpreter, double nodesPerSecThreshold) {
    9595      var twister = new MersenneTwister(31415);
    9696      var dataset = Util.CreateRandomDataset(twister, Rows, Columns);
     
    115115    ///</summary>
    116116    [TestMethod]
    117     [TestCategory("Problems.DataAnalysis")]
     117    [TestCategory("Problems.DataAnalysis.Symbolic")]
    118118    [TestProperty("Time", "short")]
    119     public void SymbolicDataAnalysisExpressionTreeInterpreterEvaluateTest() {
     119    public void TimeSeriesPrognosisInterpreterTestEvaluation() {
    120120      Dataset ds = new Dataset(new string[] { "Y", "A", "B" }, new double[,] {
    121121        { 1.0, 1.0, 1.0 },
Note: See TracChangeset for help on using the changeset viewer.