- Timestamp:
- 08/27/20 12:59:27 (4 years ago)
- Location:
- stable
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
stable
- Property svn:mergeinfo changed
/trunk merged: 17729-17730
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Optimization.Operators/3.3/ExponentialDiscreteDoubleValueModifier.cs
r17181 r17732 43 43 } 44 44 45 46 protected override double Modify(double value, double startValue, double endValue, int index, int startIndex, int endIndex) { 47 return Apply(value, startValue, endValue, index, startIndex, endIndex); 48 } 49 45 50 /// <summary> 46 51 /// Calculates a new value based on exponential decay or growth. … … 54 59 /// <param name="endIndex">The end index.</param> 55 60 /// <returns>The new value.</returns> 56 p rotected override double Modify(double value, double startValue, double endValue, int index, int startIndex, int endIndex) {61 public static double Apply(double value, double startValue, double endValue, int index, int startIndex, int endIndex) { 57 62 if (endValue <= 0 || startValue <= 0) throw new ArgumentException("startValue and endValue must be greater than 0."); 58 63 double b = Math.Pow(endValue / startValue, 1.0 / (endIndex - startIndex)); -
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 } -
stable/HeuristicLab.Optimization.Operators/3.3/LinearDiscreteDoubleValueModifier.cs
r17181 r17732 41 41 42 42 protected override double Modify(double value, double startValue, double endValue, int index, int startIndex, int endIndex) { 43 return Apply(value, startValue, endValue, index, startIndex, endIndex); 44 } 45 46 /// <summary> 47 /// Calculates a new value based on linear decay or growth. 48 /// </summary> 49 /// <param name="value">The previous value.</param> 50 /// <param name="startValue">The initial value.</param> 51 /// <param name="endValue">The final value.</param> 52 /// <param name="index">The current index.</param> 53 /// <param name="startIndex">The initial index.</param> 54 /// <param name="endIndex">The final index.</param> 55 /// <returns>The new value.</returns> 56 public static double Apply(double value, double startValue, double endValue, int index, int startIndex, int endIndex) { 43 57 double k = (endValue - startValue) / (endIndex - startIndex); 44 58 double x = index - startIndex; -
stable/HeuristicLab.Optimization.Operators/3.3/QuadraticDiscreteDoubleValueModifier.cs
r17181 r17732 41 41 42 42 protected override double Modify(double value, double startValue, double endValue, int index, int startIndex, int endIndex) { 43 return Apply(value, startValue, endValue, index, startIndex, endIndex); 44 } 45 46 /// <summary> 47 /// Calculates a new value based on quadratic decay or growth. 48 /// </summary> 49 /// <param name="value">The previous value.</param> 50 /// <param name="startValue">The initial value.</param> 51 /// <param name="endValue">The final value.</param> 52 /// <param name="index">The current index.</param> 53 /// <param name="startIndex">The initial index.</param> 54 /// <param name="endIndex">The final index.</param> 55 /// <returns>The new value.</returns> 56 public static double Apply(double value, double startValue, double endValue, int index, int startIndex, int endIndex) { 43 57 double a = (endValue - startValue) / ((endIndex - startIndex) * (endIndex - startIndex)); 44 58 return a * (index - startIndex) * (index - startIndex) + startValue; -
stable/HeuristicLab.Optimization.Operators/3.3/SquareRootDiscreteDoubleValueModifier.cs
r17181 r17732 42 42 43 43 protected override double Modify(double value, double startValue, double endValue, int index, int startIndex, int endIndex) { 44 return Apply(value, startValue, endValue, index, startIndex, endIndex); 45 } 46 47 /// <summary> 48 /// Calculates a new value based on sqrt decay or growth. 49 /// </summary> 50 /// <param name="value">The previous value.</param> 51 /// <param name="startValue">The initial value.</param> 52 /// <param name="endValue">The final value.</param> 53 /// <param name="index">The current index.</param> 54 /// <param name="startIndex">The initial index.</param> 55 /// <param name="endIndex">The final index.</param> 56 /// <returns>The new value.</returns> 57 public static double Apply(double value, double startValue, double endValue, int index, int startIndex, int endIndex) { 44 58 double a = (endValue - startValue) / Math.Sqrt(endIndex - startIndex); 45 59 return a * Math.Sqrt(index - startIndex) + startValue;
Note: See TracChangeset
for help on using the changeset viewer.