saealib.PSO#

class saealib.PSO(w=0.7, c1=1.5, c2=1.5, v_max=None)[ソース]#

ベースクラス: AskTellAlgorithm

Particle Swarm Optimization (PSO) for single-objective problems.

The global best (leader) is selected from the personal bests of all particles using ctx.comparator, so the ranking adapts automatically to any single-objective Comparator.

Multi-objective PSO (MOPSO) requires a dedicated subclass with a separate Pareto archive for leader selection.

パラメータ:
  • w (float)

  • c1 (float)

  • c2 (float)

  • v_max (float | None)

w#

Inertia weight.

Type:

float

c1#

Cognitive coefficient (personal best attraction).

Type:

float

c2#

Social coefficient (global best attraction).

Type:

float

v_max#

Maximum velocity magnitude per dimension. None disables clamping.

Type:

float or None

参照

[38]: Kennedy, J., & Eberhart, R. (1995). Particle swarm optimization. Proceedings of the IEEE International Conference on Neural Networks (ICNN), 4, 1942-1948.

[39]: Shi, Y., & Eberhart, R. (1998). A modified particle swarm optimizer. Proceedings of the IEEE International Conference on Evolutionary Computation (ICEC), 69-73. (Introduces the inertia weight w used here.)

Methods

__init__

Initialize PSO.

ask

Update particle velocities and positions.

contract

Return the PSO contract with comparator-backed feedback.

create_pareto_archive

Create a ParetoArchive with the correct direction for the problem.

get_required_attrs

Return PSO-specific attributes required by the Population.

tell

Update the population and personal bests from evaluated offspring.

Method Details

PSO.__init__(w=0.7, c1=1.5, c2=1.5, v_max=None)[ソース]#

Initialize PSO.

パラメータ:
  • w (float, optional) -- Inertia weight. Defaults to 0.7.

  • c1 (float, optional) -- Cognitive coefficient. Defaults to 1.5.

  • c2 (float, optional) -- Social coefficient. Defaults to 1.5.

  • v_max (float or None, optional) -- Maximum velocity per dimension. Defaults to None (no clamping).

PSO.ask(request, state)[ソース]#

Update particle velocities and positions.

パラメータ:
  • request (ProposalRequest) -- Request-specific offspring count; PSO uses its population size.

  • state (StateView) -- Read-only algorithm state view.

戻り値:

Candidates with updated x and velocity.

戻り値の型:

ProposalBatch

PSO.contract()[ソース]#

Return the PSO contract with comparator-backed feedback.

戻り値の型:

ComponentContract

PSO.create_pareto_archive(attrs, init_capacity, problem)#

Create a ParetoArchive with the correct direction for the problem.

パラメータ:
戻り値の型:

ParetoArchive

PSO.get_required_attrs(problem)[ソース]#

Return PSO-specific attributes required by the Population.

パラメータ:

problem (Problem) -- The Problem object being referenced.

戻り値:

velocity, pbest_x, pbest_f, and pbest_cv attributes.

戻り値の型:

list[PopulationAttribute]

PSO.tell(feedback, state)[ソース]#

Update the population and personal bests from evaluated offspring.

パラメータ:
  • feedback (FeedbackBatch) -- Feedback delivered for the current proposal.

  • state (StateView) -- Read-only algorithm state view.

戻り値の型:

StatePatch