opytimizer.optimizers.swarm.abo

Artificial Butterfly Optimization.

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

An ABO class, inherited from Optimizer.

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

References

X. Qi, Y. Zhu and H. Zhang. A new meta-heuristic butterfly-inspired algorithm. Journal of Computational Science (2017).

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

Initialization method.

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

Ratio of sunspot butterflies.

a

Free flight constant.

_flight_mode(agent: opytimizer.core.agent.Agent, neighbour: opytimizer.core.agent.Agent, function: opytimizer.core.function.Function) → Tuple[opytimizer.core.agent.Agent, bool]

Flies to a new location according to the flight mode (eq. 1).

Parameters:
  • agent – Current agent.
  • neighbour – Selected neigbour.
  • function – A Function object that will be used as the objective function.
Returns:

Current agent or an agent with updated position, along with a boolean that indicates whether agent is better or not than current one.

Return type:

(Tuple[Agent, bool])

update(space: opytimizer.core.space.Space, function: opytimizer.core.function.Function, iteration: int, n_iterations: int) → None

Wraps Artificial Butterfly 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.