Changeset 5522 for branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding/RangeConstraints
- Timestamp:
- 02/21/11 00:46:33 (14 years ago)
- Location:
- branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding/RangeConstraints
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding/RangeConstraints/ConstrainedValue.cs
r5231 r5522 86 86 #endregion 87 87 88 void value_ToStringChanged(object sender, EventArgs e) {88 private void value_ToStringChanged(object sender, EventArgs e) { 89 89 OnToStringChanged(); 90 90 } -
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding/RangeConstraints/DoubleValueRange.cs
r5337 r5522 48 48 return solutions; 49 49 } 50 51 protected override double CalculateSimilarityValue(DoubleValue a, DoubleValue b) { 52 double range = UpperBound.Value - LowerBound.Value; 53 double diff = Math.Abs(a.Value - b.Value); 54 return Math.Max(0, (range - (diff*2)) / range); 55 } 50 56 } 51 57 } -
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding/RangeConstraints/IntValueRange.cs
r5337 r5522 47 47 return solutions; 48 48 } 49 50 protected override double CalculateSimilarityValue(IntValue a, IntValue b) { 51 double range = UpperBound.Value - LowerBound.Value; 52 double diff = Math.Abs(a.Value - b.Value); 53 return Math.Max(0, (range - (diff * 2)) / range); 54 } 49 55 } 50 56 } -
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding/RangeConstraints/PercentValueRange.cs
r5337 r5522 52 52 return solutions; 53 53 } 54 55 protected override double CalculateSimilarityValue(PercentValue a, PercentValue b) { 56 double range = UpperBound.Value - LowerBound.Value; 57 double diff = Math.Abs(a.Value - b.Value); 58 return Math.Max(0, (range - (diff * 2)) / range); 59 } 54 60 } 55 61 } -
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding/RangeConstraints/Range.cs
r5144 r5522 208 208 209 209 protected abstract T GetRandomSample(IRandom random); 210 210 211 IItem IRange.GetRandomValue(IRandom random) { 211 212 return GetRandomValue(random); … … 216 217 return GetCombinations().Cast<IItem>().ToArray(); 217 218 } 219 220 public virtual double CalculateSimilarity(IItem a, IItem b) { 221 return CalculateSimilarityValue((T)a, (T)b); 222 } 223 224 protected abstract double CalculateSimilarityValue(T a, T b); 218 225 } 219 226 }
Note: See TracChangeset
for help on using the changeset viewer.