Cross-entropy method: Difference between revisions

Content deleted Content added
Reverted to revision 878794178 by JCW-CleanerBot (talk): Rv citespam (TW)
Line 53:
===Pseudo-code===
// Initialize parameters
mu := -6
sigma2 := 100
t := 0
maxits := 100
N := 100
Ne := 10
// While maxits not exceeded and not converged
'''while''' t < maxits and sigma2 > epsilon
// Obtain N samples from current sampling distribution
X := SampleGaussian(mu, sigma2, N)
// Evaluate objective function at sampled points
S := exp(-(X - 2) ^ 2) + 0.8 exp(-(X + 2) ^ 2)
// Sort X by objective function values in descending order
X := sort(X, S)
// Update parameters of sampling distribution
mu := mean(X(1:Ne))
sigma2 := var(X(1:Ne))
t := t + 1
// Return mean of final sampling distribution as solution
'''return''' mu