|
| 1 | + |
| 2 | +User guide |
| 3 | +=========================================== |
| 4 | + |
| 5 | +Overview |
| 6 | +-------------------------------------- |
| 7 | + |
| 8 | +moead-framework is a modular framework composed of 10 customizable components summarized in the following figure. |
| 9 | +In this user guide, we will present the role of each component in a general way. |
| 10 | +For more detailed information, you can visit the following documentation : https://moead-framework.github.io/framework/html/api.html |
| 11 | + |
| 12 | +.. image:: _static/components.png |
| 13 | + :width: 600 |
| 14 | + :alt: overview |
| 15 | + |
| 16 | +Problem & Solution |
| 17 | +-------------------------------------- |
| 18 | + |
| 19 | +The problem is one of the main components of the framework. |
| 20 | +The solutions are the link between the algorithm and the problem. The solutions are generated during the algorithm |
| 21 | +in order to solve the problem. |
| 22 | + |
| 23 | +The problem in the framework is a component that allows to randomly generate solutions and to evaluate them. |
| 24 | +The solutions have two important attributes: |
| 25 | + - ``decision_vector`` : list of all decision variables of the solution |
| 26 | + - ``F`` : all objectives values of the solution, for example, ``F[0]`` is the objective value for the function f0 and ``F[1]`` is the objective value for the function f1. |
| 27 | + |
| 28 | +Example of the Rmnk problem : |
| 29 | + >>> from moead_framework.problem.combinatorial import Rmnk |
| 30 | + >>> |
| 31 | + >>> # The file is available here : https://github.com/moead-framework/data/blob/master/problem/RMNK/Instances/rmnk_0_2_100_1_0.dat |
| 32 | + >>> # Others instances are available here : https://github.com/moead-framework/data/tree/master/problem/RMNK/Instances |
| 33 | + >>> instance_file = "rmnk_0_2_100_1_0.dat" |
| 34 | + >>> problem = Rmnk(instance_file=instance_file) |
| 35 | + >>> |
| 36 | + >>> # Generate a new solution |
| 37 | + >>> solution = problem.generate_random_solution() |
| 38 | + >>> |
| 39 | + >>> # Print all decision variables of the solution |
| 40 | + >>> print(solution.decision_vector) |
| 41 | + >>> |
| 42 | + >>> # Print all objectives values of the solution |
| 43 | + >>> print(solution.F) |
| 44 | + |
| 45 | + |
| 46 | +Algorithm |
| 47 | +-------------------------------------- |
| 48 | + |
| 49 | +In the framework, the algorithm is the main component, composed of several sub-components to easily parameterize it. |
| 50 | +The algorithms are defined with default components which allows to execute them very easily with few parameters. |
| 51 | +The mandatory parameters are the problem, the maximum number of evaluations, |
| 52 | +the number of sub-problems in the neighborhood, the file that defines the weight vectors and the aggregation function. |
| 53 | +The complete and detailed settings of each algorithm are available here : https://moead-framework.github.io/framework/html/main_components.html#algorithms. |
| 54 | + |
| 55 | +Example with the original MOEA/D algorithm : |
| 56 | + >>> from moead_framework.aggregation import Tchebycheff |
| 57 | + >>> from moead_framework.algorithm.combinatorial import Moead |
| 58 | + >>> from moead_framework.problem.combinatorial import Rmnk |
| 59 | + >>> |
| 60 | + >>> # The file is available here : https://github.com/moead-framework/data/blob/master/problem/RMNK/Instances/rmnk_0_2_100_1_0.dat |
| 61 | + >>> # Others instances are available here : https://github.com/moead-framework/data/tree/master/problem/RMNK/Instances |
| 62 | + >>> instance_file = "moead_framework/test/data/instances/rmnk_0_2_100_1_0.dat" |
| 63 | + >>> rmnk = Rmnk(instance_file=instance_file) |
| 64 | + >>> |
| 65 | + >>> number_of_weight = 10 |
| 66 | + >>> # The file is available here : https://github.com/moead-framework/data/blob/master/weights/SOBOL-2objs-10wei.ws |
| 67 | + >>> # Others weights files are available here : https://github.com/moead-framework/data/tree/master/weights |
| 68 | + >>> weight_file = "moead_framework/test/data/weights/SOBOL-" + str(rmnk.number_of_objective) + "objs-" + str(number_of_weight) + "wei.ws" |
| 69 | + >>> |
| 70 | + >>> moead = Moead(problem=rmnk, |
| 71 | + >>> max_evaluation=1000, |
| 72 | + >>> number_of_weight_neighborhood=2, |
| 73 | + >>> weight_file=weight_file, |
| 74 | + >>> aggregation_function=Tchebycheff, |
| 75 | + >>> ) |
| 76 | + >>> |
| 77 | + >>> population = moead.run() |
| 78 | + |
| 79 | + |
| 80 | +Sub-problem selection strategy |
| 81 | +-------------------------------------- |
| 82 | + |
| 83 | +This component, introduced in :cite:`moead_dra` and :cite:`gpruvost_evocop2020`, has the objective to select the sub-problems |
| 84 | +to be optimized during the next generation. By default in MOEA/D, all subproblems are selected. |
| 85 | +This component requires the attribute ``number_of_subproblem`` in the algorithm which defines the |
| 86 | +number of subproblems to select. |
| 87 | + |
| 88 | +More information : https://moead-framework.github.io/framework/html/other_components.html#sub-problem-selection-strategy |
| 89 | + |
| 90 | + |
| 91 | +Aggregation functions |
| 92 | +-------------------------------------- |
| 93 | + |
| 94 | +This component defines the aggregation function used to decompose the multi-objective problem into several single-objective sub-problems. |
| 95 | +The function ``run(solution, number_of_objective, weights, sub_problem, z)`` allows to evaluate a solution for a |
| 96 | +given sub-problem and the function ``is_better(old_value, new_value)`` allows to compare two aggregation values. |
| 97 | + |
| 98 | +More information : https://moead-framework.github.io/framework/html/main_components.html#aggregation-functions |
| 99 | + |
| 100 | + |
| 101 | +Mating Selector |
| 102 | +-------------------------------------- |
| 103 | + |
| 104 | +This component aims to select the solutions that can be chosen as parent solutions to generate an offspring. |
| 105 | +The method ``select(sub_problem)`` returns the indexes of the selected solutions. |
| 106 | +By default in MOEA/D, this component returns the index of the solutions in the neighborhood of the subproblem |
| 107 | +currently visited. |
| 108 | + |
| 109 | +More information : https://moead-framework.github.io/framework/html/other_components.html#mating-selector |
| 110 | + |
| 111 | + |
| 112 | +Offspring generator |
| 113 | +-------------------------------------- |
| 114 | + |
| 115 | +This component is designed to generate offsprings from a set of solutions given in parameter. |
| 116 | +Its unique method ``run(population_indexes)`` returns a unique solution. |
| 117 | +By default, a generic component is used, it uses two subcomponents which allow to select |
| 118 | +parent solutions (Parent Selector) and then to execute a genetic operator to generate the new offspring. |
| 119 | + |
| 120 | +More information : https://moead-framework.github.io/framework/html/other_components.html#offspring-generator |
| 121 | + |
| 122 | + |
| 123 | +Parent Selector |
| 124 | +~~~~~~~~~~~~~~~~~~~~~~ |
| 125 | + |
| 126 | +This component is used in the offspring generator component. |
| 127 | +It allows to choose the solutions which will be used to generate new solutions. |
| 128 | +The method ``select(indexes)`` takes as parameter the indexes of the solutions available to be |
| 129 | +selected (chosen by the Mating selector component) to return a list of solutions. |
| 130 | + |
| 131 | +More information : https://moead-framework.github.io/framework/html/other_components.html#parent-selector |
| 132 | + |
| 133 | + |
| 134 | +Genetic operators |
| 135 | +~~~~~~~~~~~~~~~~~~~~~~ |
| 136 | + |
| 137 | +This component is used in the offspring generator component. This component is initialized by its constructor with |
| 138 | +the solutions chosen by the Parent Selector component. Other parameters can be added according to the operators |
| 139 | +like the number of crossover points or the mutation rate for example. |
| 140 | +The ``run()`` method returns after its execution a new offspring. |
| 141 | + |
| 142 | +More information : https://moead-framework.github.io/framework/html/other_components.html#genetic-operators |
| 143 | + |
| 144 | + |
| 145 | +Termination criteria |
| 146 | +-------------------------------------- |
| 147 | + |
| 148 | +This component aims at defining the stopping criteria of the algorithm. The method ``test()`` of this component |
| 149 | +returns a boolean to define if the algorithm can continue to be executed. |
| 150 | + |
| 151 | +More information : https://moead-framework.github.io/framework/html/other_components.html#termination-criteria |
0 commit comments