sort_by_utility

negmas.preferences.sort_by_utility(ufun: BaseUtilityFunction, outcomes: Iterable[tuple] | None = None, *, max_cardinality: int | float = float('inf'), best_first: bool = True, rational_only: bool = False, return_sorted_outcomes: Literal[True] = True) tuple[ndarray[tuple[int, ...], dtype[floating[Any]]], list[tuple]][source]
negmas.preferences.sort_by_utility(ufun: BaseUtilityFunction, outcomes: Iterable[tuple] | None = None, *, max_cardinality: int | float = float('inf'), best_first: bool = True, rational_only: bool = False, return_sorted_outcomes: Literal[False]) ndarray[tuple[int, ...], dtype[floating[Any]]]

Returns an ordered list of utility values and outcomes for the given ufun

Remarks:
  • If outcomes is not given, the outcome-space of the ufun is used

Returns:

  • utility values ordered from best to worst or worst to best based on best_first

  • outcomes corresponding to the sorted utility values

Return type:

A tuple of two lists (first two are numpy arrays)