diff --git a/tools/push3-evolution/evolve.sh b/tools/push3-evolution/evolve.sh index 43241ba..4851178 100755 --- a/tools/push3-evolution/evolve.sh +++ b/tools/push3-evolution/evolve.sh @@ -143,7 +143,7 @@ k = int(sys.argv[1]) entries = [] with open(sys.argv[2]) as f: for line in f: - parts = line.split() + parts = line.rstrip('\n').split('\t') if len(parts) >= 3: entries.append((int(parts[0]), int(parts[1]), parts[2])) if not entries: @@ -271,8 +271,8 @@ for gen in $(seq 0 $((GENERATIONS - 1))); do printf '{"candidate_id":"%s","fitness":%s,"mutations_applied":%d}\n' \ "$CID" "$SCORE" "$MUTATIONS_APPLIED" >> "$JSONL_FILE" - # Record index, score, and filepath for selection (filepath avoids index→file mapping issues). - printf '%d %s %s\n' "$CAND_COUNT" "$SCORE" "$CAND_FILE" >> "$SCORES_FILE" + # Record index, score, and filepath for selection (tab-delimited so paths with spaces are safe). + printf '%d\t%s\t%s\n' "$CAND_COUNT" "$SCORE" "$CAND_FILE" >> "$SCORES_FILE" SCORE_VALUES="$SCORE_VALUES $SCORE" CAND_COUNT=$((CAND_COUNT + 1)) @@ -293,7 +293,7 @@ import sys entries = [] with open(sys.argv[1]) as f: for line in f: - parts = line.split() + parts = line.rstrip('\n').split('\t') if len(parts) >= 3: entries.append((int(parts[1]), parts[2])) if not entries: @@ -306,7 +306,7 @@ PYEOF GLOBAL_BEST_FITNESS="$MAX" GLOBAL_BEST_GEN="$gen" GLOBAL_BEST_CAND="$BEST_FILE_THIS_GEN" - log " New global best: gen=$gen idx=$BEST_IDX_THIS_GEN fitness=$GLOBAL_BEST_FITNESS" + log " New global best: gen=$gen fitness=$GLOBAL_BEST_FITNESS file=$(basename "$BEST_FILE_THIS_GEN")" fi # Skip next-generation creation after the final generation