Survey Driver¶
One driver runs the survey for every backend. It owns the checkpoint cadence, the halt rule and the monitor, and a backend owns the search.
The next chunk of work goes to the device before the monitor runs, so host work in a monitor overlaps device work. The map read and the tree read come first, because the next chunk changes the archive.
Every backend halts on the trailing window of gate_window checkpoints that
windowed_rates measures, so gate_window, coverage_eps and precision_eps
carry one meaning on every engine.
run_survey
¶
Run one survey on one backend and return the result.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
backend
|
An object that obeys the :class: |
required | |
ctx
|
RunContext
|
The trees, alignment, model and chart geometry for this survey. |
required |
params
|
ArchiveParams
|
The resolved run parameters. |
required |
monitor
|
(callable, None or False)
|
A checkpoint callback. None selects the default reporter and False
turns reporting off. See :mod: |
None
|
task
|
SurveyTask
|
Passed to the monitor so that a caller can tell surveys apart. |
None
|
Raises:
| Type | Description |
|---|---|
ValueError
|
The monitor names an unknown value, or a value this backend cannot serve. The check runs before any survey work starts. |
Source code in src/hifuku/driver.py
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 | |
ArchiveResult
dataclass
¶
A completed survey: the archive, its history, and the halt state.
history has one row per checkpoint of
(iteration, n_filled, best_logL, coverage_rate, precision_rate), after a
first row that records the seeded archive. The two rates are scale
invariant. See :func:windowed_rates. They are NaN until a full window of
checkpoints has run.
Source code in src/hifuku/driver.py
windowed_rates
¶
Trailing-window coverage and precision rates for the halt.
Both rates are scale invariant in the size of the domain. coverage is
the growth of the filled set per checkpoint, as a fraction of the filled
count. precision is the mean per-niche elite gain per checkpoint, as a
fraction of the elite range.
The division by n_filled makes both rates settle toward zero whether the
domain holds tens of niches or tens of thousands. One pair of thresholds
therefore fits any cell size and any gate margin.
Both rates are NaN until gate_window checkpoints exist. A NaN compares
False against a threshold, so a short run does not halt by accident.
Source code in src/hifuku/driver.py
survey_converged
¶
Discovery saturation: both windowed rates at or below their thresholds.
Coverage is the crisp signal. Precision uses a loose threshold because refinement inside a niche never fully stops.