opytimizer.optimizers.population.hho¶
Harris Hawks Optimization.
-
class
opytimizer.optimizers.population.hho.
HHO
(params: Optional[Dict[str, Any]] = None)¶ An HHO class, inherited from Optimizer.
This is the designed class to define HHO-related variables and methods.
References
A. Heidari et al. Harris hawks optimization: Algorithm and applications. Future Generation Computer Systems (2019).
-
__init__
(params: Optional[Dict[str, Any]] = None) → None¶ Initialization method.
Parameters: params – Contains key-value parameters to the meta-heuristics.
-
_calculate_initial_coefficients
(iteration: int, n_iterations: int) → Tuple[float, float]¶ Calculates the initial coefficients, i.e., energy and jump’s strength.
Parameters: - iteration – Current iteration.
- n_iterations – Maximum number of iterations.
Returns: Absolute value of energy and jump’s strength.
Return type: (Tuple[float, float])
-
_exploration_phase
(agents: List[opytimizer.core.agent.Agent], current_agent: opytimizer.core.agent.Agent, best_agent: opytimizer.core.agent.Agent) → numpy.ndarray¶ Performs the exploration phase.
Parameters: - agents – List of agents.
- current_agent – Current agent to be updated (or not).
- best_agent – Best population’s agent.
Returns: A location vector containing the updated position.
Return type: (np.ndarray)
-
_exploitation_phase
(energy: float, jump: float, agents: List[opytimizer.core.agent.Agent], current_agent: opytimizer.core.agent.Agent, best_agent: opytimizer.core.agent.Agent, function: opytimizer.core.function.Function) → numpy.ndarray¶ Performs the exploitation phase.
Parameters: - energy – Energy coefficient.
- jump – Jump’s strength.
- agents – List of agents.
- current_agent – Current agent to be updated (or not).
- best_agent – Best population’s agent.
- function – A function object.
Returns: A location vector containing the updated position.
Return type: (np.ndarray)
-
update
(space: opytimizer.core.space.Space, function: opytimizer.core.function.Function, iteration: int, n_iterations: int) → None¶ Wraps Harris Hawks Optimization over all agents and variables.
Parameters: - space – Space containing agents and update-related information.
- function – A Function object that will be used as the objective function.
- iteration – Current iteration.
- n_iterations – Maximum number of iterations.
-