OnePointCrossOverOnDoublesUsingBytes: One-point Crossover operation on the two vectors of doubles...

Description Usage Arguments Value Author(s) See Also Examples

View source: R/RcppExports.R

Description

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

Usage

1

Arguments

d1

A vector of doubles of the first parent

d2

A vector of doubles of the second parent

cutpoint

An integer between 1 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

OnePointCrossOver

UniformCrossOverOnDoublesUsingBytes

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
d1 <- runif(3)
d2 <- runif(3)
cutp <- sample(1:(length(d1)*SizeOfDouble()), 1)[1]
offspring <- OnePointCrossOverOnDoublesUsingBytes(d1,d2, cutp)
print("Parents:")
print(d1)
print(d2)
print("Offspring:")
print(offspring[[1]])
print(offspring[[2]])

Example output

Loading required package: GA
Loading required package: foreach
Loading required package: iterators
Package 'GA' version 3.2
Type 'citation("GA")' for citing this R package in publications.

Attaching package: 'GA'

The following object is masked from 'package:utils':

    de

Please use 'citation("mcga")' for citing the R package mcga
[1] "Parents:"
[1] 0.8731005 0.3914649 0.1159108
[1] 0.4041211 0.4984060 0.5019678
[1] "Offspring:"
[1] 0.8731005 0.3914649 0.5019678
[1] 0.4041211 0.4984060 0.1159108

mcga documentation built on May 2, 2019, 8:28 a.m.