Changeset 18123 for branches/3140_NumberSymbol/HeuristicLab.Tests
- Timestamp:
- 12/15/21 10:34:24 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3140_NumberSymbol/HeuristicLab.Tests/HeuristicLab.Problems.DataAnalysis.Symbolic-3.4/SymbolicDataAnalysisExpressionTreeSimplifierTest.cs
r17820 r18123 230 230 231 231 #region abs 232 AssertEqualAfterSimplification("(abs 2.0)", "2.0");233 AssertEqualAfterSimplification("(abs -2.0)", "2.0"); // constant folding232 AssertEqualAfterSimplification("(abs <num=2.0>)", "2.0"); 233 AssertEqualAfterSimplification("(abs <num=-2.0>)", "2.0"); // constant folding 234 234 AssertEqualAfterSimplification("(abs (exp (variable 2.0 x)))", "(exp (variable 2.0 x)))"); // exp is always positive 235 235 AssertEqualAfterSimplification("(abs (exp (variable 2.0 x)))", "(exp (variable 2.0 x)))"); // exp is always positive … … 238 238 AssertEqualAfterSimplification("(abs (cuberoot (variable 2.0 a)))", "(cuberoot (variable 2.0 a))"); // cuberoot is always positive (for our cases) 239 239 240 AssertEqualAfterSimplification("(* (abs (variable 2.0 x)) 2.0)", "(abs (variable 4.0 x))"); // can multiply positive constants into abs241 AssertEqualAfterSimplification("(* (abs (variable 2.0 x)) -2.0)", "(* (abs (variable 4.0 x)) -1.0)"); // for negative constants keep the sign240 AssertEqualAfterSimplification("(* (abs (variable 2.0 x)) <num=2.0>)", "(abs (variable 4.0 x))"); // can multiply positive constants into abs 241 AssertEqualAfterSimplification("(* (abs (variable 2.0 x)) <num=-2.0>)", "(* (abs (variable 4.0 x)) -1.0)"); // for negative constants keep the sign 242 242 243 243 AssertEqualAfterSimplification("(abs (* (variable 1.0 a) (variable 2.0 b)))", "(* (abs (variable 1.0 a)) (abs (variable 1.0 b)) 2.0))"); … … 265 265 266 266 #region AQ 267 AssertEqualAfterSimplification("(* (aq (variable 1.0 x) (variable 1.0 y)) 2.0)", "(aq (variable 2.0 x) (variable 1.0 y))");268 AssertEqualAfterSimplification("(/ (aq (variable 1.0 x) (variable 1.0 y)) 2.0)", "(aq (variable 0.5 x) (variable 1.0 y))");267 AssertEqualAfterSimplification("(* (aq (variable 1.0 x) (variable 1.0 y)) <num=2.0>)", "(aq (variable 2.0 x) (variable 1.0 y))"); 268 AssertEqualAfterSimplification("(/ (aq (variable 1.0 x) (variable 1.0 y)) <num=2.0>)", "(aq (variable 0.5 x) (variable 1.0 y))"); 269 269 270 270 #endregion 271 271 272 272 #region do not drop subtrees with small weights 273 AssertEqualAfterSimplification("(* 1e-14(variable 1.0 a))", "(variable 1e-14 a)");274 AssertEqualAfterSimplification("(+ (variable 1.0 a) 1e-14)",275 "(+ (variable 1.0 a) 1e-14)");273 AssertEqualAfterSimplification("(* <num=1e-14> (variable 1.0 a))", "(variable 1e-14 a)"); 274 AssertEqualAfterSimplification("(+ (variable 1.0 a) <num=1e-14>)", 275 "(+ (variable 1.0 a) <num=1e-14>)"); 276 276 // a scenario where a term with small weight can have large effect 277 AssertEqualAfterSimplification("(+ (* (pow (variable 1.0 a) 10) 1e-14) 1.0)",278 "(+ (* (pow (variable 1.0 a) 10) 1e-14) 1.0)");277 AssertEqualAfterSimplification("(+ (* (pow (variable 1.0 a) <num=10>) <num=1e-14>) 1.0)", 278 "(+ (* (pow (variable 1.0 a) <num=10>) <num=1e-14>) 1.0)"); 279 279 // a test case (from ticket #2985) 280 AssertEqualAfterSimplification("(+ (* (exp (variable 3.5861E+001 a)) 5.5606E-016) 5.9323E-002)",281 "(+ (* (exp (variable 3.5861E+001 a)) 5.5606E-016) 5.9323E-002)");280 AssertEqualAfterSimplification("(+ (* (exp (variable 3.5861E+001 a)) <num=5.5606E-016>) <num=5.9323E-002>)", 281 "(+ (* (exp (variable 3.5861E+001 a)) <num=5.5606E-016>) <num=5.9323E-002>)"); 282 282 #endregion 283 283 }
Note: See TracChangeset
for help on using the changeset viewer.