desdeo_mcdm.utilities.solvers

Implements various useful solvers.

Module Contents

Functions

weighted_scalarizer(→ numpy.ndarray)

A simple linear weight based scalarizer.

payoff_table_method_general(→ Tuple[numpy.ndarray, ...)

Solves a representation for the nadir and ideal points for a

payoff_table_method(→ Tuple[numpy.ndarray, numpy.ndarray])

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

solve_pareto_front_representation_general(...)

Computes a representation of a Pareto efficient front from a

solve_pareto_front_representation(...)

Pass through to solve_pareto_front_representation_general when the

f_1(x)

exception desdeo_mcdm.utilities.solvers.MCDMUtilityException[source]

Bases: Exception

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

desdeo_mcdm.utilities.solvers.weighted_scalarizer(xs: numpy.ndarray, ws: numpy.ndarray) numpy.ndarray[source]

A simple linear weight based scalarizer.

Parameters:
  • xs (np.ndarray) – Values to be scalarized.

  • ws (np.ndarray) – Weights to multiply each value in the summation of xs.

Returns:

An array of scalar values with length equal to the first dimension of xs.

Return type:

np.ndarray

desdeo_mcdm.utilities.solvers.payoff_table_method_general(objective_evaluator: Callable[[numpy.ndarray], numpy.ndarray], n_of_objectives: int, variable_bounds: numpy.ndarray, constraint_evaluator: Callable[[numpy.ndarray], numpy.ndarray] | None = None, initial_guess: numpy.ndarray | None = None, solver_method: desdeo_tools.solver.ScalarSolver.ScalarMethod | str | None = 'scipy_de') Tuple[numpy.ndarray, numpy.ndarray][source]

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

Parameters:
  • objective_evaluator (Callable[[np.ndarray], np.ndarray]) – The evaluator which returns the objective values given a set of variabels.

  • n_of_objectives (int) – Number of objectives returned by calling objective_evaluator.

  • variable_bounds (np.ndarray) – 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.

  • constraint_evaluator (Optional[Callable[[np.ndarray], np.ndarray]], optional) – 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.

  • initial_guess (Optional[np.ndarray], optional) – 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.

  • solver_method (Optional[Union[ScalarMethod, str]], optional) – The method to solve the scalarized problems in the payoff table method. Defaults to “scipy_de”, which ignores initial_guess.

Returns:

The representations computed using the payoff table for the ideal and nadir points respectively.

Return type:

Tuple[np.ndarray, np.ndarray]

desdeo_mcdm.utilities.solvers.payoff_table_method(problem: desdeo_problem.problem.MOProblem, initial_guess: numpy.ndarray | None = None, solver_method: desdeo_tools.solver.ScalarSolver.ScalarMethod | str | None = 'scipy_de') Tuple[numpy.ndarray, numpy.ndarray][source]

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

Parameters:
  • problem (MOProblem) – The problem defined as a MOProblem class instance.

  • initial_guess (Optional[np.ndarray]) – 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.

  • solver_method (Optional[Union[ScalarMethod, str]]) – The method used to minimize the individual problems in the payoff table method. Defaults to ‘scipy_de’.

Returns:

The ideal and nadir points

Return type:

Tuple[np.ndarray, np.ndarray]

desdeo_mcdm.utilities.solvers.solve_pareto_front_representation_general(objective_evaluator: Callable[[numpy.ndarray], numpy.ndarray], n_of_objectives: int, variable_bounds: numpy.ndarray, step: numpy.ndarray | float | None = 0.1, eps: float | None = 1e-06, ideal: numpy.ndarray | None = None, nadir: numpy.ndarray | None = None, constraint_evaluator: Callable[[numpy.ndarray], numpy.ndarray] | None = None, solver_method: desdeo_tools.solver.ScalarSolver.ScalarMethod | str | None = 'scipy_de') Tuple[numpy.ndarray, numpy.ndarray][source]

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.

Parameters:
  • objective_evaluator (Callable[[np.ndarray], np.ndarray]) – A vector valued function returning objective values given an array of decision variables.

  • n_of_objectives (int) – Number of objectives returned by objective_evaluator.

  • variable_bounds (np.ndarray) – 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.

  • step (Optional[Union[np.ndarray, float]], optional) – 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.

  • eps (Optional[float], optional) – An offset to be added to the nadir value to keep the nadir inside the range when generating reference points. Defaults to 1e-6.

  • ideal (Optional[np.ndarray], optional) – The ideal point of the problem being solved. Defaults to None.

  • nadir (Optional[np.ndarray], optional) – The nadir point of the problem being solved. Defaults to None.

  • constraint_evaluator (Optional[Callable[[np.ndarray], np.ndarray]], optional) – 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.

  • solver_method (Optional[Union[ScalarMethod, str]], optional) – The method used to minimize the achievement scalarization problems arising when calculating Pareto efficient solutions. Defaults to “scipy_de”.

Raises:
  • MCDMUtilityException – Mismatching sizes of the supplied ideal and

  • nadir points between the step, when step is an array. Or the type of

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

Return type:

Tuple[np.ndarray, np.ndarray]

Note

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

desdeo_mcdm.utilities.solvers.solve_pareto_front_representation(problem: desdeo_problem.problem.MOProblem, step: numpy.ndarray | float | None = 0.1, eps: float | None = 1e-06, solver_method: desdeo_tools.solver.ScalarSolver.ScalarMethod | str | None = 'scipy_de') Tuple[numpy.ndarray, numpy.ndarray][source]

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.

Parameters:
  • problem (MOProblem) – The multiobjective minimization problem for which the front is to be solved for.

  • step (Optional[Union[np.ndarray, float]], optional) – 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.

  • eps (Optional[float], optional) – An offset to be added to the nadir value to keep the nadir inside the range when generating reference points. Defaults to 1e-6.

  • solver_method (Optional[Union[ScalarMethod, str]], optional) – The method used to minimize the achievement scalarization problems arising when calculating Pareto efficient solutions. Defaults to “scipy_de”.

Returns:

A tuple containing representations of the Pareto optimal variable values, and the corresponsing objective values.

Return type:

Tuple[np.ndarray, np.ndarray]

desdeo_mcdm.utilities.solvers.f_1(x)[source]