Changeset 17631 for branches/3073_IA_constraint_splitting/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Interval
- Timestamp:
- 06/24/20 16:12:03 (5 years ago)
- Location:
- branches/3073_IA_constraint_splitting/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Interval
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3073_IA_constraint_splitting/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Interval/Interval.cs
r17583 r17631 33 33 [Storable] 34 34 public double UpperBound { get; private set; } 35 36 public double Width => UpperBound - LowerBound; 35 37 36 38 [StorableConstructor] … … 78 80 } 79 81 82 public Tuple<Interval, Interval> Split() { 83 var midpoint = Width / 2; 84 var left = new Interval(LowerBound, LowerBound + midpoint - double.Epsilon); 85 var right = new Interval(LowerBound + midpoint, UpperBound); 86 return Tuple.Create(left, right); 87 } 88 89 //Interval Intersection 90 public static Interval operator &(Interval lhs, Interval rhs) { 91 return new Interval(Math.Max(lhs.LowerBound, rhs.LowerBound), Math.Min(lhs.UpperBound, rhs.UpperBound)); 92 } 93 94 //Interval Union 95 public static Interval operator |(Interval lhs, Interval rhs) { 96 return new Interval(Math.Min(lhs.LowerBound, rhs.LowerBound), Math.Max(lhs.UpperBound, rhs.UpperBound)); 97 } 98 80 99 public override string ToString() { 81 100 return "Interval: [" + LowerBound + ", " + UpperBound + "]"; -
branches/3073_IA_constraint_splitting/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Interval/IntervalCollection.cs
r17564 r17631 94 94 } 95 95 96 public IDictionary<string, Interval> GetDictionary() { 97 return intervals.ToDictionary(pair => pair.Key, pair => pair.Value); 98 } 99 96 100 public IEnumerable<Tuple<string, Interval>> GetVariableIntervals() { 97 101 foreach (var variableInterval in intervals)
Note: See TracChangeset
for help on using the changeset viewer.