Table of Contents

Class RealVector

Namespace
Evolutionary
Assembly
Evolutionary.dll

Provides factory and operator methods for the RealVector<T> struct.

public static class RealVector
Inheritance
RealVector
Inherited Members

Methods

ArithmeticCrossover<T>(RealVector<T>, RealVector<T>, Random)

Creates a child by a whole arithmetic crossover. The child is the weighted mean of both parents, where the weight is a single random value between 0 and 1. The child may therefore lie outside of the interval spanned by the parents.

public static RealVector<T> ArithmeticCrossover<T>(RealVector<T> p1, RealVector<T> p2, Random random) where T : IFloatingPoint<T>

Parameters

p1 RealVector<T>

The first parent.

p2 RealVector<T>

The second parent.

random Random

The random number generator.

Returns

RealVector<T>

The child.

Type Parameters

T

The floating point type of the vector elements. It is inferred from the parents.

Exceptions

ArgumentException

Thrown if the lengths of both vectors differ.

CreateRandomly<T>(int, T, T, Random)

Creates a new vector whose values are uniformly distributed between min (inclusive) and max (exclusive).

public static RealVector<T> CreateRandomly<T>(int n, T min, T max, Random random) where T : IFloatingPoint<T>

Parameters

n int

The number of dimensions.

min T

The inclusive lower bound of the interval.

max T

The exclusive upper bound of the interval.

random Random

The random number generator.

Returns

RealVector<T>

The random vector.

Type Parameters

T

The floating point type of the vector elements, e.g. double or float. It is inferred from the bounds of the interval.

GaussianMutation<T>(RealVector<T>, Random, double)

Adds normally distributed noise with the given standard deviation to every dimension (Gaussian mutation). The noise is generated with the NextNormal(Random, double, double) extension method.

public static RealVector<T> GaussianMutation<T>(RealVector<T> vector, Random random, double sigma) where T : IFloatingPoint<T>

Parameters

vector RealVector<T>

The vector to mutate.

random Random

The random number generator.

sigma double

The standard deviation of the noise.

Returns

RealVector<T>

The mutated vector.

Type Parameters

T

The floating point type of the vector elements. It is inferred from the vector to mutate.

UniformCrossover<T>(RealVector<T>, RealVector<T>, Random)

Creates a child by a uniform crossover. Each value is taken from one of the parents with equal probability.

public static RealVector<T> UniformCrossover<T>(RealVector<T> p1, RealVector<T> p2, Random random) where T : IFloatingPoint<T>

Parameters

p1 RealVector<T>

The first parent.

p2 RealVector<T>

The second parent.

random Random

The random number generator.

Returns

RealVector<T>

The child.

Type Parameters

T

The floating point type of the vector elements. It is inferred from the parents.

Exceptions

ArgumentException

Thrown if the lengths of both vectors differ.