jmetalpy 1.5.4__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- examples/__init__.py +0 -0
- examples/experiment/__init__.py +0 -0
- examples/experiment/comparison.py +84 -0
- examples/experiment/generateKolmogorovSmirnovLatexTables.py +10 -0
- examples/experiment/generateMedianAndWilcoxonLatexTables.py +11 -0
- examples/experiment/statistical_analysis.py +75 -0
- examples/multiobjective/__init__.py +0 -0
- examples/multiobjective/gde3/__init__.py +0 -0
- examples/multiobjective/gde3/dynamic_gde3.py +25 -0
- examples/multiobjective/gde3/gde3_spark_evaluator.py +28 -0
- examples/multiobjective/gde3/gde3_zdt1.py +25 -0
- examples/multiobjective/gde3/ggde3_zdt2.py +36 -0
- examples/multiobjective/hype/__init__.py +0 -0
- examples/multiobjective/hype/hype_zdt1.py +42 -0
- examples/multiobjective/ibea/__init__.py +0 -0
- examples/multiobjective/ibea/ibea_zdt1.py +34 -0
- examples/multiobjective/mocell/__init__.py +0 -0
- examples/multiobjective/mocell/mocell_zdt1.py +38 -0
- examples/multiobjective/moead/__init__.py +0 -0
- examples/multiobjective/moead/moead_dtlz2.py +45 -0
- examples/multiobjective/moead/moead_iepsilon_lircmop1.py +41 -0
- examples/multiobjective/moead/moead_lz09.py +41 -0
- examples/multiobjective/moead/moeaddra_lz09.py +44 -0
- examples/multiobjective/nsgaii/__init__.py +0 -0
- examples/multiobjective/nsgaii/distributed_nsgaii_with_dask.py +40 -0
- examples/multiobjective/nsgaii/distributed_nsgaii_with_dask_evaluator.py +35 -0
- examples/multiobjective/nsgaii/distributed_nsgaii_with_spark_evaluator.py +36 -0
- examples/multiobjective/nsgaii/dynamic_nsgaii_solving_fda2.py +28 -0
- examples/multiobjective/nsgaii/gnsgaii_solving_zdt2_with_reference_point.py +55 -0
- examples/multiobjective/nsgaii/nsgaii_defining_schaffer_problem_on_the_fly.py +45 -0
- examples/multiobjective/nsgaii/nsgaii_defining_srinivas_problem_on_the_fly.py +64 -0
- examples/multiobjective/nsgaii/nsgaii_solving_3D_problem.py +64 -0
- examples/multiobjective/nsgaii/nsgaii_solving_ZDT5.py +34 -0
- examples/multiobjective/nsgaii/nsgaii_solving_binary_problem.py +35 -0
- examples/multiobjective/nsgaii/nsgaii_solving_constrained_srinivas_problem.py +35 -0
- examples/multiobjective/nsgaii/nsgaii_solving_mixed_encoding_problem.py +40 -0
- examples/multiobjective/nsgaii/nsgaii_ssp.py +160 -0
- examples/multiobjective/nsgaii/nsgaii_standard_settings.py +38 -0
- examples/multiobjective/nsgaii/nsgaii_standard_settings_with_real_time_plotting.py +59 -0
- examples/multiobjective/nsgaii/nsgaii_steady_state.py +39 -0
- examples/multiobjective/nsgaii/nsgaii_steady_state_with_real_time_plotting.py +62 -0
- examples/multiobjective/nsgaii/parallel_nsgaii_with_multiprocess_evaluator.py +32 -0
- examples/multiobjective/nsgaiii/__init__.py +0 -0
- examples/multiobjective/nsgaiii/nsgaiii_dtlz2.py +39 -0
- examples/multiobjective/omopso/__init__.py +0 -0
- examples/multiobjective/omopso/omopso_spark_evaluator.py +43 -0
- examples/multiobjective/omopso/omopso_zdt1.py +42 -0
- examples/multiobjective/preferences/__init__.py +0 -0
- examples/multiobjective/preferences/ggde3_zdt2.py +50 -0
- examples/multiobjective/preferences/gnsgaii_solving_zdt2_with_reference_point.py +66 -0
- examples/multiobjective/random_search/__init__.py +0 -0
- examples/multiobjective/random_search/random_search_zdt1.py +27 -0
- examples/multiobjective/smpso/__init__.py +0 -0
- examples/multiobjective/smpso/dynamic_smpso.py +32 -0
- examples/multiobjective/smpso/smpso_schaffer_on_the_fly.py +39 -0
- examples/multiobjective/smpso/smpso_spark_evaluator.py +37 -0
- examples/multiobjective/smpso/smpso_srinivas.py +31 -0
- examples/multiobjective/smpso/smpso_srinivas_on_the_fly.py +53 -0
- examples/multiobjective/smpso/smpso_tanaka.py +36 -0
- examples/multiobjective/smpso/smpso_zdt4.py +32 -0
- examples/multiobjective/smpso/smpsorp_zdt4.py +67 -0
- examples/multiobjective/spea2/__init__.py +0 -0
- examples/multiobjective/spea2/gspea2_zdt1.py +36 -0
- examples/multiobjective/spea2/spea2_dtlz1.py +32 -0
- examples/multiobjective/spea2/spea2_zdt1.py +32 -0
- examples/singleobjective/__init__.py +0 -0
- examples/singleobjective/evolution_strategy/__init__.py +0 -0
- examples/singleobjective/evolution_strategy/evolution_strategy_binary.py +25 -0
- examples/singleobjective/evolution_strategy/evolution_strategy_float.py +25 -0
- examples/singleobjective/evolution_strategy/evolution_strategy_permutation.py +27 -0
- examples/singleobjective/gde3/__init__.py +0 -0
- examples/singleobjective/gde3/gde3_single_objective.py +22 -0
- examples/singleobjective/genetic_algorithm/__init__.py +0 -0
- examples/singleobjective/genetic_algorithm/generational_genetic_algorithm_binary.py +28 -0
- examples/singleobjective/genetic_algorithm/generational_genetic_algorithm_float.py +25 -0
- examples/singleobjective/genetic_algorithm/generational_genetic_algorithm_tsp.py +31 -0
- examples/singleobjective/genetic_algorithm/generational_genetic_algorithm_tsp_with_contraints.py +61 -0
- examples/singleobjective/genetic_algorithm/steady_state_genetic_algorithm.py +158 -0
- examples/singleobjective/genetic_algorithm/steady_state_genetic_algorithm_with_knapsack_problem.py +27 -0
- examples/singleobjective/local_search/__init__.py +0 -0
- examples/singleobjective/local_search/local_search_binary.py +31 -0
- examples/singleobjective/local_search/local_search_float.py +29 -0
- examples/singleobjective/nsgaii/__init__.py +0 -0
- examples/singleobjective/nsgaii/nsgaii_single_objective_binary.py +36 -0
- examples/singleobjective/nsgaii/nsgaii_single_objective_float.py +31 -0
- examples/singleobjective/simulated_annealing/__init__.py +0 -0
- examples/singleobjective/simulated_annealing/simulated_annealing_binary.py +29 -0
- examples/singleobjective/simulated_annealing/simulated_annealing_float.py +29 -0
- examples/singleobjective/simulated_annealing/simulated_annealing_permutation.py +24 -0
- jmetal/__init__.py +7 -0
- jmetal/algorithm/__init__.py +0 -0
- jmetal/algorithm/multiobjective/__init__.py +10 -0
- jmetal/algorithm/multiobjective/gde3.py +153 -0
- jmetal/algorithm/multiobjective/hype.py +87 -0
- jmetal/algorithm/multiobjective/ibea.py +113 -0
- jmetal/algorithm/multiobjective/mocell.py +140 -0
- jmetal/algorithm/multiobjective/moead.py +440 -0
- jmetal/algorithm/multiobjective/nsgaii.py +322 -0
- jmetal/algorithm/multiobjective/nsgaiii.py +363 -0
- jmetal/algorithm/multiobjective/omopso.py +197 -0
- jmetal/algorithm/multiobjective/random_search.py +76 -0
- jmetal/algorithm/multiobjective/smpso.py +407 -0
- jmetal/algorithm/multiobjective/spea2.py +92 -0
- jmetal/algorithm/singleobjective/__init__.py +4 -0
- jmetal/algorithm/singleobjective/evolution_strategy.py +91 -0
- jmetal/algorithm/singleobjective/genetic_algorithm.py +114 -0
- jmetal/algorithm/singleobjective/local_search.py +88 -0
- jmetal/algorithm/singleobjective/simulated_annealing.py +101 -0
- jmetal/algorithm/test/__init__.py +0 -0
- jmetal/algorithm/test/ittest_algorithm.py +86 -0
- jmetal/config.py +36 -0
- jmetal/core/__init__.py +0 -0
- jmetal/core/algorithm.py +234 -0
- jmetal/core/observer.py +34 -0
- jmetal/core/operator.py +71 -0
- jmetal/core/problem.py +209 -0
- jmetal/core/quality_indicator.py +385 -0
- jmetal/core/solution.py +180 -0
- jmetal/core/test/__init__.py +0 -0
- jmetal/core/test/test_observable.py +60 -0
- jmetal/core/test/test_operator.py +48 -0
- jmetal/core/test/test_problem.py +96 -0
- jmetal/core/test/test_quality_indicator.py +297 -0
- jmetal/core/test/test_solution.py +180 -0
- jmetal/lab/__init__.py +0 -0
- jmetal/lab/experiment.py +909 -0
- jmetal/lab/statistical_test/__init__.py +0 -0
- jmetal/lab/statistical_test/apv_procedures.py +396 -0
- jmetal/lab/statistical_test/bayesian.py +138 -0
- jmetal/lab/statistical_test/critical_distance.py +232 -0
- jmetal/lab/statistical_test/functions.py +521 -0
- jmetal/lab/visualization/__init__.py +8 -0
- jmetal/lab/visualization/chord_plot.py +375 -0
- jmetal/lab/visualization/interactive.py +200 -0
- jmetal/lab/visualization/plotting.py +204 -0
- jmetal/lab/visualization/posterior.py +101 -0
- jmetal/lab/visualization/streaming.py +149 -0
- jmetal/logger.py +29 -0
- jmetal/operator/__init__.py +52 -0
- jmetal/operator/crossover.py +454 -0
- jmetal/operator/mutation.py +297 -0
- jmetal/operator/selection.py +347 -0
- jmetal/operator/test/__init__.py +0 -0
- jmetal/operator/test/test_crossover.py +419 -0
- jmetal/operator/test/test_mutation.py +328 -0
- jmetal/operator/test/test_selection.py +389 -0
- jmetal/problem/__init__.py +33 -0
- jmetal/problem/multiobjective/__init__.py +0 -0
- jmetal/problem/multiobjective/constrained.py +182 -0
- jmetal/problem/multiobjective/dtlz.py +269 -0
- jmetal/problem/multiobjective/fda.py +304 -0
- jmetal/problem/multiobjective/lircmop.py +622 -0
- jmetal/problem/multiobjective/lz09.py +404 -0
- jmetal/problem/multiobjective/rwa.py +564 -0
- jmetal/problem/multiobjective/test/__init__.py +0 -0
- jmetal/problem/multiobjective/test/test_constrained.py +64 -0
- jmetal/problem/multiobjective/test/test_dtlz.py +273 -0
- jmetal/problem/multiobjective/test/test_lz09.py +368 -0
- jmetal/problem/multiobjective/test/test_rwa.py +279 -0
- jmetal/problem/multiobjective/test/test_unconstrained.py +236 -0
- jmetal/problem/multiobjective/test/test_zdt.py +231 -0
- jmetal/problem/multiobjective/uf.py +67 -0
- jmetal/problem/multiobjective/unconstrained.py +304 -0
- jmetal/problem/multiobjective/zdt.py +251 -0
- jmetal/problem/singleobjective/__init__.py +0 -0
- jmetal/problem/singleobjective/knapsack.py +103 -0
- jmetal/problem/singleobjective/test/__init__.py +0 -0
- jmetal/problem/singleobjective/test/test_knapsack.py +56 -0
- jmetal/problem/singleobjective/test/test_unconstrained.py +101 -0
- jmetal/problem/singleobjective/tsp.py +103 -0
- jmetal/problem/singleobjective/unconstrained.py +172 -0
- jmetal/util/__init__.py +0 -0
- jmetal/util/aggregation_function.py +80 -0
- jmetal/util/archive.py +217 -0
- jmetal/util/ckecking.py +78 -0
- jmetal/util/comparator.py +274 -0
- jmetal/util/constraint_handling.py +40 -0
- jmetal/util/density_estimator.py +161 -0
- jmetal/util/distance.py +49 -0
- jmetal/util/evaluator.py +87 -0
- jmetal/util/generator.py +43 -0
- jmetal/util/neighborhood.py +238 -0
- jmetal/util/observable.py +54 -0
- jmetal/util/observer.py +211 -0
- jmetal/util/point.py +23 -0
- jmetal/util/ranking.py +165 -0
- jmetal/util/replacement.py +75 -0
- jmetal/util/solution.py +103 -0
- jmetal/util/termination_criterion.py +96 -0
- jmetal/util/test/__init__.py +0 -0
- jmetal/util/test/test_aggregation_function.py +16 -0
- jmetal/util/test/test_archive.py +340 -0
- jmetal/util/test/test_checking.py +39 -0
- jmetal/util/test/test_comparator.py +372 -0
- jmetal/util/test/test_constraint_handling.py +102 -0
- jmetal/util/test/test_density_estimator.py +219 -0
- jmetal/util/test/test_distance.py +48 -0
- jmetal/util/test/test_evaluator.py +87 -0
- jmetal/util/test/test_neighborhood.py +287 -0
- jmetal/util/test/test_point.py +43 -0
- jmetal/util/test/test_ranking.py +234 -0
- jmetal/util/test/test_replacement.py +174 -0
- jmetalpy-1.5.4.dist-info/LICENSE +21 -0
- jmetalpy-1.5.4.dist-info/METADATA +211 -0
- jmetalpy-1.5.4.dist-info/RECORD +207 -0
- jmetalpy-1.5.4.dist-info/WHEEL +6 -0
- jmetalpy-1.5.4.dist-info/top_level.txt +2 -0
examples/__init__.py
ADDED
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
from jmetal.algorithm.multiobjective.gde3 import GDE3
|
|
2
|
+
from jmetal.algorithm.multiobjective.nsgaii import NSGAII
|
|
3
|
+
from jmetal.algorithm.multiobjective.smpso import SMPSO
|
|
4
|
+
from jmetal.core.quality_indicator import *
|
|
5
|
+
from jmetal.lab.experiment import Experiment, Job, generate_summary_from_experiment
|
|
6
|
+
from jmetal.operator import PolynomialMutation, SBXCrossover
|
|
7
|
+
from jmetal.problem import ZDT1, ZDT2, ZDT3
|
|
8
|
+
from jmetal.util.archive import CrowdingDistanceArchive
|
|
9
|
+
from jmetal.util.termination_criterion import StoppingByEvaluations
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def configure_experiment(problems: dict, n_run: int):
|
|
13
|
+
jobs = []
|
|
14
|
+
max_evaluations = 25000
|
|
15
|
+
|
|
16
|
+
for run in range(n_run):
|
|
17
|
+
for problem_tag, problem in problems.items():
|
|
18
|
+
jobs.append(
|
|
19
|
+
Job(
|
|
20
|
+
algorithm=NSGAII(
|
|
21
|
+
problem=problem,
|
|
22
|
+
population_size=100,
|
|
23
|
+
offspring_population_size=100,
|
|
24
|
+
mutation=PolynomialMutation(
|
|
25
|
+
probability=1.0 / problem.number_of_variables, distribution_index=20
|
|
26
|
+
),
|
|
27
|
+
crossover=SBXCrossover(probability=1.0, distribution_index=20),
|
|
28
|
+
termination_criterion=StoppingByEvaluations(max_evaluations=max_evaluations),
|
|
29
|
+
),
|
|
30
|
+
algorithm_tag="NSGAII",
|
|
31
|
+
problem_tag=problem_tag,
|
|
32
|
+
run=run,
|
|
33
|
+
)
|
|
34
|
+
)
|
|
35
|
+
jobs.append(
|
|
36
|
+
Job(
|
|
37
|
+
algorithm=GDE3(
|
|
38
|
+
problem=problem,
|
|
39
|
+
population_size=100,
|
|
40
|
+
cr=0.5,
|
|
41
|
+
f=0.5,
|
|
42
|
+
termination_criterion=StoppingByEvaluations(max_evaluations=max_evaluations),
|
|
43
|
+
),
|
|
44
|
+
algorithm_tag="GDE3",
|
|
45
|
+
problem_tag=problem_tag,
|
|
46
|
+
run=run,
|
|
47
|
+
)
|
|
48
|
+
)
|
|
49
|
+
jobs.append(
|
|
50
|
+
Job(
|
|
51
|
+
algorithm=SMPSO(
|
|
52
|
+
problem=problem,
|
|
53
|
+
swarm_size=100,
|
|
54
|
+
mutation=PolynomialMutation(
|
|
55
|
+
probability=1.0 / problem.number_of_variables, distribution_index=20
|
|
56
|
+
),
|
|
57
|
+
leaders=CrowdingDistanceArchive(100),
|
|
58
|
+
termination_criterion=StoppingByEvaluations(max_evaluations=max_evaluations),
|
|
59
|
+
),
|
|
60
|
+
algorithm_tag="SMPSO",
|
|
61
|
+
problem_tag=problem_tag,
|
|
62
|
+
run=run,
|
|
63
|
+
)
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
return jobs
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
if __name__ == "__main__":
|
|
70
|
+
# Configure the experiments
|
|
71
|
+
jobs = configure_experiment(problems={"ZDT1": ZDT1(), "ZDT2": ZDT2(), "ZDT3": ZDT3()}, n_run=2)
|
|
72
|
+
|
|
73
|
+
# Run the study
|
|
74
|
+
output_directory = "data"
|
|
75
|
+
|
|
76
|
+
experiment = Experiment(output_dir=output_directory, jobs=jobs)
|
|
77
|
+
experiment.run()
|
|
78
|
+
|
|
79
|
+
# Generate summary file
|
|
80
|
+
generate_summary_from_experiment(
|
|
81
|
+
input_dir=output_directory,
|
|
82
|
+
reference_fronts="resources/reference_front",
|
|
83
|
+
quality_indicators=[GenerationalDistance(), EpsilonIndicator(), HyperVolume([1.0, 1.0])],
|
|
84
|
+
)
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
from jmetal.lab.experiment import (
|
|
2
|
+
generate_kolmogorov_smirnov_latex_tables,
|
|
3
|
+
)
|
|
4
|
+
|
|
5
|
+
if __name__ == "__main__":
|
|
6
|
+
"""
|
|
7
|
+
Generate Latex tables with the results of the Kolmogorov-Smirnov test. The last algorithm is considered as
|
|
8
|
+
the reference algorithm, and the cells include a symbol with the p-value < 0.05.
|
|
9
|
+
"""
|
|
10
|
+
generate_kolmogorov_smirnov_latex_tables(filename="QualityIndicatorSummary.csv")
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
from jmetal.lab.experiment import (
|
|
2
|
+
generate_median_and_wilcoxon_latex_tables,
|
|
3
|
+
)
|
|
4
|
+
|
|
5
|
+
if __name__ == "__main__":
|
|
6
|
+
"""
|
|
7
|
+
Generate Latex tables including medians and IQRs. Additionally, the last algorithm is considered as the reference
|
|
8
|
+
algorithm, and the cells include a symbol indicating whether the differences with the reference algorithm
|
|
9
|
+
are significant or not according to the Wilcoxon rank sum test.
|
|
10
|
+
"""
|
|
11
|
+
generate_median_and_wilcoxon_latex_tables(filename="QualityIndicatorSummary.csv")
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
from jmetal.lab.experiment import (
|
|
2
|
+
compute_mean_indicator,
|
|
3
|
+
compute_wilcoxon,
|
|
4
|
+
generate_boxplot,
|
|
5
|
+
generate_latex_tables,
|
|
6
|
+
)
|
|
7
|
+
from jmetal.lab.statistical_test.bayesian import *
|
|
8
|
+
from jmetal.lab.statistical_test.functions import *
|
|
9
|
+
from jmetal.lab.visualization import CDplot, plot_posterior
|
|
10
|
+
|
|
11
|
+
if __name__ == "__main__":
|
|
12
|
+
# Generate Median & IQR tables
|
|
13
|
+
generate_latex_tables(filename="QualityIndicatorSummary.csv")
|
|
14
|
+
|
|
15
|
+
# Generate boxplots
|
|
16
|
+
generate_boxplot(filename="QualityIndicatorSummary.csv")
|
|
17
|
+
|
|
18
|
+
# Wilcoxon
|
|
19
|
+
compute_wilcoxon(filename="QualityIndicatorSummary.csv")
|
|
20
|
+
|
|
21
|
+
# Statistical lab
|
|
22
|
+
|
|
23
|
+
avg = compute_mean_indicator(filename="QualityIndicatorSummary.csv", indicator_name="HV")
|
|
24
|
+
print(avg)
|
|
25
|
+
|
|
26
|
+
# Non-parametric test
|
|
27
|
+
print("-------- Sign Test --------")
|
|
28
|
+
print(sign_test(avg[["NSGAII", "SMPSO"]]))
|
|
29
|
+
print("-------- Friedman Test --------")
|
|
30
|
+
print(friedman_test(avg))
|
|
31
|
+
print("-------- Friedman Aligned Rank Test --------")
|
|
32
|
+
print(friedman_aligned_rank_test(avg))
|
|
33
|
+
print("-------- Quade Test --------")
|
|
34
|
+
print(quade_test(avg))
|
|
35
|
+
|
|
36
|
+
# Post-hoc tests
|
|
37
|
+
print("-------- Friedman Post-Hoc Test --------")
|
|
38
|
+
z, p_val, adj_pval = friedman_ph_test(avg, control=0, apv_procedure="Bonferroni")
|
|
39
|
+
print("z values \n", z)
|
|
40
|
+
print("p-values \n", p_val)
|
|
41
|
+
print("adjusted p-values \n", adj_pval)
|
|
42
|
+
print("-------- Friedman Aligned Rank Post-Hoc Test --------")
|
|
43
|
+
z, p_val, adj_pval = friedman_aligned_ph_test(avg, apv_procedure="Shaffer")
|
|
44
|
+
print("z values \n", z)
|
|
45
|
+
print("p-values \n", p_val)
|
|
46
|
+
print("adjusted p-values \n", adj_pval)
|
|
47
|
+
print("-------- QuadeTest Post-Hoc Test --------")
|
|
48
|
+
z, p_val, adj_pval = quade_ph_test(avg, apv_procedure="Holm")
|
|
49
|
+
print("z values \n", z)
|
|
50
|
+
print("p-values \n", p_val)
|
|
51
|
+
print("adjusted p-values \n", adj_pval)
|
|
52
|
+
|
|
53
|
+
# Plot critical distance
|
|
54
|
+
|
|
55
|
+
CDplot(avg.T, alpha=0.15, higher_is_better=True)
|
|
56
|
+
|
|
57
|
+
print("-------- Bayesian Sign Test --------")
|
|
58
|
+
bst, DProcess = bayesian_sign_test(
|
|
59
|
+
avg[["NSGAII", "SMPSO"]], rope_limits=[-0.002, 0.002], prior_strength=0.5, return_sample=True
|
|
60
|
+
)
|
|
61
|
+
plot_posterior(DProcess, higher_is_better=True, alg_names=["NSGAII", "SMPSO"])
|
|
62
|
+
|
|
63
|
+
print("Pr(NSGAII < SMPSO) = %.3f" % bst[0])
|
|
64
|
+
print("Pr(NSGAII ~= SMPSO) = %.3f" % bst[1])
|
|
65
|
+
print("Pr(NSGAII > SMPSO) = %.3f" % bst[2])
|
|
66
|
+
|
|
67
|
+
print("-------- Bayesian Signed Rank Test --------")
|
|
68
|
+
bst, DProcess = bayesian_signed_rank_test(
|
|
69
|
+
avg[["NSGAII", "SMPSO"]], rope_limits=[-0.002, 0.002], prior_strength=0.5, return_sample=True
|
|
70
|
+
)
|
|
71
|
+
plot_posterior(DProcess, higher_is_better=True, alg_names=["NSGAII", "SMPSO"])
|
|
72
|
+
|
|
73
|
+
print("Pr(NSGAII < SMPSO) = %.3f" % bst[0])
|
|
74
|
+
print("Pr(NSGAII ~= SMPSO) = %.3f" % bst[1])
|
|
75
|
+
print("Pr(NSGAII > SMPSO) = %.3f" % bst[2])
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
from jmetal.algorithm.multiobjective.gde3 import DynamicGDE3
|
|
2
|
+
from jmetal.problem.multiobjective.fda import FDA2
|
|
3
|
+
from jmetal.util.observable import TimeCounter
|
|
4
|
+
from jmetal.util.observer import PlotFrontToFileObserver, WriteFrontToFileObserver
|
|
5
|
+
from jmetal.util.termination_criterion import StoppingByEvaluations
|
|
6
|
+
|
|
7
|
+
if __name__ == "__main__":
|
|
8
|
+
problem = FDA2()
|
|
9
|
+
|
|
10
|
+
time_counter = TimeCounter(delay=1)
|
|
11
|
+
time_counter.observable.register(problem)
|
|
12
|
+
time_counter.start()
|
|
13
|
+
|
|
14
|
+
algorithm = DynamicGDE3(
|
|
15
|
+
problem=problem,
|
|
16
|
+
population_size=100,
|
|
17
|
+
cr=0.5,
|
|
18
|
+
f=0.5,
|
|
19
|
+
termination_criterion=StoppingByEvaluations(max_evaluations=500),
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
algorithm.observable.register(observer=PlotFrontToFileObserver("dynamic_front_vis"))
|
|
23
|
+
algorithm.observable.register(observer=WriteFrontToFileObserver("dynamic_front"))
|
|
24
|
+
|
|
25
|
+
algorithm.run()
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
from jmetal.algorithm.multiobjective.gde3 import GDE3
|
|
2
|
+
from jmetal.problem.multiobjective.zdt import ZDT1Modified
|
|
3
|
+
from jmetal.util.evaluator import SparkEvaluator
|
|
4
|
+
from jmetal.util.solution import print_function_values_to_file, print_variables_to_file
|
|
5
|
+
from jmetal.util.termination_criterion import StoppingByEvaluations
|
|
6
|
+
|
|
7
|
+
if __name__ == "__main__":
|
|
8
|
+
problem = ZDT1Modified()
|
|
9
|
+
|
|
10
|
+
algorithm = GDE3(
|
|
11
|
+
problem=problem,
|
|
12
|
+
population_size=10,
|
|
13
|
+
cr=0.5,
|
|
14
|
+
f=0.5,
|
|
15
|
+
termination_criterion=StoppingByEvaluations(max_evaluations=100),
|
|
16
|
+
population_evaluator=SparkEvaluator(),
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
algorithm.run()
|
|
20
|
+
front = algorithm.result()
|
|
21
|
+
|
|
22
|
+
# Save results to file
|
|
23
|
+
print_function_values_to_file(front, "FUN." + algorithm.get_name() + "." + problem.name())
|
|
24
|
+
print_variables_to_file(front, "VAR." + algorithm.get_name() + "." + problem.name())
|
|
25
|
+
|
|
26
|
+
print(f"Algorithm (continuous problem): {algorithm.get_name()}")
|
|
27
|
+
print(f"Problem: {problem.name()}")
|
|
28
|
+
print(f"Computing time: {algorithm.total_computing_time}")
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
from jmetal.algorithm.multiobjective.gde3 import GDE3
|
|
2
|
+
from jmetal.problem import ZDT1
|
|
3
|
+
from jmetal.util.solution import (
|
|
4
|
+
print_function_values_to_file,
|
|
5
|
+
print_variables_to_file,
|
|
6
|
+
read_solutions,
|
|
7
|
+
)
|
|
8
|
+
from jmetal.util.termination_criterion import StoppingByKeyboard
|
|
9
|
+
|
|
10
|
+
if __name__ == "__main__":
|
|
11
|
+
problem = ZDT1()
|
|
12
|
+
problem.reference_front = read_solutions(filename="resources/reference_front/ZDT1.pf")
|
|
13
|
+
|
|
14
|
+
algorithm = GDE3(problem=problem, population_size=100, cr=0.5, f=0.5, termination_criterion=StoppingByKeyboard())
|
|
15
|
+
|
|
16
|
+
algorithm.run()
|
|
17
|
+
front = algorithm.result()
|
|
18
|
+
|
|
19
|
+
# Save results to file
|
|
20
|
+
print_function_values_to_file(front, "FUN." + algorithm.label)
|
|
21
|
+
print_variables_to_file(front, "VAR." + algorithm.label)
|
|
22
|
+
|
|
23
|
+
print(f"Algorithm: {algorithm.get_name()}")
|
|
24
|
+
print(f"Problem: {problem.name()}")
|
|
25
|
+
print(f"Computing time: {algorithm.total_computing_time}")
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
from jmetal.algorithm.multiobjective.gde3 import GDE3
|
|
2
|
+
from jmetal.problem import ZDT2
|
|
3
|
+
from jmetal.util.comparator import GDominanceComparator
|
|
4
|
+
from jmetal.util.solution import (
|
|
5
|
+
print_function_values_to_file,
|
|
6
|
+
print_variables_to_file,
|
|
7
|
+
read_solutions,
|
|
8
|
+
)
|
|
9
|
+
from jmetal.util.termination_criterion import StoppingByEvaluations
|
|
10
|
+
|
|
11
|
+
if __name__ == "__main__":
|
|
12
|
+
problem = ZDT2()
|
|
13
|
+
problem.reference_front = read_solutions(filename="resources/reference_front/ZDT2.pf")
|
|
14
|
+
|
|
15
|
+
max_evaluations = 25000
|
|
16
|
+
reference_point = [0.2, 0.5]
|
|
17
|
+
|
|
18
|
+
algorithm = GDE3(
|
|
19
|
+
problem=problem,
|
|
20
|
+
population_size=100,
|
|
21
|
+
cr=0.5,
|
|
22
|
+
f=0.5,
|
|
23
|
+
termination_criterion=StoppingByEvaluations(max_evaluations=max_evaluations),
|
|
24
|
+
dominance_comparator=GDominanceComparator(reference_point),
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
algorithm.run()
|
|
28
|
+
front = algorithm.result()
|
|
29
|
+
|
|
30
|
+
# Save results to file
|
|
31
|
+
print_function_values_to_file(front, "FUN." + algorithm.label)
|
|
32
|
+
print_variables_to_file(front, "VAR." + algorithm.label)
|
|
33
|
+
|
|
34
|
+
print(f"Algorithm: {algorithm.get_name()}")
|
|
35
|
+
print(f"Problem: {problem.name()}")
|
|
36
|
+
print(f"Computing time: {algorithm.total_computing_time}")
|
|
File without changes
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
from jmetal.algorithm.multiobjective.hype import HYPE
|
|
2
|
+
from jmetal.core.solution import FloatSolution
|
|
3
|
+
from jmetal.operator import PolynomialMutation, SBXCrossover
|
|
4
|
+
from jmetal.problem import ZDT1
|
|
5
|
+
from jmetal.util.solution import (
|
|
6
|
+
print_function_values_to_file,
|
|
7
|
+
print_variables_to_file,
|
|
8
|
+
read_solutions,
|
|
9
|
+
)
|
|
10
|
+
from jmetal.util.termination_criterion import StoppingByEvaluations
|
|
11
|
+
|
|
12
|
+
if __name__ == "__main__":
|
|
13
|
+
problem = ZDT1()
|
|
14
|
+
problem.reference_front = read_solutions(filename="resources/reference_front/ZDT1.pf")
|
|
15
|
+
|
|
16
|
+
reference_point = FloatSolution(
|
|
17
|
+
[0],
|
|
18
|
+
[1],
|
|
19
|
+
problem.number_of_objectives(),
|
|
20
|
+
)
|
|
21
|
+
reference_point.objectives = [1.0, 1.0] # Mandatory for HYPE
|
|
22
|
+
|
|
23
|
+
algorithm = HYPE(
|
|
24
|
+
problem=problem,
|
|
25
|
+
reference_point=reference_point,
|
|
26
|
+
population_size=100,
|
|
27
|
+
offspring_population_size=100,
|
|
28
|
+
mutation=PolynomialMutation(probability=1.0 / problem.number_of_variables(), distribution_index=20),
|
|
29
|
+
crossover=SBXCrossover(probability=1.0, distribution_index=20),
|
|
30
|
+
termination_criterion=StoppingByEvaluations(25000),
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
algorithm.run()
|
|
34
|
+
front = algorithm.result()
|
|
35
|
+
|
|
36
|
+
# Save results to file
|
|
37
|
+
print_function_values_to_file(front, "FUN." + algorithm.label)
|
|
38
|
+
print_variables_to_file(front, "VAR." + algorithm.label)
|
|
39
|
+
|
|
40
|
+
print(f"Algorithm: {algorithm.get_name()}")
|
|
41
|
+
print(f"Problem: {problem.name()}")
|
|
42
|
+
print(f"Computing time: {algorithm.total_computing_time}")
|
|
File without changes
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
from jmetal.algorithm.multiobjective.ibea import IBEA
|
|
2
|
+
from jmetal.operator import PolynomialMutation, SBXCrossover
|
|
3
|
+
from jmetal.problem import ZDT1
|
|
4
|
+
from jmetal.util.solution import (
|
|
5
|
+
print_function_values_to_file,
|
|
6
|
+
print_variables_to_file,
|
|
7
|
+
read_solutions,
|
|
8
|
+
)
|
|
9
|
+
from jmetal.util.termination_criterion import StoppingByEvaluations
|
|
10
|
+
|
|
11
|
+
if __name__ == "__main__":
|
|
12
|
+
problem = ZDT1()
|
|
13
|
+
problem.reference_front = read_solutions(filename="resources/reference_front/ZDT1.pf")
|
|
14
|
+
|
|
15
|
+
algorithm = IBEA(
|
|
16
|
+
problem=problem,
|
|
17
|
+
kappa=1.0,
|
|
18
|
+
population_size=100,
|
|
19
|
+
offspring_population_size=100,
|
|
20
|
+
mutation=PolynomialMutation(probability=1.0 / problem.number_of_variables(), distribution_index=20),
|
|
21
|
+
crossover=SBXCrossover(probability=1.0, distribution_index=20),
|
|
22
|
+
termination_criterion=StoppingByEvaluations(max_evaluations=25000),
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
algorithm.run()
|
|
26
|
+
front = algorithm.result()
|
|
27
|
+
|
|
28
|
+
# Save results to file
|
|
29
|
+
print_function_values_to_file(front, "FUN." + algorithm.label)
|
|
30
|
+
print_variables_to_file(front, "VAR." + algorithm.label)
|
|
31
|
+
|
|
32
|
+
print(f"Algorithm: {algorithm.get_name()}")
|
|
33
|
+
print(f"Problem: {problem.name()}")
|
|
34
|
+
print(f"Computing time: {algorithm.total_computing_time}")
|
|
File without changes
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
from jmetal.algorithm.multiobjective.mocell import MOCell
|
|
2
|
+
from jmetal.operator import PolynomialMutation, SBXCrossover
|
|
3
|
+
from jmetal.problem import ZDT1
|
|
4
|
+
from jmetal.util.archive import CrowdingDistanceArchive
|
|
5
|
+
from jmetal.util.neighborhood import C9
|
|
6
|
+
from jmetal.util.solution import (
|
|
7
|
+
print_function_values_to_file,
|
|
8
|
+
print_variables_to_file,
|
|
9
|
+
read_solutions,
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
from jmetal.util.termination_criterion import StoppingByEvaluations
|
|
13
|
+
|
|
14
|
+
if __name__ == "__main__":
|
|
15
|
+
problem = ZDT1()
|
|
16
|
+
problem.reference_front = read_solutions(filename="resources/reference_front/ZDT1.pf")
|
|
17
|
+
|
|
18
|
+
max_evaluations = 25000
|
|
19
|
+
algorithm = MOCell(
|
|
20
|
+
problem=problem,
|
|
21
|
+
population_size=100,
|
|
22
|
+
neighborhood=C9(10, 10),
|
|
23
|
+
archive=CrowdingDistanceArchive(100),
|
|
24
|
+
mutation=PolynomialMutation(probability=1.0 / problem.number_of_variables(), distribution_index=20),
|
|
25
|
+
crossover=SBXCrossover(probability=1.0, distribution_index=20),
|
|
26
|
+
termination_criterion=StoppingByEvaluations(max_evaluations=max_evaluations),
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
algorithm.run()
|
|
30
|
+
front = algorithm.result()
|
|
31
|
+
|
|
32
|
+
# Save results to file
|
|
33
|
+
print_function_values_to_file(front, "FUN." + algorithm.label)
|
|
34
|
+
print_variables_to_file(front, "VAR." + algorithm.label)
|
|
35
|
+
|
|
36
|
+
print(f"Algorithm: {algorithm.get_name()}")
|
|
37
|
+
print(f"Problem: {problem.name()}")
|
|
38
|
+
print(f"Computing time: {algorithm.total_computing_time}")
|
|
File without changes
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
from jmetal.algorithm.multiobjective.moead import MOEAD
|
|
2
|
+
from jmetal.core.quality_indicator import HyperVolume
|
|
3
|
+
from jmetal.operator import DifferentialEvolutionCrossover, PolynomialMutation
|
|
4
|
+
from jmetal.problem import DTLZ2
|
|
5
|
+
from jmetal.util.aggregation_function import PenaltyBoundaryIntersection
|
|
6
|
+
|
|
7
|
+
from jmetal.util.solution import (
|
|
8
|
+
print_function_values_to_file,
|
|
9
|
+
print_variables_to_file,
|
|
10
|
+
read_solutions,
|
|
11
|
+
)
|
|
12
|
+
from jmetal.util.termination_criterion import StoppingByEvaluations
|
|
13
|
+
|
|
14
|
+
if __name__ == "__main__":
|
|
15
|
+
problem = DTLZ2()
|
|
16
|
+
problem.reference_front = read_solutions(filename="resources/reference_front/DTLZ2.3D.pf")
|
|
17
|
+
|
|
18
|
+
max_evaluations = 50000
|
|
19
|
+
|
|
20
|
+
algorithm = MOEAD(
|
|
21
|
+
problem=problem,
|
|
22
|
+
population_size=91,
|
|
23
|
+
crossover=DifferentialEvolutionCrossover(CR=1.0, F=0.5),
|
|
24
|
+
mutation=PolynomialMutation(probability=1.0 / problem.number_of_variables(), distribution_index=20),
|
|
25
|
+
aggregation_function=PenaltyBoundaryIntersection(dimension=problem.number_of_objectives()),
|
|
26
|
+
neighbor_size=20,
|
|
27
|
+
neighbourhood_selection_probability=0.9,
|
|
28
|
+
max_number_of_replaced_solutions=2,
|
|
29
|
+
weight_files_path="resources/MOEAD_weights",
|
|
30
|
+
termination_criterion=StoppingByEvaluations(max_evaluations=max_evaluations),
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
algorithm.run()
|
|
34
|
+
front = algorithm.result()
|
|
35
|
+
|
|
36
|
+
hypervolume = HyperVolume([1.0, 1.0, 1.0])
|
|
37
|
+
print("Hypervolume: " + str(hypervolume.compute([front[i].objectives for i in range(len(front))])))
|
|
38
|
+
|
|
39
|
+
# Save results to file
|
|
40
|
+
print_function_values_to_file(front, "FUN." + algorithm.label)
|
|
41
|
+
print_variables_to_file(front, "VAR." + algorithm.label)
|
|
42
|
+
|
|
43
|
+
print(f"Algorithm: {algorithm.get_name()}")
|
|
44
|
+
print(f"Problem: {problem.name()}")
|
|
45
|
+
print(f"Computing time: {algorithm.total_computing_time}")
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
from jmetal.algorithm.multiobjective.moead import MOEADIEpsilon
|
|
2
|
+
from jmetal.operator import DifferentialEvolutionCrossover, PolynomialMutation
|
|
3
|
+
from jmetal.problem.multiobjective.lircmop import LIRCMOP2
|
|
4
|
+
from jmetal.util.aggregation_function import Tschebycheff
|
|
5
|
+
from jmetal.util.solution import (
|
|
6
|
+
print_function_values_to_file,
|
|
7
|
+
print_variables_to_file,
|
|
8
|
+
read_solutions,
|
|
9
|
+
)
|
|
10
|
+
from jmetal.util.termination_criterion import StoppingByEvaluations
|
|
11
|
+
|
|
12
|
+
if __name__ == "__main__":
|
|
13
|
+
problem = LIRCMOP2()
|
|
14
|
+
|
|
15
|
+
problem.reference_front = read_solutions(filename="resources/reference_front/LIRCMOP2.pf")
|
|
16
|
+
|
|
17
|
+
max_evaluations = 300000
|
|
18
|
+
|
|
19
|
+
algorithm = MOEADIEpsilon(
|
|
20
|
+
problem=problem,
|
|
21
|
+
population_size=300,
|
|
22
|
+
crossover=DifferentialEvolutionCrossover(CR=1.0, F=0.5),
|
|
23
|
+
mutation=PolynomialMutation(probability=1.0 / problem.number_of_variables(), distribution_index=20),
|
|
24
|
+
aggregation_function=Tschebycheff(dimension=problem.number_of_objectives()),
|
|
25
|
+
neighbor_size=20,
|
|
26
|
+
neighbourhood_selection_probability=0.9,
|
|
27
|
+
max_number_of_replaced_solutions=2,
|
|
28
|
+
weight_files_path="resources/MOEAD_weights",
|
|
29
|
+
termination_criterion=StoppingByEvaluations(max_evaluations=max_evaluations),
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
algorithm.run()
|
|
33
|
+
front = algorithm.result()
|
|
34
|
+
|
|
35
|
+
# Save results to file
|
|
36
|
+
print_function_values_to_file(front, "FUN." + algorithm.label)
|
|
37
|
+
print_variables_to_file(front, "VAR." + algorithm.label)
|
|
38
|
+
|
|
39
|
+
print(f"Algorithm: {algorithm.get_name()}")
|
|
40
|
+
print(f"Problem: {problem.name()}")
|
|
41
|
+
print(f"Computing time: {algorithm.total_computing_time}")
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
from jmetal.algorithm.multiobjective.moead import MOEAD
|
|
2
|
+
from jmetal.operator import DifferentialEvolutionCrossover, PolynomialMutation
|
|
3
|
+
from jmetal.problem import LZ09_F2
|
|
4
|
+
from jmetal.util.aggregation_function import Tschebycheff
|
|
5
|
+
from jmetal.util.solution import (
|
|
6
|
+
print_function_values_to_file,
|
|
7
|
+
print_variables_to_file,
|
|
8
|
+
read_solutions,
|
|
9
|
+
)
|
|
10
|
+
from jmetal.util.termination_criterion import StoppingByEvaluations
|
|
11
|
+
|
|
12
|
+
if __name__ == "__main__":
|
|
13
|
+
problem = LZ09_F2()
|
|
14
|
+
|
|
15
|
+
problem.reference_front = read_solutions(filename="resources/reference_front/LZ09_F2.pf")
|
|
16
|
+
|
|
17
|
+
max_evaluations = 150000
|
|
18
|
+
|
|
19
|
+
algorithm = MOEAD(
|
|
20
|
+
problem=problem,
|
|
21
|
+
population_size=300,
|
|
22
|
+
crossover=DifferentialEvolutionCrossover(CR=1.0, F=0.5),
|
|
23
|
+
mutation=PolynomialMutation(probability=1.0 / problem.number_of_variables(), distribution_index=20),
|
|
24
|
+
aggregation_function=Tschebycheff(dimension=problem.number_of_objectives()),
|
|
25
|
+
neighbor_size=20,
|
|
26
|
+
neighbourhood_selection_probability=0.9,
|
|
27
|
+
max_number_of_replaced_solutions=2,
|
|
28
|
+
weight_files_path="resources/MOEAD_weights",
|
|
29
|
+
termination_criterion=StoppingByEvaluations(max_evaluations=max_evaluations),
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
algorithm.run()
|
|
33
|
+
front = algorithm.result()
|
|
34
|
+
|
|
35
|
+
# Save results to file
|
|
36
|
+
print_function_values_to_file(front, "FUN." + algorithm.label)
|
|
37
|
+
print_variables_to_file(front, "VAR." + algorithm.label)
|
|
38
|
+
|
|
39
|
+
print(f"Algorithm: {algorithm.get_name()}")
|
|
40
|
+
print(f"Problem: {problem.get_name()}")
|
|
41
|
+
print(f"Computing time: {algorithm.total_computing_time}")
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
from jmetal.algorithm.multiobjective.moead import MOEAD_DRA
|
|
2
|
+
from jmetal.core.quality_indicator import HyperVolume
|
|
3
|
+
from jmetal.operator import DifferentialEvolutionCrossover, PolynomialMutation
|
|
4
|
+
from jmetal.problem.multiobjective.lz09 import LZ09_F1
|
|
5
|
+
from jmetal.util.aggregation_function import Tschebycheff
|
|
6
|
+
from jmetal.util.solution import (
|
|
7
|
+
print_function_values_to_file,
|
|
8
|
+
print_variables_to_file,
|
|
9
|
+
read_solutions,
|
|
10
|
+
)
|
|
11
|
+
from jmetal.util.termination_criterion import StoppingByEvaluations
|
|
12
|
+
|
|
13
|
+
if __name__ == "__main__":
|
|
14
|
+
problem = LZ09_F1()
|
|
15
|
+
problem.reference_front = read_solutions(filename="resources/reference_front/LZ09_F1.pf")
|
|
16
|
+
|
|
17
|
+
max_evaluations = 300000
|
|
18
|
+
|
|
19
|
+
algorithm = MOEAD_DRA(
|
|
20
|
+
problem=problem,
|
|
21
|
+
population_size=600,
|
|
22
|
+
crossover=DifferentialEvolutionCrossover(CR=1.0, F=0.5),
|
|
23
|
+
mutation=PolynomialMutation(probability=1.0 / problem.number_of_variables(), distribution_index=20),
|
|
24
|
+
aggregation_function=Tschebycheff(dimension=problem.number_of_objectives()),
|
|
25
|
+
neighbor_size=20,
|
|
26
|
+
neighbourhood_selection_probability=0.9,
|
|
27
|
+
max_number_of_replaced_solutions=2,
|
|
28
|
+
weight_files_path="resources/MOEAD_weights",
|
|
29
|
+
termination_criterion=StoppingByEvaluations(max_evaluations=max_evaluations),
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
algorithm.run()
|
|
33
|
+
front = algorithm.result()
|
|
34
|
+
|
|
35
|
+
hypervolume = HyperVolume([2.0, 2.0])
|
|
36
|
+
print("Hypervolume: " + str(hypervolume.compute([front[i].objectives for i in range(len(front))])))
|
|
37
|
+
|
|
38
|
+
# Save results to file
|
|
39
|
+
print_function_values_to_file(front, "FUN." + algorithm.label)
|
|
40
|
+
print_variables_to_file(front, "VAR." + algorithm.label)
|
|
41
|
+
|
|
42
|
+
print(f"Algorithm: {algorithm.get_name()}")
|
|
43
|
+
print(f"Problem: {problem.name()}")
|
|
44
|
+
print(f"Computing time: {algorithm.total_computing_time}")
|
|
File without changes
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
from dask.distributed import Client
|
|
2
|
+
from distributed import LocalCluster
|
|
3
|
+
|
|
4
|
+
from jmetal.algorithm.multiobjective.nsgaii import DistributedNSGAII
|
|
5
|
+
from jmetal.operator import PolynomialMutation, SBXCrossover
|
|
6
|
+
from jmetal.problem.multiobjective.zdt import ZDT1Modified
|
|
7
|
+
from jmetal.util.termination_criterion import StoppingByEvaluations
|
|
8
|
+
|
|
9
|
+
"""
|
|
10
|
+
Distributed (asynchronous) version of NSGA-II using Dask.
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
if __name__ == "__main__":
|
|
14
|
+
problem = ZDT1Modified()
|
|
15
|
+
|
|
16
|
+
# setup Dask client
|
|
17
|
+
client = Client(LocalCluster(n_workers=24))
|
|
18
|
+
|
|
19
|
+
ncores = sum(client.ncores().values())
|
|
20
|
+
print(f"{ncores} cores available")
|
|
21
|
+
|
|
22
|
+
# creates the algorithm
|
|
23
|
+
max_evaluations = 25000
|
|
24
|
+
|
|
25
|
+
algorithm = DistributedNSGAII(
|
|
26
|
+
problem=problem,
|
|
27
|
+
population_size=100,
|
|
28
|
+
mutation=PolynomialMutation(probability=1.0 / problem.number_of_variables, distribution_index=20),
|
|
29
|
+
crossover=SBXCrossover(probability=1.0, distribution_index=20),
|
|
30
|
+
termination_criterion=StoppingByEvaluations(max_evaluations=max_evaluations),
|
|
31
|
+
number_of_cores=ncores,
|
|
32
|
+
client=client,
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
algorithm.run()
|
|
36
|
+
front = algorithm.result()
|
|
37
|
+
|
|
38
|
+
print(f"Algorithm: {algorithm.get_name()}")
|
|
39
|
+
print(f"Problem: {problem.get_name()}")
|
|
40
|
+
print(f"Computing time: {algorithm.total_computing_time}")
|