Replace the area-derived share recovery with explicit, type-guarded per-leaf multiplicity: construction stamps leaf.share=k and leaf.share_type=code; the fitness (graph.leaf_share) honours k only while leaf.type==share_type, so any retype/undivide auto-invalidates a stale share — no operator resets, and a small leaf cannot retype its way into covering rooms it does not provide. Two Node fields survive the whole search via deepcopy (genome.decode is unused in the hot path); .dom emits `share` only on a live shared leaf. This closes the §13.3 missing-fail leak: floor probe missing 17–44 → 0, and the achievable floor drops −39% harbor (120.3→73.3) / −32% maple (194.7→133.0) with no re-emergence as size fails. Flag threaded through driver.search/search_staged → constructive_topology / lift_base_to_storeys, exposed via LEAFSHARE/LEAFSHAREFAC in run_staged_search.py (injects the objective into inner-loop + final-score fitness so both A/B arms share one programme dir). run_leafshare_ab.sh runs the staged 20k A/B. Smoke-tested end-to-end (harbor, factor 3, re-score OK). 214 tests pass; default-OFF reproduces baseline. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
43 lines
2.1 KiB
Bash
Executable file
43 lines
2.1 KiB
Bash
Executable file
#!/usr/bin/env bash
|
||
# Leaf-sharing A/B (erc.3, DESIGN.md §13.3): does collapsing same-code rooms into
|
||
# fewer, larger SHARED leaves lower the end-to-end fail count, given the floor
|
||
# probe showed −32…−39 % on the achievable seed floor with zero missing-fail leak
|
||
# (explicit, type-guarded per-leaf multiplicity)?
|
||
#
|
||
# Baseline arm (LEAFSHARE=0) must reproduce the §12.2 figures (maple 136.0,
|
||
# harbor 74.0); the share arm (LEAFSHARE=1, factor 3) is the experiment. One
|
||
# programme dir per programme — run_staged_search.py injects the leaf_sharing
|
||
# objective into the whole pipeline so both arms share patterns.config.
|
||
set -u
|
||
cd "$(dirname "$0")/.."
|
||
BUDGET="${1:-20000}"
|
||
FAC="${2:-3}"
|
||
OUT=scratch/leafshare_ab; mkdir -p "$OUT"
|
||
TSV=scratch/leafshare_results.tsv
|
||
[ -f "$TSV" ] || printf 'programme\tseed\tshare\tfactor\tfails\ttopologies\telapsed_s\n' > "$TSV"
|
||
|
||
run() { # programme seed share(0|1)
|
||
local prog="$1" seed="$2" share="$3"
|
||
local tag="ls${share}"; [ "$share" = 1 ] && tag="ls1f${FAC}"
|
||
local log="$OUT/${prog}_${tag}_s${seed}.log"
|
||
echo ">>> $prog seed=$seed leafshare=$share factor=$FAC"
|
||
local t0; t0=$(date +%s)
|
||
env URB_NO_OCCLUSION=1 LEAFSHARE="$share" LEAFSHAREFAC="$FAC" \
|
||
python3 experiments/run_staged_search.py "examples/$prog" "$BUDGET" "$seed" \
|
||
"examples/$prog/init.dom" "$OUT/${prog}_${tag}_s${seed}.dom" > "$log" 2>&1
|
||
local t1; t1=$(date +%s)
|
||
local fails topos
|
||
fails=$(grep 're-scored (native)' "$log" | tail -1 | sed -n 's/.*(\([0-9]*\) fails).*/\1/p')
|
||
topos=$(grep -m1 '^evals' "$log" | sed -n 's/.*across \([0-9]*\) topologies.*/\1/p')
|
||
printf '%s\t%s\t%s\t%s\t%s\t%s\t%s\n' "$prog" "$seed" "$share" "$FAC" "${fails:-ERR}" "${topos:-?}" "$((t1-t0))" >> "$TSV"
|
||
echo " -> ${fails:-ERR} fails, ${topos:-?} topologies, $((t1-t0))s"
|
||
}
|
||
|
||
# baseline controls (reproduce §12.2) then the leaf-sharing arm, both seeds 0/1/2
|
||
for prog in maple-court harbor-house; do
|
||
for seed in 0 1 2; do run "$prog" "$seed" 0; done
|
||
for seed in 0 1 2; do run "$prog" "$seed" 1; done
|
||
done
|
||
|
||
echo "=== leaf-sharing A/B complete ==="
|
||
column -t -s $'\t' "$TSV"
|