mealpy.system_based package

mealpy.system_based.AEO

class mealpy.system_based.AEO.AdaptiveAEO(problem, epoch=10000, pop_size=100, **kwargs)[source]

Bases: mealpy.optimizer.Optimizer

The original version of: Adaptive Artificial Ecosystem Optimization (AAEO)

Links:
  1. https://doi.org/10.1109/ACCESS.2020.2973351

Notes

  • Used linear weight factor reduce from 2 to 0 through time

  • Applied Levy-flight technique and the global best solution

Examples

>>> import numpy as np
>>> from mealpy.system_based.AEO import AdaptiveAEO
>>>
>>> def fitness_function(solution):
>>>     return np.sum(solution**2)
>>>
>>> problem_dict1 = {
>>>     "fit_func": fitness_function,
>>>     "lb": [-10, -15, -4, -2, -8],
>>>     "ub": [10, 15, 12, 8, 20],
>>>     "minmax": "min",
>>>     "verbose": True,
>>> }
>>>
>>> epoch = 1000
>>> pop_size = 50
>>> model = AdaptiveAEO(problem_dict1, epoch, pop_size)
>>> best_position, best_fitness = model.solve()
>>> print(f"Solution: {best_position}, Fitness: {best_fitness}")

References

[1] Under Review

evolve(epoch)[source]

The main operations (equations) of algorithm. Inherit from Optimizer class

Parameters

epoch (int) – The current iteration

class mealpy.system_based.AEO.EnhancedAEO(problem, epoch=10000, pop_size=100, **kwargs)[source]

Bases: mealpy.optimizer.Optimizer

The original version of: Enhanced Artificial Ecosystem-Based Optimization (EAEO)

Links:
  1. https://doi.org/10.1109/ACCESS.2020.3027654

Examples

>>> import numpy as np
>>> from mealpy.system_based.AEO import EnhancedAEO
>>>
>>> def fitness_function(solution):
>>>     return np.sum(solution**2)
>>>
>>> problem_dict1 = {
>>>     "fit_func": fitness_function,
>>>     "lb": [-10, -15, -4, -2, -8],
>>>     "ub": [10, 15, 12, 8, 20],
>>>     "minmax": "min",
>>>     "verbose": True,
>>> }
>>>
>>> epoch = 1000
>>> pop_size = 50
>>> model = EnhancedAEO(problem_dict1, epoch, pop_size)
>>> best_position, best_fitness = model.solve()
>>> print(f"Solution: {best_position}, Fitness: {best_fitness}")

References

[1] Eid, A., Kamel, S., Korashy, A. and Khurshaid, T., 2020. An enhanced artificial ecosystem-based optimization for optimal allocation of multiple distributed generations. IEEE Access, 8, pp.178493-178513.

evolve(epoch)[source]

The main operations (equations) of algorithm. Inherit from Optimizer class

Parameters

epoch (int) – The current iteration

class mealpy.system_based.AEO.IAEO(problem, epoch=10000, pop_size=100, **kwargs)[source]

Bases: mealpy.system_based.AEO.OriginalAEO

The original version of: Improved Artificial Ecosystem-based Optimization (IAEO)

Links:
  1. https://doi.org/10.1016/j.ijhydene.2020.06.256

Examples

>>> import numpy as np
>>> from mealpy.system_based.AEO import IAEO
>>>
>>> def fitness_function(solution):
>>>     return np.sum(solution**2)
>>>
>>> problem_dict1 = {
>>>     "fit_func": fitness_function,
>>>     "lb": [-10, -15, -4, -2, -8],
>>>     "ub": [10, 15, 12, 8, 20],
>>>     "minmax": "min",
>>>     "verbose": True,
>>> }
>>>
>>> epoch = 1000
>>> pop_size = 50
>>> model = IAEO(problem_dict1, epoch, pop_size)
>>> best_position, best_fitness = model.solve()
>>> print(f"Solution: {best_position}, Fitness: {best_fitness}")

References

[1] Rizk-Allah, R.M. and El-Fergany, A.A., 2021. Artificial ecosystem optimizer for parameters identification of proton exchange membrane fuel cells model. International Journal of Hydrogen Energy, 46(75), pp.37612-37627.

evolve(epoch)[source]

The main operations (equations) of algorithm. Inherit from Optimizer class

Parameters

epoch (int) – The current iteration

class mealpy.system_based.AEO.ModifiedAEO(problem, epoch=10000, pop_size=100, **kwargs)[source]

Bases: mealpy.optimizer.Optimizer

The original version of: Modified Artificial Ecosystem-Based Optimization (MAEO)

Links:
  1. https://doi.org/10.1109/ACCESS.2020.2973351

Examples

>>> import numpy as np
>>> from mealpy.system_based.AEO import ModifiedAEO
>>>
>>> def fitness_function(solution):
>>>     return np.sum(solution**2)
>>>
>>> problem_dict1 = {
>>>     "fit_func": fitness_function,
>>>     "lb": [-10, -15, -4, -2, -8],
>>>     "ub": [10, 15, 12, 8, 20],
>>>     "minmax": "min",
>>>     "verbose": True,
>>> }
>>>
>>> epoch = 1000
>>> pop_size = 50
>>> model = ModifiedAEO(problem_dict1, epoch, pop_size)
>>> best_position, best_fitness = model.solve()
>>> print(f"Solution: {best_position}, Fitness: {best_fitness}")

References

[1] Menesy, A.S., Sultan, H.M., Korashy, A., Banakhr, F.A., Ashmawy, M.G. and Kamel, S., 2020. Effective parameter extraction of different polymer electrolyte membrane fuel cell stack models using a modified artificial ecosystem optimization algorithm. IEEE Access, 8, pp.31892-31909.

evolve(epoch)[source]

The main operations (equations) of algorithm. Inherit from Optimizer class

Parameters

epoch (int) – The current iteration

class mealpy.system_based.AEO.OriginalAEO(problem, epoch=10000, pop_size=100, **kwargs)[source]

Bases: mealpy.optimizer.Optimizer

The original version of: Artificial Ecosystem-based Optimization (AEO)

Links:
  1. https://doi.org/10.1007/s00521-019-04452-x

  2. https://www.mathworks.com/matlabcentral/fileexchange/72685-artificial-ecosystem-based-optimization-aeo

Examples

>>> import numpy as np
>>> from mealpy.system_based.AEO import OriginalAEO
>>>
>>> def fitness_function(solution):
>>>     return np.sum(solution**2)
>>>
>>> problem_dict1 = {
>>>     "fit_func": fitness_function,
>>>     "lb": [-10, -15, -4, -2, -8],
>>>     "ub": [10, 15, 12, 8, 20],
>>>     "minmax": "min",
>>>     "verbose": True,
>>> }
>>>
>>> epoch = 1000
>>> pop_size = 50
>>> model = OriginalAEO(problem_dict1, epoch, pop_size)
>>> best_position, best_fitness = model.solve()
>>> print(f"Solution: {best_position}, Fitness: {best_fitness}")

References

[1] Zhao, W., Wang, L. and Zhang, Z., 2020. Artificial ecosystem-based optimization: a novel nature-inspired meta-heuristic algorithm. Neural Computing and Applications, 32(13), pp.9383-9425.

evolve(epoch)[source]

The main operations (equations) of algorithm. Inherit from Optimizer class

Parameters

epoch (int) – The current iteration

mealpy.system_based.GCO

class mealpy.system_based.GCO.BaseGCO(problem, epoch=10000, pop_size=100, cr=0.7, wf=1.25, **kwargs)[source]

Bases: mealpy.optimizer.Optimizer

My changed version of: Germinal Center Optimization (GCO)

Notes

  • The global best solution and 2 random solutions are used instead of randomizing 3 solutions

Hyper-parameters should fine tuned in approximate range to get faster convergen toward the global optimum:
  • cr (float): [0.5, 0.95], crossover rate, default = 0.7 (Same as DE algorithm)

  • wf (float): [1.0, 2.0], weighting factor (f in the paper), default = 1.25 (Same as DE algorithm)

Examples

>>> import numpy as np
>>> from mealpy.system_based.GCO import BaseGCO
>>>
>>> def fitness_function(solution):
>>>     return np.sum(solution**2)
>>>
>>> problem_dict1 = {
>>>     "fit_func": fitness_function,
>>>     "lb": [-10, -15, -4, -2, -8],
>>>     "ub": [10, 15, 12, 8, 20],
>>>     "minmax": "min",
>>>     "verbose": True,
>>> }
>>>
>>> epoch = 1000
>>> pop_size = 50
>>> cr = 0.7
>>> wf = 1.25
>>> model = BaseGCO(problem_dict1, epoch, pop_size, cr, wf)
>>> best_position, best_fitness = model.solve()
>>> print(f"Solution: {best_position}, Fitness: {best_fitness}")
evolve(epoch)[source]

The main operations (equations) of algorithm. Inherit from Optimizer class

Parameters

epoch (int) – The current iteration

class mealpy.system_based.GCO.OriginalGCO(problem, epoch=10000, pop_size=100, cr=0.7, wf=1.25, **kwargs)[source]

Bases: mealpy.system_based.GCO.BaseGCO

The original version of: Germinal Center Optimization (GCO)

Links:
  1. https://doi.org/10.2991/ijcis.2018.25905179

  2. https://www.atlantis-press.com/journals/ijcis/25905179/view

Hyper-parameters should fine tuned in approximate range to get faster convergen toward the global optimum:
  • cr (float): [0.5, 0.95], crossover rate, default = 0.7 (Same as DE algorithm)

  • wf (float): [1.0, 2.0], weighting factor (f in the paper), default = 1.25 (Same as DE algorithm)

Examples

>>> import numpy as np
>>> from mealpy.system_based.GCO import OriginalGCO
>>>
>>> def fitness_function(solution):
>>>     return np.sum(solution**2)
>>>
>>> problem_dict1 = {
>>>     "fit_func": fitness_function,
>>>     "lb": [-10, -15, -4, -2, -8],
>>>     "ub": [10, 15, 12, 8, 20],
>>>     "minmax": "min",
>>>     "verbose": True,
>>> }
>>>
>>> epoch = 1000
>>> pop_size = 50
>>> cr = 0.7
>>> wf = 1.25
>>> model = OriginalGCO(problem_dict1, epoch, pop_size, cr, wf)
>>> best_position, best_fitness = model.solve()
>>> print(f"Solution: {best_position}, Fitness: {best_fitness}")

References

[1] Villaseñor, C., Arana-Daniel, N., Alanis, A.Y., López-Franco, C. and Hernandez-Vargas, E.A., 2018. Germinal center optimization algorithm. International Journal of Computational Intelligence Systems, 12(1), p.13.

evolve(epoch)[source]

The main operations (equations) of algorithm. Inherit from Optimizer class

Parameters

epoch (int) – The current iteration

mealpy.system_based.WCA

class mealpy.system_based.WCA.BaseWCA(problem, epoch=10000, pop_size=100, nsr=4, wc=2, dmax=1e-06, **kwargs)[source]

Bases: mealpy.optimizer.Optimizer

The original version of: Water Cycle Algorithm (WCA)

Links:
  1. https://doi.org/10.1016/j.compstruc.2012.07.010

Notes

The ideas are (almost the same as ICO algorithm):
  • 1 sea is global best solution

  • a few river which are second, third, …

  • other left are stream (will flow directed to sea or river)

Hyper-parameters should fine tuned in approximate range to get faster convergen toward the global optimum:
  • nsr (int): [4, 10], Number of rivers + sea (sea = 1), default = 4

  • wc (int): [1.0, 3.0], Weighting coefficient (C in the paper), default = 2

  • dmax (float): [1e-6], fixed parameter, Evaporation condition constant, default=1e-6

Examples

>>> import numpy as np
>>> from mealpy.system_based.WCA import BaseWCA
>>>
>>> def fitness_function(solution):
>>>     return np.sum(solution**2)
>>>
>>> problem_dict1 = {
>>>     "fit_func": fitness_function,
>>>     "lb": [-10, -15, -4, -2, -8],
>>>     "ub": [10, 15, 12, 8, 20],
>>>     "minmax": "min",
>>>     "verbose": True,
>>> }
>>>
>>> epoch = 1000
>>> pop_size = 50
>>> nsr = 4
>>> wc = 2
>>> dmax = 1e-6
>>> model = BaseWCA(problem_dict1, epoch, pop_size, nsr, wc, dmax)
>>> best_position, best_fitness = model.solve()
>>> print(f"Solution: {best_position}, Fitness: {best_fitness}")

References

[1] Eskandar, H., Sadollah, A., Bahreininejad, A. and Hamdi, M., 2012. Water cycle algorithm–A novel metaheuristic optimization method for solving constrained engineering optimization problems. Computers & Structures, 110, pp.151-166.

evolve(epoch)[source]

The main operations (equations) of algorithm. Inherit from Optimizer class

Parameters

epoch (int) – The current iteration

initialization()[source]