:py:mod:`desdeo_mcdm.utilities.solvers`
=======================================

.. py:module:: desdeo_mcdm.utilities.solvers

.. autoapi-nested-parse::

   Implements various useful solvers.



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


Functions
~~~~~~~~~

.. autoapisummary::

   desdeo_mcdm.utilities.solvers.weighted_scalarizer
   desdeo_mcdm.utilities.solvers.payoff_table_method_general
   desdeo_mcdm.utilities.solvers.payoff_table_method
   desdeo_mcdm.utilities.solvers.solve_pareto_front_representation_general
   desdeo_mcdm.utilities.solvers.solve_pareto_front_representation
   desdeo_mcdm.utilities.solvers.f_1



.. py:exception:: MCDMUtilityException

   Bases: :py:obj:`Exception`

   Raised when an exception is encountered in some of the utilities.




.. py:function:: weighted_scalarizer(xs: numpy.ndarray, ws: numpy.ndarray) -> numpy.ndarray

   A simple linear weight based scalarizer.

   :param xs: Values to be scalarized.
   :type xs: np.ndarray
   :param ws: Weights to multiply each value in the summation of xs.
   :type ws: np.ndarray

   :returns: An array of scalar values with length equal to the first dimension of xs.
   :rtype: np.ndarray


.. py:function:: payoff_table_method_general(objective_evaluator: Callable[[numpy.ndarray], numpy.ndarray], n_of_objectives: int, variable_bounds: numpy.ndarray, constraint_evaluator: Optional[Callable[[numpy.ndarray], numpy.ndarray]] = None, initial_guess: Optional[numpy.ndarray] = None, solver_method: Optional[Union[desdeo_tools.solver.ScalarSolver.ScalarMethod, str]] = 'scipy_de') -> Tuple[numpy.ndarray, numpy.ndarray]

   Solves a representation for the nadir and ideal points for a
   multiobjective minimization problem with objectives defined as the result
   of some objective evaluator.

   :param objective_evaluator: The
                               evaluator which returns the objective values given a set of
                               variabels.
   :type objective_evaluator: Callable[[np.ndarray], np.ndarray]
   :param n_of_objectives: Number of objectives returned by calling
                           objective_evaluator.
   :type n_of_objectives: int
   :param variable_bounds: The lower and upper bounds of the
                           variables passed as argument to objective_evaluator. Should be a 2D
                           numpy array with the limits for each variable being on each row. The
                           first column should contain the lower bounds, and the second column
                           the upper bounds. Use np.inf to indicate no bounds.
   :type variable_bounds: np.ndarray
   :param constraint_evaluator: An evaluator accepting the same arguments as
                                objective_evaluator, which returns the constraint values of the
                                multiobjective minimization problem being solved. A negative
                                constraint value indicates a broken constraint. Defaults to None.
   :type constraint_evaluator: Optional[Callable[[np.ndarray], np.ndarray]], optional
   :param initial_guess: The initial guess
                         used for the variable values while solving the payoff table. The
                         relevancy of this parameter depends on the solver_method being used.
                         Defaults to None.
   :type initial_guess: Optional[np.ndarray], optional
   :param solver_method: The
                         method to solve the scalarized problems in the payoff table method.
                         Defaults to "scipy_de", which ignores initial_guess.
   :type solver_method: Optional[Union[ScalarMethod, str]], optional

   :returns: The representations computed using the
             payoff table for the ideal and nadir points respectively.
   :rtype: Tuple[np.ndarray, np.ndarray]


.. py:function:: payoff_table_method(problem: desdeo_problem.problem.MOProblem, initial_guess: Optional[numpy.ndarray] = None, solver_method: Optional[Union[desdeo_tools.solver.ScalarSolver.ScalarMethod, str]] = 'scipy_de') -> Tuple[numpy.ndarray, numpy.ndarray]

   Uses the payoff table method to solve for the ideal and nadir points of a MOProblem.
   Call through to payoff_table_method_general.

   :param problem: The problem defined as a MOProblem class instance.
   :type problem: MOProblem
   :param initial_guess: The initial guess of decision variables
                         to be used in the solver. If None, uses the lower bounds defined for
                         the variables in MOProblem. Defaults to None.
   :type initial_guess: Optional[np.ndarray]
   :param solver_method: The method used to minimize the
                         individual problems in the payoff table method. Defaults to 'scipy_de'.
   :type solver_method: Optional[Union[ScalarMethod, str]]

   :returns: The ideal and nadir points
   :rtype: Tuple[np.ndarray, np.ndarray]


.. py:function:: solve_pareto_front_representation_general(objective_evaluator: Callable[[numpy.ndarray], numpy.ndarray], n_of_objectives: int, variable_bounds: numpy.ndarray, step: Optional[Union[numpy.ndarray, float]] = 0.1, eps: Optional[float] = 1e-06, ideal: Optional[numpy.ndarray] = None, nadir: Optional[numpy.ndarray] = None, constraint_evaluator: Optional[Callable[[numpy.ndarray], numpy.ndarray]] = None, solver_method: Optional[Union[desdeo_tools.solver.ScalarSolver.ScalarMethod, str]] = 'scipy_de') -> Tuple[numpy.ndarray, numpy.ndarray]

   Computes a representation of a Pareto efficient front from a
   multiobjective minimization problem. Does so by generating an evenly spaced
   set of reference points (in the objective space), in the space spanned by
   the supplied ideal and nadir points. The generated reference points are
   then used to formulate achievement scalarization problems, which when
   solved, yield a representation of a Pareto efficient solution. The result
   is guaranteed to contain only non-dominated solutions.

   :param objective_evaluator: A vector
                               valued function returning objective values given an array of decision
                               variables.
   :type objective_evaluator: Callable[[np.ndarray], np.ndarray]
   :param n_of_objectives: Number of objectives returned by
                           objective_evaluator.
   :type n_of_objectives: int
   :param variable_bounds: The upper and lower bounds of the
                           decision variables. Bound for each variable should be on the rows,
                           with the first column containing lower bounds, and the second column
                           upper bounds. Use np.inf to indicate no bounds.
   :type variable_bounds: np.ndarray
   :param step: Either an float
                or an array of floats. If a single float is given, generates
                reference points with the objectives having values a step apart
                between the ideal and nadir points. If an array of floats is given,
                use the steps defined in the array for each objective's values.
                Default to 0.1.
   :type step: Optional[Union[np.ndarray, float]], optional
   :param eps: An offset to be added to the nadir
               value to keep the nadir inside the range when generating reference
               points. Defaults to 1e-6.
   :type eps: Optional[float], optional
   :param ideal: The ideal point of the
                 problem being solved. Defaults to None.
   :type ideal: Optional[np.ndarray], optional
   :param nadir: The nadir point of the
                 problem being solved. Defaults to None.
   :type nadir: Optional[np.ndarray], optional
   :param constraint_evaluator: An evaluator returning values for the constraints defined
                                for the problem. A negative value for a constraint indicates a breach
                                of that constraint. Defaults to None.
   :type constraint_evaluator: Optional[Callable[[np.ndarray], np.ndarray]], optional
   :param solver_method: The
                         method used to minimize the achievement scalarization problems
                         arising when calculating Pareto efficient solutions. Defaults to
                         "scipy_de".
   :type solver_method: Optional[Union[ScalarMethod, str]], optional

   :raises MCDMUtilityException: Mismatching sizes of the supplied ideal and
   :raises nadir points between the step, when step is an array. Or the type of:
   :raises step is something else than np.ndarray of float.:

   :returns: A tuple containing representations of
             the Pareto optimal variable values, and the corresponsing objective
             values.
   :rtype: Tuple[np.ndarray, np.ndarray]

   .. note::

      The objective evaluator should be defined such that minimization is
      expected in each of the objectives.


.. py:function:: solve_pareto_front_representation(problem: desdeo_problem.problem.MOProblem, step: Optional[Union[numpy.ndarray, float]] = 0.1, eps: Optional[float] = 1e-06, solver_method: Optional[Union[desdeo_tools.solver.ScalarSolver.ScalarMethod, str]] = 'scipy_de') -> Tuple[numpy.ndarray, numpy.ndarray]

   Pass through to solve_pareto_front_representation_general when the
   problem for which the front is being calculated for is defined as an
   MOProblem object.

   Computes a representation of a Pareto efficient front
   from a multiobjective minimization problem. Does so by generating an
   evenly spaced set of reference points (in the objective space), in the
   space spanned by the supplied ideal and nadir points. The generated
   reference points are then used to formulate achievement scalarization
   problems, which when solved, yield a representation of a Pareto efficient
   solution.

   :param problem: The multiobjective minimization problem for which the front is to be solved for.
   :type problem: MOProblem
   :param step: Either a float
                or an array of floats. If a single float is given, generates
                reference points with the objectives having values a step apart
                between the ideal and nadir points. If an array of floats is given,
                use the steps defined in the array for each objective's values.
                Default to 0.1.
   :type step: Optional[Union[np.ndarray, float]], optional
   :param eps: An offset to be added to the nadir
               value to keep the nadir inside the range when generating reference
               points. Defaults to 1e-6.
   :type eps: Optional[float], optional
   :param solver_method: The
                         method used to minimize the achievement scalarization problems
                         arising when calculating Pareto efficient solutions. Defaults to
                         "scipy_de".
   :type solver_method: Optional[Union[ScalarMethod, str]], optional

   :returns: A tuple containing representations of
             the Pareto optimal variable values, and the corresponsing objective
             values.
   :rtype: Tuple[np.ndarray, np.ndarray]


.. py:function:: f_1(x)


