Changeset 16676 for branches/2974_Constants_Optimization/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/IntervalInterpreter.cs
- Timestamp:
- 03/13/19 09:30:18 (6 years ago)
- Location:
- branches/2974_Constants_Optimization/HeuristicLab.Problems.DataAnalysis.Symbolic
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2974_Constants_Optimization/HeuristicLab.Problems.DataAnalysis.Symbolic
- Property svn:mergeinfo changed
-
branches/2974_Constants_Optimization/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/IntervalInterpreter.cs
r16407 r16676 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 8Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2019 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 27 27 using HeuristicLab.Data; 28 28 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 29 using H euristicLab.Persistence.Default.CompositeSerializers.Storable;29 using HEAL.Attic; 30 30 using HeuristicLab.Parameters; 31 31 32 32 namespace HeuristicLab.Problems.DataAnalysis.Symbolic { 33 [Storable Class]33 [StorableType("DE6C1E1E-D7C1-4070-847E-63B68562B10C")] 34 34 [Item("IntervalInterpreter", "Intperter for calculation of intervals of symbolic models.")] 35 35 public sealed class IntervalInterpreter : ParameterizedNamedItem, IStatefulItem { … … 47 47 48 48 [StorableConstructor] 49 private IntervalInterpreter( bool deserializing) : base(deserializing) { }49 private IntervalInterpreter(StorableConstructorFlag _) : base(_) { } 50 50 private IntervalInterpreter(IntervalInterpreter original, Cloner cloner) 51 51 : base(original, cloner) { } … … 88 88 var outputInterval = Evaluate(instructions, ref instructionCount); 89 89 90 return outputInterval; 90 // because of numerical errors the bounds might be incorrect 91 if (outputInterval.LowerBound <= outputInterval.UpperBound) 92 return outputInterval; 93 else 94 return new Interval(outputInterval.UpperBound, outputInterval.LowerBound); 91 95 } 92 96 … … 102 106 var outputInterval = Evaluate(instructions, ref instructionCount, intervals); 103 107 104 nodeIntervals = intervals; 105 106 return outputInterval; 108 // fix incorrect intervals if necessary (could occur because of numerical errors) 109 nodeIntervals = new Dictionary<ISymbolicExpressionTreeNode, Interval>(); 110 foreach(var kvp in intervals) { 111 var interval = kvp.Value; 112 if (interval.IsInfiniteOrUndefined || interval.LowerBound <= interval.UpperBound) 113 nodeIntervals.Add(kvp.Key, interval); 114 else 115 nodeIntervals.Add(kvp.Key, new Interval(interval.UpperBound, interval.LowerBound)); 116 } 117 118 // because of numerical errors the bounds might be incorrect 119 if (outputInterval.IsInfiniteOrUndefined || outputInterval.LowerBound <= outputInterval.UpperBound) 120 return outputInterval; 121 else 122 return new Interval(outputInterval.UpperBound, outputInterval.LowerBound); 107 123 } 108 124
Note: See TracChangeset
for help on using the changeset viewer.