1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
//! Multi-valued heuristics: a set of cost-to-go estimates per state.
use Vec;
use Heuristic;
pub use ;
/// A multi-valued heuristic (MVH): for every state, a set of cost vectors
/// that bound the remaining cost to a goal from below.
///
/// Wolff, Felner, Salzman, "Bridging Multi-Valued Heuristics and
/// Dimensionality Reduction in Multi-Objective Search", arXiv 2606.20644.
///
/// - **Admissible:** for every path from `state` to a goal, some estimate
/// weakly dominates its cost. In particular every goal has the zero
/// vector among its estimates.
/// - **Consistent** (monotone): every goal's estimates are `{0}`, and for
/// every edge `(s, t)` with cost `c` and every estimate `h'` of `t`, some
/// estimate `h` of `s` has `h <= c + h'` component-wise (Mandow and Pérez
/// de la Cruz 2010, Definition 5.7). The exact Pareto sets of the
/// remaining cost are consistent in this sense.
///
/// Wolff et al. state consistency with the quantifiers the other way round
/// (every `h` of `s` has some `h'` of `t`), which their own Table 1 and the
/// exact Pareto sets do not satisfy. What
/// [`namoa_star_dr_mvh`](crate::namoa_star_dr_mvh) needs is that every path
/// to a goal carries a chain of estimates `h_k <= c_k + h_(k+1)` ending in
/// the goal's `0`; either form provides one.
///
/// A single-valued [`Heuristic`] is the special case of one estimate per
/// state; wrap it in [`SingleValued`]. Implemented for closures through
/// [`mv_heuristic_fn`] and for `&mut M`.
///
/// # Examples
///
/// ```
/// use multiobjective_search::{MvHeuristic, mv_heuristic_fn};
///
/// // Two trade-offs from state 0, the goal 1 is free.
/// let mut h = mv_heuristic_fn(|s: &u8, out: &mut Vec<[u32; 2]>| match s {
/// 0 => out.extend([[1, 5], [4, 2]]),
/// _ => out.push([0, 0]),
/// });
///
/// let mut out = Vec::new();
/// h.estimates(&0, &mut out);
/// assert_eq!(out, [[1, 5], [4, 2]]);
/// ```
/// A single-valued [`Heuristic`] as a [`MvHeuristic`] with one estimate
/// per state, none for a dead end.
///
/// Admissible or consistent exactly when the wrapped heuristic is.
;
/// A [`MvHeuristic`] backed by a closure; see [`mv_heuristic_fn`].
;
/// Wraps a closure `|state, out| ...` that appends the estimates of
/// `state` to `out` as a [`MvHeuristic`].
pub const