generalized_minkowski_distance

negmas.outcomes.generalized_minkowski_distance(a, b, outcome_space, *, weights=None, dist_power=2)[source]

Calculates the difference between two outcomes given an outcome-space (optionally with issue weights). This is defined as the distance.

Parameters:
  • outcome_space (OutcomeSpace | None) – The outcome space used for comparison (If None an apporximate implementation is provided)

  • a (tuple) – first outcome

  • b (tuple) – second outcome

  • weights (Optional[Sequence[float]]) – Issue weights

  • dist_power (float) – The exponent used when calculating the distance

Return type:

float

Remarks:

  • Implements the following distance measure:

    \[d(a, b) = \left( \sum_{i=1}^{N} w_i {\left| a_i - b_i \right|}^p \right)^{frac{1}{p}}\]

    where $a, b$ are the outocmes, $x_i$ is value for issue $i$ of outcoem $x$, $w_i$ is the weight of issue $i$ and $p$ is the dist_power passsed. Categorical issue differences is defined as $1$ if the values are not equal and $0$ otherwise.

  • Becomes the Euclidean distance if all issues are numeric and no weights are given

  • You can control the power:

    • Setting it to 1 is the city-block distance

    • Setting it to 0 is the maximum issue difference