public final class ParticleSwarmOptimization extends AbstractMinimizer
GradientDescent, but for this to work we don't need to
have a derivative, it is enough to provide the cost at a certain parameter
position (theta). For additional information you can browse the wikipedia
page: Particle
swarm optimization article on Wikipedia| Constructor and Description |
|---|
ParticleSwarmOptimization(int numParticles,
double alpha,
double beta,
double phi,
int numThreads) |
| Modifier and Type | Method and Description |
|---|---|
de.jungblut.math.DoubleVector |
minimize(CostFunction f,
de.jungblut.math.DoubleVector pInput,
int maxIterations,
boolean verbose)
Minimizes the given costfunction with the starting parameter theta.
|
static de.jungblut.math.DoubleVector |
minimizeFunction(CostFunction f,
de.jungblut.math.DoubleVector pInput,
int numParticles,
double alpha,
double beta,
double phi,
int maxIterations,
int numThreads,
boolean verbose)
Minimize a function using particle swarm optimization.
|
addIterationCompletionCallback, onIterationFinishedpublic ParticleSwarmOptimization(int numParticles,
double alpha,
double beta,
double phi,
int numThreads)
public final de.jungblut.math.DoubleVector minimize(CostFunction f, de.jungblut.math.DoubleVector pInput, int maxIterations, boolean verbose)
Minimizerf - the costfunction to minimize.pInput - the starting parameters.maxIterations - the number of iterations to do.verbose - if TRUE it will print progress.public static de.jungblut.math.DoubleVector minimizeFunction(CostFunction f, de.jungblut.math.DoubleVector pInput, int numParticles, double alpha, double beta, double phi, int maxIterations, int numThreads, boolean verbose)
f - the cost function to minimize. Note that the returned gradient
will be ignored, because it is not needed in this algorithm.pInput - the initial starting point of the algorithm / particles. This
is very important to choose, since this is considered a fast
algorithm you could try out multiple starting points.numParticles - how many particles to use.alpha - personal memory weighting.beta - group memory weighting.phi - own velocity weighting (inertia).maxIterations - how many iterations this algorithm should perform.verbose - if true prints progress to STDOUT.Copyright © 2016. All rights reserved.