homemaker-layout/experiments/run_c3g_ab.sh
Bruno Postle e9684ea7ef c3g: circ-per-room granularity knob (circ_divisor) + A/B harness
Threads circ_divisor (default 3 = unchanged) through
operators.constructive_topology/lift_base_to_storeys and
driver.search/search_staged; env CIRCDIV in run_staged_search.py. Adds
experiments/run_c3g_ab.sh.

Motivation (DESIGN.md §12.3 diagnostic): the maple shape residual is
over-granular construction (73 small leaves -> crinkliness+size). Cheap raw-seed
probe: a coarser spine lowers the SHAPE floor (maple 135->110, harbor 83->66)
but raises access/adjacency, leaving the raw TOTAL floor flat-to-worse. Because
§12.3 showed shape is the HARD residual and access/adjacency are cheap to
repair, only an end-to-end A/B settles whether trading them pays — this is the
plumbing for that run. Tests green (default path byte-identical).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 21:10:18 +01:00

39 lines
1.8 KiB
Bash
Executable file

#!/usr/bin/env bash
# c3g granularity A/B (DESIGN.md §12.3 follow-up): does a coarser circulation
# spine (fewer, larger leaves -> lower shape floor) pay end-to-end, given that
# §12.3 showed shape fails are the HARD residual and access/adjacency are cheap
# to repair? Trade hard-shape for easy-access at the seed and measure.
#
# Reuses the §12.3 div=3 baseline (maple 126/148/134, harbor 72/81/69); runs
# div=6 and div=8 arms + a div=3 seed-0 control to confirm reproduction.
set -u
cd "$(dirname "$0")/.."
BUDGET="${1:-20000}"
OUT=scratch/c3g_ab; mkdir -p "$OUT"
TSV=scratch/c3g_results.tsv
[ -f "$TSV" ] || printf 'programme\tseed\tcircdiv\tfails\ttopologies\telapsed_s\n' > "$TSV"
run() { # programme seed div
local prog="$1" seed="$2" div="$3"
local log="$OUT/${prog}_div${div}_s${seed}.log"
echo ">>> $prog seed=$seed circdiv=$div"
local t0; t0=$(date +%s)
env URB_NO_OCCLUSION=1 CIRCDIV="$div" \
python3 experiments/run_staged_search.py "examples/$prog" "$BUDGET" "$seed" \
"examples/$prog/init.dom" "$OUT/${prog}_div${div}_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\n' "$prog" "$seed" "$div" "${fails:-ERR}" "${topos:-?}" "$((t1-t0))" >> "$TSV"
echo " -> ${fails:-ERR} fails, ${topos:-?} topologies, $((t1-t0))s"
}
# control (reproduce §12.3 div=3) then the reduced-granularity arms
run maple-court 0 3
for seed in 0 1 2; do run maple-court "$seed" 6; run maple-court "$seed" 8; done
run harbor-house 0 3
for seed in 0 1 2; do run harbor-house "$seed" 6; done
echo "=== c3g sweep complete ==="
column -t -s $'\t' "$TSV"