AI-ParticleSwarmOptimization-Pmap
view release on metacpan or search on metacpan
my $pso = AI::ParticleSwarmOptimization::Pmap->new(
-fitFunc => [\&calcFit, $context],
-dimensions => 3,
);
...
sub calcFit {
my ($context, @values) = @_;
...
return $fitness;
}
In addition to any user provided parameters the list of values
representing the current particle position in the hyperspace is
passed in. There is one value per hyperspace dimension.
-inertia: positive or zero number, optional
Determines what proportion of the previous velocity is carried
forward to the next iteration. Defaults to 0.9
See also -meWeight and -themWeight.
-iterations: number, optional
Number of optimization iterations to perform. Defaults to 1000.
-meWeight: number, optional
Coefficient determining the influence of the current local best
position on the next iterations velocity. Defaults to 0.5.
See also -inertia and -themWeight.
-numNeighbors: positive number, optional
Number of local particles considered to be part of the
neighbourhood of the current particle. Defaults to the square root
of the total number of particles.
-numParticles: positive number, optional
Number of particles in the swarm. Defaults to 10 times the number
of dimensions.
-posMax: number, optional
Maximum coordinate value for any dimension in the hyper space.
Defaults to 100.
-posMin: number, optional
Minimum coordinate value for any dimension in the hyper space.
Defaults to --posMax (if -posMax is negative -posMin should be set
more negative).
-randSeed: number, optional
Seed for the random number generator. Useful if you want to rerun
an optimization, perhaps for benchmarking or test purposes.
-randStartVelocity: boolean, optional
Set true to initialize particles with a random velocity. Otherwise
particle velocity is set to 0 on initalization.
A range based on 1/100th of --posMax - -posMin is used for the
initial speed in each dimension of the velocity vector if a random
start velocity is used.
-stallSpeed: positive number, optional
Speed below which a particle is considered to be stalled and is
repositioned to a new random location with a new initial speed.
By default -stallSpeed is undefined but particles with a speed of 0
will be repositioned.
-themWeight: number, optional
Coefficient determining the influence of the neighbourhod best
position on the next iterations velocity. Defaults to 0.5.
See also -inertia and -meWeight.
-exitPlateau: boolean, optional
Set true to have the optimization check for plateaus (regions where
the fit hasn't improved much for a while) during the search. The
optimization ends when a suitable plateau is detected following the
burn in period.
Defaults to undefined (option disabled).
-exitPlateauDP: number, optional
Specify the number of decimal places to compare between the current
fitness function value and the mean of the previous
-exitPlateauWindow values.
Defaults to 10.
-exitPlateauWindow: number, optional
Specify the size of the window used to calculate the mean for
comparison to the current output of the fitness function.
Correlates to the minimum size of a plateau needed to end the
optimization.
Defaults to 10% of the number of iterations (-iterations).
-exitPlateauBurnin: number, optional
Determines how many iterations to run before checking for plateaus.
Defaults to 50% of the number of iterations (-iterations).
-verbose: flags, optional
If set to a non-zero value -verbose determines the level of
( run in 0.756 second using v1.01-cache-2.11-cpan-677af5a14d3 )