Changeset 17732 for stable/HeuristicLab.Optimization.Operators/3.3/GeneralizedExponentialDiscreteDoubleValueModifier.cs
- Timestamp:
- 08/27/20 12:59:27 (4 years ago)
- Location:
- stable
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
stable
- Property svn:mergeinfo changed
/trunk merged: 17729-17730
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Optimization.Operators/3.3/GeneralizedExponentialDiscreteDoubleValueModifier.cs
r17181 r17732 58 58 } 59 59 60 protected override double Modify(double value, double startValue, double endValue, int index, int startIndex, int endIndex) { 61 return Apply(value, startValue, endValue, index, startIndex, endIndex, Base); 62 } 63 60 64 /// <summary> 61 65 /// Calculates a new value based on exponential decay or growth. … … 69 73 /// <param name="endIndex">The final index.</param> 70 74 /// <returns>The new value.</returns> 71 p rotected override double Modify(double value, double startValue, double endValue, int index, int startIndex, int endIndex) {72 if ( Base <= 0)75 public static double Apply(double value, double startValue, double endValue, int index, int startIndex, int endIndex, double @base) { 76 if (@base <= 0) 73 77 throw new ArgumentException("Base must be > 0."); 74 if ( Base == 1.0)75 return startValue + (endValue - startValue) *(index - startIndex)/(endIndex - startIndex);76 return startValue + (endValue - startValue) *(Math.Pow(Base, 1.0*(index-startIndex)/(endIndex-startIndex)) - 1)/(Base - 1);78 if (@base == 1.0) 79 return startValue + (endValue - startValue) * (index - startIndex) / (endIndex - startIndex); 80 return startValue + (endValue - startValue) * (Math.Pow(@base, 1.0 * (index - startIndex) / (endIndex - startIndex)) - 1) / (@base - 1); 77 81 } 78 82 }
Note: See TracChangeset
for help on using the changeset viewer.