diff --git a/tools/push3-evolution/evolve.sh b/tools/push3-evolution/evolve.sh index 89624ff..a8c2392 100755 --- a/tools/push3-evolution/evolve.sh +++ b/tools/push3-evolution/evolve.sh @@ -452,7 +452,8 @@ for gen in $(seq 0 $((GENERATIONS - 1))); do CAND_IDX="${CAND_FILE##*candidate_}" CAND_IDX="${CAND_IDX%.push3}" - CID="gen${gen}_c${CAND_IDX}" + # Canonical candidate_id format: "candidate_XXX" (matches source filename and batch-eval IDs). + CID="candidate_${CAND_IDX}" # Read mutations_applied from sidecar; default 0 if missing. OPS_FILE="${CAND_FILE%.push3}.ops" @@ -761,7 +762,7 @@ for fname in sorted(os.listdir(output_dir)): if not (fname.startswith('generation_') and fname.endswith('.jsonl')): continue try: - int(fname[len('generation_'):-len('.jsonl')]) # validate integer suffix + gen_idx = int(fname[len('generation_'):-len('.jsonl')]) # validate integer suffix except ValueError: continue with open(os.path.join(output_dir, fname)) as f: @@ -772,13 +773,11 @@ for fname in sorted(os.listdir(output_dir)): fitness = int(d.get('fitness', 0)) if fitness < threshold: continue - # cid format: "gen{N}_c{MMM}" - if not cid.startswith('gen') or '_c' not in cid: + # cid format: "candidate_XXX" (gen_idx derived from enclosing filename) + if not cid.startswith('candidate_'): continue - after_gen = cid[3:] # strip "gen" - gen_str, cand_str = after_gen.split('_c', 1) - gen_idx = int(gen_str) - push3_path = os.path.join( + cand_str = cid[len('candidate_'):] # numeric suffix, e.g. "001" + push3_path = os.path.join( work_dir, f'gen_{gen_idx}', f'candidate_{int(cand_str):03d}.push3' )