Learn R Programming

LHD (version 1.4.1)

GA: Genetic Algorithm for LHD

Description

GA returns a n by k LHD matrix generated by genetic algorithm (GA)

Usage

GA(
  n,
  k,
  m = 10,
  N = 10,
  pmut = 1/(k - 1),
  OC = "phi_p",
  p = 15,
  q = 1,
  maxtime = 5
)

Value

If all inputs are logical, then the output will be a n by k LHD.

Arguments

n

A positive integer, which stands for the number of rows (or run size).

k

A positive integer, which stands for the number of columns (or factor size).

m

A positive even integer, which stands for the population size and it must be an even number. The default is set to be 10. A large value of m will result a high CPU time, and it is recommended to be no greater than 100.

N

A positive integer, which stands for the number of iterations. The default is set to be 10. A large value of N will result a high CPU time, and it is recommended to be no greater than 500.

pmut

A probability, which stands for the probability of mutation. The default is set to be 1/(k - 1).

OC

An optimality criterion. The default setting is "phi_p", and it could be one of the following: "phi_p", "AvgAbsCor", "MaxAbsCor", "MaxProCriterion".

p

A positive integer, which is the parameter in the phi_p formula, and p is prefered to be large. The default is set to be 15.

q

The default is set to be 1, and it could be either 1 or 2. If q is 1, dij is the Manhattan (rectangular) distance. If q is 2, dij is the Euclidean distance.

maxtime

A positive number, which indicates the expected maximum CPU time given by user, and it is measured by minutes. For example, maxtime=3.5 indicates the CPU time will be no greater than three and half minutes. The default is set to be 5.

References

Liefvendahl, M., and Stocki, R. (2006) A study on algorithms for optimization of Latin hypercubes. Journal of Statistical Planning and Inference, 136, 3231-3247.

Examples

Run this code
#generate a 5 by 3 maximin distance LHD with the default setting
try=GA(n=5,k=3)
try
phi_p(try)   #calculate the phi_p of "try".

#Another example
#generate a 8 by 4 nearly orthogonal LHD
try2=GA(n=8,k=4,OC="AvgAbsCor")
try2
AvgAbsCor(try2)  #calculate the average absolute correlation.

Run the code above in your browser using DataLab