moead_framework.algorithm.combinatorial.moead_delta_nr.MoeadDeltaNr¶
-
class
moead_framework.algorithm.combinatorial.moead_delta_nr.
MoeadDeltaNr
(problem, max_evaluation, number_of_objective, number_of_weight_neighborhood, delta, number_of_replacement, aggregation_function, weight_file, sps_strategy=None, number_of_crossover_points=None, mutation_probability=None, parent_selector=None)[source]¶ Bases:
moead_framework.algorithm.combinatorial.moead.Moead
Implementation of MOEA/D with parameters delta / nr
Li and Q. Zhang. MOEA/D-DE : Multiobjective Optimization Problems With Complicated Pareto Sets, MOEA/D and NSGA-II. IEEE Transactions on Evolutionary Computation, 13(2):284–302, April 2009. doi:10.1109/TEVC.2008.925798
Example:
>>> from moead_framework.aggregation import Tchebycheff >>> from moead_framework.algorithm.combinatorial import MoeadDeltaNr >>> from moead_framework.problem.combinatorial import Rmnk >>> >>> # The file is available here : https://github.com/moead-framework/data/blob/master/problem/RMNK/Instances/rmnk_0_2_100_1_0.dat >>> # Others instances are available here : https://github.com/moead-framework/data/tree/master/problem/RMNK/Instances >>> instance_file = "moead_framework/test/data/instances/rmnk_0_2_100_1_0.dat" >>> rmnk = Rmnk(instance_file=instance_file) >>> >>> number_of_weight = 10 >>> number_of_weight_neighborhood = 2 >>> number_of_evaluations = 1000 >>> # The file is available here : https://github.com/moead-framework/data/blob/master/weights/SOBOL-2objs-10wei.ws >>> # Others weights files are available here : https://github.com/moead-framework/data/tree/master/weights >>> weight_file = "moead_framework/test/data/weights/SOBOL-" + str(rmnk.number_of_objective) + "objs-" + str(number_of_weight) + "wei.ws" >>> >>> moead = MoeadDeltaNr(problem=rmnk, >>> max_evaluation=number_of_evaluations, >>> number_of_objective=2, >>> delta=0.9, >>> number_of_replacement=1, >>> number_of_weight_neighborhood=number_of_weight_neighborhood, >>> weight_file=weight_file, >>> aggregation_function=Tchebycheff, >>> ) >>> >>> population = moead.run()
-
__init__
(problem, max_evaluation, number_of_objective, number_of_weight_neighborhood, delta, number_of_replacement, aggregation_function, weight_file, sps_strategy=None, number_of_crossover_points=None, mutation_probability=None, parent_selector=None)[source]¶ Constructor of the algorithm.
- Parameters
problem – {
Problem
} problem to optimizemax_evaluation – {integer} maximum number of evaluation
number_of_weight_neighborhood – {integer} size of the neighborhood
delta – {float} probability to use all the population as neighborhood
number_of_replacement – {integer} maximum number of solutions replaced in the population for each new offspring generated
aggregation_function – {
AggregationFunction
}weight_file – {string} path of the weight file. Each line represent a weight vector, each column represent a coordinate. An exemple is available here: https://github.com/moead-framework/data/blob/master/weights/SOBOL-2objs-10wei.ws
parent_selector – Optional – {
ParentSelector
} The default operator depends of the number of solution required by the genetic operatorsps_strategy – Optional – {
SpsStrategy
} The default strategy is {SpsAllSubproblems
}number_of_crossover_points – {integer} number of crossover point
mutation_probability – {integer} probability of mutation used by the genetic operator
number_of_objective – Deprecated – {integer} number of objective in the problem. Deprecated, remove in the next major release.
Methods
__init__
(problem, max_evaluation, …[, …])Constructor of the algorithm.
Generate all neighborhood for each solution in the population
generate_offspring
(population)Generate a new offspring.
Select sub-problems to visit for the next generation.
init_z
()Initialize the reference point z
Initialize the population of solution
mating_pool_selection
(sub_problem)Select the set of solutions where future parents solutions will be selected according to the current sub-problem visited
optimize_sub_problem
(sub_problem_index)Execute the process to optimize the sub-problem currently iterated
repair
(solution)Repair the solution in parameter.
run
([checkpoint])Execute the algorithm.
update_current_sub_problem
(sub_problem)Update the attribute current_sub_problem
update_solutions
(solution, …)Update solutions of the population and of the external archive ep.
update_z
(solution)Update the reference point z with coordinates of the solution in parameter if coordinates are better.
-
generate_closest_weight_vectors
()¶ Generate all neighborhood for each solution in the population
- Returns
{list<List<Integer>>} List of sub-problem (neighborhood) for each solution
-
generate_offspring
(population)¶ Generate a new offspring. This function calls the component
OffspringGenerator
- Parameters
population – {list<
OneDimensionSolution
>} set of solutions (parents) used to generate the offspring- Returns
{
OneDimensionSolution
} offspring
-
get_sub_problems_to_visit
()¶ Select sub-problems to visit for the next generation. This function calls the component
SpsStrategy
- Returns
{list} indexes of sub-problems
-
init_z
()¶ Initialize the reference point z
- Returns
-
initial_population
()¶ Initialize the population of solution
- Returns
{List<
OneDimensionSolution
>}
-
mating_pool_selection
(sub_problem)¶ Select the set of solutions where future parents solutions will be selected according to the current sub-problem visited
- Parameters
sub_problem – {integer} index of the sub-problem currently visited
- Returns
{list} indexes of sub-problems
-
optimize_sub_problem
(sub_problem_index)¶ Execute the process to optimize the sub-problem currently iterated
- Parameters
sub_problem_index – {integer} index of the sub-problem iterated
- Returns
-
repair
(solution)¶ Repair the solution in parameter.
- Parameters
solution – {
OneDimensionSolution
}- Returns
{
OneDimensionSolution
} the repaired solution
-
run
(checkpoint=None)¶ Execute the algorithm.
- Parameters
checkpoint – {function} The default value is None. The checkpoint can be used to save data during the process. The function required one parameter of type {
AbstractMoead
}- Returns
list<{
OneDimensionSolution
}> All non-dominated solutions found by the algorithm
Example:
>>> from moead_framework.algorithm.combinatorial import Moead >>> from moead_framework.tool.result import save_population >>> moead = Moead(...) >>> >>> def checkpoint(moead_algorithm: AbstractMoead): >>> if moead_algorithm.current_eval % 10 == 0 : >>> filename = "non_dominated_solutions-eval" + str(moead_algorithm.current_eval) + ".txt" >>> save_population(file_name=filename, population=moead_algorithm.ep) >>> >>> population = moead.run(checkpoint)
-
update_current_sub_problem
(sub_problem)¶ Update the attribute current_sub_problem
- Parameters
sub_problem – {integer} index of sub-problem
- Returns
-
update_solutions
(solution, aggregation_function, sub_problem)[source]¶ Update solutions of the population and of the external archive ep.
Integration of the parameter number_of_replacement (the maximal number of solutions replaced by each child solution to preserve the diversity)
- Parameters
solution – {
OneDimensionSolution
} the candidate solution also called offspringaggregation_function – {
AggregationFunction
} Aggregation function used to compare solution in a multi-objective contextsub_problem – {integer} index of the sub-problem currently visited
- Returns
-
update_z
(solution)¶ Update the reference point z with coordinates of the solution in parameter if coordinates are better.
- Parameters
solution –
OneDimensionSolution
solution used to update the reference point- Returns