Changeset 3094 for trunk/sources/HeuristicLab.Optimization.Operators/3.3/ExponentialDiscreteDoubleValueModifier.cs
- Timestamp:
- 03/18/10 02:03:30 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Optimization.Operators/3.3/ExponentialDiscreteDoubleValueModifier.cs
r3093 r3094 31 31 [StorableClass] 32 32 public class ExponentialDiscreteDoubleValueModifier : DiscreteDoubleValueModifier { 33 /// <summary> 34 /// Calculates a new value based on exponential decay or growth. 35 /// </summary> 36 /// <exception cref="ArgumentException">Thrown when endValue or startValue or both are 0.</exception> 37 /// <param name="value">The last value.</param> 38 /// <param name="startValue">The start value.</param> 39 /// <param name="endValue">The end value.</param> 40 /// <param name="index">The current index.</param> 41 /// <param name="startIndex">The start index.</param> 42 /// <param name="endIndex">The end index.</param> 43 /// <returns>The new value.</returns> 33 44 protected override double Modify(double value, double startValue, double endValue, int index, int startIndex, int endIndex) { 45 if (endValue <= 0 || startValue <= 0) throw new ArgumentException("ExponentialDiscreteDoubleValueModifier: startValue and endValue must be greater than 0."); 34 46 double b = Math.Pow(endValue / startValue, 1.0 / (endIndex - startIndex)); 35 47 return startValue * Math.Pow(b, index - startIndex);
Note: See TracChangeset
for help on using the changeset viewer.