Grasshopper Optimization Algorithm.

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

A GOA class, inherited from Optimizer.

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


S. Saremi, S. Mirjalili and A. Lewis. Grasshopper Optimisation Algorithm: Theory and application. Advances in Engineering Software (2017).

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

Initialization method.

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

Minimum comfort zone.


Maximum comfort zone.


Intensity of attraction.


Attractive length scale.

_social_force(r: numpy.ndarray) → numpy.ndarray

Calculates the social force based on an input value.

Parameters:r – Array of values.
Returns:The social force based on the input value.
Return type:(np.ndarray)
update(space: opytimizer.core.space.Space, function: opytimizer.core.function.Function, iteration: int, n_iterations: int) → None

Wraps Grasshopper Optimization Algorithm over all agents and variables.

  • 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.