Cross-entropy method: Difference between revisions

Content deleted Content added
Bderrett (talk | contribs)
m Improve pseudo-code formatting
Line 55:
 
===Pseudo-code===
1. mu:=-6; sigma2:=100; t:=0; maxits=100; // Initialize parameters
mu:=-6
2. N:=100; Ne:=10; //
sigma2:=100
3. while t < maxits and sigma2 > epsilon // While maxits not exceeded and not converged
t:=0
4. X = SampleGaussian(mu,sigma2,N); // Obtain N samples from current sampling distribution
maxits:=100
5. S = exp(-(X-2)^2) + 0.8 exp(-(X+2)^2); // Evaluate objective function at sampled points
N:=100
6. X = sort(X,S); // Sort X by objective function values (in descending order)
Ne:=10
7. mu = mean(X(1:Ne)); sigma2=var(X(1:Ne)); // Update parameters of sampling distribution
3. while t < maxits and sigma2 > epsilon // While maxits not exceeded and not converged
8. t = t+1; // Increment iteration counter
'''while''' t < maxits and sigma2 > epsilon
9. return mu // Return mean of final sampling distribution as solution
4. X = SampleGaussian(mu,sigma2,N); // Obtain N samples from current sampling distribution
X:=SampleGaussian(mu,sigma2,N)
5. S = exp(-(X-2)^2) + 0.8 exp(-(X+2)^2); // Evaluate objective function at sampled points
S:=exp(-(X-2)^2) + 0.8 exp(-(X+2)^2)
6. X = sort(X,S); // Sort X by objective function values (in descending order)
X:=sort(X,S)
7. mu = mean(X(1:Ne)); sigma2=var(X(1:Ne)); // Update parameters of sampling distribution
mu:=mean(X(1:Ne))
sigma2:=var(X(1:Ne))
t:=t+1
9. return mu // Return mean of final sampling distribution as solution
2.'''return''' mu N:=100; Ne:=10; //
 
==Related methods==