Bessere Verteilung: Strafen/Mutation, plus Abstammungsbaum mit Id-Herkunft

Weniger vermeidbare Gruppentrennungen:
- strafen.cfg: Tischbesetzung bestraft jetzt gestaffelt nach freien
  Plaetzen (teilbelegte Tische am teuersten, mit Fallback auf den
  naechstkleineren Eintrag), Trennungsstrafen deutlich erhoeht - so
  werden Gruppen nicht mehr getrennt, obwohl leere Tische danebenstehen
- gibPunkte('Tischbesetzung') mit Naechst-kleiner-Fallback
- mutieren() setzt geraeumte Gruppen groesste-zuerst neu
  (GruppenSetzen(GrosseZuerst=True)), damit grosse Gruppen die frei
  gewordenen ganzen Tische bekommen und wieder zusammenkommen
  (uebrig bleiben nur physisch unvermeidbare Trennungen, Gruppe > Tisch)

Abstammungsbaum (neuer Schalter --show-lineage -> Abstammung.svg):
- neue Klasse ga.Abstammung zeichnet den vollen Mutationsbaum aller
  Loesungen; der Ast der finalen besten Loesung ist hervorgehoben und
  mit ihrer Id beschriftet
- hierarchische Loesungs-Ids (Farm._WurzelId/_KindId): Wurzel '7',
  Mutationskind '7.2', dessen Kind '7.2.1' - die ganze Abstammung ist
  direkt aus der Id ablesbar

Tests (15 gruen), README und CLAUDE.md aktualisiert; Beispiele mit den
neuen Strafen und beiden Grafiken neu berechnet.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Michael Stangl
2026-07-11 22:38:43 +02:00
parent 644f61ef6b
commit 6710d4f06a
28 changed files with 3908 additions and 1468 deletions
@@ -3,8 +3,8 @@
<rect width="100%" height="100%" fill="white"/>
<polyline points="125.6,353.6 206,286.4" fill="none" stroke="#e6194b" stroke-width="12" stroke-linecap="round" stroke-linejoin="round" stroke-opacity="0.5"/>
<polyline points="125.6,380 45.2,286.4" fill="none" stroke="#3cb44b" stroke-width="12" stroke-linecap="round" stroke-linejoin="round" stroke-opacity="0.5"/>
<polyline points="206,125.6 125.6,58.4" fill="none" stroke="#4363d8" stroke-width="12" stroke-linecap="round" stroke-linejoin="round" stroke-opacity="0.5"/>
<polyline points="125.6,32 45.2,125.6" fill="none" stroke="#f58231" stroke-width="12" stroke-linecap="round" stroke-linejoin="round" stroke-opacity="0.5"/>
<polyline points="206,125.6 125.6,32" fill="none" stroke="#4363d8" stroke-width="12" stroke-linecap="round" stroke-linejoin="round" stroke-opacity="0.5"/>
<polyline points="125.6,58.4 45.2,125.6" fill="none" stroke="#f58231" stroke-width="12" stroke-linecap="round" stroke-linejoin="round" stroke-opacity="0.5"/>
<circle cx="125.6" cy="366.8" r="35.2" fill="white" stroke="black" stroke-width="1.5"/>
<circle cx="125.6" cy="353.6" r="12" fill="#e6194b" stroke="black" stroke-width="1"/>
<circle cx="125.6" cy="380" r="12" fill="#3cb44b" stroke="black" stroke-width="1"/>
@@ -21,8 +21,8 @@
<circle cx="206" cy="125.6" r="12" fill="white" fill-opacity="0.75"/>
<text x="206" y="125.6" text-anchor="middle" dominant-baseline="central" font-size="13.2" font-weight="bold" fill="black">0</text>
<circle cx="125.6" cy="45.2" r="35.2" fill="white" stroke="black" stroke-width="1.5"/>
<circle cx="125.6" cy="32" r="12" fill="#f58231" stroke="black" stroke-width="1"/>
<circle cx="125.6" cy="58.4" r="12" fill="#4363d8" stroke="black" stroke-width="1"/>
<circle cx="125.6" cy="32" r="12" fill="#4363d8" stroke="black" stroke-width="1"/>
<circle cx="125.6" cy="58.4" r="12" fill="#f58231" stroke="black" stroke-width="1"/>
<circle cx="125.6" cy="45.2" r="12" fill="white" fill-opacity="0.75"/>
<text x="125.6" y="45.2" text-anchor="middle" dominant-baseline="central" font-size="13.2" font-weight="bold" fill="black">0</text>
<circle cx="45.2" cy="125.6" r="35.2" fill="white" stroke="black" stroke-width="1.5"/>

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

+45
View File
@@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="1200" height="340" viewBox="0 0 1200 340" font-family="sans-serif">
<rect width="100%" height="100%" fill="white"/>
<text x="600" y="30" text-anchor="middle" font-size="16" fill="#333">Abstammung der Loesungen (Mutationsbaum)</text>
<line x1="60.0" y1="60.0" x2="60.0" y2="150.0" stroke="#c04040" stroke-width="2.5"/>
<line x1="420.0" y1="60.0" x2="368.6" y2="150.0" stroke="#bbb" stroke-width="1"/>
<line x1="780.0" y1="60.0" x2="677.1" y2="150.0" stroke="#bbb" stroke-width="1"/>
<line x1="1140.0" y1="60.0" x2="985.7" y2="150.0" stroke="#bbb" stroke-width="1"/>
<line x1="60.0" y1="60.0" x2="214.3" y2="150.0" stroke="#bbb" stroke-width="1"/>
<line x1="420.0" y1="60.0" x2="522.9" y2="150.0" stroke="#bbb" stroke-width="1"/>
<line x1="780.0" y1="60.0" x2="831.4" y2="150.0" stroke="#bbb" stroke-width="1"/>
<line x1="1140.0" y1="60.0" x2="1140.0" y2="150.0" stroke="#bbb" stroke-width="1"/>
<line x1="60.0" y1="150.0" x2="60.0" y2="240.0" stroke="#c04040" stroke-width="2.5"/>
<line x1="368.6" y1="150.0" x2="368.6" y2="240.0" stroke="#bbb" stroke-width="1"/>
<line x1="677.1" y1="150.0" x2="677.1" y2="240.0" stroke="#bbb" stroke-width="1"/>
<line x1="985.7" y1="150.0" x2="985.7" y2="240.0" stroke="#bbb" stroke-width="1"/>
<line x1="60.0" y1="150.0" x2="214.3" y2="240.0" stroke="#bbb" stroke-width="1"/>
<line x1="368.6" y1="150.0" x2="522.9" y2="240.0" stroke="#bbb" stroke-width="1"/>
<line x1="677.1" y1="150.0" x2="831.4" y2="240.0" stroke="#bbb" stroke-width="1"/>
<line x1="985.7" y1="150.0" x2="1140.0" y2="240.0" stroke="#bbb" stroke-width="1"/>
<circle cx="60.0" cy="60.0" r="7" fill="#c83232" stroke="#c04040" stroke-width="2"><title>Id 1, Wert -100.0</title></circle>
<circle cx="420.0" cy="60.0" r="5" fill="#c83232" stroke="#333" stroke-width="0.5"><title>Id 2, Wert -100.0</title></circle>
<circle cx="780.0" cy="60.0" r="5" fill="#c83232" stroke="#333" stroke-width="0.5"><title>Id 3, Wert -100.0</title></circle>
<circle cx="1140.0" cy="60.0" r="5" fill="#c83232" stroke="#333" stroke-width="0.5"><title>Id 4, Wert -100.0</title></circle>
<circle cx="60.0" cy="150.0" r="7" fill="#785f41" stroke="#c04040" stroke-width="2"><title>Id 1.1, Wert -99.0</title></circle>
<circle cx="368.6" cy="150.0" r="5" fill="#785f41" stroke="#333" stroke-width="0.5"><title>Id 2.1, Wert -99.0</title></circle>
<circle cx="677.1" cy="150.0" r="5" fill="#785f41" stroke="#333" stroke-width="0.5"><title>Id 3.1, Wert -99.0</title></circle>
<circle cx="985.7" cy="150.0" r="5" fill="#785f41" stroke="#333" stroke-width="0.5"><title>Id 4.1, Wert -99.0</title></circle>
<circle cx="214.3" cy="150.0" r="5" fill="#785f41" stroke="#333" stroke-width="0.5"><title>Id 1.2, Wert -99.0</title></circle>
<circle cx="522.9" cy="150.0" r="5" fill="#785f41" stroke="#333" stroke-width="0.5"><title>Id 2.2, Wert -99.0</title></circle>
<circle cx="831.4" cy="150.0" r="5" fill="#785f41" stroke="#333" stroke-width="0.5"><title>Id 3.2, Wert -99.0</title></circle>
<circle cx="1140.0" cy="150.0" r="5" fill="#785f41" stroke="#333" stroke-width="0.5"><title>Id 4.2, Wert -99.0</title></circle>
<circle cx="60.0" cy="240.0" r="7" fill="#288c50" stroke="#c04040" stroke-width="2"><title>Id 1.1.1, Wert -98.0</title></circle>
<circle cx="368.6" cy="240.0" r="5" fill="#288c50" stroke="#333" stroke-width="0.5"><title>Id 2.1.1, Wert -98.0</title></circle>
<circle cx="677.1" cy="240.0" r="5" fill="#288c50" stroke="#333" stroke-width="0.5"><title>Id 3.1.1, Wert -98.0</title></circle>
<circle cx="985.7" cy="240.0" r="5" fill="#288c50" stroke="#333" stroke-width="0.5"><title>Id 4.1.1, Wert -98.0</title></circle>
<circle cx="214.3" cy="240.0" r="5" fill="#288c50" stroke="#333" stroke-width="0.5"><title>Id 1.1.2, Wert -98.0</title></circle>
<circle cx="522.9" cy="240.0" r="5" fill="#288c50" stroke="#333" stroke-width="0.5"><title>Id 2.1.2, Wert -98.0</title></circle>
<circle cx="831.4" cy="240.0" r="5" fill="#288c50" stroke="#333" stroke-width="0.5"><title>Id 3.1.2, Wert -98.0</title></circle>
<circle cx="1140.0" cy="240.0" r="5" fill="#288c50" stroke="#333" stroke-width="0.5"><title>Id 4.1.2, Wert -98.0</title></circle>
<text x="60.0" y="262.0" text-anchor="middle" font-size="12" font-weight="bold" fill="#c04040">1.1.1</text>
<text x="48" y="64.0" text-anchor="end" font-size="11" fill="#666">Gen 0</text>
<text x="48" y="154.0" text-anchor="end" font-size="11" fill="#666">Gen 1</text>
<text x="48" y="244.0" text-anchor="end" font-size="11" fill="#666">Gen 2</text>
</svg>

After

Width:  |  Height:  |  Size: 4.4 KiB