mealpy.system_based package¶
mealpy.system_based.AEO module¶
- class mealpy.system_based.AEO.AugmentedAEO(epoch: int = 10000, pop_size: int = 100, **kwargs: object)[source]¶
Bases:
mealpy.optimizer.Optimizer
The original version of: Augmented Artificial Ecosystem Optimization (AAEO)
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 import FloatVar, AEO >>> >>> def objective_function(solution): >>> return np.sum(solution**2) >>> >>> problem_dict = { >>> "bounds": FloatVar(n_vars=30, lb=(-10.,) * 30, ub=(10.,) * 30, name="delta"), >>> "minmax": "min", >>> "obj_func": objective_function >>> } >>> >>> model = AEO.AugmentedAEO(epoch=1000, pop_size=50) >>> g_best = model.solve(problem_dict) >>> print(f"Solution: {g_best.solution}, Fitness: {g_best.target.fitness}") >>> print(f"Solution: {model.g_best.solution}, Fitness: {model.g_best.target.fitness}")
References
[1] Van Thieu, N., Barma, S. D., Van Lam, T., Kisi, O., & Mahesha, A. (2022). Groundwater level modeling using Augmented Artificial Ecosystem Optimization. Journal of Hydrology, 129034.
- class mealpy.system_based.AEO.EnhancedAEO(epoch: int = 10000, pop_size: int = 100, **kwargs: object)[source]¶
Bases:
mealpy.optimizer.Optimizer
The original version of: Enhanced Artificial Ecosystem-Based Optimization (EAEO)
Examples
>>> import numpy as np >>> from mealpy import FloatVar, AEO >>> >>> def objective_function(solution): >>> return np.sum(solution**2) >>> >>> problem_dict = { >>> "bounds": FloatVar(n_vars=30, lb=(-10.,) * 30, ub=(10.,) * 30, name="delta"), >>> "minmax": "min", >>> "obj_func": objective_function >>> } >>> >>> model = AEO.EnhancedAEO(epoch=1000, pop_size=50) >>> g_best = model.solve(problem_dict) >>> print(f"Solution: {g_best.solution}, Fitness: {g_best.target.fitness}") >>> print(f"Solution: {model.g_best.solution}, Fitness: {model.g_best.target.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.
- class mealpy.system_based.AEO.ImprovedAEO(epoch: int = 10000, pop_size: int = 100, **kwargs: object)[source]¶
Bases:
mealpy.system_based.AEO.OriginalAEO
The original version of: Improved Artificial Ecosystem-based Optimization (ImprovedAEO)
Examples
>>> import numpy as np >>> from mealpy import FloatVar, AEO >>> >>> def objective_function(solution): >>> return np.sum(solution**2) >>> >>> problem_dict = { >>> "bounds": FloatVar(n_vars=30, lb=(-10.,) * 30, ub=(10.,) * 30, name="delta"), >>> "minmax": "min", >>> "obj_func": objective_function >>> } >>> >>> model = AEO.ImprovedAEO(epoch=1000, pop_size=50) >>> g_best = model.solve(problem_dict) >>> print(f"Solution: {g_best.solution}, Fitness: {g_best.target.fitness}") >>> print(f"Solution: {model.g_best.solution}, Fitness: {model.g_best.target.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.
- class mealpy.system_based.AEO.ModifiedAEO(epoch: int = 10000, pop_size: int = 100, **kwargs: object)[source]¶
Bases:
mealpy.optimizer.Optimizer
The original version of: Modified Artificial Ecosystem-Based Optimization (MAEO)
Examples
>>> import numpy as np >>> from mealpy import FloatVar, AEO >>> >>> def objective_function(solution): >>> return np.sum(solution**2) >>> >>> problem_dict = { >>> "bounds": FloatVar(n_vars=30, lb=(-10.,) * 30, ub=(10.,) * 30, name="delta"), >>> "minmax": "min", >>> "obj_func": objective_function >>> } >>> >>> model = AEO.ModifiedAEO(epoch=1000, pop_size=50) >>> g_best = model.solve(problem_dict) >>> print(f"Solution: {g_best.solution}, Fitness: {g_best.target.fitness}") >>> print(f"Solution: {model.g_best.solution}, Fitness: {model.g_best.target.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.
- class mealpy.system_based.AEO.OriginalAEO(epoch: int = 10000, pop_size: int = 100, **kwargs: object)[source]¶
Bases:
mealpy.optimizer.Optimizer
The original version of: Artificial Ecosystem-based Optimization (AEO)
- Links:
Examples
>>> import numpy as np >>> from mealpy import FloatVar, AEO >>> >>> def objective_function(solution): >>> return np.sum(solution**2) >>> >>> problem_dict = { >>> "bounds": FloatVar(n_vars=30, lb=(-10.,) * 30, ub=(10.,) * 30, name="delta"), >>> "minmax": "min", >>> "obj_func": objective_function >>> } >>> >>> model = AEO.OriginalAEO(epoch=1000, pop_size=50) >>> g_best = model.solve(problem_dict) >>> print(f"Solution: {g_best.solution}, Fitness: {g_best.target.fitness}") >>> print(f"Solution: {model.g_best.solution}, Fitness: {model.g_best.target.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.
mealpy.system_based.GCO module¶
- class mealpy.system_based.GCO.DevGCO(epoch: int = 10000, pop_size: int = 100, cr: float = 0.7, wf: float = 1.25, **kwargs: object)[source]¶
Bases:
mealpy.optimizer.Optimizer
The developed version: Germinal Center Optimization (GCO)
Notes
The global best solution and 2 random solutions are used instead of randomizing 3 solutions
- Hyper-parameters should fine-tune in approximate range to get faster convergence 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 import FloatVar, GCO >>> >>> def objective_function(solution): >>> return np.sum(solution**2) >>> >>> problem_dict = { >>> "bounds": FloatVar(n_vars=30, lb=(-10.,) * 30, ub=(10.,) * 30, name="delta"), >>> "minmax": "min", >>> "obj_func": objective_function >>> } >>> >>> model = GCO.DevGCO(epoch=1000, pop_size=50, cr = 0.7, wf = 1.25) >>> g_best = model.solve(problem_dict) >>> print(f"Solution: {g_best.solution}, Fitness: {g_best.target.fitness}") >>> print(f"Solution: {model.g_best.solution}, Fitness: {model.g_best.target.fitness}")
- class mealpy.system_based.GCO.OriginalGCO(epoch: int = 10000, pop_size: int = 100, cr: float = 0.7, wf: float = 1.25, **kwargs: object)[source]¶
Bases:
mealpy.system_based.GCO.DevGCO
The original version of: Germinal Center Optimization (GCO)
- Links:
- Hyper-parameters should fine-tune in approximate range to get faster convergence 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 import FloatVar, GCO >>> >>> def objective_function(solution): >>> return np.sum(solution**2) >>> >>> problem_dict = { >>> "bounds": FloatVar(n_vars=30, lb=(-10.,) * 30, ub=(10.,) * 30, name="delta"), >>> "minmax": "min", >>> "obj_func": objective_function >>> } >>> >>> model = GCO.OriginalGCO(epoch=1000, pop_size=50, cr = 0.7, wf = 1.25) >>> g_best = model.solve(problem_dict) >>> print(f"Solution: {g_best.solution}, Fitness: {g_best.target.fitness}") >>> print(f"Solution: {model.g_best.solution}, Fitness: {model.g_best.target.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.
mealpy.system_based.WCA module¶
- class mealpy.system_based.WCA.OriginalWCA(epoch: int = 10000, pop_size: int = 100, nsr: int = 4, wc: float = 2.0, dmax: float = 1e-06, **kwargs: object)[source]¶
Bases:
mealpy.optimizer.Optimizer
The original version of: Water Cycle Algorithm (WCA)
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-tune in approximate range to get faster convergence toward the global optimum:
nsr (int): [4, 10], Number of rivers + sea (sea = 1), default = 4
wc (float): [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 import FloatVar, WCA >>> >>> def objective_function(solution): >>> return np.sum(solution**2) >>> >>> problem_dict = { >>> "bounds": FloatVar(n_vars=30, lb=(-10.,) * 30, ub=(10.,) * 30, name="delta"), >>> "minmax": "min", >>> "obj_func": objective_function >>> } >>> >>> model = WCA.OriginalWCA(epoch=1000, pop_size=50, nsr = 4, wc = 2.0, dmax = 1e-6) >>> g_best = model.solve(problem_dict) >>> print(f"Solution: {g_best.solution}, Fitness: {g_best.target.fitness}") >>> print(f"Solution: {model.g_best.solution}, Fitness: {model.g_best.target.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.