Evolution/Evolution/Genes/FloatGene.cs
/// <summary>
/// Returns a gene with newValue value and whose bounds are the maximum range which fits in a and b bounds
/// </summary>
/// <param name="newValue">The new value.</param>
/// <param name="a">a.</param>
/// <param name="b">The b.</param>
/// <returns></returns>
Returns a gene with newValue value and whose bounds are the maximum range which fits in a and b bounds
Returns a gene with newValue value and whose bounds are the maximum range which fits in a and b bounds
public static FloatGene MinimumBoundedGene(double newValue, FloatGene a, FloatGene b)
        {
            double? max = a.MaxValue;
            double? min = a.MinValue;
            if (!a.IsBounded)
            {
                max = b.MaxValue;
                min = b.MinValue;
            }
            else if (b.IsBounded)
            {
                max = Math.Min(a.MaxValue.Value, b.MaxValue.Value);
                min = Math.Max(a.MinValue.Value, b.MinValue.Value);
            }
            return new FloatGene(newValue, max, min);
        }
public static FloatGene MinimumBoundedGene ( double newValue , FloatGene a , FloatGene b ) { double ? max = a . MaxValue ; double ? min = a . MinValue ; if ( ! a . IsBounded ) { max = b . MaxValue ; min = b . MinValue ; } else if ( b . IsBounded ) { max = Math . Min ( a . MaxValue . Value , b . MaxValue . Value ) ; min = Math . Max ( a . MinValue . Value , b . MinValue . Value ) ; } return new FloatGene ( newValue , max , min ) ; }
Returns a gene with newValue value and whose bounds are the maximum range which fits in a and b bounds
Returns a gene with newValue value and whose bounds are the maximum range which fits in a and b bounds
None
newValue
double
The new value.
The new value .
a
FloatGene
None
b
FloatGene
None