Free cookie consent management tool by TermsFeed Policy Generator

Changeset 17730 for trunk


Ignore:
Timestamp:
08/27/20 12:06:16 (4 years ago)
Author:
dpiringe
Message:

#3081

  • renamed method Calculate -> Apply
  • copied/added comments of the method Modify -> Apply
Location:
trunk/HeuristicLab.Optimization.Operators/3.3
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/HeuristicLab.Optimization.Operators/3.3/ExponentialDiscreteDoubleValueModifier.cs

    r17729 r17730  
    4343    }
    4444
     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
    4550    /// <summary>
    4651    /// Calculates a new value based on exponential decay or growth.
     
    5459    /// <param name="endIndex">The end index.</param>
    5560    /// <returns>The new value.</returns>
    56     protected override double Modify(double value, double startValue, double endValue, int index, int startIndex, int endIndex) {
    57       return Calculate(value, startValue, endValue, index, startIndex, endIndex);
    58     }
    59 
    60     public static double Calculate(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) {
    6162      if (endValue <= 0 || startValue <= 0) throw new ArgumentException("startValue and endValue must be greater than 0.");
    6263      double b = Math.Pow(endValue / startValue, 1.0 / (endIndex - startIndex));
  • trunk/HeuristicLab.Optimization.Operators/3.3/GeneralizedExponentialDiscreteDoubleValueModifier.cs

    r17729 r17730  
    5858    }
    5959
     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
    6064    /// <summary>
    6165    /// Calculates a new value based on exponential decay or growth.
     
    6973    /// <param name="endIndex">The final index.</param>
    7074    /// <returns>The new value.</returns>
    71     protected override double Modify(double value, double startValue, double endValue, int index, int startIndex, int endIndex) {
    72       return Calculate(value, startValue, endValue, index, startIndex, endIndex, Base);
    73     }
    74 
    75     public static double Calculate(double value, double startValue, double endValue, int index, int startIndex, int endIndex, double @base) {
     75    public static double Apply(double value, double startValue, double endValue, int index, int startIndex, int endIndex, double @base) {
    7676      if (@base <= 0)
    7777        throw new ArgumentException("Base must be > 0.");
  • trunk/HeuristicLab.Optimization.Operators/3.3/LinearDiscreteDoubleValueModifier.cs

    r17729 r17730  
    4141
    4242    protected override double Modify(double value, double startValue, double endValue, int index, int startIndex, int endIndex) {
    43       return Calculate(value, startValue, endValue, index, startIndex, endIndex);
     43      return Apply(value, startValue, endValue, index, startIndex, endIndex);
    4444    }
    4545
    46     public static double Calculate(double value, double startValue, double endValue, int index, int startIndex, int endIndex) {
     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) {
    4757      double k = (endValue - startValue) / (endIndex - startIndex);
    4858      double x = index - startIndex;
  • trunk/HeuristicLab.Optimization.Operators/3.3/QuadraticDiscreteDoubleValueModifier.cs

    r17729 r17730  
    4141
    4242    protected override double Modify(double value, double startValue, double endValue, int index, int startIndex, int endIndex) {
    43       return Calculate(value, startValue, endValue, index, startIndex, endIndex);
     43      return Apply(value, startValue, endValue, index, startIndex, endIndex);
    4444    }
    4545
    46     public static double Calculate(double value, double startValue, double endValue, int index, int startIndex, int endIndex) {
     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) {
    4757      double a = (endValue - startValue) / ((endIndex - startIndex) * (endIndex - startIndex));
    4858      return a * (index - startIndex) * (index - startIndex) + startValue;
  • trunk/HeuristicLab.Optimization.Operators/3.3/SquareRootDiscreteDoubleValueModifier.cs

    r17729 r17730  
    4242
    4343    protected override double Modify(double value, double startValue, double endValue, int index, int startIndex, int endIndex) {
    44       return Calculate(value, startValue, endValue, index, startIndex, endIndex);
     44      return Apply(value, startValue, endValue, index, startIndex, endIndex);
    4545    }
    4646
    47     public static double Calculate(double value, double startValue, double endValue, int index, int startIndex, int endIndex) {
     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) {
    4858      double a = (endValue - startValue) / Math.Sqrt(endIndex - startIndex);
    4959      return a * Math.Sqrt(index - startIndex) + startValue;
Note: See TracChangeset for help on using the changeset viewer.