Commit edae760
Log avg_distance_per_infraction (port from emerge/temp_training)
Adds the metric:
avg_distance_per_infraction = total_fleet_distance / max(1, total_fleet_infractions)
which tracks how far agents drive between offroad/collision/red-light
events — a useful single-scalar driving-quality signal for wandb.
The two underlying log fields already exist in puffer-4 and are already
aggregated per-step in add_log; only the binding-side ratio was missing.
my_log gains an `n` parameter and multiplies the per-agent-normalized
log->total_* fields by n to recover raw fleet totals. The ratio itself
is invariant to the 1/n scaling, but the un-normalization makes the
fmaxf(1.0f, total_infractions) clamp behave correctly: it floors the
denominator at "one infraction across the whole fleet", so a window
with zero infractions reports total fleet distance instead of
distance/epsilon. Both static_vec_log call sites in vecenv.h pass n.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 094a2af commit edae760
2 files changed
Lines changed: 18 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
182 | 182 | | |
183 | 183 | | |
184 | 184 | | |
185 | | - | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
186 | 199 | | |
187 | 200 | | |
188 | 201 | | |
| |||
191 | 204 | | |
192 | 205 | | |
193 | 206 | | |
| 207 | + | |
194 | 208 | | |
195 | 209 | | |
196 | 210 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
238 | 238 | | |
239 | 239 | | |
240 | 240 | | |
241 | | - | |
| 241 | + | |
242 | 242 | | |
243 | 243 | | |
244 | 244 | | |
| |||
643 | 643 | | |
644 | 644 | | |
645 | 645 | | |
646 | | - | |
| 646 | + | |
647 | 647 | | |
648 | 648 | | |
649 | 649 | | |
| |||
653 | 653 | | |
654 | 654 | | |
655 | 655 | | |
656 | | - | |
| 656 | + | |
657 | 657 | | |
658 | 658 | | |
659 | 659 | | |
| |||
0 commit comments