opytimizer.optimizers.swarm.bwo

Black Widow Optimization.

class opytimizer.optimizers.swarm.bwo.BWO(params: Optional[Dict[str, Any]] = None)

A BWO class, inherited from Optimizer.

This is the designed class to define BWO-related variables and methods.

References

V. Hayyolalam and A. Kazem. Black Widow Optimization Algorithm: A novel meta-heuristic approach for solving engineering optimization problems. Engineering Applications of Artificial Intelligence (2020).

__init__(params: Optional[Dict[str, Any]] = None) → None

Initialization method.

Parameters:params – Contains key-value parameters to the meta-heuristics.
pp

Procreating rate.

cr

Cannibalism rate.

pm

Mutation rate.

_procreating(x1: opytimizer.core.agent.Agent, x2: opytimizer.core.agent.Agent) → Tuple[opytimizer.core.agent.Agent, opytimizer.core.agent.Agent]

Procreates a pair of parents into offsprings (eq. 1).

Parameters:
  • x1 – Father to produce the offsprings.
  • x2 – Mother to produce the offsprings.
Returns:

Two generated offsprings based on parents.

Return type:

(Tuple[Agent, Agent])

_mutation(alpha: opytimizer.core.agent.Agent) → opytimizer.core.agent.Agent

Performs the mutation over an offspring (s. 3.4).

Parameters:alpha – Offspring to be mutated.
Returns:The mutated offspring.
Return type:(Agent)
update(space: opytimizer.core.space.Space, function: opytimizer.core.function.Function) → None

Wraps Black Widow 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.