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 May 21, 2024
2 parents da88bd3 + 81d00e5 commit 86e1f44
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 61 deletions.
56 changes: 28 additions & 28 deletions docs/source/pages/general/advances/import_all_models.rst
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ Import All Models
"pf_min": 0.,
"pf_max": 10.,
}
paras_modified_ba = {
paras_dev_ba = {
"epoch": 20,
"pop_size": 50,
"pulse_rate": 0.95,
Expand Down Expand Up @@ -729,25 +729,25 @@ Import All Models
}
if __name__ == "__main__":
model = BBO.BaseBBO(**paras_bbo)
model = BBO.DevBBO(**paras_bbo)
model = BBO.OriginalBBO(**paras_bbo)
model = EOA.OriginalEOA(**paras_eoa)
model = IWO.OriginalIWO(**paras_eoa)
model = SBO.BaseSBO(**paras_sbo)
model = SBO.DevSBO(**paras_sbo)
model = SBO.OriginalSBO(**paras_sbo)
model = SMA.BaseSMA(**paras_sma)
model = SMA.DevSMA(**paras_sma)
model = SMA.OriginalSMA(**paras_sma)
model = VCS.BaseVCS(**paras_vcs)
model = VCS.DevVCS(**paras_vcs)
model = VCS.OriginalVCS(**paras_vcs)
model = WHO.OriginalWHO(**paras_vcs)
model = CRO.OriginalCRO(**paras_cro)
model = CRO.OCRO(**paras_ocro)
model = DE.BaseDE(**paras_de)
# model = DE.BaseDE(**paras_de)
model = DE.JADE(**paras_jade)
model = DE.SADE(**paras_sade)
model = DE.SHADE(**paras_shade)
model = DE.L_SHADE(**paras_lshade)
model = SHADE.OriginalSHADE(**paras_shade)
model = SHADE.L_SHADE(**paras_lshade)
model = DE.SAP_DE(**paras_sap_de)
model = EP.OriginalEP(**paras_ep)
model = EP.LevyEP(**paras_levy_ep)
Expand All @@ -759,30 +759,30 @@ Import All Models
model = GA.MultiGA(**paras_multi_ga)
model = MA.OriginalMA(**paras_ma)
model = BRO.BaseBRO(**paras_bro)
model = BRO.DevBRO(**paras_bro)
model = BRO.OriginalBRO(**paras_bro)
model = BSO.OriginalBSO(**paras_bso)
model = BSO.ImprovedBSO(**paras_improved_bso)
model = CA.OriginalCA(**paras_ca)
model = CHIO.BaseCHIO(**paras_chio)
model = CHIO.DevCHIO(**paras_chio)
model = CHIO.OriginalCHIO(**paras_chio)
model = FBIO.BaseFBIO(**paras_fbio)
model = FBIO.DevFBIO(**paras_fbio)
model = FBIO.OriginalFBIO(**paras_fbio)
model = GSKA.BaseGSKA(**paras_base_gska)
model = GSKA.DevGSKA(**paras_base_gska)
model = GSKA.OriginalGSKA(**paras_gska)
model = ICA.OriginalICA(**paras_ica)
model = LCO.BaseLCO(**paras_lco)
model = LCO.DevLCO(**paras_lco)
model = LCO.OriginalLCO(**paras_lco)
model = LCO.ImprovedLCO(**paras_improved_lco)
model = QSA.BaseQSA(**paras_qsa)
model = QSA.DevQSA(**paras_qsa)
model = QSA.OriginalQSA(**paras_qsa)
model = QSA.OppoQSA(**paras_qsa)
model = QSA.LevyQSA(**paras_qsa)
model = QSA.ImprovedQSA(**paras_qsa)
model = SARO.BaseSARO(**paras_saro)
model = SARO.DevSARO(**paras_saro)
model = SARO.OriginalSARO(**paras_saro)
model = SSDO.OriginalSSDO(**paras_ssdo)
model = TLO.BaseTLO(**paras_tlo)
model = TLO.DevTLO(**paras_tlo)
model = TLO.OriginalTLO(**paras_tlo)
model = TLO.ImprovedTLO(**paras_improved_tlo)
Expand All @@ -794,24 +794,24 @@ Import All Models
model = HC.SwarmHC(**paras_swarm_hc)
model = PSS.OriginalPSS(**paras_pss)
model = SCA.OriginalSCA(**paras_sca)
model = SCA.BaseSCA(**paras_sca)
model = SCA.DevSCA(**paras_sca)
model = HS.BaseHS(**paras_hs)
model = HS.DevHS(**paras_hs)
model = HS.OriginalHS(**paras_hs)
model = AEO.OriginalAEO(**paras_aeo)
model = AEO.EnhancedAEO(**paras_aeo)
model = AEO.ModifiedAEO(**paras_aeo)
model = AEO.ImprovedAEO(**paras_aeo)
model = AEO.AugmentedAEO(**paras_aeo)
model = GCO.BaseGCO(**paras_aeo)
model = GCO.DevGCO(**paras_aeo)
model = GCO.OriginalGCO(**paras_aeo)
model = WCA.OriginalWCA(**paras_wca)
model = ArchOA.OriginalArchOA(**paras_archoa)
model = ASO.OriginalASO(**paras_aso)
model = EFO.OriginalEFO(**paras_efo)
model = EFO.BaseEFO(**paras_efo)
model = EFO.DevEFO(**paras_efo)
model = EO.OriginalEO(**paras_eo)
model = EO.AdaptiveEO(**paras_eo)
model = EO.ModifiedEO(**paras_eo)
Expand All @@ -831,10 +831,10 @@ Import All Models
model = ACOR.OriginalACOR(**paras_acor)
model = ALO.OriginalALO(**paras_alo)
model = AO.OriginalAO(**paras_ao)
model = ALO.BaseALO(**paras_alo)
model = ALO.DevALO(**paras_alo)
model = BA.OriginalBA(**paras_ba)
model = BA.AdaptiveBA(**paras_adaptive_ba)
model = BA.ModifiedBA(**paras_modified_ba)
model = BA.DevBA(**paras_dev_ba)
model = BeesA.OriginalBeesA(**paras_beesa)
model = BeesA.ProbBeesA(**paras_prob_beesa)
model = BES.OriginalBES(**paras_bes)
Expand All @@ -849,25 +849,25 @@ Import All Models
model = FA.OriginalFA(**paras_fa)
model = FFA.OriginalFFA(**paras_ffa)
model = FOA.OriginalFOA(**paras_foa)
model = FOA.BaseFOA(**paras_foa)
model = FOA.DevFOA(**paras_foa)
model = FOA.WhaleFOA(**paras_foa)
model = GOA.OriginalGOA(**paras_goa)
model = GWO.OriginalGWO(**paras_gwo)
model = GWO.RW_GWO(**paras_gwo)
model = HGS.OriginalHGS(**paras_hgs)
model = HHO.OriginalHHO(**paras_hho)
model = JA.OriginalJA(**paras_ja)
model = JA.BaseJA(**paras_ja)
model = JA.DevJA(**paras_ja)
model = JA.LevyJA(**paras_ja)
model = MFO.OriginalMFO(**paras_mfo)
model = MFO.BaseMFO(**paras_mfo)
# model = MFO.BaseMFO(**paras_mfo)
model = MRFO.OriginalMRFO(**paras_mrfo)
model = MSA.OriginalMSA(**paras_msa)
model = NMRA.ImprovedNMRA(**paras_improved_nmra)
model = NMRA.OriginalNMRA(**paras_nmra)
model = PFA.OriginalPFA(**paras_pfa)
model = PSO.OriginalPSO(**paras_pso)
model = PSO.PPSO(**paras_ppso)
model = PSO.P_PSO(**paras_ppso)
model = PSO.HPSO_TVAC(**paras_hpso_tvac)
model = PSO.C_PSO(**paras_cpso)
model = PSO.CL_PSO(**paras_clpso)
Expand All @@ -879,14 +879,14 @@ Import All Models
model = SLO.ImprovedSLO(**paras_improved_slo)
model = SRSR.OriginalSRSR(**paras_srsr)
model = SSA.OriginalSSA(**paras_ssa)
model = SSA.BaseSSA(**paras_ssa)
model = SSA.DevSSA(**paras_ssa)
model = SSO.OriginalSSO(**paras_sso)
model = SSpiderA.OriginalSSpiderA(**paras_sspidera)
model = SSpiderO.OriginalSSpiderO(**paras_sspidero)
model = WOA.OriginalWOA(**paras_woa)
model = WOA.HI_WOA(**paras_hi_woa)
best_position, best_fitness = model.solve(P1)
g_best = model.solve(problem)
print(model.get_parameters())
print(model.get_name())
print(model.problem.get_name())
Expand Down
2 changes: 1 addition & 1 deletion examples/applications/pytorch/linear_regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def __init__(self, bounds, minmax="min", data=None, **kwargs):
self.data = data
super().__init__(bounds, minmax, **kwargs)

def fit_func(self, x: np.ndarray):
def obj_func(self, x: np.ndarray):
# Decode solution from real value to real-world solution
x = self.decode_solution(x)
opt, learning_rate, epoch = x["optimizer"], x["learning-rate"], x["epoch"]
Expand Down
64 changes: 32 additions & 32 deletions examples/run_all_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
# --------------------------------------------------%

from opfunu.cec_based.cec2017 import F292017
from mealpy import FloatVar
from mealpy.bio_based import BBO, EOA, IWO, SBO, SMA, TPO, VCS, WHO
from mealpy.evolutionary_based import CRO, DE, EP, ES, FPA, GA, MA
from mealpy.evolutionary_based import CRO, DE, EP, ES, FPA, GA, MA, SHADE
from mealpy.human_based import BRO, BSO, CA, CHIO, FBIO, GSKA, ICA, LCO, QSA, SARO, SSDO, TLO
from mealpy.math_based import AOA, CEM, CGO, GBO, HC, PSS, SCA
from mealpy.music_based import HS
Expand All @@ -18,9 +19,8 @@

f18 = F292017(ndim=30, f_bias=0)
P1 = {
"fit_func": f18.evaluate,
"lb": f18.lb,
"ub": f18.ub,
"obj_func": f18.evaluate,
"bounds": FloatVar(lb=f18.lb, ub=f18.ub, name="delta"),
"minmax": "min",
"name": "F18"
}
Expand Down Expand Up @@ -727,25 +727,25 @@
}


model = BBO.BaseBBO(**paras_bbo)
model = BBO.DevBBO(**paras_bbo)
model = BBO.OriginalBBO(**paras_bbo)
model = EOA.OriginalEOA(**paras_eoa)
model = IWO.OriginalIWO(**paras_eoa)
model = SBO.BaseSBO(**paras_sbo)
model = SBO.DevSBO(**paras_sbo)
model = SBO.OriginalSBO(**paras_sbo)
model = SMA.BaseSMA(**paras_sma)
model = SMA.DevSMA(**paras_sma)
model = SMA.OriginalSMA(**paras_sma)
model = VCS.BaseVCS(**paras_vcs)
model = VCS.DevVCS(**paras_vcs)
model = VCS.OriginalVCS(**paras_vcs)
model = WHO.OriginalWHO(**paras_vcs)

model = CRO.OriginalCRO(**paras_cro)
model = CRO.OCRO(**paras_ocro)
model = DE.BaseDE(**paras_de)
# model = DE.BaseDE(**paras_de)
model = DE.JADE(**paras_jade)
model = DE.SADE(**paras_sade)
model = DE.SHADE(**paras_shade)
model = DE.L_SHADE(**paras_lshade)
model = SHADE.OriginalSHADE(**paras_shade)
model = SHADE.L_SHADE(**paras_lshade)
model = DE.SAP_DE(**paras_sap_de)
model = EP.OriginalEP(**paras_ep)
model = EP.LevyEP(**paras_levy_ep)
Expand All @@ -757,30 +757,30 @@
model = GA.MultiGA(**paras_multi_ga)
model = MA.OriginalMA(**paras_ma)

model = BRO.BaseBRO(**paras_bro)
model = BRO.DevBRO(**paras_bro)
model = BRO.OriginalBRO(**paras_bro)
model = BSO.OriginalBSO(**paras_bso)
model = BSO.ImprovedBSO(**paras_improved_bso)
model = CA.OriginalCA(**paras_ca)
model = CHIO.BaseCHIO(**paras_chio)
model = CHIO.DevCHIO(**paras_chio)
model = CHIO.OriginalCHIO(**paras_chio)
model = FBIO.BaseFBIO(**paras_fbio)
model = FBIO.DevFBIO(**paras_fbio)
model = FBIO.OriginalFBIO(**paras_fbio)
model = GSKA.BaseGSKA(**paras_base_gska)
model = GSKA.DevGSKA(**paras_base_gska)
model = GSKA.OriginalGSKA(**paras_gska)
model = ICA.OriginalICA(**paras_ica)
model = LCO.BaseLCO(**paras_lco)
model = LCO.DevLCO(**paras_lco)
model = LCO.OriginalLCO(**paras_lco)
model = LCO.ImprovedLCO(**paras_improved_lco)
model = QSA.BaseQSA(**paras_qsa)
model = QSA.DevQSA(**paras_qsa)
model = QSA.OriginalQSA(**paras_qsa)
model = QSA.OppoQSA(**paras_qsa)
model = QSA.LevyQSA(**paras_qsa)
model = QSA.ImprovedQSA(**paras_qsa)
model = SARO.BaseSARO(**paras_saro)
model = SARO.DevSARO(**paras_saro)
model = SARO.OriginalSARO(**paras_saro)
model = SSDO.OriginalSSDO(**paras_ssdo)
model = TLO.BaseTLO(**paras_tlo)
model = TLO.DevTLO(**paras_tlo)
model = TLO.OriginalTLO(**paras_tlo)
model = TLO.ImprovedTLO(**paras_improved_tlo)

Expand All @@ -792,24 +792,24 @@
model = HC.SwarmHC(**paras_swarm_hc)
model = PSS.OriginalPSS(**paras_pss)
model = SCA.OriginalSCA(**paras_sca)
model = SCA.BaseSCA(**paras_sca)
model = SCA.DevSCA(**paras_sca)

model = HS.BaseHS(**paras_hs)
model = HS.DevHS(**paras_hs)
model = HS.OriginalHS(**paras_hs)

model = AEO.OriginalAEO(**paras_aeo)
model = AEO.EnhancedAEO(**paras_aeo)
model = AEO.ModifiedAEO(**paras_aeo)
model = AEO.ImprovedAEO(**paras_aeo)
model = AEO.AugmentedAEO(**paras_aeo)
model = GCO.BaseGCO(**paras_aeo)
model = GCO.DevGCO(**paras_aeo)
model = GCO.OriginalGCO(**paras_aeo)
model = WCA.OriginalWCA(**paras_wca)

model = ArchOA.OriginalArchOA(**paras_archoa)
model = ASO.OriginalASO(**paras_aso)
model = EFO.OriginalEFO(**paras_efo)
model = EFO.BaseEFO(**paras_efo)
model = EFO.DevEFO(**paras_efo)
model = EO.OriginalEO(**paras_eo)
model = EO.AdaptiveEO(**paras_eo)
model = EO.ModifiedEO(**paras_eo)
Expand All @@ -828,10 +828,10 @@
model = ACOR.OriginalACOR(**paras_acor)
model = ALO.OriginalALO(**paras_alo)
model = AO.OriginalAO(**paras_ao)
model = ALO.BaseALO(**paras_alo)
model = ALO.DevALO(**paras_alo)
model = BA.OriginalBA(**paras_ba)
model = BA.AdaptiveBA(**paras_adaptive_ba)
model = BA.ModifiedBA(**paras_modified_ba)
model = BA.DevBA(**paras_modified_ba)
model = BeesA.OriginalBeesA(**paras_beesa)
model = BeesA.ProbBeesA(**paras_prob_beesa)
model = BES.OriginalBES(**paras_bes)
Expand All @@ -846,25 +846,25 @@
model = FA.OriginalFA(**paras_fa)
model = FFA.OriginalFFA(**paras_ffa)
model = FOA.OriginalFOA(**paras_foa)
model = FOA.BaseFOA(**paras_foa)
model = FOA.DevFOA(**paras_foa)
model = FOA.WhaleFOA(**paras_foa)
model = GOA.OriginalGOA(**paras_goa)
model = GWO.OriginalGWO(**paras_gwo)
model = GWO.RW_GWO(**paras_gwo)
model = HGS.OriginalHGS(**paras_hgs)
model = HHO.OriginalHHO(**paras_hho)
model = JA.OriginalJA(**paras_ja)
model = JA.BaseJA(**paras_ja)
model = JA.DevJA(**paras_ja)
model = JA.LevyJA(**paras_ja)
model = MFO.OriginalMFO(**paras_mfo)
model = MFO.BaseMFO(**paras_mfo)
# model = MFO.BaseMFO(**paras_mfo)
model = MRFO.OriginalMRFO(**paras_mrfo)
model = MSA.OriginalMSA(**paras_msa)
model = NMRA.ImprovedNMRA(**paras_improved_nmra)
model = NMRA.OriginalNMRA(**paras_nmra)
model = PFA.OriginalPFA(**paras_pfa)
model = PSO.OriginalPSO(**paras_pso)
model = PSO.PPSO(**paras_ppso)
model = PSO.P_PSO(**paras_ppso)
model = PSO.HPSO_TVAC(**paras_hpso_tvac)
model = PSO.C_PSO(**paras_cpso)
model = PSO.CL_PSO(**paras_clpso)
Expand All @@ -876,15 +876,15 @@
model = SLO.ImprovedSLO(**paras_improved_slo)
model = SRSR.OriginalSRSR(**paras_srsr)
model = SSA.OriginalSSA(**paras_ssa)
model = SSA.BaseSSA(**paras_ssa)
model = SSA.DevSSA(**paras_ssa)
model = SSO.OriginalSSO(**paras_sso)
model = SSpiderA.OriginalSSpiderA(**paras_sspidera)
model = SSpiderO.OriginalSSpiderO(**paras_sspidero)
model = WOA.OriginalWOA(**paras_woa)
model = WOA.HI_WOA(**paras_hi_woa)

best_position, best_fitness = model.solve(P1)
g_best = model.solve(P1)
print(model.get_parameters())
print(model.get_name())
print(model.problem.get_name())
print(model.get_attributes()["solution"])
print(g_best)

0 comments on commit 86e1f44

Please sign in to comment.