Beispiel #1
0
#!/usr/bin/env python
# ------------------------------------------------------------------------------------------------------%
# Created by "Thieu Nguyen" at 12:51, 30/03/2020                                                        %
#                                                                                                       %
#       Email:      [email protected]                                                           %
#       Homepage:   https://www.researchgate.net/profile/Thieu_Nguyen6                                  %
#       Github:     https://github.com/thieunguyen5991                                                  %
#-------------------------------------------------------------------------------------------------------%

from opfunu.type_based.uni_modal import Functions
from mealpy.physics_based.EO import BaseEO, LevyEO

t1 = Functions()

## Setting parameters
objective_func = t1._sum_squres__
problem_size = 3000
domain_range = [-15, 15]
log = True
epoch = 100
pop_size = 50

md1 = BaseEO(objective_func, problem_size, domain_range, log, epoch, pop_size)
best_pos1, best_fit1, list_loss1 = md1._train__()
print(best_fit1)
print("========================================================")

md3 = LevyEO(objective_func, problem_size, domain_range, log, epoch, pop_size)
best_pos3, best_fit3, list_loss3 = md3._train__()
print(best_fit3)
Beispiel #2
0
#!/usr/bin/env python
# ------------------------------------------------------------------------------------------------------%
# Created by "Thieu Nguyen" at 21:02, 16/03/2020                                                        %
#                                                                                                       %
#       Email:      [email protected]                                                           %
#       Homepage:   https://www.researchgate.net/profile/Thieu_Nguyen6                                  %
#       Github:     https://github.com/thieu1995                                                  %
#-------------------------------------------------------------------------------------------------------%

from opfunu.type_based.uni_modal import Functions
ff = Functions()

PF1 = {  # paras for function 1 (PF1)
    "domain_range": [-100, 100],
    "obj_func": ff._brown__
}
PF2 = {"domain_range": [-10, 10], "obj_func": ff._chung_reynolds__}
PF3 = {"domain_range": [-100, 100], "obj_func": ff._dixon_price__}
PF4 = {"domain_range": [-100, 100], "obj_func": ff._powell_singular_2__}
PF5 = {"domain_range": [-30, 30], "obj_func": ff._powell_result__}
PF6 = {"domain_range": [-100, 100], "obj_func": ff._rosenbrock__}
PF7 = {"domain_range": [-1.28, 1.28], "obj_func": ff._rotate_ellipse__}
PF8 = {"domain_range": [-100, 100], "obj_func": ff._schwefel__}
PF9 = {"domain_range": [-1, 1], "obj_func": ff._schwefel_1_2__}

PF10 = {"domain_range": [-10, 10], "obj_func": ff._schwefel_2_20__}

PF11 = {"domain_range": [-100, 100], "obj_func": ff._schwefel_2_21__}

PF12 = {"domain_range": [-10, 10], "obj_func": ff._schwefel_2_22__}