t4t/dominated.rs
1/// Captures a domination relationship between moves in a simultaneous move game.
2///
3/// A move `m1` is *strictly dominated* by another move `m2` for player `p` if, for any possible
4/// moves played by other players, changing from `m1` to `m2` increases `p`'s utility.
5///
6/// A move `m1` is *weakly dominated* by another move `m2` for player `p` if, for any possible
7/// moves played by other players, changing from `m1` to `m2` does not decrease `p`'s utility.
8///
9/// Note that `m1` and `m2` may weakly dominate each other if the two moves are equivalent, that
10/// is, if they always yield the same utility in otherwise identical profiles.
11#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]
12pub struct Dominated<M> {
13 /// The move that is dominated, i.e. yields a worse utility.
14 pub dominated: M,
15 /// The move that is dominates the dominated move, i.e. yields a better utility.
16 pub dominator: M,
17 /// Is the domination relationship strict? If `true`, the `dominator` always yields a greater
18 /// utility. If `false`, the `dominator` always yields a greater or equal utility.
19 pub is_strict: bool,
20}
21
22impl<M> Dominated<M> {
23 /// Construct a strict domination relationship.
24 pub fn strict(dominated: M, dominator: M) -> Self {
25 Dominated {
26 dominated,
27 dominator,
28 is_strict: true,
29 }
30 }
31
32 /// Construct a weak domination relationship.
33 pub fn weak(dominated: M, dominator: M) -> Self {
34 Dominated {
35 dominated,
36 dominator,
37 is_strict: false,
38 }
39 }
40}