saealib.IslandModel#

class saealib.IslandModel(optimizers=(), topology='ring', migration_interval=1, migration_size=1, *, adjacency=None)[source]#

Bases: object

Run optimizers in parallel and periodically exchange individuals.

Migration selects the best individuals from a source island using its problem comparator and overwrites the worst rows of the target population. The target rows’ existing id values are intentionally retained: an island migration is a value transfer, not a candidate-identity transfer.

Parameters:
  • optimizers (iterable of Optimizer) – Configured optimizers, one per island.

  • topology ({"ring", "fully_connected"} or array-like, optional) – Directed migration topology. An array-like value is an explicit adjacency matrix, where a true entry [source, target] enables migration in that direction.

  • migration_interval (int, optional) – Migration period in generations. Non-positive values disable migration.

  • migration_size (int, optional) – Number of individuals sent along each enabled edge.

  • adjacency (array-like, optional) – Explicit adjacency matrix, as an alternative to topology.

Methods

__init__

run

Run all islands, returning their final states.

Method Details

IslandModel.__init__(optimizers=(), topology='ring', migration_interval=1, migration_size=1, *, adjacency=None)[source]#
Parameters:
  • optimizers (Iterable[Optimizer])

  • topology (str | Iterable[Iterable[object]])

  • migration_interval (int)

  • migration_size (int)

  • adjacency (Iterable[Iterable[object]] | None)

Return type:

None

IslandModel.run()[source]#

Run all islands, returning their final states.

Return type:

tuple[OptimizationState, …]