Motor motor-perf bbe7f4ec: Frist breit vorausschauend (p95 darf die Frist des Laeufers nicht reissen)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-29 12:38:39 +01:00
co-authored by Claude Opus 5.5
parent f9f3f309eb
commit fc773cb67d
+9 -2
View File
@@ -85,9 +85,16 @@ pub fn loese(a: &Aufgabe, zuege: &[Zug2], runden: u32, gut: f32) -> Result<PostF
}
} else {
let bis = BIS.with(|b| b.get());
let t0 = std::time::Instant::now();
for i in 0..runden {
if bis.is_some_and(|b| std::time::Instant::now() >= b) {
return Err(FRIST.into());
// Frist (MOTOR_NACH_BREIT_FRIST): abbrechen, sobald die naechste Iteration (mit Pruefung ~3 Iterationen) nicht mehr
// hineinpasst, nicht erst danach; dazu ~2 Iterationen fuer Abschluss und Antwort (29.11.: River breit riss sonst 9 s)
if let Some(b) = bis {
let je = if i > 0 { t0.elapsed() / i } else { std::time::Duration::ZERO };
let pruef = pruefen && i % 20 == 19 && i + 1 < runden;
if std::time::Instant::now() + je * if pruef { 5 } else { 3 } >= b {
return Err(FRIST.into());
}
}
solve_step(&g, i);
if pruefen && i % 20 == 19 && i + 1 < runden && compute_exploitability(&g) < ziel {