fix: address review findings in evolve.sh (#546)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
2ee7feb621
commit
0496c94681
1 changed files with 5 additions and 5 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue