homemaker-layout/experiments/run_lj3_qjg_ab.sh
Bruno Postle 1e2fa2adfc lj3/qjg: larger-N + weight sweep finds bridge_circulation effect is noise
Combined follow-up to 8sh (DESIGN.md §22): raised bridge_circulation's
_MUTATION_WEIGHTS entry to 2.0 (lj3) and re-ran the qi6/qpk-protocol A/B
at 4x the sample size (qjg) in one sweep, since the two variables were
confounded if tested separately. Result is null in the opposite direction
from 8sh's small-N signal -- no total-fail benefit (p=0.71 programme-house
N=20, p=0.69 harbor-house N=12) and a higher rate of trajectory-divergence
-induced new not-connected fails than at the original uniform weight.
Reverted the weight bump; enable_bridge_circulation stays default off.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GDZjAATDWW1xFfc7xnJqSt
2026-07-25 12:20:22 +01:00

60 lines
2.8 KiB
Bash
Executable file

#!/usr/bin/env bash
# lj3/qjg larger-N confirmation of 8sh's mixed A/B (DESIGN.md §21), combined
# with lj3's weight change in one sweep (weight and sample-size are separate
# variables tested together, not two separate small sweeps -- per lj3's own
# description). By the time this script runs, driver._MUTATION_WEIGHTS
# already carries "bridge_circulation": 2.0 (matching place_missing), so the
# ON arm here is "enabled + weight 2.0" vs the original 8sh A/B's "enabled +
# uniform weight ~1.0".
#
# Same qpk/1ph protocol as the original run_8sh_ab.sh and the 1ph
# programme-house larger-N confirmation (DESIGN.md §20): equal-budget ON vs
# OFF, both arms finished with the standard finish-time --collapse (94g),
# canonical homemaker-fitness re-score for the .fails breakdown. 1ph used
# 4x the original N (5->20) on programme-house alone; this sweep does the
# same for programme-house (5->20) and a matched 4x for harbor-house (3->12).
#
# Usage: experiments/run_lj3_qjg_ab.sh
set -u
cd "$(dirname "$0")/.."
WORKERS=4
OUT=scratch/lj3_qjg_ab; mkdir -p "$OUT"
TSV=scratch/lj3_qjg_ab_results.tsv
[ -f "$TSV" ] || printf 'programme\tseed\tbridge\tbudget\tfails\tnot_connected\tfitness\telapsed_s\n' > "$TSV"
run() { # programme seed bridge(0|1) budget
local prog="$1" seed="$2" bc="$3" budget="$4"
local tag="bc${bc}"
local dom="$OUT/${prog}_${tag}_s${seed}.dom"
local log="$OUT/${prog}_${tag}_s${seed}.log"
local flag="--no-bridge-circulation"; [ "$bc" = 1 ] && flag="--bridge-circulation"
echo ">>> $prog seed=$seed bridge=$bc budget=$budget"
local t0; t0=$(date +%s)
homemaker-evolve "examples/$prog/init.dom" \
--budget "$budget" --workers "$WORKERS" --seed "$seed" \
$flag --output "$dom" > "$log" 2>&1
local t1; t1=$(date +%s)
local fitness fails notconn
fitness=$(sed -n 's/^best *: \([0-9.e+-]*\) .*/\1/p' "$log")
fails=$(sed -n 's/^best *: [0-9.e+-]* (\([0-9]*\) fails).*/\1/p' "$log")
( cd "examples/$prog" && homemaker-fitness "$(realpath "../../$dom")" > /dev/null 2>&1 )
notconn=0
if [ -f "${dom}.fails" ]; then
notconn=$(grep -c 'not connected' "${dom}.fails")
fi
printf '%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n' \
"$prog" "$seed" "$bc" "$budget" "${fails:-ERR}" "$notconn" "${fitness:-ERR}" "$((t1-t0))" >> "$TSV"
echo " -> ${fails:-ERR} fails (${notconn} not-connected), fitness=${fitness:-ERR}, $((t1-t0))s"
}
# programme-house: budget 3000, seeds 1-20 (1ph protocol, 4x the original 8sh N=5)
for seed in $(seq 1 20); do run programme-house "$seed" 0 3000; done
for seed in $(seq 1 20); do run programme-house "$seed" 1 3000; done
# harbor-house: budget 2500, seeds 1-12 (matched 4x the original 8sh N=3)
for seed in $(seq 1 12); do run harbor-house "$seed" 0 2500; done
for seed in $(seq 1 12); do run harbor-house "$seed" 1 2500; done
echo "=== lj3/qjg bridge_circulation larger-N A/B complete ==="
column -t -s $'\t' "$TSV"