feat(dommer): the power solutions compared on equal terms, and the axes of the surfaces (clarifications 134, 135 and 137)
M7 gives, for each of the five solutions, the share of the draws in which it is best alone and in which it shares the place, with no verdict on A; part II and the thresholds for M7 are gone. T-F and T-K share the place where they are the same path. The surfaces carry the classes along their axes, and kontroll prints a line per file. The made-up reference files are regenerated: everything outside the comparison is unchanged to the last digit. Nothing is computed on the frozen parameters. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
parent
d650ce219e
commit
5a54fba628
15 changed files with 8804 additions and 758 deletions
|
|
@ -7,6 +7,7 @@ draw for the table. Nothing here says anything about the hypothesis.
|
|||
from __future__ import annotations
|
||||
|
||||
import dataclasses
|
||||
import math
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
import pytest
|
||||
|
|
@ -457,7 +458,7 @@ def test_hovedkjoringen_i_tabellen_er_dommene_paa_trinnet() -> None:
|
|||
norm = d.scenarioer[NORM.navn]
|
||||
assert (t.rad, t.scenario, t.gjelder) == (fs.HOVEDKJORINGEN, NORM.navn, ())
|
||||
assert t.losninger == norm.per_trinn[5]
|
||||
assert (t.M7, t.del_I, t.del_II) == (norm.M7[5], norm.del_I, norm.del_II)
|
||||
assert (t.M7, t.del_I) == (norm.M7[5], norm.del_I)
|
||||
assert t.ved_siden_av[Losning.A] == kj.ved_siden_av_m6(hoved.utfall(NORM, Losning.A, 5))
|
||||
with pytest.raises(ValueError, match="no table"):
|
||||
fs.hovedtabell(hoved, M5, Trinnvalg(trinn=None, grunnlag=Grunnlag.INGEN), NORM)
|
||||
|
|
@ -474,13 +475,17 @@ def test_en_rad_i_tabellen_har_radens_utfall_der_den_gjelder_og_hovedkjoringens_
|
|||
assert t.losninger[Losning.C] == fs.hovedtabell(hoved, M5, VALG, NORM).losninger[Losning.C]
|
||||
a = t.losninger[Losning.A]
|
||||
assert (a.maal["M1"].andel_holder, a.maal["M1"].dom, a.median_M1) == (1.0, Dom.HOLDER, 0.1)
|
||||
# the comparison from the row's outcomes: A best in 2, C (the main run's) in 8; no verdict
|
||||
assert t.M7 is not None
|
||||
assert (t.M7.andel_holder, t.M7.dom) == (0.2, Dom.BETINGELSER)
|
||||
assert (t.del_I, t.del_II) == (Dom.HOLDER, Dom.BETINGELSER)
|
||||
assert {a: b.best_alene for a, b in t.M7.losninger.items()} == {Losning.A: 0.2, Losning.C: 0.8}
|
||||
assert (t.M7.delt, t.M7.ingen) == (0.0, 0.0)
|
||||
assert t.del_I is Dom.HOLDER
|
||||
# the main run next to it: 7 of 10 positive, and A best in those 7
|
||||
h = fs.hovedtabell(hoved, M5, VALG, NORM)
|
||||
assert h.M7 is not None
|
||||
assert (h.losninger[Losning.A].maal["M1"].andel_holder, h.M7.andel_holder) == (0.7, 0.7)
|
||||
a_best = h.M7.losninger[Losning.A].best_alene
|
||||
assert (h.losninger[Losning.A].maal["M1"].andel_holder, a_best) == (0.7, 0.7)
|
||||
assert h.M7.losninger[Losning.C].best_alene == 0.3
|
||||
# without a run of the row every solution has the main run's figures
|
||||
(uten,) = fs.tabell(hoved, RADER["3"], None, M5, VALG).values()
|
||||
assert (uten.losninger, uten.M7, uten.del_I) == (h.losninger, h.M7, h.del_I)
|
||||
|
|
@ -504,16 +509,67 @@ def test_M6_mot_medianen_er_en_dom_og_ingen_kjoring() -> None:
|
|||
|
||||
|
||||
def test_C_i_moduler_staar_paa_plassen_til_C_og_endrer_ikke_M7_og_del_I() -> None:
|
||||
"""Row 35: the path beats A in every draw, and is still not one of the five solutions."""
|
||||
"""Row 35: the path beats A in one draw, and is still not one of the five solutions.
|
||||
|
||||
The comparison is the main run's (clarification 135 e): A is best in every draw there.
|
||||
"""
|
||||
hoved = _kjoring([{Losning.A: _u(1.0), Losning.C: _u(0.5)} for _ in range(10)])
|
||||
radkjoring = _kjoring([{Losning.C: _u(-2.0 if j < 9 else 3.0)} for j in range(10)])
|
||||
(t,) = fs.tabell(hoved, RADER["35"], radkjoring, M5, VALG).values()
|
||||
h = fs.hovedtabell(hoved, M5, VALG, NORM)
|
||||
assert t.losninger[Losning.C].maal["M1"].andel_holder == 0.1
|
||||
assert t.losninger[Losning.C].median_M1 == -2.0
|
||||
assert (t.M7, t.del_I, t.del_II) == (h.M7, h.del_I, h.del_II)
|
||||
assert (t.M7, t.del_I) == (h.M7, h.del_I)
|
||||
assert h.M7 is not None
|
||||
assert h.M7.andel_holder == 1.0
|
||||
assert (h.M7.losninger[Losning.A].best_alene, h.M7.losninger[Losning.C].best_alene) == (1.0, 0)
|
||||
|
||||
|
||||
def test_sammenligningen_i_tabellen_gjelder_de_fem_og_summerer_til_en() -> None:
|
||||
"""Clarifications 135 e and 137: row 22 (B, B', C, T-F, T-K) with B' highest, not compared.
|
||||
|
||||
Main run: A 2.0, B 1.0, C 1.0, T-F 0.5, T-K cannot be built in the last two of ten. In the
|
||||
row B rises to 2.0 in the first five draws (sharing the place with A) and to 3.0 in the
|
||||
next five.
|
||||
"""
|
||||
alle = (Losning.A, Losning.B, Losning.B_MERKET, Losning.C, Losning.T_F, Losning.T_K)
|
||||
|
||||
def hovedtrekning(j: int) -> dict[Losning, Utfall | None]:
|
||||
verdier = {Losning.A: 2.0, Losning.B: 1.0, Losning.B_MERKET: 99.0, Losning.C: 1.0}
|
||||
u: dict[Losning, Utfall | None] = {a: _u(v) for a, v in verdier.items()}
|
||||
return {**u, Losning.T_F: _u(0.5), Losning.T_K: None if j >= 8 else _u(0.0)}
|
||||
|
||||
hoved = _kjoring([hovedtrekning(j) for j in range(10)])
|
||||
assert hoved.losninger == alle
|
||||
egne = (Losning.B, Losning.B_MERKET, Losning.C, Losning.T_F, Losning.T_K)
|
||||
radkjoring = _kjoring(
|
||||
[
|
||||
{
|
||||
**{a: hovedtrekning(j)[a] for a in egne},
|
||||
Losning.B: _u(2.0 if j < 5 else 3.0),
|
||||
}
|
||||
for j in range(10)
|
||||
]
|
||||
)
|
||||
(t,) = fs.tabell(hoved, RADER["22"], radkjoring, M5, VALG).values()
|
||||
assert t.gjelder == egne
|
||||
assert t.M7 is not None
|
||||
assert list(t.M7.losninger) == [Losning.A, Losning.B, Losning.C, Losning.T_F, Losning.T_K]
|
||||
andeler = {a: b.best_alene for a, b in t.M7.losninger.items()}
|
||||
assert andeler == {
|
||||
Losning.A: 0.0,
|
||||
Losning.B: 0.5,
|
||||
Losning.C: 0.0,
|
||||
Losning.T_F: 0.0,
|
||||
Losning.T_K: 0.0,
|
||||
}
|
||||
assert (t.M7.delt, t.M7.ingen) == (0.5, 0.0)
|
||||
assert t.M7.losninger[Losning.A].deler_plassen == 0.5
|
||||
assert [p for p, x in t.M7.par.items() if x > 0] == [(Losning.A, Losning.B)]
|
||||
assert t.M7.losninger[Losning.T_K].ikke_byggbar == 0.2
|
||||
assert math.fsum([*andeler.values(), t.M7.delt, t.M7.ingen]) == 1.0
|
||||
h = fs.hovedtabell(hoved, M5, VALG, NORM)
|
||||
assert h.M7 is not None
|
||||
assert (h.M7.losninger[Losning.A].best_alene, h.M7.delt, h.M7.ingen) == (1.0, 0.0, 0.0)
|
||||
|
||||
|
||||
def test_tabellen_har_en_rad_per_scenario_raden_leses_av_i() -> None:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue