Skip to main content
Ctrl+K

metaheuristic-designer 1.1.0 documentation

  • Quick Start
  • API reference
  • Custom components
  • Module Details
  • Simple subpackage
    • Algorithm Configuration
    • Operators and selection methods
    • Plotting Tutorial
  • Quick Start
  • API reference
  • Custom components
  • Module Details
  • Simple subpackage
  • Algorithm Configuration
  • Operators and selection methods
  • Plotting Tutorial

Section Navigation

  • metaheuristic_designer.strategies.classic.CMA_ES module
  • metaheuristic_designer.strategies.classic.DE module
  • metaheuristic_designer.strategies.classic.ES module
  • metaheuristic_designer.strategies.classic.GA module
  • metaheuristic_designer.strategies.classic.SA module
  • metaheuristic_designer.strategies.classic.hill_climb module
  • metaheuristic_designer.strategies.classic.local_search module
  • metaheuristic_designer.strategies.classic.random_search module
  • metaheuristic_designer.strategies.classic.local_search module

metaheuristic_designer.strategies.classic.local_search module#

Local Search strategy (single solution, multiple perturbations per iteration).

class LocalSearch(initializer, operator=None, survivor_sel=None, name='LocalSearch', iterations=100, rng=None, **kwargs)[source]#

Bases: PopulationBasedStrategy

Local Search algorithm.

At each iteration the current solution is duplicated iterations times, and every copy is perturbed independently. The best among the original and the perturbed copies survives. By default, the survivor selection is set to "local_search" (one parent vs. many offspring).

Parameters:
initializerInitializer

Population initializer.

operatorOperator, optional

Perturbation operator.

survivor_selSurvivorSelection, optional

Survivor selection; defaults to "local_search".

namestr, optional

Display name (default "LocalSearch").

iterationsint, optional

Number of perturbed copies per iteration (default 100).

rngRNGLike, optional

Random number generator.

**kwargs

Forwarded to SearchStrategy.

Attributes:
params

Access parameter values by attribute-style lookup.

population_size

Gets the amount of individuals in the population.

Parameters:
  • initializer (Initializer)

  • operator (Optional[Operator])

  • survivor_sel (Optional[SurvivorSelection])

  • name (str)

  • iterations (int)

  • rng (Optional[RNGLike])

Methods

extra_report()

Hook called at the end of the optimization (intended for subclasses).

extra_step_info()

Hook called after each generation (intended for subclasses).

gather_parameters()

Collect the current parameters from all sub-components.

get_params()

Return a copy of the current parameter dictionary.

get_state()

Gets the current state of the search strategy as a dictionary.

initialize(objfunc)

Initializes the optimization search strategy.

step(prev_population, objfunc)

Performs a single iteration of the algorithm on a given population.

store_kwargs([progress])

Store keyword arguments and evaluate them at the given progress.

update(progress)

Advances the state of the search by one iteration.

update_kwargs([progress])

Add or replace parameters and immediately evaluate them.

reset

On this page
  • LocalSearch
Show Source

© Copyright 2023, Eugenio Lorente-Ramos.

Created using Sphinx 8.1.3.

Built with the PyData Sphinx Theme 0.18.0.