InverseUFun
- class negmas.preferences.InverseUFun(*args, **kwargs)[source]
Bases:
Protocol
Can be used to get one or more outcomes at a given range
Methods Summary
__call__
(rng, normalized)Calling an inverse ufun directly is equivalent to calling
one_in()
best
()Finds the best outcome
best_in
(rng, normalized)Finds an outcome with highest utility within the given range
Finds the worst and best outcomes that can be returned.
init
()Used to intialize the inverse ufun.
max
()Finds the maximum utility value that can be returned.
min
()Finds the minimum utility value that can be returned.
minmax
()Finds the minimum and maximum utility values that can be returned.
one_in
(rng, normalized)Finds an outcmoe with the given utility value.
some
(rng, normalized[, n])Finds a list of outcomes with utilities in the given range.
within_fractions
(rng)Finds outocmes within the given fractions of utility values.
within_indices
(rng)Finds outocmes within the given indices with the best at index 0 and the worst at largest index.
worst
()Finds the worst outcome
worst_in
(rng, normalized)Finds an outcome with lowest utility within the given range
Methods Documentation
- abstract __call__(rng, normalized)[source]
Calling an inverse ufun directly is equivalent to calling
one_in()
- Return type
Outcome | None
- abstract best_in(rng, normalized)[source]
Finds an outcome with highest utility within the given range
- abstract extreme_outcomes()[source]
Finds the worst and best outcomes that can be returned.
- Remarks:
These may be different from the results of
ufun.extreme_outcomes()
as they can be approximate.
- init()[source]
Used to intialize the inverse ufun. Any computationally expensive initialization should be done here not in the constructor.
- abstract max()[source]
Finds the maximum utility value that can be returned.
- Remarks:
May be different from the maximum of the whole ufun if there is approximation
- Return type
- abstract min()[source]
Finds the minimum utility value that can be returned.
- Remarks:
May be different from the minimum of the whole ufun if there is approximation
- Return type
- abstract minmax()[source]
Finds the minimum and maximum utility values that can be returned.
- Remarks:
These may be different from the results of
ufun.minmax()
as they can be approximate.
- abstract some(rng, normalized, n=None)[source]
Finds a list of outcomes with utilities in the given range.
- Parameters
- Remarks:
If the ufun outcome space is continuous a sample of outcomes is returned
If the ufun outcome space is discrete all outcomes in the range are returned
- Return type
list[Outcome]
- abstract within_fractions(rng)[source]
Finds outocmes within the given fractions of utility values.
rng
is always assumed to be normalized between 0-1
- abstract within_indices(rng)[source]
Finds outocmes within the given indices with the best at index 0 and the worst at largest index.
- Remarks:
Works only for discrete outcome spaces