moead_framework.algorithm.combinatorial.moead.Moead

class moead_framework.algorithm.combinatorial.moead.Moead(problem, max_evaluation, number_of_weight_neighborhood, aggregation_function, weight_file, number_of_objective=None, termination_criteria=None, number_of_crossover_points=None, mutation_probability=None, mating_pool_selector=None, genetic_operator=None, parent_selector=None, sps_strategy=None, offspring_generator=None, number_of_weight=None)[source]

Bases: moead_framework.algorithm.abstract_moead.AbstractMoead

Implementation of MOEA/D for combinatorial problems.

Example:

>>> from moead_framework.aggregation import Tchebycheff
>>> from moead_framework.algorithm.combinatorial import Moead
>>> 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 = Moead(problem=rmnk,
>>>               max_evaluation=number_of_evaluations,
>>>               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, aggregation_function, weight_file, number_of_objective=None, termination_criteria=None, number_of_crossover_points=None, mutation_probability=None, mating_pool_selector=None, genetic_operator=None, parent_selector=None, sps_strategy=None, offspring_generator=None, number_of_weight=None)[source]

Constructor of the algorithm.

Parameters

Methods

__init__(problem, max_evaluation, …[, …])

Constructor of the algorithm.

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_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)

Update solutions of the population and of the external archive ep

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