moead_framework.algorithm.combinatorial.moead_dra.MoeadDRA

class moead_framework.algorithm.combinatorial.moead_dra.MoeadDRA(problem, max_evaluation, number_of_weight_neighborhood, delta, number_of_replacement, aggregation_function, weight_file, number_of_objective=None, number_of_crossover_points=None, threshold_before_evaluate_subproblem_utility=50, delta_threshold=0.001)[source]

Bases: moead_framework.algorithm.combinatorial.moead_delta_nr.MoeadDeltaNr

Implementation of MOEA/D-DRA

  1. Zhang, W. Liu, and H. Li. The performance of a new version of moea/d on cec09 unconstrained mop test instances. In 2009 IEEE Congress on Evolutionary Computation, volume, 203–208. 2009. doi:10.1109/CEC.2009.4982949.

Example:

>>> from moead_framework.aggregation import Tchebycheff
>>> from moead_framework.algorithm.combinatorial import MoeadDRA
>>> 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 = MoeadDRA(problem=rmnk,
>>>               max_evaluation=number_of_evaluations,
>>>               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_weight_neighborhood, delta, number_of_replacement, aggregation_function, weight_file, number_of_objective=None, number_of_crossover_points=None, threshold_before_evaluate_subproblem_utility=50, delta_threshold=0.001)[source]

Constructor of the algorithm.

Parameters
  • problem – {Problem} problem to optimize

  • max_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

  • number_of_crossover_points – {integer} number of crossover point

  • threshold_before_evaluate_subproblem_utility – Optional – Threshold before evaluate the subproblem utility. The default value is 50

  • delta_threshold – Optional – reset the utility if the relative decrease delta_i is under this treshold. The default value is 0.001

  • 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.

compute_delta(i)

compute the relative decrease delta_i

generate_closest_weight_vectors()

Generate all neighborhood for each solution in the population

generate_offspring(population)

Generate a new offspring.

get_sub_problems_to_visit()

Select sub-problems to visit for the next generation.

init_z()

Initialize the reference point z

initial_population()

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_pi()

update the utility of each sub_problem

update_scores(sub_problem, score)

Update the score

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.

compute_delta(i)[source]

compute the relative decrease delta_i

Parameters

i – {integer} index of sub-problem

Returns

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)[source]

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.algorithm import AbstractMoead
>>> 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_pi()[source]

update the utility of each sub_problem

Returns

update_scores(sub_problem, score)[source]

Update the score

self.scores[sub_problem][0] = old score self.scores[sub_problem][1] = new score

Parameters
  • sub_problem – {integer} index of the current sub-problem

  • score – {float}

Returns

update_solutions(solution, aggregation_function, sub_problem)

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 offspring

  • aggregation_function – {AggregationFunction} Aggregation function used to compare solution in a multi-objective context

  • sub_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

solutionOneDimensionSolution solution used to update the reference point

Returns