TwoPointCrossOver function

Two Point Crossover operation on the two vectors of bytes

Two Point Crossover operation on the two vectors of bytes

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

TwoPointCrossOver(bytes1, bytes2, cutpoint1, cutpoint2)

Arguments

  • bytes1: A vector of bytes of the first parent
  • bytes2: A vector of bytes of the second parent
  • cutpoint1: First cut-point for the single point crossing-over
  • cutpoint2: Second cut-point for the single point crossing-over

Returns

List of two byte vectors of offspring

Examples

b1 <- DoubleVectorToBytes(c(56.54, 89.7666, 98.565)) b2 <- DoubleVectorToBytes(c(79.76, 56.4443, 34.22121)) cutpoints <- sort(sample(1:(length(b1)*SizeOfDouble()), 2, replace = FALSE)) result <- TwoPointCrossOver(b1,b2, cutpoints[1], cutpoints[2]) print(ByteVectorToDoubles(result[[1]])) print(ByteVectorToDoubles(result[[2]]))

Author(s)

Mehmet Hakan Satman - mhsatman@istanbul.edu.tr

See Also

OnePointCrossOver

OnePointCrossOverOnDoublesUsingBytes

UniformCrossOverOnDoublesUsingBytes

  • Maintainer: Mehmet Hakan Satman
  • License: GPL (>= 2)
  • Last published: 2023-11-27

Useful links