Skip to content

Commit

Permalink
Update test case for cec 2020
Browse files Browse the repository at this point in the history
  • Loading branch information
thieu1995 committed Sep 22, 2020
1 parent d80a76a commit a66e00e
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions opfunu/cec/cec2020/test.py → examples/test_cec2020.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
#!/usr/bin/env python
# ------------------------------------------------------------------------------------------------------%
# Created by "Thieu Nguyen" at 14:37, 20/09/2020 %
# Created by "Thieu Nguyen" at 11:19, 22/09/2020 %
# %
# Email: [email protected] %
# Homepage: https://www.researchgate.net/profile/Thieu_Nguyen6 %
# Github: https://github.com/thieunguyen5991 %
#-------------------------------------------------------------------------------------------------------%
# -------------------------------------------------------------------------------------------------------%

from opfunu.cec.cec2020.constant import benchmark_function as BF
from opfunu.cec.cec2020 import engineering
from numpy.random import uniform

for i in range(1, 26):
out = BF(i) # Get object contain information about problems
out = BF(i) # Get object contain information about problems
D, g, h, xmin, xmax = out["D"], out["g"], out["h"], out["xmin"], out["xmax"]

solution = uniform(xmin, xmax) ## Create solution based on information above
problem = "p" + str(i) ## Choice the problem
fx, gx, hx = getattr(engineering, problem)(solution) ## Fitness function, constraint
solution = uniform(xmin, xmax) ## Create solution based on information above
problem = "p" + str(i) ## Choice the problem
fx, gx, hx = getattr(engineering, problem)(solution) ## Fitness function, constraint
print("\n==============" + problem + "=================")
print("fx:", fx)
print("gx:", gx)
print("hx:", hx)
print("hx:", hx)

0 comments on commit a66e00e

Please sign in to comment.