metaheuristic_designer.strategies.classic.hill_climb module#
Hill Climbing strategy (single-solution, greedy local improvement).
- class HillClimb(initializer, operator=None, survivor_sel=None, params=None, name='HillClimb', rng=None, **kwargs)[source]#
Bases:
SingleSolutionStrategyHill Climbing algorithm.
A single solution is perturbed each iteration. If the new solution is better, it replaces the current one. By default, the survivor selection is set to one-to-one competition (
"hill_climb"in the survivor registry).- Parameters:
- initializerInitializer
Population initializer (typically creates a single individual).
- operatorOperator, optional
Perturbation operator. Defaults to
NullOperator.- survivor_selSurvivorSelection, optional
Survivor selection method; defaults to
"hill_climb".- paramsdict, optional
Additional parameters stored as schedulable values.
- namestr, optional
Display name (default
"HillClimb").- rngRNGLike, optional
Random number generator.
- **kwargs
Forwarded to
SearchStrategy.
- Attributes:
paramsAccess parameter values by attribute-style lookup.
population_sizeGets the amount of individuals in the population.
- Parameters:
initializer (Initializer)
operator (Optional[Operator])
survivor_sel (Optional[SurvivorSelection])
params (Optional[dict])
name (str)
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