# Optimality Operators¶

## Abstract Operators¶

class improb.decision.opt.Opt

Abstract base class for optimality operators.

class improb.decision.opt.OptPartialPreorder

Bases: improb.decision.opt.Opt

Abstract base class for optimality operators that use a maximality criterion with respect to a partial preordering.

is_strictly_larger(gamble, other_gamble, event=True)

Defines the partial ordering.

class improb.decision.opt.OptTotalPreorder

Abstract base class for optimality operators that use a maximality criterion with respect to a total preordering, which is assumed to be represented via real numbers.

get_value(gamble, event=True)

Defines the total order.

Returns: The value of the gamble. float or similar; see Values

## Concrete Operators¶

Optimality by pointwise dominance.

is_strictly_larger(gamble, other_gamble, event=True)

Check for pointwise dominance.

```>>> opt = OptAdmissible('abc', number_type='fraction')
>>> opt.is_strictly_larger([1, 2, 3], [1, 2, 3])
False
>>> opt.is_strictly_larger([1, 2, 3], [1, 1, 4])
False
>>> opt.is_strictly_larger([1, 2, 3], [0, 1, 2])
True
>>> opt.is_strictly_larger([1, 2, 3], [2, 3, 4])
False
>>> opt.is_strictly_larger([1, 2, 3], [1, 2, '8/3'])
True
>>> opt.is_strictly_larger([1, 2, 3], [1, 5, 2], event='ac')
True
```
class improb.decision.opt.OptLowPrevMax(lowprev)

Maximality with respect to a lower prevision.

class improb.decision.opt.OptLowPrevMaxMin(lowprev)

Gamma-maximin with respect to a lower prevision.

class improb.decision.opt.OptLowPrevMaxMax(lowprev)

Gamma-maximax with respect to a lower prevision.

class improb.decision.opt.OptLowPrevMaxHurwicz(lowprev, alpha)

Hurwicz with respect to a lower prevision.

class improb.decision.opt.OptLowPrevMaxInterval(lowprev)

Interval dominance with respect to a lower prevision.

## Examples¶

Example taken from [1]:

```>>> lpr = LowPoly(pspace=2)
>>> lpr.set_lower([1, 0], 0.28)
>>> lpr.set_upper([1, 0], 0.70)
>>> gambles = [[4, 0], [0, 4], [3, 2], [0.5, 3], [2.35, 2.35], [4.1, -0.3]]
>>> opt = OptLowPrevMax(lpr)
>>> list(opt(gambles)) == [[4, 0], [0, 4], [3, 2], [2.35, 2.35]]
True
>>> list(OptLowPrevMaxMin(lpr)(gambles)) == [[2.35, 2.35]]
True
>>> list(OptLowPrevMaxMax(lpr)(gambles)) == [[0, 4]]
True
>>> list(OptLowPrevMaxInterval(lpr)(gambles)) == [[4, 0], [0, 4], [3, 2], [2.35, 2.35], [4.1, -0.3]]
True
```

Another example:

```>>> lpr = Prob(pspace=4, prob=[0.42, 0.08, 0.18, 0.32]).get_linvac(0.1)
>>> opt = OptLowPrevMax(lpr)
>>> for c in range(3):
...     gambles = [[10-c,10-c,15-c,15-c],[10-c,5-c,15-c,20-c],
...                [5-c,10-c,20-c,15-c],[5-c,5-c,20-c,20-c],
...                [10,10,15,15],[5,5,20,20]]
...     print(list(opt(gambles)))
[[10, 5, 15, 20]]
[[9, 4, 14, 19], [10, 10, 15, 15], [5, 5, 20, 20]]
[[10, 10, 15, 15], [5, 5, 20, 20]]
```

Footnotes

 [1] Matthias C. M. Troffaes. Decision making under uncertainty using imprecise probabilities. International Journal of Approximate Reasoning, 45(1):17-29, May 2007.