Changeset 13651 for trunk/sources/HeuristicLab.Tests/HeuristicLab.Algorithms.DataAnalysis-3.4/MctsSymbolicRegressionTest.cs
- Timestamp:
- 03/05/16 08:25:08 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Tests/HeuristicLab.Algorithms.DataAnalysis-3.4/MctsSymbolicRegressionTest.cs
r13648 r13651 1 1 using System; 2 using System.Diagnostics.Contracts; 2 3 using System.Linq; 3 4 using System.Threading; … … 31 32 { 32 33 // possible solutions with max two variable references: 34 // TODO: equal terms should not be allowed (see ConstraintHandler) 33 35 // x 34 36 // log(x) … … 40 42 // x * exp(x) 41 43 // x * 1/x 42 // x + x 44 // x + x ? 43 45 // x + log(x) 44 46 // x + exp(x) … … 48 50 // log(x) * exp(x) 49 51 // log(x) * 1/x 50 // log(x) + log(x) 51 // log(x) + exp(x) 52 // log(x) + log(x) ? 53 // log(x) + exp(x) ? 52 54 // log(x) + 1/x 53 55 // -- 6 54 56 // exp(x) * exp(x) 55 57 // exp(x) * 1/x 56 // exp(x) + exp(x) 58 // exp(x) + exp(x) ? 57 59 // exp(x) + 1/x 58 60 // -- 4 59 61 // 1/x * 1/x 60 // 1/x + 1/x 62 // 1/x + 1/x ? 61 63 // -- 2 62 // log(x+x) 64 // log(x+x) ? 63 65 // log(x*x) 64 66 // exp(x*x) 65 // 1/(x+x) 67 // 1/(x+x) ? 66 68 // 1/(x*x) 67 69 // -- 5 70 71 68 72 TestMctsNumberOfSolutions(regProblem, 2, 29); 69 73 } … … 75 79 // -- 2 76 80 // x * x 77 // x + x 81 // x + x ? 78 82 // x * exp(x) 79 83 // x + exp(x) 80 84 // exp(x) * exp(x) 81 // exp(x) + exp(x) 85 // exp(x) + exp(x) ? 82 86 // exp(x*x) 83 87 // -- 7 84 88 // x * x * x 85 // x + x * x 86 // x * x + x !! 87 // x + x + x 89 // x + x * x 90 // x + x + x ? 88 91 // x * x * exp(x) 89 // x + x * exp(x) 90 // x * x + exp(x) 91 // x + x + exp(x) 92 // x * exp(x) + x !! 93 // x * exp(x) + exp(x) 94 // x + exp(x) * exp(x) 95 // x + exp(x) + exp(x) 92 // x + x * exp(x) 93 // x + x + exp(x) ? 94 // exp(x) + x*x 95 // exp(x) + x*exp(x) 96 // x + exp(x) * exp(x) 97 // x + exp(x) + exp(x) ? 96 98 // x * exp(x) * exp(x) 97 99 // x * exp(x*x) 98 100 // x + exp(x*x) 99 // -- 1 5101 // -- 13 100 102 101 103 // exp(x) * exp(x) * exp(x) 102 // exp(x) + exp(x) * exp(x) 103 // exp(x) * exp(x) + exp(x) !! 104 // exp(x) + exp(x) + exp(x) 105 // -- 4 104 // exp(x) + exp(x) * exp(x) 105 // exp(x) + exp(x) + exp(x) ? 106 // -- 3 106 107 107 108 // exp(x) * exp(x*x) 108 109 // exp(x) + exp(x*x) 109 // exp(x*x) * exp(x) !! 110 // exp(x*x) + exp(x) !! 111 // -- 4 110 // -- 2 112 111 // exp(x*x*x) 113 112 // -- 1 114 115 TestMctsNumberOfSolutions(regProblem, 3, 2 + 7 + 15 + 4 + 4 + 1, allowLog: false, allowInv: false); 113 TestMctsNumberOfSolutions(regProblem, 3, 2 + 7 + 13 + 3 + 2 + 1, allowLog: false, allowInv: false); 114 } 115 { 116 // possible solutions with max 4 variable references: 117 // without exp, log and inv 118 // x 119 // x*x 120 // x+x ? 121 // x*x*x 122 // x+x*x 123 // x+x+x ? 124 // x*x*x*x 125 // x+x*x*x 126 // x*x+x*x ? 127 // x+x+x*x ? 128 // x+x+x+x ? 129 130 TestMctsNumberOfSolutions(regProblem, 4, 11, allowLog: false, allowInv: false, allowExp: false); 131 } 132 { 133 // possible solutions with max 5 variable references: 134 // without exp, log and inv 135 // x 136 // xx 137 // x+x ? 138 // xxx 139 // x+xx 140 // x+x+x ? 141 // xxxx 142 // x+xxx 143 // xx+xx ? 144 // x+x+xx ? 145 // x+x+x+x ? 146 // xxxxx 147 // x+xxxx 148 // xx+xxx 149 // x+x+xxx ? 150 // x+xx+xx ? 151 // x+x+x+xx ? 152 // x+x+x+x+x ? 153 TestMctsNumberOfSolutions(regProblem, 5, 18, allowLog: false, allowInv: false, allowExp: false); 116 154 } 117 155 } … … 236 274 #endregion 237 275 276 238 277 #region Nguyen 239 278 [TestMethod] … … 485 524 486 525 private void TestMctsNumberOfSolutions(IRegressionProblemData problemData, int maxNumberOfVariables, int expectedNumberOfSolutions, 526 bool allowProd = true, 487 527 bool allowExp = true, 488 528 bool allowLog = true, … … 494 534 regProblem.ProblemDataParameter.Value = problemData; 495 535 #region Algorithm Configuration 536 537 mctsSymbReg.SetSeedRandomly = false; 538 mctsSymbReg.Seed = 1234; 496 539 mctsSymbReg.Problem = regProblem; 497 540 mctsSymbReg.Iterations = int.MaxValue; // stopping when all solutions have been enumerated 498 541 mctsSymbReg.MaxSize = maxNumberOfVariables; 499 542 mctsSymbReg.C = 1000; // essentially breath first seach 543 mctsSymbReg.AllowedFactors.SetItemCheckedState(mctsSymbReg.AllowedFactors.Single(s => s.Value.StartsWith("prod")), allowProd); 500 544 mctsSymbReg.AllowedFactors.SetItemCheckedState(mctsSymbReg.AllowedFactors.Single(s => s.Value.Contains("exp")), allowExp); 501 545 mctsSymbReg.AllowedFactors.SetItemCheckedState(mctsSymbReg.AllowedFactors.Single(s => s.Value.Contains("log")), allowLog);
Note: See TracChangeset
for help on using the changeset viewer.