motor: Frist breit vorausschauend (Abbruch, wenn die naechste Iteration mit Pruefung nicht mehr passt; River breit riss sonst 9 s); ohne Frist unveraendert

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-29 12:38:27 +01:00
co-authored by Claude Opus 5.5
parent 821c6aae04
commit bbe7f4ec03
+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 {