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

.. py:module:: desdeo_emo.EAs.IOPIS


Module Contents
---------------

Classes
~~~~~~~

.. autoapisummary::

   desdeo_emo.EAs.IOPIS.BaseIOPISDecompositionEA
   desdeo_emo.EAs.IOPIS.IOPIS_RVEA
   desdeo_emo.EAs.IOPIS.IOPIS_NSGAIII




.. py:class:: BaseIOPISDecompositionEA(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:`desdeo_emo.EAs.BaseEA.BaseDecompositionEA`, :py:obj:`desdeo_emo.EAs.BaseEA.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:: manage_preferences(preference=None)

      Run the interruption phase of EA.

      Use this phase to make changes to RVEA.params or other objects.
      Updates Reference Vectors (adaptation), conducts interaction with the user.


   .. py:method:: request_preferences() -> Union[None, desdeo_tools.interaction.ReferencePointPreference]


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


