:py:mod:`desdeo_mcdm.interactive.ParetoNavigator`
=================================================

.. py:module:: desdeo_mcdm.interactive.ParetoNavigator


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

Classes
~~~~~~~

.. autoapisummary::

   desdeo_mcdm.interactive.ParetoNavigator.ParetoNavigatorInitialRequest
   desdeo_mcdm.interactive.ParetoNavigator.ParetoNavigatorRequest
   desdeo_mcdm.interactive.ParetoNavigator.ParetoNavigatorSolutionRequest
   desdeo_mcdm.interactive.ParetoNavigator.ParetoNavigatorStopRequest
   desdeo_mcdm.interactive.ParetoNavigator.ParetoNavigator



Functions
~~~~~~~~~

.. autoapisummary::

   desdeo_mcdm.interactive.ParetoNavigator.f1



.. py:exception:: ParetoNavigatorException

   Bases: :py:obj:`Exception`

   Raised when an exception related to Pareto Navigator is encountered.


.. py:class:: ParetoNavigatorInitialRequest(ideal: numpy.ndarray, nadir: numpy.ndarray, allowed_speeds: numpy.ndarray, po_solutions: numpy.ndarray)

   Bases: :py:obj:`desdeo_tools.interaction.request.BaseRequest`

   A request class to handle the Decision Maker's initial preferences for the first iteration round.

   :param ideal: Ideal vector
   :type ideal: np.ndarray
   :param nadir: Nadir vector
   :type nadir: np.ndarray
   :param allowed_speeds: Allowed movement speeds
   :type allowed_speeds: np.ndarray
   :param po_solutions: (np.ndarray): A set of pareto optimal solutions

   .. py:attribute:: msg
      :annotation: = Please specify a starting point as 'preferred_solution'.

      Or specify a reference point as 'reference_point'.

   .. py:method:: init_with_method(method: desdeo_mcdm.interactive.InteractiveMethod.InteractiveMethod)
      :classmethod:

      Initialize request with given instance of ParetoNavigator.

      :param method: Instance of ReferencePointMethod-class.
      :type method: ParetoNavigator

      :returns: Initial request.
      :rtype: ParetoNavigatorInitialRequest



.. py:class:: ParetoNavigatorRequest(current_solution: numpy.ndarray, ideal: numpy.ndarray, nadir: numpy.ndarray, allowed_speeds: numpy.ndarray, valid_classifications: numpy.ndarray)

   Bases: :py:obj:`desdeo_tools.interaction.request.BaseRequest`

   A request class to handle navigation preferences after the first iteration round.

   :param current_solution: Current solution.
   :type current_solution: np.ndarray
   :param ideal: Ideal vector.
   :type ideal: np.ndarray
   :param nadir: Nadir vector.
   :type nadir: np.ndarray
   :param allowed_speeds: Allowed movement speeds
   :type allowed_speeds: np.ndarray
   :param valid_classifications: Valid classifications
   :type valid_classifications: np.ndarray

   .. py:method:: init_with_method(method: desdeo_mcdm.interactive.InteractiveMethod.InteractiveMethod)
      :classmethod:

      Initialize request with given instance of ParetoNavigator.

      :param method: Instance of ParetoNavigator-class.
      :type method: ParetoNavigator

      :returns: Initial request.
      :rtype: ParetoNavigatorRequest



.. py:class:: ParetoNavigatorSolutionRequest(approx_solution: numpy.ndarray, pareto_optimal_solution: numpy.ndarray, objective_values: numpy.ndarray)

   Bases: :py:obj:`desdeo_tools.interaction.request.BaseRequest`

   A request class to handle requests to see pareto optimal solution.

   :param approx_solution: The approximated solution received by navigation
   :type approx_solution: np.ndarray
   :param pareto_optimal_solution: A pareto optimal solution (decision variables).
   :type pareto_optimal_solution: np.ndarray
   :param objective_values: Objective vector.
   :type objective_values: np.ndarray


.. py:class:: ParetoNavigatorStopRequest(approx_solution: numpy.ndarray, final_solution: numpy.ndarray, objective_values: numpy.ndarray)

   Bases: :py:obj:`desdeo_tools.interaction.request.BaseRequest`

   A request class to handle termination.

   :param approx_solution: The approximated solution received by navigation.
   :type approx_solution: np.ndarray
   :param final_solution: Solution (decision variables).
   :type final_solution: np.ndarray
   :param objective_values: Objective values.
   :type objective_values: np.ndarray


.. py:class:: ParetoNavigator(problem: Union[desdeo_problem.problem.MOProblem, desdeo_problem.problem.DiscreteDataProblem], pareto_optimal_solutions: Optional[numpy.ndarray] = None, scalar_method: Optional[desdeo_tools.solver.ScalarSolver.ScalarMethod] = None)

   Bases: :py:obj:`desdeo_mcdm.interactive.InteractiveMethod.InteractiveMethod`

   Paretonavigator as described in 'Pareto navigator for interactive nonlinear
   multiobjective optimization' (2008) [Petri Eskelinen · Kaisa Miettinen ·
   Kathrin Klamroth · Jussi Hakanen].

   :param problem: The problem to be solved.
   :type problem: MOProblem
   :param pareto_optimal_solutions: Some pareto optimal solutions to construct the polyhedral set.
   :type pareto_optimal_solutions: np.ndarray
   :param scalar_method: (Optional[ScalarMethod], optional): The scalar method used to solve asf

   .. note::

      pareto_optimal_solutions must be provided for problems of type MOProblem.
          For DiscreteDataProblems if no pareto optimal solutions are provided
          the method will use the objective values from the problem.

   .. py:method:: start()

      Start the solving process

      :returns: Initial request
      :rtype: ParetoNavigatorInitialRequest


   .. py:method:: iterate(request: Union[ParetoNavigatorInitialRequest, ParetoNavigatorRequest, ParetoNavigatorSolutionRequest, ParetoNavigatorStopRequest]) -> Union[ParetoNavigatorRequest, ParetoNavigatorSolutionRequest, ParetoNavigatorStopRequest]

      Perform the next logical iteration step based on the given request type.

      :param request (Union[ParetoNavigatorInitialRequest: ParetoNavigatorSolutionRequest, ParetoNavigatorStopRequest]):
                                                           A ParetoNavigatorRequest
      :param ParetoNavigatorRequest: ParetoNavigatorSolutionRequest, ParetoNavigatorStopRequest]):
                                     A ParetoNavigatorRequest
      :param : ParetoNavigatorSolutionRequest, ParetoNavigatorStopRequest]):
               A ParetoNavigatorRequest

      :returns:     A new request with content depending on the Decision Maker's preferences.
      :rtype: Union[ParetoNavigatorRequest, ParetoNavigatorSolutionRequest, ParetoNavigatorStopRequest]


   .. py:method:: handle_initial_request(request: ParetoNavigatorInitialRequest) -> ParetoNavigatorRequest

      Handles the initial request.

      :param request: Initial request
      :type request: ParetoNavigatorInitialRequest

      :returns: A navigation request
      :rtype: ParetoNavigatorRequest


   .. py:method:: handle_request(request: ParetoNavigatorRequest) -> Union[ParetoNavigatorRequest, ParetoNavigatorSolutionRequest, ParetoNavigatorStopRequest]

      Handles a navigation request.

      :param request: A request
      :type request: ParetoNavigatorRequest

      :returns:     Next request corresponding the DM's preferences
      :rtype: Union[ParetoNavigatorRequest, ParetoNavigatorSolutionRequest, ParetoNavigatorStopRequest]


   .. py:method:: handle_solution_request(request: ParetoNavigatorSolutionRequest) -> Union[ParetoNavigatorRequest, ParetoNavigatorStopRequest]

      Handle a solution request

      :param request: A solution request
      :type request: ParetoNavigatorSolutionRequest

      :returns:     A navigation request or a stop request depending on whether
                    the DM wishes to continue or stop
      :rtype: Union[ParetoNavigatorRequest, ParetoNavigatorStopRequest]


   .. py:method:: calculate_extremes(points: numpy.ndarray) -> Tuple[numpy.ndarray, numpy.ndarray]

      Calculate the minimum and maximum points of a given array.

      :param points: A two dimensional array
      :type points: np.ndarray

      :returns: The min and max values of each column
      :rtype: Tuple[np.ndarray, np.ndarray]


   .. py:method:: calculate_speed(given_speed: int) -> float

      Calculate a speed value from given integer value.

      :param given_speed: a speed value where 1 is slowest and 5 fastest
      :type given_speed: int

      :returns:

                A speed value calculated from given integer value.
                    Is between 0 and 1
      :rtype: float

      .. note::

         The denominator 10 is not mentioned in the article, but it is included
         because the navigation speed seems to be too fast without it.


   .. py:method:: calculate_weights(ideal: numpy.ndarray, nadir: numpy.ndarray)

      Calculate the scaling coefficients w from ideal and nadir.

      :param ideal: Ideal vector
      :type ideal: np.ndarray
      :param nadir: Nadir vector
      :type nadir: np.ndarray

      :returns: The scaling coefficients
      :rtype: np.ndarray


   .. py:method:: polyhedral_set_eq(po_solutions: numpy.ndarray) -> Tuple[numpy.ndarray, numpy.ndarray]

      Construct a polyhedral set as convex hull from the set of pareto optimal solutions

      :param po_solutions: Some pareto optimal solutions
      :type po_solutions: np.ndarray

      :returns:

                Matrix A and vector b from the
                    convex hull inequality representation Az <= b
      :rtype: Tuple[np.ndarray, np.ndarray]


   .. py:method:: construct_lppp_A(weights, A)

      The matrix A used in the linear parametric programming problem

      :param weights: Scaling coefficients
      :type weights: np.ndarray
      :param A: Matrix A from the convex hull representation Ax < b
      :type A: np.ndarray

      :returns: The matrix A' in the linear parametric programming problem A'x<b'
      :rtype: np.ndarray


   .. py:method:: calculate_direction(current_solution: numpy.ndarray, ref_point: numpy.ndarray)

      Calculate a new direction from current solution and a given reference point

      :param current_solution: The current solution
      :type current_solution: np.ndarray
      :param ref_point: A reference point
      :type ref_point: np.ndarray

      :returns: A new direction
      :rtype: np.ndarray


   .. py:method:: classification_to_ref_point(classifications, ideal, nadir, current_solution)

      Transform classifications to a reference point

      :param classifications: Classification for each objective
      :type classifications: np.ndarray
      :param ideal: Ideal point
      :type ideal: np.ndarray
      :param nadir: Nadir point
      :type nadir: np.ndarray
      :param current_solution: Current solution
      :type current_solution: np.ndarray

      :returns: A reference point which is constructed from the classifications
      :rtype: np.ndarray


   .. py:method:: solve_linear_parametric_problem(current_sol: numpy.ndarray, ideal: numpy.ndarray, nadir: numpy.ndarray, direction: numpy.ndarray, a: float, A: numpy.ndarray, b: numpy.ndarray) -> numpy.ndarray

      Solves the linear parametric programming problem as defined in (3)

      :param current_sol: Current solution
      :type current_sol: np.ndarray
      :param ideal: Ideal vector
      :type ideal: np.ndarray
      :param nadir: Nadir vector
      :type nadir: np.ndarray
      :param direction: Navigation direction
      :type direction: np.ndarray
      :param a: Alpha in problem (3)
      :type a: float
      :param A: Matrix A from Az <= b
      :type A: np.ndarray
      :param b: Vector b from Az <= b
      :type b: np.ndarray

      :returns:

                Optimal vector from the linear parametric programming problem.
                    This is the new solution to be used in the navigation.
      :rtype: np.ndarray


   .. py:method:: solve_asf(problem: Union[desdeo_problem.problem.MOProblem, desdeo_problem.problem.DiscreteDataProblem], ref_point: numpy.ndarray, method: Optional[desdeo_tools.solver.ScalarSolver.ScalarMethod] = None)

      Solve the achievement scalarizing function

      :param problem: The problem
      :type problem: MOProblem
      :param ref_point: A reference point
      :param method: A method provided to the scalar minimizer
      :type method: Optional[ScalarMethod], optional

      :returns: The decision vector which solves the achievement scalarizing function
      :rtype: np.ndarray



.. py:function:: f1(xs)


