-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
86 lines (80 loc) · 2.23 KB
/
main.py
File metadata and controls
86 lines (80 loc) · 2.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
from classes.experiments import Experiments
from classes.enums_and_hints.experiments_dict import ExperimentsDict
from classes.enums_and_hints.problem_enum import ProblemFuncNames
from classes.enums_and_hints.optimizers_enum import OptimizersNames
from classes.enums_and_hints.params_enum import DEMultStrategyNames, GAParentSelectionNames, GACrossoverNames, GAMutationNames
from classes.enums_and_hints.ga_dict import GADict
from classes.enums_and_hints.pso_dict import PSODict
from classes.enums_and_hints.de_dict import DEDict
from classes.enums_and_hints.psor_dict import PSORDict
pso = PSODict(
name = OptimizersNames.PSO,
dimensions = 30,
population_size = 10,
bounds = [-100, 100],
omega = .9,
min_speed = -50,
max_speed = 50,
cognitive_update_factor = 2.,
social_update_factor = 2.,
reduce_omega_linearly = True,
reduction_speed_factor = .1
)
de = DEDict(
name = OptimizersNames.DE,
dimensions = 10,
population_size = 10,
bounds = [-100, 100],
perc_mutation = .8,
perc_crossover = .4,
mut_strategy = DEMultStrategyNames.RANDTOBEST1
)
ga = GADict(
name = OptimizersNames.GA,
dimensions = 10,
population_size = 50,
bounds = [-100, 100],
total_pais_cruzamento = 2,
tipo_selecao_pais = GAParentSelectionNames.ROULETTE_WHEEL_SELECTION,
total_pais_torneio = 3,
tipo_cruzamento = GACrossoverNames.SINGLE_POINT,
taxa_cruzamento = .9,
tipo_mutacao = GAMutationNames.SWAP,
taxa_mutacao = .05,
elitismo = 1
)
psor = PSORDict(
name = OptimizersNames.PSOR,
dimensions = 30,
population_size = 20,
bounds = [-100, 100],
omega = .9,
min_speed = -50,
max_speed = 50,
cognitive_update_factor = 2.,
social_update_factor = 2.,
reduce_omega_linearly = True,
nsubspaces = 2,
r_size = 50
)
exp_dict = ExperimentsDict(
name = 'ult_test_psor_30d',
nexecucoes = 30,
functions = [
ProblemFuncNames.F1,
ProblemFuncNames.F2,
ProblemFuncNames.F4,
ProblemFuncNames.F6,
ProblemFuncNames.F7,
ProblemFuncNames.F9,
ProblemFuncNames.F14
],
optimizers = [
ga,
pso,
de,
psor
]
)
exp = Experiments(exp_dict = exp_dict)
exp.main()