# LaPSO

From LHD v0.1.0
0th

Percentile

##### Particle Swarm Optimization for LHD

LaPSO returns a maximin distance LHD constructed by particle swarm optimization algorithm (PSO)

##### Usage
LaPSO(n, k, m, N, SameNumP, SameNumG, p0, p = 50, q = 1)
##### Arguments
n

A positive integer.

k

A positive integer.

m

A positive integer.

N

A positive integer.

A non-negative integer.

A non-negative integer.

p0

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 particles.

• N stands for the number of iterations.

• SameNumP stands for how many elements in current column of current particle LHD should be the same as corresponding Personal Best. SameNumP=0, 1, 2, ..., n, and 0 means to skip the "exchange".

• SameNumG stands for how many elements in current column of current particle LHD should be the same as corresponding Global Best. SameNumP=0, 1, 2, ..., n, and 0 means to skip the "exchange".

• SameNumP and SameNumG cannot be 0 at the same time.

• p0 stands the probability of exchange two randomly selected elements in current column of current particle LHD.

• 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.

##### Note

Here are some general suggestions about the parameters:

• SameNumP is approximately n/2 when SameNumG is 0.

• SameNumG is approximately n/4 when SameNumP is 0.

• p0 * (k - 1) = 1 or 2 is often sufficient. So p0 = 1/(k - 1) or 2/(k - 1).

##### References

Chen, R.-B., Hsieh, D.-N., Hung, Y., and Wang, W. (2013) Optimizing Latin hypercube designs by particle swarm. Stat. Comput., 23, 663-676.

• LaPSO
##### Examples
# NOT RUN {
#create a 8 by 3 maximin distance LHD, with # of particles and iterations = 10, when SameNumG is 0
tryLaPSO1
phi_p(tryLaPSO1,p=50)   #calculate the phi_p of "tryLaPSO1".

#create a 8 by 3 maximin distance LHD, with # of particles and iterations = 10, when SameNumP is 0