TwoPointCrossOverOnDoublesUsingBytes: Two-point Crossover operation on the two vectors of doubles...

View source: R/RcppExports.R

TwoPointCrossOverOnDoublesUsingBytesR Documentation

Two-point Crossover operation on the two vectors of doubles using their byte representations

Description

This function is a C++ wrapper for crossing-over of two double vectors of candidate solutions using their byte representations

Usage

TwoPointCrossOverOnDoublesUsingBytes(d1, d2, cutpoint1, cutpoint2)

Arguments

d1

A vector of doubles of the first parent

d2

A vector of doubles of the second parent

cutpoint1

An integer between 1 and chromosome length for crossover cutting

cutpoint2

An integer between cutpoint1 and chromosome length for crossover cutting

Value

List of two double vectors of offspring

Author(s)

Mehmet Hakan Satman - mhsatman@istanbul.edu.tr

See Also

TwoPointCrossOver

OnePointCrossOver

UniformCrossOver

OnePointCrossOverOnDoublesUsingBytes

Examples

d1 <- runif(3)
d2 <- runif(3)
cutpoints <- sort(sample(1:(length(d1)*SizeOfDouble()), 2, replace = FALSE))
offspring <- TwoPointCrossOverOnDoublesUsingBytes(d1,d2,cutpoints[1], cutpoints[2])
print("Parents:")
print(d1)
print(d2)
print("Offspring:")
print(offspring[[1]])
print(offspring[[2]])

mcga documentation built on Nov. 27, 2023, 5:12 p.m.