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:
Kjell Tore Guttormsen 2026-11-13 23:03:05 +01:00
commit 5a54fba628
Signed by: ktg
SSH key fingerprint: SHA256:JakMjO6FTBBzN0Bhfj9saOoEjaFxlSdYuZQQpM/lF9Q
15 changed files with 8804 additions and 758 deletions

View file

@ -61,7 +61,7 @@ def test_trekning_uten_verdi_teller_i_nevneren() -> None:
assert dommer.median(_utfall((1.0, 4), (None, 6))) == -math.inf
# -------------------------------------------------------------- M1, M2, M7
# -------------------------------------------------------------- M1, M2
@pytest.mark.parametrize(
@ -88,23 +88,32 @@ def test_dom_m2_teller_null_som_oppfylt() -> None:
assert dommer.dom_m2(_utfall((1.0, 10), (-1.0, 50), (None, 40))) is Dom.HOLDER_IKKE
def test_dom_m7_a_mot_b_og_c() -> None:
"""A is best in 5 of 10 draws: holds. A draw where A cannot be built is not one of them.
def test_m7_hvem_som_er_best_blant_a_b_og_c() -> None:
"""Clarification 137 a, one rule for each: the highest value among those that can be built.
The two versions of solution T are left out here; ``test_trinnvis_dommer.py`` has all five.
Ten draws. 0-4: A highest. 5-7: B highest (A lower, C equal to A in 5-7). 8-9: A cannot
be built, B is negative and C cannot be built either: B is best alone. The two versions of
solution T are left out here; ``test_trinnvis_dommer.py`` has all five.
"""
A = _utfall((10.0, 5), (1.0, 3), (None, 2))
B = _utfall((5.0, 5), (2.0, 3), (-9.0, 2))
C = _utfall((None, 5), (0.0, 5))
assert dommer.a_er_best({Losning.A: A, Losning.B: B, Losning.C: C}) == [True] * 5 + [False] * 5
assert dommer.dom_m7({Losning.A: A, Losning.B: B, Losning.C: C}) is Dom.HOLDER
alltid_bedre = _utfall((5.0, 5), (2.0, 5))
fire = {Losning.A: _utfall((10.0, 4), (1.0, 6)), Losning.B: alltid_bedre, Losning.C: C}
assert dommer.dom_m7(fire) is Dom.BETINGELSER
en = {Losning.A: _utfall((10.0, 1), (1.0, 9)), Losning.B: alltid_bedre, Losning.C: C}
assert dommer.dom_m7(en) is Dom.HOLDER_IKKE
# equal is not best
assert dommer.a_er_best({Losning.A: [1.0], Losning.B: [1.0], Losning.C: [0.0]}) == [False]
C = _utfall((None, 5), (1.0, 3), (None, 2))
beste = dommer.beste_per_trekning({Losning.A: A, Losning.B: B, Losning.C: C})
assert beste == [(Losning.A,)] * 5 + [(Losning.B,)] * 5
# equal values share the place, in the order A, B, C; none built leaves none
assert dommer.beste_per_trekning({Losning.A: [1.0], Losning.B: [1.0], Losning.C: [0.0]}) == [
(Losning.A, Losning.B)
]
assert dommer.beste_per_trekning({Losning.C: [3.0], Losning.B: [2.0], Losning.A: [3.0]}) == [
(Losning.A, Losning.C)
]
assert dommer.beste_per_trekning({Losning.A: [None], Losning.B: [None], Losning.C: [None]}) == [
()
]
# C can be best as A can, and a solution that cannot be built is never among the best
assert dommer.beste_per_trekning({Losning.A: [None], Losning.B: [-1.0], Losning.C: [0.0]}) == [
(Losning.C,)
]
# ------------------------------------------------------------------ M3 and M4
@ -320,10 +329,6 @@ def test_del_I_ser_ikke_paa_referansekjoringen() -> None:
assert dommer.del_I(per_losning, median, Trinnvalg(10, Grunnlag.TRINN_25)) is Dom.HOLDER_IKKE
def test_del_II_folger_M7() -> None:
assert dommer.del_II(Dom.BETINGELSER) is Dom.BETINGELSER
def test_hvor_mye_av_dommen_som_skyldes_baner_som_ikke_lar_seg_bygge() -> None:
"""Clarification 69: 2 of 8 draws cannot be built; 3 of the 6 others meet the condition."""
oppfylt = [True, None, False, True, None, False, True, False]