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

@ -116,11 +116,12 @@ def test_m5_for_tk_folger_ikke_trinnet_eller_trekningen() -> None:
# ----------------------------------------------------------- M7 with five solutions
def test_m7_a_maa_slaa_hver_av_de_fire_som_lar_seg_bygge() -> None:
"""Six invented draws.
def test_m7_de_beste_er_de_med_hoyest_verdi_blant_dem_som_lar_seg_bygge() -> None:
"""Six invented draws (clarification 137 a).
1: A highest. 2: T-F higher. 3: T-K equal (strictly higher is required). 4: only A can
be built. 5: A cannot be built. 6: A highest among those that can be built.
1: A highest. 2: T-F highest. 3: A and T-K share the highest value. 4: only A can be built.
5: A cannot be built and the four others share one value. 6: A highest among those that can
be built.
"""
nnv: dict[Losning, list[float | None]] = {
Losning.A: [10.0, 10.0, 10.0, 10.0, None, 10.0],
@ -129,33 +130,52 @@ def test_m7_a_maa_slaa_hver_av_de_fire_som_lar_seg_bygge() -> None:
Losning.T_F: [5.0, 11.0, 5.0, None, 1.0, None],
Losning.T_K: [5.0, 5.0, 10.0, None, 1.0, 9.0],
}
assert dommer.a_er_best(nnv) == [True, False, False, True, False, True]
assert dommer.dom_m7(nnv) is Dom.HOLDER # three of six
# without the two versions of T, A is also best in draws 2 and 3
tre = {a: nnv[a] for a in (Losning.A, Losning.B, Losning.C)}
assert dommer.a_er_best(tre) == [True, True, True, True, False, True]
A, B, C, TF, TK = dommer.DOMSLOSNINGER
assert dommer.beste_per_trekning(nnv) == [(A,), (TF,), (A, TK), (A,), (B, C, TF, TK), (A,)]
# without the two versions of T, A is best alone in draws 2 and 3 too, B and C share draw 5
tre = {a: nnv[a] for a in (A, B, C)}
assert dommer.beste_per_trekning(tre) == [(A,), (A,), (A,), (A,), (B, C), (A,)]
# the order the solutions stand in does not matter
snudd = {a: nnv[a] for a in reversed(list(nnv))}
assert dommer.a_er_best(snudd) == dommer.a_er_best(nnv)
assert dommer.beste_per_trekning(snudd) == dommer.beste_per_trekning(nnv)
def test_m7_andelene() -> None:
"""A is best in 4 of 10 and in 1 of 10 draws against a T-F that is otherwise higher."""
andre = {a: _utfall((5.0, 10)) for a in (Losning.B, Losning.C, Losning.T_K)}
tf_fire = {Losning.A: _utfall((10.0, 10)), Losning.T_F: _utfall((1.0, 4), (20.0, 6))}
tf_en = {Losning.A: _utfall((10.0, 10)), Losning.T_F: _utfall((1.0, 1), (20.0, 9))}
assert dommer.dom_m7({**andre, **tf_fire}) is Dom.BETINGELSER
assert dommer.dom_m7({**andre, **tf_en}) is Dom.HOLDER_IKKE
@pytest.mark.parametrize("vinner", [Losning.A, Losning.B, Losning.C, Losning.T_F, Losning.T_K])
def test_m7_hver_av_de_fem_kan_vaere_best(vinner: Losning) -> None:
"""The rule is the same for all five: the one above the others is best, whichever it is."""
nnv: dict[Losning, list[float | None]] = {
a: [3.0 if a is vinner else 1.0, None if a is vinner else 2.0] for a in dommer.DOMSLOSNINGER
}
# draw 2: the winner cannot be built, and the four others share the place
andre = tuple(a for a in dommer.DOMSLOSNINGER if a is not vinner)
assert dommer.beste_per_trekning(nnv) == [(vinner,), andre]
def test_m7_gjelder_a_mot_b_c_tf_og_tk() -> None:
"""Without A there is nothing to judge; R and B' are not part of M7."""
with pytest.raises(ValueError, match="M7 compares A"):
dommer.a_er_best({Losning.B: [1.0], Losning.C: [2.0]})
with pytest.raises(ValueError, match="M7 compares A"):
dommer.a_er_best({Losning.A: [1.0], Losning.R: [2.0]})
with pytest.raises(ValueError, match="M7 compares A"):
dommer.a_er_best({Losning.A: [1.0], Losning.B_MERKET: [2.0]})
def test_m7_T_F_og_T_K_like_deler_plassen() -> None:
"""Where no module of T-K gets nuclear power, T-K is T-F: the two share, not none (137)."""
nnv: dict[Losning, list[float | None]] = {
Losning.A: [1.0, 1.0, None],
Losning.B: [2.0, 9.0, None],
Losning.C: [3.0, 1.0, None],
Losning.T_F: [7.0, 7.0, 7.0],
Losning.T_K: [7.0, 7.0, 7.0],
}
TF, TK = Losning.T_F, Losning.T_K
assert dommer.beste_per_trekning(nnv) == [(TF, TK), (Losning.B,), (TF, TK)]
def test_m7_uten_a_sammenlignes_de_som_er_med() -> None:
"""A run without A compares those of the five that are in it; R and B' are not part of M7."""
assert dommer.beste_per_trekning({Losning.B: [1.0, None], Losning.C: [2.0, None]}) == [
(Losning.C,),
(),
]
assert dommer.beste_per_trekning({Losning.T_K: [-1.0]}) == [(Losning.T_K,)]
for med in ({Losning.A: [1.0], Losning.R: [2.0]}, {Losning.A: [1.0], Losning.B_MERKET: [2.0]}):
with pytest.raises(ValueError, match="M7 compares A, B, C, T-F and T-K"):
dommer.beste_per_trekning(med)
with pytest.raises(ValueError, match="M7 compares"):
dommer.beste_per_trekning({})
# ------------------------------------------------------ the ladder with five solutions