Changeset 17579 for trunk/HeuristicLab.Problems.DataAnalysis.Symbolic
- Timestamp:
- 05/30/20 22:00:12 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/IntervalInterpreter.cs
r17180 r17579 23 23 using System.Collections.Generic; 24 24 using System.Linq; 25 using HEAL.Attic; 25 26 using HeuristicLab.Common; 26 27 using HeuristicLab.Core; 27 28 using HeuristicLab.Data; 28 29 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 29 using HEAL.Attic;30 30 using HeuristicLab.Parameters; 31 31 … … 80 80 } 81 81 82 public Interval GetSymbolicExpressionTreeInterval(ISymbolicExpressionTree tree, I Dictionary<string, Interval> variableRanges) {82 public Interval GetSymbolicExpressionTreeInterval(ISymbolicExpressionTree tree, IReadOnlyDictionary<string, Interval> variableRanges) { 83 83 lock (syncRoot) { 84 84 EvaluatedSolutions++; … … 97 97 98 98 public Interval GetSymbolicExpressionTreeIntervals(ISymbolicExpressionTree tree, 99 I Dictionary<string, Interval> variableRanges, out IDictionary<ISymbolicExpressionTreeNode, Interval> nodeIntervals) {99 IReadOnlyDictionary<string, Interval> variableRanges, out IDictionary<ISymbolicExpressionTreeNode, Interval> nodeIntervals) { 100 100 lock (syncRoot) { 101 101 EvaluatedSolutions++; … … 124 124 125 125 126 private static Instruction[] PrepareInterpreterState(ISymbolicExpressionTree tree, I Dictionary<string, Interval> variableRanges) {126 private static Instruction[] PrepareInterpreterState(ISymbolicExpressionTree tree, IReadOnlyDictionary<string, Interval> variableRanges) { 127 127 if (variableRanges == null) 128 128 throw new ArgumentNullException("No variablew ranges are present!", nameof(variableRanges)); … … 234 234 break; 235 235 } 236 case OpCodes.Power: {237 result = Evaluate(instructions, ref instructionCounter, nodeIntervals);238 for (int i = 1; i < currentInstr.nArguments; i++) {239 var argumentInterval = Evaluate(instructions, ref instructionCounter, nodeIntervals);240 result = Interval.Power(result, argumentInterval);241 }242 break;243 }244 236 case OpCodes.Square: { 245 237 var argumentInterval = Evaluate(instructions, ref instructionCounter, nodeIntervals); … … 247 239 break; 248 240 } 249 case OpCodes.Root: {250 result = Evaluate(instructions, ref instructionCounter, nodeIntervals);251 for (int i = 1; i < currentInstr.nArguments; i++) {252 var argumentInterval = Evaluate(instructions, ref instructionCounter, nodeIntervals);253 result = Interval.Root(result, argumentInterval);254 }255 break;256 }257 241 case OpCodes.SquareRoot: { 258 242 var argumentInterval = Evaluate(instructions, ref instructionCounter, nodeIntervals); 259 243 result = Interval.SquareRoot(argumentInterval); 244 break; 245 } 246 case OpCodes.Cube: { 247 var argumentInterval = Evaluate(instructions, ref instructionCounter, nodeIntervals); 248 result = Interval.Cube(argumentInterval); 249 break; 250 } 251 case OpCodes.CubeRoot: { 252 var argumentInterval = Evaluate(instructions, ref instructionCounter, nodeIntervals); 253 result = Interval.CubicRoot(argumentInterval); 254 break; 255 } 256 case OpCodes.Absolute: { 257 var argumentInterval = Evaluate(instructions, ref instructionCounter, nodeIntervals); 258 result = Interval.Absolute(argumentInterval); 259 break; 260 } 261 case OpCodes.AnalyticQuotient: { 262 result = Evaluate(instructions, ref instructionCounter, nodeIntervals); 263 for (var i = 1; i < currentInstr.nArguments; i++) { 264 var argumentInterval = Evaluate(instructions, ref instructionCounter, nodeIntervals); 265 result = Interval.AnalyticalQuotient(result, argumentInterval); 266 } 267 260 268 break; 261 269 } … … 274 282 from n in tree.Root.GetSubtree(0).IterateNodesPrefix() 275 283 where 284 !(n.Symbol is Problems.DataAnalysis.Symbolic.Variable) && 285 !(n.Symbol is Constant) && 276 286 !(n.Symbol is StartSymbol) && 277 287 !(n.Symbol is Addition) && … … 284 294 !(n.Symbol is Logarithm) && 285 295 !(n.Symbol is Exponential) && 286 !(n.Symbol is Power) &&287 296 !(n.Symbol is Square) && 288 !(n.Symbol is Root) &&289 297 !(n.Symbol is SquareRoot) && 290 !(n.Symbol is Problems.DataAnalysis.Symbolic.Variable) && 291 !(n.Symbol is Constant) 298 !(n.Symbol is Cube) && 299 !(n.Symbol is CubeRoot) && 300 !(n.Symbol is Absolute) && 301 !(n.Symbol is AnalyticQuotient) 292 302 select n).Any(); 293 303 return !containsUnknownSyumbol;
Note: See TracChangeset
for help on using the changeset viewer.