| Did you know ... | Search Documentation: |
| Pack logtalk -- logtalk-3.102.0/docs/apis/_sources/particle_swarm_optimization_2.rst.txt |
.. index:: single: particle_swarm_optimization(Problem,RandomAlgorithm)
.. _particle_swarm_optimization/2:
.. rst-class:: right
object
particle_swarm_optimization(Problem,RandomAlgorithm)Problem - Problem object implementing particle_swarm_optimization_protocol.RandomAlgorithm - Random number generator algorithm for the fast_random library.
Continuous bounded global-best particle swarm optimization algorithm. Parameterized by a problem object implementing the particle_swarm_optimization_protocol protocol and by a random number generator algorithm for the fast_random library. The algorithm minimizes or maximizes the fitness function defined by the problem.
| Availability:
| logtalk_load(particle_swarm_optimization(loader))
| Author: Paulo Moura | Version: 1:0:0 | Date: 2026-08-19
| Compilation flags:
| static, context_switching_calls
| Imports:
| public :ref:`options <options/0>`
| Uses:
| :ref:`fast_random(Algorithm) <fast_random/1>`
| :ref:`linear_algebra <linear_algebra/0>`
| :ref:`numberlist <numberlist/0>`
| :ref:`type <type/0>`
| Remarks:
objective(minimize|maximize) option selects the fitness ordering. Fitness values are otherwise used unchanged.target_fitness(Fitness) option stops the run when the best fitness reaches or passes the target in the selected objective direction.stagnation_iterations(N) option stops the run after N consecutive iterations without a strict global-best improvement; zero disables this condition.seed(S) option initializes the random number generator for reproducible runs.| Inherited public predicates: | Â :ref:`options_protocol/0::check_option/1` Â :ref:`options_protocol/0::check_options/1` Â :ref:`options_protocol/0::default_option/1` Â :ref:`options_protocol/0::default_options/1` Â :ref:`options_protocol/0::option/2` Â :ref:`options_protocol/0::option/3` Â :ref:`options_protocol/0::valid_option/1` Â :ref:`options_protocol/0::valid_options/1` Â
.. contents:: :local: :backlinks: top
.. index:: run/2 .. _particle_swarm_optimization/2::run/2:
run/2 ^^^^^^^^^
Runs the particle swarm optimization algorithm using default options and returns the best position and fitness found.
| Compilation flags:
| static
| Template:
| run(BestPosition,BestFitness)
| Mode and number of proofs:
| run(-list(number),-number) - one
.. index:: run/3 .. _particle_swarm_optimization/2::run/3:
run/3 ^^^^^^^^^
Runs the particle swarm optimization algorithm using the given options and returns the best position and fitness found.
| Compilation flags:
| static
| Template:
| run(BestPosition,BestFitness,Options)
| Mode and number of proofs:
| run(-list(number),-number,+list(compound)) - one
| Remarks:
objective(Objective) option: Optimization objective, either minimize or maximize (default: minimize).target_fitness(Fitness) option: Numeric target that stops the run when reached or passed in the selected objective direction (default: none).max_iterations(N) option: Maximum number of swarm iterations (default: 1000).stagnation_iterations(N) option: Number of consecutive iterations without a strict global-best improvement before stopping; zero disables this condition (default: 0).inertia_weight(W) option: Velocity inertia weight (default: 0.7298).cognitive_coefficient(C) option: Personal-best acceleration coefficient (default: 1.49618).social_coefficient(C) option: Global-best acceleration coefficient (default: 1.49618).updates(N) option: Number of progress reports during the run; zero disables reporting (default: 0).seed(S) option: Positive integer random seed for reproducible runs... index:: run/4 .. _particle_swarm_optimization/2::run/4:
run/4 ^^^^^^^^^
Runs the particle swarm optimization algorithm using the given options and returns the best position, best fitness, and run statistics.
| Compilation flags:
| static
| Template:
| run(BestPosition,BestFitness,Statistics,Options)
| Mode and number of proofs:
| run(-list(number),-number,-list(compound),+list(compound)) - one
| Remarks:
iterations(N), evaluations(E), improvements(I), final_mean_fitness(M), and final_diversity(D). Improvements are measured in the selected objective direction.(no local declarations; see entity ancestors if any)
(no local declarations; see entity ancestors if any)
(none)
.. seealso::
:ref:`particle_swarm_optimization(Problem) <particle_swarm_optimization/1>`, :ref:`particle_swarm_optimization_protocol <particle_swarm_optimization_protocol/0>`