SMPSO¶
SMPSO (Speed-constrained Multi-objective PSO) is a particle swarm optimization algorithm that bounds the particle velocity to avoid the swarm diverging, and uses a crowding-distance-based external archive of leaders.
from jmetal.algorithm.multiobjective.smpso import SMPSO
from jmetal.operator.mutation import PolynomialMutation
from jmetal.problem import ZDT3
from jmetal.util.archive import CrowdingDistanceArchive
from jmetal.util.solution import (
print_function_values_to_file,
print_variables_to_file,
)
from jmetal.util.termination_criterion import StoppingByEvaluations
if __name__ == "__main__":
problem = ZDT3()
max_evaluations = 25000
algorithm = SMPSO(
problem=problem,
swarm_size=100,
mutation=PolynomialMutation(
probability=1.0 / problem.number_of_variables(), distribution_index=20
),
leaders=CrowdingDistanceArchive(100),
termination_criterion=StoppingByEvaluations(max_evaluations=max_evaluations),
)
algorithm.run()
front = algorithm.result()
# Save results to file
print_function_values_to_file(front, "FUN." + algorithm.label)
print_variables_to_file(front, "VAR." + algorithm.label)
print(f"Algorithm: {algorithm.get_name()}")
print(f"Problem: {problem.name()}")
print(f"Computing time: {algorithm.total_computing_time}")
examples/multiobjective/smpso/ also has dynamic, preference-based (SMPSO/RP), and Spark
evaluator variants.