Class PSEngine


  • public class PSEngine
    extends Object
    Particle swarm main engine.

    http://www.borgelt.net/psopt.html

    Biblio: http://ncra.ucd.ie/COMP30290/crc2006/Olapeju_Ayoola_03304281.pdf ?

    Author:
    Andrea Antonello (www.hydrologis.com)
    • Constructor Detail

      • PSEngine

        public PSEngine​(int particlesNum,
                        int maxIterations,
                        double accelerationFactorLocal,
                        double accelerationFactorGlobal,
                        double initDecelerationFactor,
                        double decayFactor,
                        IPSFunction function,
                        String prefix)
        Constructor.
        Parameters:
        particlesNum - number of particles involved.
        maxIterations - maximum iterations.
        accelerationFactorLocal - local acceleration factor for particles.
        accelerationFactorGlobal - global acceleration factor for particles.
        initDecelerationFactor - initial deceleration factor.
        decayFactor - decay factor.
        function - the fitting function to use.
        prefix - TODO
    • Method Detail

      • initializeRanges

        public void initializeRanges​(double[]... ranges)
        Set ranges for the parameter space.

        The order of the ranges needs to be the same that will be used be the particles and fitting function.

        Parameters:
        ranges - the [min, max] ranges to use.
      • run

        public void run()
                 throws Exception
        Run the particle swarm engine.
        Throws:
        Exception
      • getSolution

        public double[] getSolution()
        Getter for the found solution.
        Returns:
        the solution.
      • getSolutionFittingValue

        public double getSolutionFittingValue()
      • parametersInRange

        public static boolean parametersInRange​(double[] parameters,
                                                double[]... ranges)
        Checks if the parameters are in the ranges.
        Parameters:
        parameters - the params.
        ranges - the ranges.
        Returns:
        true, if they are inside the given ranges.