Changeset 17928 for branches/3026_IntegrationIntoSymSpace/HeuristicLab.Optimization.Operators/3.3/GeneralizedExponentialDiscreteDoubleValueModifier.cs
- Timestamp:
- 04/06/21 13:13:32 (3 years ago)
- Location:
- branches/3026_IntegrationIntoSymSpace
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3026_IntegrationIntoSymSpace
- Property svn:mergeinfo changed
-
branches/3026_IntegrationIntoSymSpace/HeuristicLab.Optimization.Operators/3.3/GeneralizedExponentialDiscreteDoubleValueModifier.cs
r17180 r17928 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.