From 6f123c546a994b80cec4fc4318f5e2204866cd33 Mon Sep 17 00:00:00 2001 From: ajnebro Date: Mon, 22 Jan 2024 12:30:24 +0100 Subject: [PATCH] Rename method of class Algorithm --- README.md | 4 ++-- examples/multiobjective/gde3/gde3_spark_evaluator.py | 2 +- examples/multiobjective/gde3/gde3_zdt1.py | 2 +- examples/multiobjective/gde3/ggde3_zdt2.py | 2 +- examples/multiobjective/hype/hype_zdt1.py | 2 +- examples/multiobjective/ibea/ibea_zdt1.py | 2 +- examples/multiobjective/mocell/mocell_zdt1.py | 2 +- examples/multiobjective/moead/moead_dtlz2.py | 2 +- examples/multiobjective/moead/moead_iepsilon_lircmop1.py | 2 +- examples/multiobjective/moead/moead_lz09.py | 2 +- examples/multiobjective/moead/moeaddra_lz09.py | 2 +- .../multiobjective/nsgaii/distributed_nsgaii_with_dask.py | 2 +- .../nsgaii/distributed_nsgaii_with_dask_evaluator.py | 2 +- .../nsgaii/distributed_nsgaii_with_spark_evaluator.py | 2 +- .../nsgaii/gnsgaii_solving_zdt2_with_reference_point.py | 2 +- .../nsgaii/nsgaii_defining_schaffer_problem_on_the_fly.py | 2 +- .../nsgaii/nsgaii_defining_srinivas_problem_on_the_fly.py | 2 +- examples/multiobjective/nsgaii/nsgaii_solving_3D_problem.py | 2 +- examples/multiobjective/nsgaii/nsgaii_solving_ZDT5.py | 2 +- .../multiobjective/nsgaii/nsgaii_solving_binary_problem.py | 2 +- .../nsgaii/nsgaii_solving_constrained_srinivas_problem.py | 2 +- .../nsgaii/nsgaii_solving_mixed_encoding_problem.py | 2 +- examples/multiobjective/nsgaii/nsgaii_ssp.py | 2 +- examples/multiobjective/nsgaii/nsgaii_standard_settings.py | 2 +- .../nsgaii_standard_settings_with_real_time_plotting.py | 2 +- examples/multiobjective/nsgaii/nsgaii_steady_state.py | 2 +- .../nsgaii/nsgaii_steady_state_with_real_time_plotting.py | 2 +- .../nsgaii/parallel_nsgaii_with_multiprocess_evaluator.py | 2 +- examples/multiobjective/nsgaiii/nsgaiii_dtlz2.py | 2 +- examples/multiobjective/omopso/omopso_spark_evaluator.py | 2 +- examples/multiobjective/omopso/omopso_zdt1.py | 2 +- examples/multiobjective/preferences/ggde3_zdt2.py | 2 +- .../gnsgaii_solving_zdt2_with_reference_point.py | 2 +- examples/multiobjective/random_search/random_search_zdt1.py | 2 +- examples/multiobjective/smpso/smpso_schaffer_on_the_fly.py | 2 +- examples/multiobjective/smpso/smpso_spark_evaluator.py | 2 +- examples/multiobjective/smpso/smpso_srinivas.py | 2 +- examples/multiobjective/smpso/smpso_srinivas_on_the_fly.py | 2 +- examples/multiobjective/smpso/smpso_tanaka.py | 2 +- examples/multiobjective/smpso/smpso_zdt4.py | 2 +- examples/multiobjective/smpso/smpsorp_zdt4.py | 2 +- examples/multiobjective/spea2/gspea2_zdt1.py | 2 +- examples/multiobjective/spea2/spea2_dtlz1.py | 2 +- examples/multiobjective/spea2/spea2_zdt1.py | 2 +- .../evolution_strategy/evolution_strategy_binary.py | 2 +- .../evolution_strategy/evolution_strategy_float.py | 2 +- .../evolution_strategy/evolution_strategy_permutation.py | 2 +- examples/singleobjective/gde3/gde3_single_objective.py | 2 +- .../generational_genetic_algorithm_binary.py | 2 +- .../generational_genetic_algorithm_float.py | 2 +- .../genetic_algorithm/generational_genetic_algorithm_tsp.py | 2 +- .../generational_genetic_algorithm_tsp_with_contraints.py | 2 +- .../genetic_algorithm/steady_state_genetic_algorithm.py | 2 +- .../steady_state_genetic_algorithm_with_knapsack_problem.py | 2 +- .../singleobjective/local_search/local_search_binary.py | 2 +- examples/singleobjective/local_search/local_search_float.py | 2 +- .../nsgaii/nsgaii_single_objective_binary.py | 2 +- .../singleobjective/nsgaii/nsgaii_single_objective_float.py | 2 +- .../simulated_annealing/simulated_annealing_binary.py | 2 +- .../simulated_annealing/simulated_annealing_float.py | 2 +- .../simulated_annealing/simulated_annealing_permutation.py | 2 +- jmetal/algorithm/multiobjective/gde3.py | 2 +- jmetal/algorithm/multiobjective/hype.py | 2 +- jmetal/algorithm/multiobjective/ibea.py | 2 +- jmetal/algorithm/multiobjective/mocell.py | 2 +- jmetal/algorithm/multiobjective/moead.py | 4 ++-- jmetal/algorithm/multiobjective/nsgaii.py | 6 +++--- jmetal/algorithm/multiobjective/nsgaiii.py | 2 +- jmetal/algorithm/multiobjective/omopso.py | 2 +- jmetal/algorithm/multiobjective/random_search.py | 4 ++-- jmetal/algorithm/multiobjective/smpso.py | 4 ++-- jmetal/algorithm/multiobjective/spea2.py | 2 +- jmetal/algorithm/singleobjective/evolution_strategy.py | 2 +- jmetal/algorithm/singleobjective/genetic_algorithm.py | 2 +- jmetal/algorithm/singleobjective/local_search.py | 4 ++-- jmetal/algorithm/singleobjective/simulated_annealing.py | 4 ++-- jmetal/algorithm/test/ittest_algorithm.py | 4 ++-- jmetal/core/algorithm.py | 6 +++--- jmetal/lab/experiment.py | 4 ++-- 79 files changed, 91 insertions(+), 91 deletions(-) diff --git a/README.md b/README.md index bf80bc7f..b2d62330 100644 --- a/README.md +++ b/README.md @@ -78,10 +78,10 @@ algorithm.run() We can then proceed to explore the results: ```python -from jmetal.util.solution import get_non_dominated_solutions, print_function_values_to_file, \ +from jmetal.util.solution import get_non_dominated_solutions, print_function_values_to_file, print_variables_to_file -front = get_non_dominated_solutions(algorithm.get_result()) +front = get_non_dominated_solutions(algorithm.result()) # save to files print_function_values_to_file(front, 'FUN.NSGAII.ZDT1') diff --git a/examples/multiobjective/gde3/gde3_spark_evaluator.py b/examples/multiobjective/gde3/gde3_spark_evaluator.py index 46bb917a..c7e16e85 100644 --- a/examples/multiobjective/gde3/gde3_spark_evaluator.py +++ b/examples/multiobjective/gde3/gde3_spark_evaluator.py @@ -17,7 +17,7 @@ ) algorithm.run() - front = algorithm.get_result() + front = algorithm.result() # Save results to file print_function_values_to_file(front, "FUN." + algorithm.get_name() + "." + problem.name()) diff --git a/examples/multiobjective/gde3/gde3_zdt1.py b/examples/multiobjective/gde3/gde3_zdt1.py index 4b5ed807..54f758e7 100644 --- a/examples/multiobjective/gde3/gde3_zdt1.py +++ b/examples/multiobjective/gde3/gde3_zdt1.py @@ -14,7 +14,7 @@ algorithm = GDE3(problem=problem, population_size=100, cr=0.5, f=0.5, termination_criterion=StoppingByKeyboard()) algorithm.run() - front = algorithm.get_result() + front = algorithm.result() # Save results to file print_function_values_to_file(front, "FUN." + algorithm.label) diff --git a/examples/multiobjective/gde3/ggde3_zdt2.py b/examples/multiobjective/gde3/ggde3_zdt2.py index 07d7d32e..5bd1aa86 100644 --- a/examples/multiobjective/gde3/ggde3_zdt2.py +++ b/examples/multiobjective/gde3/ggde3_zdt2.py @@ -25,7 +25,7 @@ ) algorithm.run() - front = algorithm.get_result() + front = algorithm.result() # Save results to file print_function_values_to_file(front, "FUN." + algorithm.label) diff --git a/examples/multiobjective/hype/hype_zdt1.py b/examples/multiobjective/hype/hype_zdt1.py index 0d6fe555..3423aa92 100644 --- a/examples/multiobjective/hype/hype_zdt1.py +++ b/examples/multiobjective/hype/hype_zdt1.py @@ -31,7 +31,7 @@ ) algorithm.run() - front = algorithm.get_result() + front = algorithm.result() # Save results to file print_function_values_to_file(front, "FUN." + algorithm.label) diff --git a/examples/multiobjective/ibea/ibea_zdt1.py b/examples/multiobjective/ibea/ibea_zdt1.py index c3feb1d9..d059be0e 100644 --- a/examples/multiobjective/ibea/ibea_zdt1.py +++ b/examples/multiobjective/ibea/ibea_zdt1.py @@ -23,7 +23,7 @@ ) algorithm.run() - front = algorithm.get_result() + front = algorithm.result() # Save results to file print_function_values_to_file(front, "FUN." + algorithm.label) diff --git a/examples/multiobjective/mocell/mocell_zdt1.py b/examples/multiobjective/mocell/mocell_zdt1.py index 19a81883..4f6cbfe3 100644 --- a/examples/multiobjective/mocell/mocell_zdt1.py +++ b/examples/multiobjective/mocell/mocell_zdt1.py @@ -27,7 +27,7 @@ ) algorithm.run() - front = algorithm.get_result() + front = algorithm.result() # Save results to file print_function_values_to_file(front, "FUN." + algorithm.label) diff --git a/examples/multiobjective/moead/moead_dtlz2.py b/examples/multiobjective/moead/moead_dtlz2.py index 85b43d36..4573b3ea 100644 --- a/examples/multiobjective/moead/moead_dtlz2.py +++ b/examples/multiobjective/moead/moead_dtlz2.py @@ -31,7 +31,7 @@ ) algorithm.run() - front = algorithm.get_result() + front = algorithm.result() hypervolume = HyperVolume([1.0, 1.0, 1.0]) print("Hypervolume: " + str(hypervolume.compute([front[i].objectives for i in range(len(front))]))) diff --git a/examples/multiobjective/moead/moead_iepsilon_lircmop1.py b/examples/multiobjective/moead/moead_iepsilon_lircmop1.py index 2deac8a4..c3a9616b 100644 --- a/examples/multiobjective/moead/moead_iepsilon_lircmop1.py +++ b/examples/multiobjective/moead/moead_iepsilon_lircmop1.py @@ -30,7 +30,7 @@ ) algorithm.run() - front = algorithm.get_result() + front = algorithm.result() # Save results to file print_function_values_to_file(front, "FUN." + algorithm.label) diff --git a/examples/multiobjective/moead/moead_lz09.py b/examples/multiobjective/moead/moead_lz09.py index 214a3ca8..3ce28316 100644 --- a/examples/multiobjective/moead/moead_lz09.py +++ b/examples/multiobjective/moead/moead_lz09.py @@ -30,7 +30,7 @@ ) algorithm.run() - front = algorithm.get_result() + front = algorithm.result() # Save results to file print_function_values_to_file(front, "FUN." + algorithm.label) diff --git a/examples/multiobjective/moead/moeaddra_lz09.py b/examples/multiobjective/moead/moeaddra_lz09.py index eb093885..ac25463d 100644 --- a/examples/multiobjective/moead/moeaddra_lz09.py +++ b/examples/multiobjective/moead/moeaddra_lz09.py @@ -31,7 +31,7 @@ ) algorithm.run() - front = algorithm.get_result() + front = algorithm.result() hypervolume = HyperVolume([2.0, 2.0]) print("Hypervolume: " + str(hypervolume.compute([front[i].objectives for i in range(len(front))]))) diff --git a/examples/multiobjective/nsgaii/distributed_nsgaii_with_dask.py b/examples/multiobjective/nsgaii/distributed_nsgaii_with_dask.py index 3311519a..b289e52d 100644 --- a/examples/multiobjective/nsgaii/distributed_nsgaii_with_dask.py +++ b/examples/multiobjective/nsgaii/distributed_nsgaii_with_dask.py @@ -33,7 +33,7 @@ ) algorithm.run() - front = algorithm.get_result() + front = algorithm.result() print(f"Algorithm: {algorithm.get_name()}") print(f"Problem: {problem.get_name()}") diff --git a/examples/multiobjective/nsgaii/distributed_nsgaii_with_dask_evaluator.py b/examples/multiobjective/nsgaii/distributed_nsgaii_with_dask_evaluator.py index 8cfc1990..d022cea5 100644 --- a/examples/multiobjective/nsgaii/distributed_nsgaii_with_dask_evaluator.py +++ b/examples/multiobjective/nsgaii/distributed_nsgaii_with_dask_evaluator.py @@ -25,7 +25,7 @@ ) algorithm.run() - front = algorithm.get_result() + front = algorithm.result() # Save results to file print_function_values_to_file(front, "FUN." + algorithm.label) diff --git a/examples/multiobjective/nsgaii/distributed_nsgaii_with_spark_evaluator.py b/examples/multiobjective/nsgaii/distributed_nsgaii_with_spark_evaluator.py index eef1b5d7..b856d344 100644 --- a/examples/multiobjective/nsgaii/distributed_nsgaii_with_spark_evaluator.py +++ b/examples/multiobjective/nsgaii/distributed_nsgaii_with_spark_evaluator.py @@ -25,7 +25,7 @@ ) algorithm.run() - front = algorithm.get_result() + front = algorithm.result() # Save results to file print_function_values_to_file(front, "FUN." + algorithm.label) diff --git a/examples/multiobjective/nsgaii/gnsgaii_solving_zdt2_with_reference_point.py b/examples/multiobjective/nsgaii/gnsgaii_solving_zdt2_with_reference_point.py index b84dd8e1..62ae4a86 100644 --- a/examples/multiobjective/nsgaii/gnsgaii_solving_zdt2_with_reference_point.py +++ b/examples/multiobjective/nsgaii/gnsgaii_solving_zdt2_with_reference_point.py @@ -34,7 +34,7 @@ observer=VisualizerObserver(reference_front=problem.reference_front, reference_point=reference_point)) algorithm.run() - front = algorithm.get_result() + front = algorithm.result() # Plot front plot_front = Plot(title='Pareto front approximation. Problem: ' + problem.get_name(), diff --git a/examples/multiobjective/nsgaii/nsgaii_defining_schaffer_problem_on_the_fly.py b/examples/multiobjective/nsgaii/nsgaii_defining_schaffer_problem_on_the_fly.py index a1506772..e78cdc2b 100644 --- a/examples/multiobjective/nsgaii/nsgaii_defining_schaffer_problem_on_the_fly.py +++ b/examples/multiobjective/nsgaii/nsgaii_defining_schaffer_problem_on_the_fly.py @@ -34,7 +34,7 @@ def f2(x: [float]): ) algorithm.run() - front = get_non_dominated_solutions(algorithm.get_result()) + front = get_non_dominated_solutions(algorithm.result()) # Save results to file print_function_values_to_file(front, "FUN." + algorithm.label) diff --git a/examples/multiobjective/nsgaii/nsgaii_defining_srinivas_problem_on_the_fly.py b/examples/multiobjective/nsgaii/nsgaii_defining_srinivas_problem_on_the_fly.py index bd539999..7861f7c0 100644 --- a/examples/multiobjective/nsgaii/nsgaii_defining_srinivas_problem_on_the_fly.py +++ b/examples/multiobjective/nsgaii/nsgaii_defining_srinivas_problem_on_the_fly.py @@ -53,7 +53,7 @@ def c2(x: [float]): ) algorithm.run() - front = get_non_dominated_solutions(algorithm.get_result()) + front = get_non_dominated_solutions(algorithm.result()) # Save results to file print_function_values_to_file(front, "FUN." + algorithm.label) diff --git a/examples/multiobjective/nsgaii/nsgaii_solving_3D_problem.py b/examples/multiobjective/nsgaii/nsgaii_solving_3D_problem.py index bd539999..7861f7c0 100644 --- a/examples/multiobjective/nsgaii/nsgaii_solving_3D_problem.py +++ b/examples/multiobjective/nsgaii/nsgaii_solving_3D_problem.py @@ -53,7 +53,7 @@ def c2(x: [float]): ) algorithm.run() - front = get_non_dominated_solutions(algorithm.get_result()) + front = get_non_dominated_solutions(algorithm.result()) # Save results to file print_function_values_to_file(front, "FUN." + algorithm.label) diff --git a/examples/multiobjective/nsgaii/nsgaii_solving_ZDT5.py b/examples/multiobjective/nsgaii/nsgaii_solving_ZDT5.py index a9187454..bdf6e2bc 100644 --- a/examples/multiobjective/nsgaii/nsgaii_solving_ZDT5.py +++ b/examples/multiobjective/nsgaii/nsgaii_solving_ZDT5.py @@ -24,7 +24,7 @@ ) algorithm.run() - front = algorithm.get_result() + front = algorithm.result() # Save results to file print_function_values_to_file(front, "FUN." + algorithm.label) diff --git a/examples/multiobjective/nsgaii/nsgaii_solving_binary_problem.py b/examples/multiobjective/nsgaii/nsgaii_solving_binary_problem.py index 9b5e902f..7e3a7308 100644 --- a/examples/multiobjective/nsgaii/nsgaii_solving_binary_problem.py +++ b/examples/multiobjective/nsgaii/nsgaii_solving_binary_problem.py @@ -24,7 +24,7 @@ ) algorithm.run() - front = algorithm.get_result() + front = algorithm.result() # Save results to file print_function_values_to_file(front, "FUN." + algorithm.label) diff --git a/examples/multiobjective/nsgaii/nsgaii_solving_constrained_srinivas_problem.py b/examples/multiobjective/nsgaii/nsgaii_solving_constrained_srinivas_problem.py index a203005f..ed4ea391 100644 --- a/examples/multiobjective/nsgaii/nsgaii_solving_constrained_srinivas_problem.py +++ b/examples/multiobjective/nsgaii/nsgaii_solving_constrained_srinivas_problem.py @@ -24,7 +24,7 @@ ) algorithm.run() - front = algorithm.get_result() + front = algorithm.result() # Save results to file print_function_values_to_file(front, "FUN." + algorithm.label) diff --git a/examples/multiobjective/nsgaii/nsgaii_solving_mixed_encoding_problem.py b/examples/multiobjective/nsgaii/nsgaii_solving_mixed_encoding_problem.py index 8d063cf7..3b53f814 100644 --- a/examples/multiobjective/nsgaii/nsgaii_solving_mixed_encoding_problem.py +++ b/examples/multiobjective/nsgaii/nsgaii_solving_mixed_encoding_problem.py @@ -29,7 +29,7 @@ ) algorithm.run() - front = get_non_dominated_solutions(algorithm.get_result()) + front = get_non_dominated_solutions(algorithm.result()) # Save results to file print_function_values_to_file(front, "FUN." + algorithm.label) diff --git a/examples/multiobjective/nsgaii/nsgaii_ssp.py b/examples/multiobjective/nsgaii/nsgaii_ssp.py index 827f90b0..b391e430 100644 --- a/examples/multiobjective/nsgaii/nsgaii_ssp.py +++ b/examples/multiobjective/nsgaii/nsgaii_ssp.py @@ -149,7 +149,7 @@ ) algorithm.run() - front = algorithm.get_result() + front = algorithm.result() # Save results to file print_function_values_to_file(front, "FUN." + algorithm.label) diff --git a/examples/multiobjective/nsgaii/nsgaii_standard_settings.py b/examples/multiobjective/nsgaii/nsgaii_standard_settings.py index b26d95de..09d5fe2f 100644 --- a/examples/multiobjective/nsgaii/nsgaii_standard_settings.py +++ b/examples/multiobjective/nsgaii/nsgaii_standard_settings.py @@ -27,7 +27,7 @@ algorithm.run() - front = get_non_dominated_solutions(algorithm.get_result()) + front = get_non_dominated_solutions(algorithm.result()) # Save results to file print_function_values_to_file(front, "FUN." + algorithm.label) diff --git a/examples/multiobjective/nsgaii/nsgaii_standard_settings_with_real_time_plotting.py b/examples/multiobjective/nsgaii/nsgaii_standard_settings_with_real_time_plotting.py index 6dccf1a2..381b537e 100644 --- a/examples/multiobjective/nsgaii/nsgaii_standard_settings_with_real_time_plotting.py +++ b/examples/multiobjective/nsgaii/nsgaii_standard_settings_with_real_time_plotting.py @@ -32,7 +32,7 @@ algorithm.observable.register(observer=VisualizerObserver(reference_front=problem.reference_front)) algorithm.run() - front = algorithm.get_result() + front = algorithm.result() # Plot front plot_front = Plot( diff --git a/examples/multiobjective/nsgaii/nsgaii_steady_state.py b/examples/multiobjective/nsgaii/nsgaii_steady_state.py index 247f0f5d..153102c1 100644 --- a/examples/multiobjective/nsgaii/nsgaii_steady_state.py +++ b/examples/multiobjective/nsgaii/nsgaii_steady_state.py @@ -28,7 +28,7 @@ ) algorithm.run() - front = get_non_dominated_solutions(algorithm.get_result()) + front = get_non_dominated_solutions(algorithm.result()) # Save results to file print_function_values_to_file(front, "FUN." + algorithm.label) diff --git a/examples/multiobjective/nsgaii/nsgaii_steady_state_with_real_time_plotting.py b/examples/multiobjective/nsgaii/nsgaii_steady_state_with_real_time_plotting.py index 0a513e15..49b64482 100644 --- a/examples/multiobjective/nsgaii/nsgaii_steady_state_with_real_time_plotting.py +++ b/examples/multiobjective/nsgaii/nsgaii_steady_state_with_real_time_plotting.py @@ -35,7 +35,7 @@ ) algorithm.run() - front = algorithm.get_result() + front = algorithm.result() # Plot front plot_front = Plot( diff --git a/examples/multiobjective/nsgaii/parallel_nsgaii_with_multiprocess_evaluator.py b/examples/multiobjective/nsgaii/parallel_nsgaii_with_multiprocess_evaluator.py index 34960da7..a931e899 100644 --- a/examples/multiobjective/nsgaii/parallel_nsgaii_with_multiprocess_evaluator.py +++ b/examples/multiobjective/nsgaii/parallel_nsgaii_with_multiprocess_evaluator.py @@ -21,7 +21,7 @@ ) algorithm.run() - front = algorithm.get_result() + front = algorithm.result() # Save results to file print_function_values_to_file(front, "FUN." + algorithm.label) diff --git a/examples/multiobjective/nsgaiii/nsgaiii_dtlz2.py b/examples/multiobjective/nsgaiii/nsgaiii_dtlz2.py index 44cde190..673e6c97 100644 --- a/examples/multiobjective/nsgaiii/nsgaiii_dtlz2.py +++ b/examples/multiobjective/nsgaiii/nsgaiii_dtlz2.py @@ -28,7 +28,7 @@ ) algorithm.run() - front = get_non_dominated_solutions(algorithm.get_result()) + front = get_non_dominated_solutions(algorithm.result()) # Save results to file print_function_values_to_file(front, "FUN." + algorithm.label) diff --git a/examples/multiobjective/omopso/omopso_spark_evaluator.py b/examples/multiobjective/omopso/omopso_spark_evaluator.py index a83016dd..337b71d0 100644 --- a/examples/multiobjective/omopso/omopso_spark_evaluator.py +++ b/examples/multiobjective/omopso/omopso_spark_evaluator.py @@ -32,7 +32,7 @@ ) algorithm.run() - front = algorithm.get_result() + front = algorithm.result() # Save results to file print_function_values_to_file(front, "FUN." + algorithm.get_name() + "." + problem.name()) diff --git a/examples/multiobjective/omopso/omopso_zdt1.py b/examples/multiobjective/omopso/omopso_zdt1.py index b7a52d89..65b6f02f 100644 --- a/examples/multiobjective/omopso/omopso_zdt1.py +++ b/examples/multiobjective/omopso/omopso_zdt1.py @@ -31,7 +31,7 @@ ) algorithm.run() - front = algorithm.get_result() + front = algorithm.result() # Save results to file print_function_values_to_file(front, "FUN." + algorithm.label) diff --git a/examples/multiobjective/preferences/ggde3_zdt2.py b/examples/multiobjective/preferences/ggde3_zdt2.py index 66707182..13a1d4a0 100644 --- a/examples/multiobjective/preferences/ggde3_zdt2.py +++ b/examples/multiobjective/preferences/ggde3_zdt2.py @@ -27,7 +27,7 @@ ) algorithm.run() - front = algorithm.get_result() + front = algorithm.result() # Plot front plot_front = Plot( diff --git a/examples/multiobjective/preferences/gnsgaii_solving_zdt2_with_reference_point.py b/examples/multiobjective/preferences/gnsgaii_solving_zdt2_with_reference_point.py index f09b4842..863250b9 100644 --- a/examples/multiobjective/preferences/gnsgaii_solving_zdt2_with_reference_point.py +++ b/examples/multiobjective/preferences/gnsgaii_solving_zdt2_with_reference_point.py @@ -39,7 +39,7 @@ ) algorithm.run() - front = algorithm.get_result() + front = algorithm.result() # Plot front plot_front = Plot( diff --git a/examples/multiobjective/random_search/random_search_zdt1.py b/examples/multiobjective/random_search/random_search_zdt1.py index 528e3152..5a6bd6a1 100644 --- a/examples/multiobjective/random_search/random_search_zdt1.py +++ b/examples/multiobjective/random_search/random_search_zdt1.py @@ -16,7 +16,7 @@ ) algorithm.run() - front = algorithm.get_result() + front = algorithm.result() # Save results to file print_function_values_to_file(front, "FUN." + algorithm.label) diff --git a/examples/multiobjective/smpso/smpso_schaffer_on_the_fly.py b/examples/multiobjective/smpso/smpso_schaffer_on_the_fly.py index 866f8152..bc82cfb4 100644 --- a/examples/multiobjective/smpso/smpso_schaffer_on_the_fly.py +++ b/examples/multiobjective/smpso/smpso_schaffer_on_the_fly.py @@ -28,7 +28,7 @@ def f2(x: [float]): ) algorithm.run() - front = algorithm.get_result() + front = algorithm.result() # Save results to file print_function_values_to_file(front, "FUN." + algorithm.label) diff --git a/examples/multiobjective/smpso/smpso_spark_evaluator.py b/examples/multiobjective/smpso/smpso_spark_evaluator.py index 6e785da1..0fdd661a 100644 --- a/examples/multiobjective/smpso/smpso_spark_evaluator.py +++ b/examples/multiobjective/smpso/smpso_spark_evaluator.py @@ -26,7 +26,7 @@ ) algorithm.run() - front = algorithm.get_result() + front = algorithm.result() # Save results to file print_function_values_to_file(front, "FUN." + algorithm.get_name() + "." + problem.get_name()) diff --git a/examples/multiobjective/smpso/smpso_srinivas.py b/examples/multiobjective/smpso/smpso_srinivas.py index 35409cf0..6d257875 100644 --- a/examples/multiobjective/smpso/smpso_srinivas.py +++ b/examples/multiobjective/smpso/smpso_srinivas.py @@ -20,7 +20,7 @@ ) algorithm.run() - front = algorithm.get_result() + front = algorithm.result() # Save results to file print_function_values_to_file(front, 'FUN.' + algorithm.label) diff --git a/examples/multiobjective/smpso/smpso_srinivas_on_the_fly.py b/examples/multiobjective/smpso/smpso_srinivas_on_the_fly.py index e109a664..407a3545 100644 --- a/examples/multiobjective/smpso/smpso_srinivas_on_the_fly.py +++ b/examples/multiobjective/smpso/smpso_srinivas_on_the_fly.py @@ -42,7 +42,7 @@ def c2(x: [float]): ) algorithm.run() - front = algorithm.get_result() + front = algorithm.result() # Save results to file print_function_values_to_file(front, "FUN." + algorithm.label) diff --git a/examples/multiobjective/smpso/smpso_tanaka.py b/examples/multiobjective/smpso/smpso_tanaka.py index d2e5cab7..4065096a 100644 --- a/examples/multiobjective/smpso/smpso_tanaka.py +++ b/examples/multiobjective/smpso/smpso_tanaka.py @@ -25,7 +25,7 @@ ) algorithm.run() - front = algorithm.get_result() + front = algorithm.result() # Save results to file print_function_values_to_file(front, "FUN." + algorithm.label) diff --git a/examples/multiobjective/smpso/smpso_zdt4.py b/examples/multiobjective/smpso/smpso_zdt4.py index bc7a35c6..71720464 100644 --- a/examples/multiobjective/smpso/smpso_zdt4.py +++ b/examples/multiobjective/smpso/smpso_zdt4.py @@ -21,7 +21,7 @@ ) algorithm.run() - front = algorithm.get_result() + front = algorithm.result() # Save results to file print_function_values_to_file(front, "FUN." + algorithm.label) diff --git a/examples/multiobjective/smpso/smpsorp_zdt4.py b/examples/multiobjective/smpso/smpsorp_zdt4.py index 14df9d5c..00460f50 100644 --- a/examples/multiobjective/smpso/smpsorp_zdt4.py +++ b/examples/multiobjective/smpso/smpsorp_zdt4.py @@ -40,7 +40,7 @@ ) algorithm.run() - front = algorithm.get_result() + front = algorithm.result() # Plot front plot_front = Plot( diff --git a/examples/multiobjective/spea2/gspea2_zdt1.py b/examples/multiobjective/spea2/gspea2_zdt1.py index a8afe70c..3ac19460 100644 --- a/examples/multiobjective/spea2/gspea2_zdt1.py +++ b/examples/multiobjective/spea2/gspea2_zdt1.py @@ -25,7 +25,7 @@ ) algorithm.run() - front = algorithm.get_result() + front = algorithm.result() # Save results to file print_function_values_to_file(front, "FUN." + algorithm.label) diff --git a/examples/multiobjective/spea2/spea2_dtlz1.py b/examples/multiobjective/spea2/spea2_dtlz1.py index bd3d92fe..a643af6d 100644 --- a/examples/multiobjective/spea2/spea2_dtlz1.py +++ b/examples/multiobjective/spea2/spea2_dtlz1.py @@ -21,7 +21,7 @@ ) algorithm.run() - front = algorithm.get_result() + front = algorithm.result() # Save results to file print_function_values_to_file(front, "FUN." + algorithm.label) diff --git a/examples/multiobjective/spea2/spea2_zdt1.py b/examples/multiobjective/spea2/spea2_zdt1.py index ce860c7d..c445bf13 100644 --- a/examples/multiobjective/spea2/spea2_zdt1.py +++ b/examples/multiobjective/spea2/spea2_zdt1.py @@ -21,7 +21,7 @@ ) algorithm.run() - front = algorithm.get_result() + front = algorithm.result() # Save results to file print_function_values_to_file(front, "FUN." + algorithm.label) diff --git a/examples/singleobjective/evolution_strategy/evolution_strategy_binary.py b/examples/singleobjective/evolution_strategy/evolution_strategy_binary.py index 17416f27..ffd977d5 100644 --- a/examples/singleobjective/evolution_strategy/evolution_strategy_binary.py +++ b/examples/singleobjective/evolution_strategy/evolution_strategy_binary.py @@ -16,7 +16,7 @@ ) algorithm.run() - result = algorithm.get_result() + result = algorithm.result() print("Algorithm: " + algorithm.get_name()) print("Problem: " + problem.get_name()) diff --git a/examples/singleobjective/evolution_strategy/evolution_strategy_float.py b/examples/singleobjective/evolution_strategy/evolution_strategy_float.py index 3e8bb3de..b5f00858 100644 --- a/examples/singleobjective/evolution_strategy/evolution_strategy_float.py +++ b/examples/singleobjective/evolution_strategy/evolution_strategy_float.py @@ -16,7 +16,7 @@ ) algorithm.run() - result = algorithm.get_result() + result = algorithm.result() print("Algorithm: " + algorithm.get_name()) print("Problem: " + problem.get_name()) diff --git a/examples/singleobjective/evolution_strategy/evolution_strategy_permutation.py b/examples/singleobjective/evolution_strategy/evolution_strategy_permutation.py index 87586a43..a41b8419 100644 --- a/examples/singleobjective/evolution_strategy/evolution_strategy_permutation.py +++ b/examples/singleobjective/evolution_strategy/evolution_strategy_permutation.py @@ -18,7 +18,7 @@ ) algorithm.run() - result = algorithm.get_result() + result = algorithm.result() print(f"Algorithm: {algorithm.get_name()}") print(f"Solution: {result.variables}") diff --git a/examples/singleobjective/gde3/gde3_single_objective.py b/examples/singleobjective/gde3/gde3_single_objective.py index b30f496e..de19e2d1 100644 --- a/examples/singleobjective/gde3/gde3_single_objective.py +++ b/examples/singleobjective/gde3/gde3_single_objective.py @@ -11,7 +11,7 @@ ) algorithm.run() - front = algorithm.get_result() + front = algorithm.result() # Save results to file print_function_values_to_file(front, "FUN." + algorithm.get_name() + "." + problem.get_name()) diff --git a/examples/singleobjective/genetic_algorithm/generational_genetic_algorithm_binary.py b/examples/singleobjective/genetic_algorithm/generational_genetic_algorithm_binary.py index b64a675c..e8908293 100644 --- a/examples/singleobjective/genetic_algorithm/generational_genetic_algorithm_binary.py +++ b/examples/singleobjective/genetic_algorithm/generational_genetic_algorithm_binary.py @@ -19,7 +19,7 @@ algorithm.observable.register(observer=PrintObjectivesObserver(100)) algorithm.run() - result = algorithm.get_result() + result = algorithm.result() print("Algorithm: {}".format(algorithm.get_name())) print("Problem: {}".format(problem.name())) diff --git a/examples/singleobjective/genetic_algorithm/generational_genetic_algorithm_float.py b/examples/singleobjective/genetic_algorithm/generational_genetic_algorithm_float.py index a5aadd78..9dabc4b6 100644 --- a/examples/singleobjective/genetic_algorithm/generational_genetic_algorithm_float.py +++ b/examples/singleobjective/genetic_algorithm/generational_genetic_algorithm_float.py @@ -16,7 +16,7 @@ ) algorithm.run() - result = algorithm.get_result() + result = algorithm.result() print("Algorithm: {}".format(algorithm.get_name())) print("Problem: {}".format(problem.name())) diff --git a/examples/singleobjective/genetic_algorithm/generational_genetic_algorithm_tsp.py b/examples/singleobjective/genetic_algorithm/generational_genetic_algorithm_tsp.py index 3093cc33..8e88d43c 100644 --- a/examples/singleobjective/genetic_algorithm/generational_genetic_algorithm_tsp.py +++ b/examples/singleobjective/genetic_algorithm/generational_genetic_algorithm_tsp.py @@ -22,7 +22,7 @@ algorithm.observable.register(observer=PrintObjectivesObserver(5000)) algorithm.run() - result = algorithm.get_result() + result = algorithm.result() print("Algorithm: {}".format(algorithm.get_name())) print("Problem: {}".format(problem.name())) diff --git a/examples/singleobjective/genetic_algorithm/generational_genetic_algorithm_tsp_with_contraints.py b/examples/singleobjective/genetic_algorithm/generational_genetic_algorithm_tsp_with_contraints.py index d1b4b323..70f60770 100644 --- a/examples/singleobjective/genetic_algorithm/generational_genetic_algorithm_tsp_with_contraints.py +++ b/examples/singleobjective/genetic_algorithm/generational_genetic_algorithm_tsp_with_contraints.py @@ -52,7 +52,7 @@ def __evaluate_constraints__(self, solution: PermutationSolution): algorithm.observable.register(observer=PrintObjectivesObserver(1000)) algorithm.run() - result = algorithm.get_result() + result = algorithm.result() print("Algorithm: {}".format(algorithm.get_name())) print("Problem: {}".format(problem.name())) diff --git a/examples/singleobjective/genetic_algorithm/steady_state_genetic_algorithm.py b/examples/singleobjective/genetic_algorithm/steady_state_genetic_algorithm.py index 7ad347a1..ad0e5b0d 100644 --- a/examples/singleobjective/genetic_algorithm/steady_state_genetic_algorithm.py +++ b/examples/singleobjective/genetic_algorithm/steady_state_genetic_algorithm.py @@ -149,7 +149,7 @@ ) algorithm.run() - subset = algorithm.get_result() + subset = algorithm.result() print("Algorithm: {}".format(algorithm.get_name())) print("Problem: {}".format(problem.name())) diff --git a/examples/singleobjective/genetic_algorithm/steady_state_genetic_algorithm_with_knapsack_problem.py b/examples/singleobjective/genetic_algorithm/steady_state_genetic_algorithm_with_knapsack_problem.py index e1c976b6..ee5d5b98 100644 --- a/examples/singleobjective/genetic_algorithm/steady_state_genetic_algorithm_with_knapsack_problem.py +++ b/examples/singleobjective/genetic_algorithm/steady_state_genetic_algorithm_with_knapsack_problem.py @@ -17,7 +17,7 @@ ) algorithm.run() - subset = algorithm.get_result() + subset = algorithm.result() print("Algorithm: {}".format(algorithm.get_name())) print("Problem: {}".format(problem.name())) diff --git a/examples/singleobjective/local_search/local_search_binary.py b/examples/singleobjective/local_search/local_search_binary.py index 72e2000d..981b9fe3 100644 --- a/examples/singleobjective/local_search/local_search_binary.py +++ b/examples/singleobjective/local_search/local_search_binary.py @@ -18,7 +18,7 @@ algorithm.observable.register(observer=PrintObjectivesObserver(100)) algorithm.run() - result = algorithm.get_result() + result = algorithm.result() # Save results to file print_function_values_to_file(result, "FUN." + algorithm.get_name() + "." + problem.get_name()) diff --git a/examples/singleobjective/local_search/local_search_float.py b/examples/singleobjective/local_search/local_search_float.py index f658cb37..70aa1edc 100644 --- a/examples/singleobjective/local_search/local_search_float.py +++ b/examples/singleobjective/local_search/local_search_float.py @@ -16,7 +16,7 @@ ) algorithm.run() - result = algorithm.get_result() + result = algorithm.result() # Save results to file print_function_values_to_file(result, "FUN." + algorithm.get_name() + "." + problem.get_name()) diff --git a/examples/singleobjective/nsgaii/nsgaii_single_objective_binary.py b/examples/singleobjective/nsgaii/nsgaii_single_objective_binary.py index 6a215a35..3de31c78 100644 --- a/examples/singleobjective/nsgaii/nsgaii_single_objective_binary.py +++ b/examples/singleobjective/nsgaii/nsgaii_single_objective_binary.py @@ -25,7 +25,7 @@ algorithm.observable.register(observer=ProgressBarObserver(max=max_evaluations)) algorithm.run() - front = algorithm.get_result() + front = algorithm.result() # Save results to file print_function_values_to_file(front, "FUN." + algorithm.get_name() + "-" + problem.get_name()) diff --git a/examples/singleobjective/nsgaii/nsgaii_single_objective_float.py b/examples/singleobjective/nsgaii/nsgaii_single_objective_float.py index 25ce2386..e1bf5919 100644 --- a/examples/singleobjective/nsgaii/nsgaii_single_objective_float.py +++ b/examples/singleobjective/nsgaii/nsgaii_single_objective_float.py @@ -20,7 +20,7 @@ ) algorithm.run() - front = algorithm.get_result() + front = algorithm.result() # Save results to file print_function_values_to_file(front, "FUN." + algorithm.get_name() + "-" + problem.get_name()) diff --git a/examples/singleobjective/simulated_annealing/simulated_annealing_binary.py b/examples/singleobjective/simulated_annealing/simulated_annealing_binary.py index 1f89b618..56026d97 100644 --- a/examples/singleobjective/simulated_annealing/simulated_annealing_binary.py +++ b/examples/singleobjective/simulated_annealing/simulated_annealing_binary.py @@ -16,7 +16,7 @@ ) algorithm.run() - result = algorithm.get_result() + result = algorithm.result() # Save results to file print_function_values_to_file(result, "FUN." + algorithm.get_name() + "." + problem.get_name()) diff --git a/examples/singleobjective/simulated_annealing/simulated_annealing_float.py b/examples/singleobjective/simulated_annealing/simulated_annealing_float.py index 2383bc2a..c83d210c 100644 --- a/examples/singleobjective/simulated_annealing/simulated_annealing_float.py +++ b/examples/singleobjective/simulated_annealing/simulated_annealing_float.py @@ -16,7 +16,7 @@ ) algorithm.run() - result = algorithm.get_result() + result = algorithm.result() # Save results to file print_function_values_to_file(result, "FUN." + algorithm.get_name() + "." + problem.get_name()) diff --git a/examples/singleobjective/simulated_annealing/simulated_annealing_permutation.py b/examples/singleobjective/simulated_annealing/simulated_annealing_permutation.py index f9349ffe..0a136e95 100644 --- a/examples/singleobjective/simulated_annealing/simulated_annealing_permutation.py +++ b/examples/singleobjective/simulated_annealing/simulated_annealing_permutation.py @@ -15,7 +15,7 @@ ) algorithm.run() - result = algorithm.get_result() + result = algorithm.result() print(f"Algorithm: {algorithm.get_name()}") print(f"Solution: {result.variables}") diff --git a/jmetal/algorithm/multiobjective/gde3.py b/jmetal/algorithm/multiobjective/gde3.py index b2c39c59..09b1b7f1 100644 --- a/jmetal/algorithm/multiobjective/gde3.py +++ b/jmetal/algorithm/multiobjective/gde3.py @@ -95,7 +95,7 @@ def evaluate(self, solution_list: List[FloatSolution]) -> List[FloatSolution]: def stopping_condition_is_met(self) -> bool: return self.termination_criterion.is_met - def get_result(self) -> List[FloatSolution]: + def result(self) -> List[FloatSolution]: return self.solutions def get_name(self) -> str: diff --git a/jmetal/algorithm/multiobjective/hype.py b/jmetal/algorithm/multiobjective/hype.py index fb732904..b508b664 100644 --- a/jmetal/algorithm/multiobjective/hype.py +++ b/jmetal/algorithm/multiobjective/hype.py @@ -80,7 +80,7 @@ def replacement(self, population: List[S], offspring_population: List[S]) -> Lis join_population = population + offspring_population return self.ranking_fitness.execute(join_population) - def get_result(self) -> R: + def result(self) -> R: return self.solutions def get_name(self) -> str: diff --git a/jmetal/algorithm/multiobjective/ibea.py b/jmetal/algorithm/multiobjective/ibea.py index 818abd9a..cd59a954 100644 --- a/jmetal/algorithm/multiobjective/ibea.py +++ b/jmetal/algorithm/multiobjective/ibea.py @@ -106,7 +106,7 @@ def replacement(self, population: List[S], offspring_population: List[S]) -> Lis return join_population - def get_result(self) -> R: + def result(self) -> R: return self.solutions def get_name(self) -> str: diff --git a/jmetal/algorithm/multiobjective/mocell.py b/jmetal/algorithm/multiobjective/mocell.py index cb19458a..d384c254 100644 --- a/jmetal/algorithm/multiobjective/mocell.py +++ b/jmetal/algorithm/multiobjective/mocell.py @@ -133,7 +133,7 @@ def replacement(self, population: List[S], offspring_population: List[S]) -> Lis return population - def get_result(self) -> R: + def result(self) -> R: return self.archive.solution_list def get_name(self) -> str: diff --git a/jmetal/algorithm/multiobjective/moead.py b/jmetal/algorithm/multiobjective/moead.py index 57079285..d073918c 100644 --- a/jmetal/algorithm/multiobjective/moead.py +++ b/jmetal/algorithm/multiobjective/moead.py @@ -156,7 +156,7 @@ def choose_neighbor_type(self): def get_name(self): return "MOEAD" - def get_result(self): + def result(self): return self.solutions @@ -416,7 +416,7 @@ def update_external_archive(self): for solution in first_rank_solutions: self.archive.append(copy.deepcopy(solution)) - def get_result(self): + def result(self): return self.archive diff --git a/jmetal/algorithm/multiobjective/nsgaii.py b/jmetal/algorithm/multiobjective/nsgaii.py index eb863cd0..581db207 100644 --- a/jmetal/algorithm/multiobjective/nsgaii.py +++ b/jmetal/algorithm/multiobjective/nsgaii.py @@ -98,7 +98,7 @@ def replacement(self, population: List[S], offspring_population: List[S]) -> Lis return solutions - def get_result(self) -> R: + def result(self) -> R: return self.solutions def get_name(self) -> str: @@ -206,7 +206,7 @@ def observable_data(self) -> dict: return { "PROBLEM": self.problem, "EVALUATIONS": self.evaluations, - "SOLUTIONS": self.get_result(), + "SOLUTIONS": self.result(), "COMPUTING_TIME": ctime, } @@ -301,7 +301,7 @@ def run(self): for future, _ in task_pool: future.cancel() - def get_result(self) -> R: + def result(self) -> R: return self.solutions def get_name(self) -> str: diff --git a/jmetal/algorithm/multiobjective/nsgaiii.py b/jmetal/algorithm/multiobjective/nsgaiii.py index 1c6157cc..fa80bc02 100644 --- a/jmetal/algorithm/multiobjective/nsgaiii.py +++ b/jmetal/algorithm/multiobjective/nsgaiii.py @@ -352,7 +352,7 @@ def replacement(self, population: List[S], offspring_population: List[S]) -> Lis return list(pop) - def get_result(self): + def result(self): """Return only non dominated solutions.""" ranking = FastNonDominatedRanking(self.dominance_comparator) ranking.compute_ranking(self.solutions, k=self.population_size) diff --git a/jmetal/algorithm/multiobjective/omopso.py b/jmetal/algorithm/multiobjective/omopso.py index 8274d617..ab6b6727 100644 --- a/jmetal/algorithm/multiobjective/omopso.py +++ b/jmetal/algorithm/multiobjective/omopso.py @@ -190,7 +190,7 @@ def update_progress(self) -> None: observable_data["SOLUTIONS"] = self.epsilon_archive.solution_list self.observable.notify_all(**observable_data) - def get_result(self) -> List[FloatSolution]: + def result(self) -> List[FloatSolution]: return self.epsilon_archive.solution_list def get_name(self) -> str: diff --git a/jmetal/algorithm/multiobjective/random_search.py b/jmetal/algorithm/multiobjective/random_search.py index 47ca457a..f37af534 100644 --- a/jmetal/algorithm/multiobjective/random_search.py +++ b/jmetal/algorithm/multiobjective/random_search.py @@ -35,7 +35,7 @@ def observable_data(self) -> dict: return { "PROBLEM": self.problem, "EVALUATIONS": self.evaluations, - "SOLUTIONS": self.get_result(), + "SOLUTIONS": self.result(), "COMPUTING_TIME": ctime, } @@ -65,7 +65,7 @@ def update_progress(self) -> None: observable_data = self.observable_data() self.observable.notify_all(**observable_data) - def get_result(self) -> List[S]: + def result(self) -> List[S]: return self.archive.solution_list def get_name(self) -> str: diff --git a/jmetal/algorithm/multiobjective/smpso.py b/jmetal/algorithm/multiobjective/smpso.py index 5cf23511..bcfac7b2 100644 --- a/jmetal/algorithm/multiobjective/smpso.py +++ b/jmetal/algorithm/multiobjective/smpso.py @@ -213,7 +213,7 @@ def update_progress(self) -> None: observable_data["SOLUTIONS"] = self.leaders.solution_list self.observable.notify_all(**observable_data) - def get_result(self) -> List[FloatSolution]: + def result(self) -> List[FloatSolution]: return self.leaders.solution_list def get_name(self) -> str: @@ -377,7 +377,7 @@ def get_reference_point(self): with self.lock: return self.reference_points - def get_result(self) -> List[FloatSolution]: + def result(self) -> List[FloatSolution]: result = [] for leader in self.leaders: diff --git a/jmetal/algorithm/multiobjective/spea2.py b/jmetal/algorithm/multiobjective/spea2.py index 92f9cb8e..40cc0f1c 100644 --- a/jmetal/algorithm/multiobjective/spea2.py +++ b/jmetal/algorithm/multiobjective/spea2.py @@ -85,7 +85,7 @@ def replacement(self, population: List[S], offspring_population: List[S]) -> Lis return solutions - def get_result(self) -> R: + def result(self) -> R: return self.solutions def get_name(self) -> str: diff --git a/jmetal/algorithm/singleobjective/evolution_strategy.py b/jmetal/algorithm/singleobjective/evolution_strategy.py index 0dbe81ca..0e989c4d 100644 --- a/jmetal/algorithm/singleobjective/evolution_strategy.py +++ b/jmetal/algorithm/singleobjective/evolution_strategy.py @@ -84,7 +84,7 @@ def replacement(self, population: List[S], offspring_population: List[S]) -> Lis return new_population - def get_result(self) -> R: + def result(self) -> R: return self.solutions[0] def get_name(self) -> str: diff --git a/jmetal/algorithm/singleobjective/genetic_algorithm.py b/jmetal/algorithm/singleobjective/genetic_algorithm.py index 29d57b89..5656ee50 100644 --- a/jmetal/algorithm/singleobjective/genetic_algorithm.py +++ b/jmetal/algorithm/singleobjective/genetic_algorithm.py @@ -107,7 +107,7 @@ def replacement(self, population: List[S], offspring_population: List[S]) -> Lis return population[: self.population_size] - def get_result(self) -> R: + def result(self) -> R: return self.solutions[0] def get_name(self) -> str: diff --git a/jmetal/algorithm/singleobjective/local_search.py b/jmetal/algorithm/singleobjective/local_search.py index 37dde496..1774e804 100644 --- a/jmetal/algorithm/singleobjective/local_search.py +++ b/jmetal/algorithm/singleobjective/local_search.py @@ -77,11 +77,11 @@ def observable_data(self) -> dict: return { "PROBLEM": self.problem, "EVALUATIONS": self.evaluations, - "SOLUTIONS": self.get_result(), + "SOLUTIONS": self.result(), "COMPUTING_TIME": ctime, } - def get_result(self) -> R: + def result(self) -> R: return self.solutions[0] def get_name(self) -> str: diff --git a/jmetal/algorithm/singleobjective/simulated_annealing.py b/jmetal/algorithm/singleobjective/simulated_annealing.py index 72b5a6e6..a546730d 100644 --- a/jmetal/algorithm/singleobjective/simulated_annealing.py +++ b/jmetal/algorithm/singleobjective/simulated_annealing.py @@ -90,11 +90,11 @@ def observable_data(self) -> dict: return { "PROBLEM": self.problem, "EVALUATIONS": self.evaluations, - "SOLUTIONS": self.get_result(), + "SOLUTIONS": self.result(), "COMPUTING_TIME": ctime, } - def get_result(self) -> R: + def result(self) -> R: return self.solutions[0] def get_name(self) -> str: diff --git a/jmetal/algorithm/test/ittest_algorithm.py b/jmetal/algorithm/test/ittest_algorithm.py index beecb753..11bd461e 100644 --- a/jmetal/algorithm/test/ittest_algorithm.py +++ b/jmetal/algorithm/test/ittest_algorithm.py @@ -55,7 +55,7 @@ def test_should_NSGAII_work_when_solving_problem_ZDT1_with_standard_settings(sel ) algorithm.run() - front = algorithm.get_result() + front = algorithm.result() hv = HyperVolume(reference_point=[1, 1]) value = hv.compute([front[i].objectives for i in range(len(front))]) @@ -74,7 +74,7 @@ def test_should_SMPSO_work_when_solving_problem_ZDT1_with_standard_settings(self ) algorithm.run() - front = algorithm.get_result() + front = algorithm.result() hv = HyperVolume(reference_point=[1, 1]) value = hv.compute([front[i].objectives for i in range(len(front))]) diff --git a/jmetal/core/algorithm.py b/jmetal/core/algorithm.py index 860a8cba..2c7e960c 100644 --- a/jmetal/core/algorithm.py +++ b/jmetal/core/algorithm.py @@ -91,7 +91,7 @@ def run(self): self.total_computing_time = time.time() - self.start_computing_time @abstractmethod - def get_result(self) -> R: + def result(self) -> R: pass @abstractmethod @@ -131,7 +131,7 @@ def observable_data(self) -> dict: return { "PROBLEM": self.problem, "EVALUATIONS": self.evaluations, - "SOLUTIONS": self.get_result(), + "SOLUTIONS": self.result(), "COMPUTING_TIME": time.time() - self.start_computing_time, } @@ -201,7 +201,7 @@ def observable_data(self) -> dict: return { "PROBLEM": self.problem, "EVALUATIONS": self.evaluations, - "SOLUTIONS": self.get_result(), + "SOLUTIONS": self.result(), "COMPUTING_TIME": time.time() - self.start_computing_time, } diff --git a/jmetal/lab/experiment.py b/jmetal/lab/experiment.py index 0fa5456e..dc8de35a 100644 --- a/jmetal/lab/experiment.py +++ b/jmetal/lab/experiment.py @@ -42,10 +42,10 @@ def execute(self, output_path: str = ""): if output_path: file_name = os.path.join(output_path, "FUN.{}.tsv".format(self.run_tag)) - print_function_values_to_file(self.algorithm.get_result(), filename=file_name) + print_function_values_to_file(self.algorithm.result(), filename=file_name) file_name = os.path.join(output_path, "VAR.{}.tsv".format(self.run_tag)) - print_variables_to_file(self.algorithm.get_result(), filename=file_name) + print_variables_to_file(self.algorithm.result(), filename=file_name) file_name = os.path.join(output_path, "TIME.{}".format(self.run_tag)) with open(file_name, "w+") as of: