MetaheuristicsHelper Module

Implements metaheuristic optimization algorithms and related utilities.

HMB.MetaheuristicsHelper.MantaRayForagingOptimizer(X, Fs, Ps, D, lb, ub, t, T, fitnessFunction=None, spiral=True, spiralConstant=2.0, explorationProb=0.5, customUpdate=None)[source]

Perform one iteration of the Manta Ray Foraging Optimization (MRFO) algorithm with dynamic options.

Parameters:
  • X (numpy.ndarray) – Current population of candidate solutions (shape: [Ps, D]).

  • Fs (list or numpy.ndarray) – Fitness values for each candidate in X.

  • Ps (int) – Population size.

  • D (int) – Number of dimensions.

  • lb (numpy.ndarray) – Lower bounds for each dimension.

  • ub (numpy.ndarray) – Upper bounds for each dimension.

  • t (int) – Current iteration number.

  • T (int) – Total number of iterations.

  • fitnessFunction (callable) – Function to evaluate fitness of a candidate.

  • spiral (bool, optional) – Whether to use spiral foraging phase. Default is True.

  • spiralConstant (float, optional) – Spiral constant for spiral foraging phase. Default is 2.0.

  • explorationProb (float, optional) – Probability of exploration phase. Default is 0.5.

  • customUpdate (callable, optional) – Custom update function with signature (i, X, newX, bestSolution, r, alpha, beta, coef, lb, ub, D, t, T) -> np.ndarray.

Returns:

(newX, bestSolution, bestFitness)
  • newX (numpy.ndarray): Updated population after this iteration.

  • bestSolution (numpy.ndarray): Best solution found so far.

  • bestFitness (float): Fitness value of the best solution.

Return type:

tuple