# GA

##### Genetic Algorithm for LHD

`GA`

returns a maximin distance LHD constructed by genetic algorithm (GA)

##### Usage

`GA(n, k, m, N, pmut, p = 50, q = 1)`

##### Arguments

- n
A positive integer.

- k
A positive integer.

- m
A positive even integer.

- N
A positive integer.

- pmut
A probability.

- p
A positive integer.

- q
The default is set to be 1, and it could be either 1 or 2.

##### Details

`n`

stands for the number of rows (or run size).`k`

stands for the number of columns (or the number of factors).`m`

stands for the number of population and it must be an even number.`N`

stands for the number of iterations.`pmut`

stands for the probability of mutation.`p`

is the parameter in the phi_p formula, and`p`

is prefered to be large.If

`q`

is 1 (the default setting),`dij`

is the rectangular distance. If`q`

is 2,`dij`

is the Euclidean distance.

##### Value

If all inputs are logical, then the output will be a `n`

by `k`

LHD.

##### 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

```
# NOT RUN {
#create a 8 by 3 maximin distance LHD, with # of population and iterations = 10,
#the probability of mutation is 1/(k-1)
tryGA1=GA(n=8,k=3,m=10,N=10,pmut=1/(3-1),p=50,q=1)
tryGA1
phi_p(tryGA1,p=50) #calculate the phi_p of "tryGA1".
#Another example with different n and k.
tryGA2=GA(n=12,k=2,m=10,N=10,pmut=1/(3-1),p=50,q=1)
tryGA2
phi_p(tryGA2,p=50) #calculate the phi_p of "tryGA2".
# }
```

*Documentation reproduced from package LHD, version 0.1.0, License: MIT + file LICENSE*