EnsureBounds: Altering vector of doubles to satisfy boundary constraints

Description Usage Arguments Value Author(s) See Also Examples

Description

Byte based crossover and mutation operators can generate variables out of bounds of the decision variables. This function controls if variables are between their lower and upper bounds and if not, draws random numbers between these ranges. This function directly modifies the argument doubles and does not return a value.

Usage

1
EnsureBounds(doubles, mins, maxs)

Arguments

doubles

A vector of doubles

mins

A vector of lower bounds of decision variables

maxs

A vector of upper bounds of decision variables

Value

Function directly modifies the argument doubles and does not return a result.

Author(s)

Mehmet Hakan Satman - mhsatman@istanbul.edu.tr

See Also

byte_crossover

byte_mutation

mcga2

Examples

1
2
3
4
5
6
7
8
9
set.seed(1234)
x <- runif(10)
print(x)
# [1] 0.113703411 0.622299405 0.609274733 0.623379442 0.860915384 0.640310605
# [7] 0.009495756 0.232550506 0.666083758 0.514251141
EnsureBounds(x, mins=rep(0,10), maxs=rep(0.2,10))
print(x)
# [1] 0.113703411 0.138718258 0.108994967 0.056546717 0.184686697 0.058463168
# [7] 0.009495756 0.167459126 0.057244657 0.053364156


Search within the mcga package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.