Changeset 18027 for branches/3026_IntegrationIntoSymSpace/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter
- Timestamp:
- 07/20/21 18:13:55 (3 years ago)
- Location:
- branches/3026_IntegrationIntoSymSpace
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3026_IntegrationIntoSymSpace
-
branches/3026_IntegrationIntoSymSpace/HeuristicLab.Problems.DataAnalysis.Symbolic
- Property svn:mergeinfo changed
/trunk/HeuristicLab.Problems.DataAnalysis.Symbolic merged: 17929,17931,17958,17963-17964,17993
- Property svn:mergeinfo changed
-
branches/3026_IntegrationIntoSymSpace/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/IntervalArithBoundsEstimator.cs
r17928 r18027 223 223 break; 224 224 } 225 case OpCodes.Power: { 226 var a = Evaluate(instructions, ref instructionCounter, nodeIntervals, variableIntervals); 227 var b = Evaluate(instructions, ref instructionCounter, nodeIntervals, variableIntervals); 228 // support only integer powers 229 if (b.LowerBound == b.UpperBound && Math.Truncate(b.LowerBound) == b.LowerBound) { 230 result = Interval.Power(a, (int)b.LowerBound); 231 } else { 232 throw new NotSupportedException("Interval is only supported for integer powers"); 233 } 234 break; 235 } 225 236 case OpCodes.Absolute: { 226 237 var argumentInterval = Evaluate(instructions, ref instructionCounter, nodeIntervals, variableIntervals); … … 329 340 !(n.Symbol is Cube) && 330 341 !(n.Symbol is CubeRoot) && 342 !(n.Symbol is Power) && 331 343 !(n.Symbol is Absolute) && 332 344 !(n.Symbol is AnalyticQuotient) -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/IntervalInterpreter.cs
r17928 r18027 283 283 break; 284 284 } 285 case OpCodes.Power: { 286 var a = Evaluate(instructions, ref instructionCounter, nodeIntervals, variableIntervals); 287 var b = Evaluate(instructions, ref instructionCounter, nodeIntervals, variableIntervals); 288 // support only integer powers 289 if (b.LowerBound == b.UpperBound && Math.Truncate(b.LowerBound) == b.LowerBound) { 290 result = Interval.Power(a, (int)b.LowerBound); 291 } else { 292 throw new NotSupportedException("Interval is only supported for integer powers"); 293 } 294 break; 295 } 296 285 297 case OpCodes.Absolute: { 286 298 var argumentInterval = Evaluate(instructions, ref instructionCounter, nodeIntervals, variableIntervals); … … 309 321 310 322 public static bool IsCompatible(ISymbolicExpressionTree tree) { 311 var containsUnknownSymbols = ( 312 from n in tree.Root.GetSubtree(0).IterateNodesPrefix() 313 where 323 foreach (var n in tree.Root.GetSubtree(0).IterateNodesPrefix()) { 324 if ( 314 325 !(n.Symbol is Variable) && 315 326 !(n.Symbol is Constant) && … … 329 340 !(n.Symbol is Cube) && 330 341 !(n.Symbol is CubeRoot) && 342 !(n.Symbol is Power) && 331 343 !(n.Symbol is Absolute) && 332 !(n.Symbol is AnalyticQuotient) 333 select n).Any(); 334 return !containsUnknownSymbols; 344 !(n.Symbol is AnalyticQuotient)) return false; 345 346 else if (n.Symbol is Power) { 347 // only integer exponents are supported 348 var exp = n.GetSubtree(1) as ConstantTreeNode; 349 if (exp == null || exp.Value != Math.Truncate(exp.Value)) return false; 350 } 351 } 352 return true; 335 353 } 336 354 } -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/OpCodes.cs
r17180 r18027 144 144 { typeof(Cosine), OpCodes.Cos }, 145 145 { typeof(Tangent), OpCodes.Tan }, 146 { typeof 146 { typeof(HyperbolicTangent), OpCodes.Tanh}, 147 147 { typeof(Logarithm), OpCodes.Log }, 148 148 { typeof(Exponential), OpCodes.Exp },
Note: See TracChangeset
for help on using the changeset viewer.