:py:mod:`desdeo_emo.EAs`
========================

.. py:module:: desdeo_emo.EAs

.. autoapi-nested-parse::

   This module contains classes implementing different Evolutionary algorithms.



Submodules
----------
.. toctree::
   :titlesonly:
   :maxdepth: 1

   BaseEA/index.rst
   BaseIndicatorEA/index.rst
   IBEA/index.rst
   IKRVEA/index.rst
   IOPIS/index.rst
   MOEAD/index.rst
   NSGAIII/index.rst
   PBEA/index.rst
   PPGA/index.rst
   RVEA/index.rst
   TournamentEA/index.rst
   slowRVEA/index.rst


Package Contents
----------------

Classes
~~~~~~~

.. autoapisummary::

   desdeo_emo.EAs.BaseEA
   desdeo_emo.EAs.BaseDecompositionEA
   desdeo_emo.EAs.RVEA
   desdeo_emo.EAs.NSGAIII
   desdeo_emo.EAs.PPGA
   desdeo_emo.EAs.TournamentEA
   desdeo_emo.EAs.IOPIS_NSGAIII
   desdeo_emo.EAs.IOPIS_RVEA
   desdeo_emo.EAs.MOEA_D
   desdeo_emo.EAs.IBEA




.. py:class:: BaseEA(a_priori: bool = False, interact: bool = False, selection_operator: Type[desdeo_emo.selection.SelectionBase.SelectionBase] = None, n_iterations: int = 10, n_gen_per_iter: int = 100, total_function_evaluations: int = 0, use_surrogates: bool = False, keep_archive: bool = False, save_non_dominated: bool = False)

   This class provides the basic structure for Evolutionary algorithms.

   .. py:method:: allowable_interaction_types() -> dict
      :property:


   .. py:method:: start()

      Mimics the structure of the mcdm methods. Returns the request objects from self.retuests().


   .. py:method:: end()

      To be run at the end of the evolution process.


   .. py:method:: _next_gen()

      Run one generation of an EA. Change nothing about the parameters.


   .. py:method:: iterate(preference=None) -> Tuple

      Run one iteration of EA.

      One iteration consists of a constant or variable number of
      generations. This method leaves EA.params unchanged, except the current
      iteration count and gen count.


   .. py:method:: pre_iteration()

      Run this code before every iteration.


   .. py:method:: post_iteration()

      Run this code after every iteration.


   .. py:method:: continue_iteration()

      Checks whether the current iteration should be continued or not.


   .. py:method:: continue_evolution() -> bool

      Checks whether the current iteration should be continued or not.


   .. py:method:: check_FE_count() -> bool

      Checks whether termination criteria via function evaluation count has been
          met or not.

      :returns: True is function evaluation count limit NOT met.
      :rtype: bool


   .. py:method:: set_interaction_type(interaction_type: Union[None, str]) -> Union[None, str]


   .. py:method:: manage_preferences(preference=None)

      Forward the preference to the correct preference handling method.

      :param preference: _description_. Defaults to None.
      :type preference: _type_, optional

      :raises eaError: Preference handling not implemented.


   .. py:method:: requests() -> Tuple


   .. py:method:: non_dominated_archive(individuals: numpy.ndarray, results: desdeo_problem.EvaluationResults) -> None



.. py:class:: BaseDecompositionEA(problem: desdeo_problem.MOProblem = None, initial_population: desdeo_emo.population.Population.Population = None, population_size: int = None, population_params: Dict = None, lattice_resolution: int = None, interact: bool = False, n_iterations: int = 10, n_gen_per_iter: int = 100, use_surrogates: bool = False, total_function_evaluations: int = 0, keep_archive: bool = False, save_non_dominated: bool = False)

   Bases: :py:obj:`BaseEA`

   The Base class for decomposition based EAs.

   This class contains most of the code to set up the parameters and operators.
   It also contains the logic of a simple decomposition EA.

   :param problem: The problem class object specifying the details of the problem.
   :type problem: MOProblem
   :param selection_operator: The selection operator to be used by the EA, by default None.
   :type selection_operator: Type[SelectionBase], optional
   :param population_size: The desired population size, by default None, which sets up a default value
                           of population size depending upon the dimensionaly of the problem.
   :type population_size: int, optional
   :param population_params: The parameters for the population class, by default None. See
                             desdeo_emo.population.Population for more details.
   :type population_params: Dict, optional
   :param initial_population: An initial population class, by default None. Use this if you want to set up
                              a specific starting population, such as when the output of one EA is to be
                              used as the input of another.
   :type initial_population: Population, optional
   :param lattice_resolution: The number of divisions along individual axes in the objective space to be
                              used while creating the reference vector lattice by the simplex lattice
                              design. By default None
   :type lattice_resolution: int, optional
   :param a_priori: A bool variable defining whether a priori preference is to be used or not.
                    By default False
   :type a_priori: bool, optional
   :param interact: A bool variable defining whether interactive preference is to be used or
                    not. By default False
   :type interact: bool, optional
   :param n_iterations: The total number of iterations to be run, by default 10. This is not a hard
                        limit and is only used for an internal counter.
   :type n_iterations: int, optional
   :param n_gen_per_iter: The total number of generations in an iteration to be run, by default 100.
                          This is not a hard limit and is only used for an internal counter.
   :type n_gen_per_iter: int, optional
   :param total_function_evaluations: Set an upper limit to the total number of function evaluations. When set to
                                      zero, this argument is ignored and other termination criteria are used.
   :type total_function_evaluations: int, optional

   .. py:method:: _next_gen()

      Run one generation of decomposition based EA. Intended to be used by
      next_iteration.


   .. py:method:: pre_iteration()

      Run this code before every iteration.


   .. py:method:: _select() -> list

      Describe a selection mechanism. Return indices of selected
      individuals.

      :returns: List of indices of individuals to be selected.
      :rtype: list


   .. py:method:: request_plot() -> desdeo_tools.interaction.SimplePlotRequest


   .. py:method:: request_preferences() -> Type[desdeo_tools.interaction.request.BaseRequest]


   .. py:method:: requests() -> Tuple


   .. py:method:: end()

      Conducts non-dominated sorting at the end of the evolution process

      :returns:

                The first element is a 2-D array of the decision vectors of the non-dominated solutions.
                    The second element is a 2-D array of the corresponding objective values.
      :rtype: tuple



.. py:class:: RVEA(problem: desdeo_problem.MOProblem, population_size: int = None, population_params: Dict = None, initial_population: desdeo_emo.population.Population.Population = None, alpha: float = 2, lattice_resolution: int = None, selection_type: str = None, interact: bool = False, use_surrogates: bool = False, n_iterations: int = 10, n_gen_per_iter: int = 100, total_function_evaluations: int = 0, time_penalty_component: Union[str, float] = None, keep_archive: bool = False, save_non_dominated: bool = False)

   Bases: :py:obj:`desdeo_emo.EAs.BaseEA.BaseDecompositionEA`

   The python version reference vector guided evolutionary algorithm.

   Most of the relevant code is contained in the super class. This class just assigns
   the APD selection operator to BaseDecompositionEA.

   NOTE: The APD function had to be slightly modified to accomodate for the fact that
   this version of the algorithm is interactive, and does not have a set termination
   criteria. There is a time component in the APD penalty function formula of the type:
   (t/t_max)^alpha. As there is no set t_max, the formula has been changed. See below,
   the documentation for the argument: penalty_time_component

   See the details of RVEA in the following paper

   R. Cheng, Y. Jin, M. Olhofer and B. Sendhoff, A Reference Vector Guided
   Evolutionary Algorithm for Many-objective Optimization, IEEE Transactions on
   Evolutionary Computation, 2016

   :param problem: The problem class object specifying the details of the problem.
   :type problem: MOProblem
   :param population_size: The desired population size, by default None, which sets up a default value
                           of population size depending upon the dimensionaly of the problem.
   :type population_size: int, optional
   :param population_params: The parameters for the population class, by default None. See
                             desdeo_emo.population.Population for more details.
   :type population_params: Dict, optional
   :param initial_population: An initial population class, by default None. Use this if you want to set up
                              a specific starting population, such as when the output of one EA is to be
                              used as the input of another.
   :type initial_population: Population, optional
   :param alpha: The alpha parameter in the APD selection mechanism. Read paper for details.
   :type alpha: float, optional
   :param lattice_resolution: The number of divisions along individual axes in the objective space to be
                              used while creating the reference vector lattice by the simplex lattice
                              design. By default None
   :type lattice_resolution: int, optional
   :param selection_type: One of ["mean", "optimistic", "robust"]. To be used in data-driven optimization.
                          To be used only with surrogate models which return an "uncertainity" factor.
                          Using "mean" is equivalent to using the mean predicted values from the surrogate
                          models and is the default case.
                          Using "optimistic" results in using (mean - uncertainity) values from the
                          the surrogate models as the predicted value (in case of minimization). It is
                          (mean + uncertainity for maximization).
                          Using "robust" is the opposite of using "optimistic".
   :type selection_type: str, optional
   :param a_priori: A bool variable defining whether a priori preference is to be used or not.
                    By default False
   :type a_priori: bool, optional
   :param interact: A bool variable defining whether interactive preference is to be used or
                    not. By default False
   :type interact: bool, optional
   :param n_iterations: The total number of iterations to be run, by default 10. This is not a hard
                        limit and is only used for an internal counter.
   :type n_iterations: int, optional
   :param n_gen_per_iter: The total number of generations in an iteration to be run, by default 100.
                          This is not a hard limit and is only used for an internal counter.
   :type n_gen_per_iter: int, optional
   :param total_function_evaluations: Set an upper limit to the total number of function evaluations. When set to
                                      zero, this argument is ignored and other termination criteria are used.
   :type total_function_evaluations: int, optional
   :param penalty_time_component: The APD formula had to be slightly changed.
                                  If penalty_time_component is a float between [0, 1], (t/t_max) is replaced by
                                  that constant for the entire algorithm.
                                  If penalty_time_component is "original", the original intent of the paper is
                                  followed and (t/t_max) is calculated as
                                  (current generation count/total number of generations).
                                  If penalty_time_component is "function_count", (t/t_max) is calculated as
                                  (current function evaluation count/total number of function evaluations)
                                  If penalty_time_component is "interactive", (t/t_max)  is calculated as
                                  (Current gen count within an iteration/Total gen count within an iteration).
                                  Hence, time penalty is always zero at the beginning of each iteration, and one
                                  at the end of each iteration.
                                  Note: If the penalty_time_component ever exceeds one, the value one is used as
                                  the penalty_time_component.
                                  If no value is provided, an appropriate default is selected.
                                  If `interact` is true, penalty_time_component is "interactive" by default.
                                  If `interact` is false, but `total_function_evaluations` is provided,
                                  penalty_time_component is "function_count" by default.
                                  If `interact` is false, but `total_function_evaluations` is not provided,
                                  penalty_time_component is "original" by default.
   :type penalty_time_component: Union[str, float], optional

   .. py:method:: _time_penalty_constant()

      Returns the constant time penalty value.


   .. py:method:: _time_penalty_original()

      Calculates the appropriate time penalty value, by the original formula.


   .. py:method:: _time_penalty_interactive()

      Calculates the appropriate time penalty value.


   .. py:method:: _time_penalty_function_count()

      Calculates the appropriate time penalty value.



.. py:class:: NSGAIII(problem: desdeo_problem.MOProblem, population_size: int = None, population_params: Dict = None, n_survive: int = None, initial_population: desdeo_emo.population.Population.Population = None, lattice_resolution: int = None, selection_type: str = None, interact: bool = False, use_surrogates: bool = False, n_iterations: int = 10, n_gen_per_iter: int = 100, total_function_evaluations: int = 0, keep_archive: bool = False, save_non_dominated: bool = False)

   Bases: :py:obj:`desdeo_emo.EAs.BaseEA.BaseDecompositionEA`

   Python Implementation of NSGA-III. Based on the pymoo package.

   Most of the relevant code is contained in the super class. This class just assigns
   the NSGAIII selection operator to BaseDecompositionEA.

   :param problem: The problem class object specifying the details of the problem.
   :type problem: MOProblem
   :param population_size: The desired population size, by default None, which sets up a default value
                           of population size depending upon the dimensionaly of the problem.
   :type population_size: int, optional
   :param population_params: The parameters for the population class, by default None. See
                             desdeo_emo.population.Population for more details.
   :type population_params: Dict, optional
   :param initial_population: An initial population class, by default None. Use this if you want to set up
                              a specific starting population, such as when the output of one EA is to be
                              used as the input of another.
   :type initial_population: Population, optional
   :param lattice_resolution: The number of divisions along individual axes in the objective space to be
                              used while creating the reference vector lattice by the simplex lattice
                              design. By default None
   :type lattice_resolution: int, optional
   :param selection_type: One of ["mean", "optimistic", "robust"]. To be used in data-driven optimization.
                          To be used only with surrogate models which return an "uncertainity" factor.
                          Using "mean" is equivalent to using the mean predicted values from the surrogate
                          models and is the default case.
                          Using "optimistic" results in using (mean - uncertainity) values from the
                          the surrogate models as the predicted value (in case of minimization). It is
                          (mean + uncertainity for maximization).
                          Using "robust" is the opposite of using "optimistic".
   :type selection_type: str, optional
   :param a_priori: A bool variable defining whether a priori preference is to be used or not.
                    By default False
   :type a_priori: bool, optional
   :param interact: A bool variable defining whether interactive preference is to be used or
                    not. By default False
   :type interact: bool, optional
   :param n_iterations: The total number of iterations to be run, by default 10. This is not a hard
                        limit and is only used for an internal counter.
   :type n_iterations: int, optional
   :param n_gen_per_iter: The total number of generations in an iteration to be run, by default 100.
                          This is not a hard limit and is only used for an internal counter.
   :type n_gen_per_iter: int, optional
   :param total_function_evaluations: Set an upper limit to the total number of function evaluations. When set to
                                      zero, this argument is ignored and other termination criteria are used.
   :type total_function_evaluations: int, optional


.. py:class:: PPGA(problem, population_size: int = 100, population_params=None, initial_population=None, n_iterations: int = 10, n_gen_per_iter: int = 10, predator_pop_size: int = 50, prey_max_moves: int = 10, prob_prey_move: float = 0.3, offspring_place_attempts: int = 10, kill_interval: int = 7, max_rank: int = 20, neighbourhood_radius: int = 3)

   Bases: :py:obj:`desdeo_emo.EAs.BaseEA.BaseEA`

   Predatory-Prey genetic algorithm.

   A population of prey signify the various models or solutions to the problem at hand.
   Weaker prey, i.e. bad models or solutions, are killed by predators.
   The predators and prey are placed in a lattice, in which they are free to roam.

   In each generation, each predator gets a certain number of turns to move about and
   hunt in its neighbourhood, killing the weaker prey, according to a fitness criteria.
   After this, each prey gets a certain number of moves to pursue a random walk and to
   reproduce with other prey. Each reproduction step generates two new prey from two
   parents, by crossing over their attributes and adding random mutations. After each
   prey has completed its move, the whole process starts again.

   As the weaker individuals get eliminated in each generation, the population as a
   whole becomes more fit, i.e. the individuals get closer to the true pareto-optimal
   solutions.

   If you have any questions about the code, please contact:

   Bhupinder Saini: bhupinder.s.saini@jyu.fi
   Project researcher at University of Jyväskylä.

   :param population: The population object
   :type population: object

   .. rubric:: Notes

   The algorithm has been created earlier in MATLAB, and this Python implementation
   has been using that code as a basis. See references [4] for the study during which
   the original MATLAB version was created.
   Python code has been written by Niko Rissanen under the supervision of professor
   Nirupam Chakraborti.

   For the MATLAB implementation, see:
   N. Chakraborti. Data-Driven Bi-Objective Genetic Algorithms EvoNN and BioGP and
   Their Applications in Metallurgical and Materials Domain. In Datta, Shubhabrata,
   Davim, J. Paulo (eds.), Computational Approaches to Materials Design: Theoretical
   and Practical Aspects, pp. 346-369, 2016.

   .. rubric:: References

   [1] Laumanns, M., Rudolph, G., & Schwefel, H. P. (1998). A spatial predator-prey
   approach to multi-objective
   optimization: A preliminary study.
   In International Conference on Parallel Problem Solving from Nature (pp. 241-249).
   Springer, Berlin, Heidelberg.

   [2] Li, X. (2003). A real-coded predator-prey genetic algorithm for multiobjective
   optimization. In International
   Conference on Evolutionary Multi-Criterion Optimization (pp. 207-221). Springer,
   Berlin, Heidelberg.

   [3] Chakraborti, N. (2014). Strategies for evolutionary data driven modeling in
   chemical and metallurgical Systems.
   In Applications of Metaheuristics in Process Engineering (pp. 89-122). Springer,
   Cham.

   [4] Pettersson, F., Chakraborti, N., & Saxén, H. (2007). A genetic algorithms based
   multi-objective neural net
   applied to noisy blast furnace data. Applied Soft Computing, 7(1), 387-397.

   .. py:method:: _next_gen()

      Run one generation of PPGA.

      Intended to be used by next_iteration.

      :param population: Population object
      :type population: "Population"


   .. py:method:: select(population, max_rank=20) -> list

      Of the population, individuals lower than max_rank are selected.
      Return indices of selected individuals.

      :param population: Contains the current population and problem
                         information.
      :type population: Population
      :param max_rank: Select only individuals lower than max_rank
      :type max_rank: int

      :returns: List of indices of individuals to be selected.
      :rtype: list


   .. py:method:: manage_preferences(preference=None)

      Forward the preference to the correct preference handling method.

      :param preference: _description_. Defaults to None.
      :type preference: _type_, optional

      :raises eaError: Preference handling not implemented.



.. py:class:: TournamentEA(problem, initial_population: desdeo_emo.population.Population.Population, n_gen_per_iter: int = 10, n_iterations: int = 10, tournament_size: int = 5, population_size: int = 500)

   Bases: :py:obj:`desdeo_emo.EAs.BaseEA.BaseEA`

   This class provides the basic structure for Evolutionary algorithms.

   .. py:method:: start()

      Mimics the structure of the mcdm methods. Returns the request objects from self.retuests().


   .. py:method:: end()

      Conducts non-dominated sorting at the end of the evolution process
      :returns:

                The first element is a 2-D array of the decision vectors of the non-dominated solutions.
                    The second element is a 2-D array of the corresponding objective values.
      :rtype: tuple


   .. py:method:: _next_gen()

      Run one generation of decomposition based EA.

      This method leaves method.params unchanged. Intended to be used by
      next_iteration.

      :param population: Population object
      :type population: "Population"


   .. py:method:: select() -> list



.. py:class:: IOPIS_NSGAIII(problem: desdeo_problem.MOProblem, population_size: int = None, population_params: Dict = None, initial_population: desdeo_emo.population.Population.Population = None, lattice_resolution: int = None, n_iterations: int = 10, n_gen_per_iter: int = 100, total_function_evaluations: int = 0, use_surrogates: bool = False)

   Bases: :py:obj:`BaseIOPISDecompositionEA`

   The Base class for decomposition based EAs.

   This class contains most of the code to set up the parameters and operators.
   It also contains the logic of a simple decomposition EA.

   :param problem: The problem class object specifying the details of the problem.
   :type problem: MOProblem
   :param selection_operator: The selection operator to be used by the EA, by default None.
   :type selection_operator: Type[SelectionBase], optional
   :param population_size: The desired population size, by default None, which sets up a default value
                           of population size depending upon the dimensionaly of the problem.
   :type population_size: int, optional
   :param population_params: The parameters for the population class, by default None. See
                             desdeo_emo.population.Population for more details.
   :type population_params: Dict, optional
   :param initial_population: An initial population class, by default None. Use this if you want to set up
                              a specific starting population, such as when the output of one EA is to be
                              used as the input of another.
   :type initial_population: Population, optional
   :param lattice_resolution: The number of divisions along individual axes in the objective space to be
                              used while creating the reference vector lattice by the simplex lattice
                              design. By default None
   :type lattice_resolution: int, optional
   :param a_priori: A bool variable defining whether a priori preference is to be used or not.
                    By default False
   :type a_priori: bool, optional
   :param interact: A bool variable defining whether interactive preference is to be used or
                    not. By default False
   :type interact: bool, optional
   :param n_iterations: The total number of iterations to be run, by default 10. This is not a hard
                        limit and is only used for an internal counter.
   :type n_iterations: int, optional
   :param n_gen_per_iter: The total number of generations in an iteration to be run, by default 100.
                          This is not a hard limit and is only used for an internal counter.
   :type n_gen_per_iter: int, optional
   :param total_function_evaluations: Set an upper limit to the total number of function evaluations. When set to
                                      zero, this argument is ignored and other termination criteria are used.
   :type total_function_evaluations: int, optional


.. py:class:: IOPIS_RVEA(problem: desdeo_problem.MOProblem, population_size: int = None, population_params: Dict = None, initial_population: desdeo_emo.population.Population.Population = None, alpha: float = None, lattice_resolution: int = None, n_iterations: int = 10, n_gen_per_iter: int = 100, total_function_evaluations: int = 0, time_penalty_component: Union[str, float] = None, use_surrogates: bool = False)

   Bases: :py:obj:`BaseIOPISDecompositionEA`, :py:obj:`desdeo_emo.EAs.RVEA.RVEA`

   The python version reference vector guided evolutionary algorithm.

   Most of the relevant code is contained in the super class. This class just assigns
   the APD selection operator to BaseDecompositionEA.

   NOTE: The APD function had to be slightly modified to accomodate for the fact that
   this version of the algorithm is interactive, and does not have a set termination
   criteria. There is a time component in the APD penalty function formula of the type:
   (t/t_max)^alpha. As there is no set t_max, the formula has been changed. See below,
   the documentation for the argument: penalty_time_component

   See the details of RVEA in the following paper

   R. Cheng, Y. Jin, M. Olhofer and B. Sendhoff, A Reference Vector Guided
   Evolutionary Algorithm for Many-objective Optimization, IEEE Transactions on
   Evolutionary Computation, 2016

   :param problem: The problem class object specifying the details of the problem.
   :type problem: MOProblem
   :param population_size: The desired population size, by default None, which sets up a default value
                           of population size depending upon the dimensionaly of the problem.
   :type population_size: int, optional
   :param population_params: The parameters for the population class, by default None. See
                             desdeo_emo.population.Population for more details.
   :type population_params: Dict, optional
   :param initial_population: An initial population class, by default None. Use this if you want to set up
                              a specific starting population, such as when the output of one EA is to be
                              used as the input of another.
   :type initial_population: Population, optional
   :param alpha: The alpha parameter in the APD selection mechanism. Read paper for details.
   :type alpha: float, optional
   :param lattice_resolution: The number of divisions along individual axes in the objective space to be
                              used while creating the reference vector lattice by the simplex lattice
                              design. By default None
   :type lattice_resolution: int, optional
   :param a_priori: A bool variable defining whether a priori preference is to be used or not.
                    By default False
   :type a_priori: bool, optional
   :param interact: A bool variable defining whether interactive preference is to be used or
                    not. By default False
   :type interact: bool, optional
   :param n_iterations: The total number of iterations to be run, by default 10. This is not a hard
                        limit and is only used for an internal counter.
   :type n_iterations: int, optional
   :param n_gen_per_iter: The total number of generations in an iteration to be run, by default 100.
                          This is not a hard limit and is only used for an internal counter.
   :type n_gen_per_iter: int, optional
   :param total_function_evaluations: Set an upper limit to the total number of function evaluations. When set to
                                      zero, this argument is ignored and other termination criteria are used.
   :type total_function_evaluations: int, optional
   :param penalty_time_component: The APD formula had to be slightly changed.
                                  If penalty_time_component is a float between [0, 1], (t/t_max) is replaced by
                                  that constant for the entire algorithm.
                                  If penalty_time_component is "original", the original intent of the paper is
                                  followed and (t/t_max) is calculated as
                                  (current generation count/total number of generations).
                                  If penalty_time_component is "function_count", (t/t_max) is calculated as
                                  (current function evaluation count/total number of function evaluations)
                                  If penalty_time_component is "interactive", (t/t_max)  is calculated as
                                  (Current gen count within an iteration/Total gen count within an iteration).
                                  Hence, time penalty is always zero at the beginning of each iteration, and one
                                  at the end of each iteration.
                                  Note: If the penalty_time_component ever exceeds one, the value one is used as
                                  the penalty_time_component.
                                  If no value is provided, an appropriate default is selected.
                                  If `interact` is true, penalty_time_component is "interactive" by default.
                                  If `interact` is false, but `total_function_evaluations` is provided,
                                  penalty_time_component is "function_count" by default.
                                  If `interact` is false, but `total_function_evaluations` is not provided,
                                  penalty_time_component is "original" by default.
   :type penalty_time_component: Union[str, float], optional

   .. py:method:: _time_penalty_constant()

      Returns the constant time penalty value.



   .. py:method:: _time_penalty_original()

      Calculates the appropriate time penalty value, by the original formula.



   .. py:method:: _time_penalty_interactive()

      Calculates the appropriate time penalty value.



   .. py:method:: _time_penalty_function_count()

      Calculates the appropriate time penalty value.




.. py:class:: MOEA_D(problem: desdeo_problem.MOProblem, n_neighbors: int = 20, n_parents: int = 2, use_repair: bool = True, initial_population: desdeo_emo.population.Population.Population = None, population_size: int = None, population_params: Dict = None, lattice_resolution: int = None, interact: bool = False, n_iterations: int = 10, n_gen_per_iter: int = 100, use_surrogates: bool = False, total_function_evaluations: int = 0, scalarization_function: desdeo_tools.scalarization.MOEADSF = PBI(), keep_archive: bool = False, save_non_dominated: bool = False)

   Bases: :py:obj:`desdeo_emo.EAs.BaseEA.BaseDecompositionEA`

   Python implementation of MOEA/D

   .. Q. Zhang and H. Li, "MOEA/D: A Multiobjective Evolutionary Algorithm Based on Decomposition,"
   in IEEE Transactions on Evolutionary Computation, vol. 11, no. 6, pp. 712-731, Dec. 2007, doi: 10.1109/TEVC.2007.892759.

   :param problem: The problem class object specifying the details of the problem.
   :type problem: MOProblem
   :param scalarization_function: The scalarization function to compare the solutions. Some implementations
                                  can be found in desdeo-tools/scalarization/MOEADSF. By default it uses the
                                  PBI function.
   :type scalarization_function: MOEADSF
   :param n_neighbors: Number of reference vectors considered in the neighborhoods creation. The default
                       number is 20.
   :type n_neighbors: int, optional
   :param population_params: The parameters for the population class, by default None. See
                             desdeo_emo.population.Population for more details.
   :type population_params: Dict, optional
   :param initial_population: An initial population class, by default None. Use this if you want to set up
                              a specific starting population, such as when the output of one EA is to be
                              used as the input of another.
   :type initial_population: Population, optional
   :param lattice_resolution: The number of divisions along individual axes in the objective space to be
                              used while creating the reference vector lattice by the simplex lattice
                              design. By default None
   :type lattice_resolution: int, optional
   :param n_parents: Number of individuals considered for the generation of offspring solutions. The default
                     option is 2.
   :type n_parents: int, optional
   :param a_priori: A bool variable defining whether a priori preference is to be used or not.
                    By default False
   :type a_priori: bool, optional
   :param interact: A bool variable defining whether interactive preference is to be used or
                    not. By default False
   :type interact: bool, optional
   :param use_surrogates: A bool variable defining whether surrogate problems are to be used or
                          not. By default False
   :type use_surrogates: bool, optional
   :param n_iterations:  The total number of iterations to be run, by default 10. This is not a hard
                        limit and is only used for an internal counter.
   :type n_iterations: int, optional
   :param n_gen_per_iter: The total number of generations in an iteration to be run, by default 100.
                          This is not a hard limit and is only used for an internal counter.
   :type n_gen_per_iter: int, optional
   :param total_function_evaluations: Set an upper limit to the total number of function evaluations. When set to
                                      zero, this argument is ignored and other termination criteria are used.
   :type total_function_evaluations: int, optional

   .. py:method:: _next_gen()

      Run one generation of decomposition based EA. Intended to be used by
      next_iteration.


   .. py:method:: _select(current_neighborhood: int) -> list

      Describe a selection mechanism. Return indices of selected
      individuals.

      :returns: List of indices of individuals to be selected.
      :rtype: list



.. py:class:: IBEA(problem: desdeo_problem.MOProblem, population_size: int, initial_population: desdeo_emo.population.Population.Population = None, a_priori: bool = False, interact: bool = False, population_params: Dict = None, n_iterations: int = 10, n_gen_per_iter: int = 100, total_function_evaluations: int = 0, use_surrogates: bool = False, kappa: float = 0.05, indicator: Callable = epsilon_indicator)

   Bases: :py:obj:`desdeo_emo.EAs.BaseIndicatorEA.BaseIndicatorEA`

   Python Implementation of IBEA.

   Most of the relevant code is contained in the super class. This class just assigns
   the EnviromentalSelection operator to BaseIndicatorEA.

   :param problem: The problem class object specifying the details of the problem.
   :type problem: MOProblem
   :param population_size: The desired population size, by default None, which sets up a default value
                           of population size depending upon the dimensionaly of the problem.
   :type population_size: int, optional
   :param population_params: The parameters for the population class, by default None. See
                             desdeo_emo.population.Population for more details.
   :type population_params: Dict, optional
   :param initial_population: An initial population class, by default None. Use this if you want to set up
                              a specific starting population, such as when the output of one EA is to be
                              used as the input of another.
   :type initial_population: Population, optional
   :param a_priori: A bool variable defining whether a priori preference is to be used or not.
                    By default False
   :type a_priori: bool, optional
   :param interact: A bool variable defining whether interactive preference is to be used or
                    not. By default False
   :type interact: bool, optional
   :param n_iterations: The total number of iterations to be run, by default 10. This is not a hard
                        limit and is only used for an internal counter.
   :type n_iterations: int, optional
   :param n_gen_per_iter: The total number of generations in an iteration to be run, by default 100.
                          This is not a hard limit and is only used for an internal counter.
   :type n_gen_per_iter: int, optional
   :param total_function_evaluations: Set an upper limit to the total number of function evaluations. When set to
                                      zero, this argument is ignored and other termination criteria are used.
   :type total_function_evaluations: int, optional
   :param use_surrogates: A bool variable defining whether surrogate problems are to be used or
                          not. By default False
   :type use_surrogates: bool, optional
   :param kappa: Fitness scaling value for indicators. By default 0.05.
   :type kappa: float, optional
   :param indicator: Quality indicator to use in indicatorEAs. By default in IBEA this is additive epsilon indicator.
   :type indicator: Callable, optional

   .. py:method:: _fitness_assignment(fitnesses)

      Performs the fitness assignment of the individuals.


   .. py:method:: _environmental_selection(fitnesses, worst_index)

      Selects the worst member of population, then updates the population members fitness values compared to the worst individual.
      Worst individual is removed from the population.



