Skip to content

Commit

Permalink
Merge branch 'master' of github.com:thieu1995/mealpy
Browse files Browse the repository at this point in the history
  • Loading branch information
thieu1995 committed Mar 25, 2024
2 parents c194a4c + 6dacfb6 commit 7c08f80
Show file tree
Hide file tree
Showing 138 changed files with 222 additions and 222 deletions.
2 changes: 1 addition & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Defining the exact version will make sure things don't break
sphinx==4.4.0
sphinx_rtd_theme==1.0.0
readthedocs-sphinx-search==0.1.1
readthedocs-sphinx-search==0.3.2
numpy>=1.17.5
matplotlib==3.1.3
pandas>=1.2.0
Expand Down
2 changes: 1 addition & 1 deletion examples/utils/visualize/convergence_chart.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def fitness_function(solution):

problem = {
"fit_func": fitness_function,
"bounds": FloatVar(n_vars=8, lb=[-10, -5, -15, -20, -10, -15, -10, -30], ub=[10, 5, 15, 20, 50, 30, 100, 85]),
"bounds": FloatVar(lb=[-10, -5, -15, -20, -10, -15, -10, -30], ub=[10, 5, 15, 20, 50, 30, 100, 85]),
"minmax": "min",
"obj_weights": [0.2, 0.5, 0.3]
}
Expand Down
2 changes: 1 addition & 1 deletion examples/utils/visualize/exploration_exploitation_chart.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def fitness_function(solution):

problem = {
"fit_func": fitness_function,
"bounds": FloatVar(n_vars=8, lb=[-10, -5, -15, -20, -10, -15, -10, -30], ub=[10, 5, 15, 20, 50, 30, 100, 85]),
"bounds": FloatVar(lb=[-10, -5, -15, -20, -10, -15, -10, -30], ub=[10, 5, 15, 20, 50, 30, 100, 85]),
"minmax": "min",
"obj_weights": [0.2, 0.5, 0.3]
}
Expand Down
2 changes: 1 addition & 1 deletion examples/utils/visualize/objectives_chart.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def fitness_function(solution):

problem = {
"fit_func": fitness_function,
"bounds": FloatVar(n_vars=8, lb=[-10, -5, -15, -20, -10, -15, -10, -30], ub=[10, 5, 15, 20, 50, 30, 100, 85]),
"bounds": FloatVar(lb=[-10, -5, -15, -20, -10, -15, -10, -30], ub=[10, 5, 15, 20, 50, 30, 100, 85]),
"minmax": "min",
"obj_weights": [0.2, 0.5, 0.3]
}
Expand Down
2 changes: 1 addition & 1 deletion examples/utils/visualize/trajectory_chart.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def fitness_function(solution):

problem = {
"fit_func": fitness_function,
"bounds": FloatVar(n_vars=8, lb=[-10, -5, -15, -20, -10, -15, -10, -30], ub=[10, 5, 15, 20, 50, 30, 100, 85]),
"bounds": FloatVar(lb=[-10, -5, -15, -20, -10, -15, -10, -30], ub=[10, 5, 15, 20, 50, 30, 100, 85]),
"minmax": "min",
"obj_weights": [0.2, 0.5, 0.3],
"save_population": True
Expand Down
2 changes: 1 addition & 1 deletion mealpy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# >>> return np.sum(solution ** 2)
# >>>
# >>> p1 = {
# >>> "bounds": FloatVar(n_vars=30, lb=(-10.,) * 30, ub=(10.,) * 30, name="delta"),
# >>> "bounds": FloatVar(lb=(-10.,) * 30, ub=(10.,) * 30, name="delta"),
# >>> "minmax": "min",
# >>> "obj_func": objective_function,
# >>> "save_population": True, # To be able to draw the trajectory figure
Expand Down
4 changes: 2 additions & 2 deletions mealpy/bio_based/BBO.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class OriginalBBO(Optimizer):
>>> return np.sum(solution**2)
>>>
>>> problem_dict = {
>>> "bounds": FloatVar(n_vars=30, lb=(-10.,) * 30, ub=(10.,) * 30, name="delta"),
>>> "bounds": FloatVar(lb=(-10.,) * 30, ub=(10.,) * 30, name="delta"),
>>> "minmax": "min",
>>> "obj_func": objective_function
>>> }
Expand Down Expand Up @@ -119,7 +119,7 @@ class DevBBO(OriginalBBO):
>>> return np.sum(solution**2)
>>>
>>> problem_dict = {
>>> "bounds": FloatVar(n_vars=30, lb=(-10.,) * 30, ub=(10.,) * 30, name="delta"),
>>> "bounds": FloatVar(lb=(-10.,) * 30, ub=(10.,) * 30, name="delta"),
>>> "minmax": "min",
>>> "obj_func": objective_function
>>> }
Expand Down
2 changes: 1 addition & 1 deletion mealpy/bio_based/BBOA.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class OriginalBBOA(Optimizer):
>>> return np.sum(solution**2)
>>>
>>> problem_dict = {
>>> "bounds": FloatVar(n_vars=30, lb=(-10.,) * 30, ub=(10.,) * 30, name="delta"),
>>> "bounds": FloatVar(lb=(-10.,) * 30, ub=(10.,) * 30, name="delta"),
>>> "minmax": "min",
>>> "obj_func": objective_function
>>> }
Expand Down
2 changes: 1 addition & 1 deletion mealpy/bio_based/BMO.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class OriginalBMO(Optimizer):
>>> return np.sum(solution**2)
>>>
>>> problem_dict = {
>>> "bounds": FloatVar(n_vars=30, lb=(-10.,) * 30, ub=(10.,) * 30, name="delta"),
>>> "bounds": FloatVar(lb=(-10.,) * 30, ub=(10.,) * 30, name="delta"),
>>> "minmax": "min",
>>> "obj_func": objective_function
>>> }
Expand Down
2 changes: 1 addition & 1 deletion mealpy/bio_based/EOA.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class OriginalEOA(Optimizer):
>>> return np.sum(solution**2)
>>>
>>> problem_dict = {
>>> "bounds": FloatVar(n_vars=30, lb=(-10.,) * 30, ub=(10.,) * 30, name="delta"),
>>> "bounds": FloatVar(lb=(-10.,) * 30, ub=(10.,) * 30, name="delta"),
>>> "minmax": "min",
>>> "obj_func": objective_function
>>> }
Expand Down
2 changes: 1 addition & 1 deletion mealpy/bio_based/IWO.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class OriginalIWO(Optimizer):
>>> return np.sum(solution**2)
>>>
>>> problem_dict = {
>>> "bounds": FloatVar(n_vars=30, lb=(-10.,) * 30, ub=(10.,) * 30, name="delta"),
>>> "bounds": FloatVar(lb=(-10.,) * 30, ub=(10.,) * 30, name="delta"),
>>> "minmax": "min",
>>> "obj_func": objective_function
>>> }
Expand Down
4 changes: 2 additions & 2 deletions mealpy/bio_based/SBO.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class DevSBO(Optimizer):
>>> return np.sum(solution**2)
>>>
>>> problem_dict = {
>>> "bounds": FloatVar(n_vars=30, lb=(-10.,) * 30, ub=(10.,) * 30, name="delta"),
>>> "bounds": FloatVar(lb=(-10.,) * 30, ub=(10.,) * 30, name="delta"),
>>> "minmax": "min",
>>> "obj_func": objective_function
>>> }
Expand Down Expand Up @@ -118,7 +118,7 @@ class OriginalSBO(DevSBO):
>>> return np.sum(solution**2)
>>>
>>> problem_dict = {
>>> "bounds": FloatVar(n_vars=30, lb=(-10.,) * 30, ub=(10.,) * 30, name="delta"),
>>> "bounds": FloatVar(lb=(-10.,) * 30, ub=(10.,) * 30, name="delta"),
>>> "minmax": "min",
>>> "obj_func": objective_function
>>> }
Expand Down
4 changes: 2 additions & 2 deletions mealpy/bio_based/SMA.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class DevSMA(Optimizer):
>>> return np.sum(solution**2)
>>>
>>> problem_dict = {
>>> "bounds": FloatVar(n_vars=30, lb=(-10.,) * 30, ub=(10.,) * 30, name="delta"),
>>> "bounds": FloatVar(lb=(-10.,) * 30, ub=(10.,) * 30, name="delta"),
>>> "minmax": "min",
>>> "obj_func": objective_function
>>> }
Expand Down Expand Up @@ -123,7 +123,7 @@ class OriginalSMA(DevSMA):
>>> return np.sum(solution**2)
>>>
>>> problem_dict = {
>>> "bounds": FloatVar(n_vars=30, lb=(-10.,) * 30, ub=(10.,) * 30, name="delta"),
>>> "bounds": FloatVar(lb=(-10.,) * 30, ub=(10.,) * 30, name="delta"),
>>> "minmax": "min",
>>> "obj_func": objective_function
>>> }
Expand Down
4 changes: 2 additions & 2 deletions mealpy/bio_based/SOA.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class DevSOA(Optimizer):
>>> return np.sum(solution**2)
>>>
>>> problem_dict = {
>>> "bounds": FloatVar(n_vars=30, lb=(-10.,) * 30, ub=(10.,) * 30, name="delta"),
>>> "bounds": FloatVar(lb=(-10.,) * 30, ub=(10.,) * 30, name="delta"),
>>> "minmax": "min",
>>> "obj_func": objective_function
>>> }
Expand Down Expand Up @@ -102,7 +102,7 @@ class OriginalSOA(Optimizer):
>>> return np.sum(solution**2)
>>>
>>> problem_dict = {
>>> "bounds": FloatVar(n_vars=30, lb=(-10.,) * 30, ub=(10.,) * 30, name="delta"),
>>> "bounds": FloatVar(lb=(-10.,) * 30, ub=(10.,) * 30, name="delta"),
>>> "minmax": "min",
>>> "obj_func": objective_function
>>> }
Expand Down
2 changes: 1 addition & 1 deletion mealpy/bio_based/SOS.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class OriginalSOS(Optimizer):
>>> return np.sum(solution**2)
>>>
>>> problem_dict = {
>>> "bounds": FloatVar(n_vars=30, lb=(-10.,) * 30, ub=(10.,) * 30, name="delta"),
>>> "bounds": FloatVar(lb=(-10.,) * 30, ub=(10.,) * 30, name="delta"),
>>> "minmax": "min",
>>> "obj_func": objective_function
>>> }
Expand Down
2 changes: 1 addition & 1 deletion mealpy/bio_based/TPO.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class DevTPO(Optimizer):
>>> return np.sum(solution**2)
>>>
>>> problem_dict = {
>>> "bounds": FloatVar(n_vars=30, lb=(-10.,) * 30, ub=(10.,) * 30, name="delta"),
>>> "bounds": FloatVar(lb=(-10.,) * 30, ub=(10.,) * 30, name="delta"),
>>> "minmax": "min",
>>> "obj_func": objective_function
>>> }
Expand Down
2 changes: 1 addition & 1 deletion mealpy/bio_based/TSA.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class OriginalTSA(Optimizer):
>>> return np.sum(solution**2)
>>>
>>> problem_dict = {
>>> "bounds": FloatVar(n_vars=30, lb=(-10.,) * 30, ub=(10.,) * 30, name="delta"),
>>> "bounds": FloatVar(lb=(-10.,) * 30, ub=(10.,) * 30, name="delta"),
>>> "minmax": "min",
>>> "obj_func": objective_function
>>> }
Expand Down
4 changes: 2 additions & 2 deletions mealpy/bio_based/VCS.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class DevVCS(Optimizer):
>>> return np.sum(solution**2)
>>>
>>> problem_dict = {
>>> "bounds": FloatVar(n_vars=30, lb=(-10.,) * 30, ub=(10.,) * 30, name="delta"),
>>> "bounds": FloatVar(lb=(-10.,) * 30, ub=(10.,) * 30, name="delta"),
>>> "minmax": "min",
>>> "obj_func": objective_function
>>> }
Expand Down Expand Up @@ -157,7 +157,7 @@ class OriginalVCS(DevVCS):
>>> return np.sum(solution**2)
>>>
>>> problem_dict = {
>>> "bounds": FloatVar(n_vars=30, lb=(-10.,) * 30, ub=(10.,) * 30, name="delta"),
>>> "bounds": FloatVar(lb=(-10.,) * 30, ub=(10.,) * 30, name="delta"),
>>> "minmax": "min",
>>> "obj_func": objective_function
>>> }
Expand Down
2 changes: 1 addition & 1 deletion mealpy/bio_based/WHO.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class OriginalWHO(Optimizer):
>>> return np.sum(solution**2)
>>>
>>> problem_dict = {
>>> "bounds": FloatVar(n_vars=30, lb=(-10.,) * 30, ub=(10.,) * 30, name="delta"),
>>> "bounds": FloatVar(lb=(-10.,) * 30, ub=(10.,) * 30, name="delta"),
>>> "minmax": "min",
>>> "obj_func": objective_function
>>> }
Expand Down
4 changes: 2 additions & 2 deletions mealpy/evolutionary_based/CRO.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class OriginalCRO(Optimizer):
>>> return np.sum(solution**2)
>>>
>>> problem_dict = {
>>> "bounds": FloatVar(n_vars=30, lb=(-10.,) * 30, ub=(10.,) * 30, name="delta"),
>>> "bounds": FloatVar(lb=(-10.,) * 30, ub=(10.,) * 30, name="delta"),
>>> "minmax": "min",
>>> "obj_func": objective_function
>>> }
Expand Down Expand Up @@ -208,7 +208,7 @@ class OCRO(OriginalCRO):
>>> return np.sum(solution**2)
>>>
>>> problem_dict = {
>>> "bounds": FloatVar(n_vars=30, lb=(-10.,) * 30, ub=(10.,) * 30, name="delta"),
>>> "bounds": FloatVar(lb=(-10.,) * 30, ub=(10.,) * 30, name="delta"),
>>> "minmax": "min",
>>> "obj_func": objective_function
>>> }
Expand Down
8 changes: 4 additions & 4 deletions mealpy/evolutionary_based/DE.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class OriginalDE(Optimizer):
>>> return np.sum(solution**2)
>>>
>>> problem_dict = {
>>> "bounds": FloatVar(n_vars=30, lb=(-10.,) * 30, ub=(10.,) * 30, name="delta"),
>>> "bounds": FloatVar(lb=(-10.,) * 30, ub=(10.,) * 30, name="delta"),
>>> "minmax": "min",
>>> "obj_func": objective_function
>>> }
Expand Down Expand Up @@ -178,7 +178,7 @@ class JADE(Optimizer):
>>> return np.sum(solution**2)
>>>
>>> problem_dict = {
>>> "bounds": FloatVar(n_vars=30, lb=(-10.,) * 30, ub=(10.,) * 30, name="delta"),
>>> "bounds": FloatVar(lb=(-10.,) * 30, ub=(10.,) * 30, name="delta"),
>>> "minmax": "min",
>>> "obj_func": objective_function
>>> }
Expand Down Expand Up @@ -313,7 +313,7 @@ class SADE(Optimizer):
>>> return np.sum(solution**2)
>>>
>>> problem_dict = {
>>> "bounds": FloatVar(n_vars=30, lb=(-10.,) * 30, ub=(10.,) * 30, name="delta"),
>>> "bounds": FloatVar(lb=(-10.,) * 30, ub=(10.,) * 30, name="delta"),
>>> "minmax": "min",
>>> "obj_func": objective_function
>>> }
Expand Down Expand Up @@ -434,7 +434,7 @@ class SAP_DE(Optimizer):
>>> return np.sum(solution**2)
>>>
>>> problem_dict = {
>>> "bounds": FloatVar(n_vars=30, lb=(-10.,) * 30, ub=(10.,) * 30, name="delta"),
>>> "bounds": FloatVar(lb=(-10.,) * 30, ub=(10.,) * 30, name="delta"),
>>> "minmax": "min",
>>> "obj_func": objective_function
>>> }
Expand Down
4 changes: 2 additions & 2 deletions mealpy/evolutionary_based/EP.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class OriginalEP(Optimizer):
>>> return np.sum(solution**2)
>>>
>>> problem_dict = {
>>> "bounds": FloatVar(n_vars=30, lb=(-10.,) * 30, ub=(10.,) * 30, name="delta"),
>>> "bounds": FloatVar(lb=(-10.,) * 30, ub=(10.,) * 30, name="delta"),
>>> "minmax": "min",
>>> "obj_func": objective_function
>>> }
Expand Down Expand Up @@ -122,7 +122,7 @@ class LevyEP(OriginalEP):
>>> return np.sum(solution**2)
>>>
>>> problem_dict = {
>>> "bounds": FloatVar(n_vars=30, lb=(-10.,) * 30, ub=(10.,) * 30, name="delta"),
>>> "bounds": FloatVar(lb=(-10.,) * 30, ub=(10.,) * 30, name="delta"),
>>> "minmax": "min",
>>> "obj_func": objective_function
>>> }
Expand Down
8 changes: 4 additions & 4 deletions mealpy/evolutionary_based/ES.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class OriginalES(Optimizer):
>>> return np.sum(solution**2)
>>>
>>> problem_dict = {
>>> "bounds": FloatVar(n_vars=30, lb=(-10.,) * 30, ub=(10.,) * 30, name="delta"),
>>> "bounds": FloatVar(lb=(-10.,) * 30, ub=(10.,) * 30, name="delta"),
>>> "minmax": "min",
>>> "obj_func": objective_function
>>> }
Expand Down Expand Up @@ -110,7 +110,7 @@ class LevyES(OriginalES):
>>> return np.sum(solution**2)
>>>
>>> problem_dict = {
>>> "bounds": FloatVar(n_vars=30, lb=(-10.,) * 30, ub=(10.,) * 30, name="delta"),
>>> "bounds": FloatVar(lb=(-10.,) * 30, ub=(10.,) * 30, name="delta"),
>>> "minmax": "min",
>>> "obj_func": objective_function
>>> }
Expand Down Expand Up @@ -186,7 +186,7 @@ class CMA_ES(Optimizer):
>>> return np.sum(solution**2)
>>>
>>> problem_dict = {
>>> "bounds": FloatVar(n_vars=30, lb=(-10.,) * 30, ub=(10.,) * 30, name="delta"),
>>> "bounds": FloatVar(lb=(-10.,) * 30, ub=(10.,) * 30, name="delta"),
>>> "minmax": "min",
>>> "obj_func": objective_function
>>> }
Expand Down Expand Up @@ -307,7 +307,7 @@ class Simple_CMA_ES(Optimizer):
>>> return np.sum(solution**2)
>>>
>>> problem_dict = {
>>> "bounds": FloatVar(n_vars=30, lb=(-10.,) * 30, ub=(10.,) * 30, name="delta"),
>>> "bounds": FloatVar(lb=(-10.,) * 30, ub=(10.,) * 30, name="delta"),
>>> "minmax": "min",
>>> "obj_func": objective_function
>>> }
Expand Down
2 changes: 1 addition & 1 deletion mealpy/evolutionary_based/FPA.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class OriginalFPA(Optimizer):
>>> return np.sum(solution**2)
>>>
>>> problem_dict = {
>>> "bounds": FloatVar(n_vars=30, lb=(-10.,) * 30, ub=(10.,) * 30, name="delta"),
>>> "bounds": FloatVar(lb=(-10.,) * 30, ub=(10.,) * 30, name="delta"),
>>> "minmax": "min",
>>> "obj_func": objective_function
>>> }
Expand Down
10 changes: 5 additions & 5 deletions mealpy/evolutionary_based/GA.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class BaseGA(Optimizer):
>>> return np.sum(solution**2)
>>>
>>> problem_dict = {
>>> "bounds": FloatVar(n_vars=30, lb=(-10.,) * 30, ub=(10.,) * 30, name="delta"),
>>> "bounds": FloatVar(lb=(-10.,) * 30, ub=(10.,) * 30, name="delta"),
>>> "obj_func": objective_function,
>>> "minmax": "min",
>>> }
Expand Down Expand Up @@ -348,7 +348,7 @@ class SingleGA(BaseGA):
>>> return np.sum(solution**2)
>>>
>>> problem_dict = {
>>> "bounds": FloatVar(n_vars=30, lb=(-10.,) * 30, ub=(10.,) * 30, name="delta"),
>>> "bounds": FloatVar(lb=(-10.,) * 30, ub=(10.,) * 30, name="delta"),
>>> "obj_func": objective_function,
>>> "minmax": "min",
>>> }
Expand Down Expand Up @@ -462,7 +462,7 @@ class EliteSingleGA(SingleGA):
>>> return np.sum(solution**2)
>>>
>>> problem_dict = {
>>> "bounds": FloatVar(n_vars=30, lb=(-10.,) * 30, ub=(10.,) * 30, name="delta"),
>>> "bounds": FloatVar(lb=(-10.,) * 30, ub=(10.,) * 30, name="delta"),
>>> "obj_func": objective_function,
>>> "minmax": "min",
>>> }
Expand Down Expand Up @@ -582,7 +582,7 @@ class MultiGA(BaseGA):
>>> return np.sum(solution**2)
>>>
>>> problem_dict = {
>>> "bounds": FloatVar(n_vars=30, lb=(-10.,) * 30, ub=(10.,) * 30, name="delta"),
>>> "bounds": FloatVar(lb=(-10.,) * 30, ub=(10.,) * 30, name="delta"),
>>> "obj_func": objective_function,
>>> "minmax": "min",
>>> }
Expand Down Expand Up @@ -682,7 +682,7 @@ class EliteMultiGA(MultiGA):
>>> return np.sum(solution**2)
>>>
>>> problem_dict = {
>>> "bounds": FloatVar(n_vars=30, lb=(-10.,) * 30, ub=(10.,) * 30, name="delta"),
>>> "bounds": FloatVar(lb=(-10.,) * 30, ub=(10.,) * 30, name="delta"),
>>> "obj_func": objective_function,
>>> "minmax": "min",
>>> }
Expand Down
2 changes: 1 addition & 1 deletion mealpy/evolutionary_based/MA.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class OriginalMA(Optimizer):
>>> return np.sum(solution**2)
>>>
>>> problem_dict = {
>>> "bounds": FloatVar(n_vars=30, lb=(-10.,) * 30, ub=(10.,) * 30, name="delta"),
>>> "bounds": FloatVar(lb=(-10.,) * 30, ub=(10.,) * 30, name="delta"),
>>> "obj_func": objective_function,
>>> "minmax": "min",
>>> }
Expand Down
Loading

0 comments on commit 7c08f80

Please sign in to comment.