claude-evolve 1.3.14 → 1.3.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/claude-evolve-analyze +101 -48
- package/bin/claude-evolve-run-parallel +4 -1
- package/lib/csv-lock.sh +9 -1
- package/lib/csv_helper.py +5 -1
- package/package.json +1 -1
|
@@ -295,13 +295,13 @@ if command -v gnuplot >/dev/null 2>&1 && [[ $valid_performance_count -gt 0 ]]; t
|
|
|
295
295
|
# Get color by generation number (rotates through 5 colors)
|
|
296
296
|
get_gen_color() {
|
|
297
297
|
local gen_num="$1"
|
|
298
|
-
local color_index=$((
|
|
298
|
+
local color_index=$(( gen_num % 5 + 1 ))
|
|
299
299
|
case $color_index in
|
|
300
300
|
1) echo "#1f77b4" ;; # blue
|
|
301
301
|
2) echo "#ff7f0e" ;; # orange
|
|
302
302
|
3) echo "#2ca02c" ;; # green
|
|
303
303
|
4) echo "#d62728" ;; # red
|
|
304
|
-
|
|
304
|
+
0) echo "#9467bd" ;; # purple
|
|
305
305
|
esac
|
|
306
306
|
}
|
|
307
307
|
|
|
@@ -314,76 +314,101 @@ if command -v gnuplot >/dev/null 2>&1 && [[ $valid_performance_count -gt 0 ]]; t
|
|
|
314
314
|
max_row=0
|
|
315
315
|
max_id=""
|
|
316
316
|
|
|
317
|
-
# Use Python to generate chart data
|
|
318
|
-
|
|
317
|
+
# Use Python to generate chart data
|
|
318
|
+
"$PYTHON_CMD" -c "
|
|
319
319
|
import csv
|
|
320
320
|
import re
|
|
321
321
|
|
|
322
|
-
row_num = 0
|
|
323
|
-
max_perf = 0
|
|
324
|
-
max_row = 0
|
|
325
|
-
max_id = ''
|
|
326
|
-
|
|
327
322
|
with open('$csv_file', 'r') as f:
|
|
328
323
|
reader = csv.reader(f)
|
|
329
324
|
next(reader) # Skip header
|
|
330
325
|
|
|
331
|
-
|
|
332
|
-
|
|
326
|
+
completed_order = 0 # Track order of completion
|
|
327
|
+
|
|
328
|
+
with open('$data_file', 'w') as data_f:
|
|
329
|
+
data_f.write('# Order ID Performance Generation\\n')
|
|
330
|
+
|
|
331
|
+
with open('$gen_data_temp', 'w') as gen_f:
|
|
332
|
+
pass # Clear file
|
|
333
|
+
|
|
334
|
+
max_perf = 0
|
|
335
|
+
max_id = ''
|
|
336
|
+
max_order = 0
|
|
333
337
|
|
|
334
338
|
for row in reader:
|
|
335
339
|
if len(row) < 5:
|
|
336
340
|
continue
|
|
337
341
|
|
|
338
|
-
row_num += 1
|
|
339
342
|
id, _, desc, perf, status = row[:5]
|
|
340
343
|
|
|
341
344
|
# Extract generation from ID
|
|
342
345
|
gen = 'gen01' # default
|
|
343
|
-
|
|
346
|
+
gen_num = 1
|
|
347
|
+
match = re.match(r'^gen([0-9]+)-', id)
|
|
344
348
|
if match:
|
|
345
|
-
gen = match.group(1)
|
|
349
|
+
gen = f'gen{match.group(1)}'
|
|
350
|
+
gen_num = int(match.group(1))
|
|
346
351
|
|
|
347
352
|
# Only include completed algorithms with non-zero performance
|
|
348
353
|
if perf and perf != '' and status in ['complete', 'completed']:
|
|
349
354
|
try:
|
|
350
355
|
perf_val = float(perf)
|
|
351
356
|
if perf_val > 0:
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
+
completed_order += 1
|
|
358
|
+
|
|
359
|
+
# Write to data file
|
|
360
|
+
with open('$data_file', 'a') as f:
|
|
361
|
+
f.write(f'{completed_order} \"{id}\" {perf} {gen_num}\\n')
|
|
357
362
|
|
|
358
|
-
|
|
359
|
-
|
|
363
|
+
# Write to gen temp file
|
|
364
|
+
with open('$gen_data_temp', 'a') as f:
|
|
365
|
+
f.write(f'{gen} {perf}\\n')
|
|
360
366
|
|
|
361
367
|
# Track the winner
|
|
362
368
|
if perf_val > max_perf:
|
|
363
369
|
max_perf = perf_val
|
|
364
|
-
|
|
370
|
+
max_order = completed_order
|
|
365
371
|
max_id = id
|
|
366
372
|
except ValueError:
|
|
367
373
|
pass
|
|
368
374
|
|
|
369
|
-
# Write data file
|
|
370
|
-
with open('$data_file', 'a') as f:
|
|
371
|
-
for line in data_lines:
|
|
372
|
-
f.write(line + '\\\\n')
|
|
373
|
-
|
|
374
|
-
# Write gen temp file
|
|
375
|
-
with open('$gen_data_temp', 'a') as f:
|
|
376
|
-
for line in gen_temp_lines:
|
|
377
|
-
f.write(line + '\\\\n')
|
|
378
|
-
|
|
379
375
|
# Output max values for shell
|
|
380
376
|
print(f'max_perf={max_perf}')
|
|
381
|
-
print(f'max_row={
|
|
382
|
-
print(f'max_id
|
|
383
|
-
"
|
|
377
|
+
print(f'max_row={max_order}')
|
|
378
|
+
print(f'max_id=\"{max_id}\"')
|
|
379
|
+
"
|
|
384
380
|
|
|
385
|
-
#
|
|
386
|
-
eval "$
|
|
381
|
+
# Capture the output properly
|
|
382
|
+
eval "$("$PYTHON_CMD" -c "
|
|
383
|
+
import csv
|
|
384
|
+
import re
|
|
385
|
+
|
|
386
|
+
with open('$csv_file', 'r') as f:
|
|
387
|
+
reader = csv.reader(f)
|
|
388
|
+
next(reader)
|
|
389
|
+
|
|
390
|
+
max_perf = 0
|
|
391
|
+
max_id = ''
|
|
392
|
+
max_order = 0
|
|
393
|
+
completed_order = 0
|
|
394
|
+
|
|
395
|
+
for row in reader:
|
|
396
|
+
if len(row) >= 5 and row[3] and row[4] in ['complete', 'completed']:
|
|
397
|
+
try:
|
|
398
|
+
perf_val = float(row[3])
|
|
399
|
+
if perf_val > 0:
|
|
400
|
+
completed_order += 1
|
|
401
|
+
if perf_val > max_perf:
|
|
402
|
+
max_perf = perf_val
|
|
403
|
+
max_order = completed_order
|
|
404
|
+
max_id = row[0]
|
|
405
|
+
except ValueError:
|
|
406
|
+
pass
|
|
407
|
+
|
|
408
|
+
print(f'max_perf={max_perf}')
|
|
409
|
+
print(f'max_row={max_order}')
|
|
410
|
+
print(f'max_id=\"{max_id}\"')
|
|
411
|
+
")"
|
|
387
412
|
|
|
388
413
|
# Create generation averages file and track max generation
|
|
389
414
|
gen_index=1
|
|
@@ -397,7 +422,7 @@ print(f'max_id=\\\"{max_id}\\\"')
|
|
|
397
422
|
avg=$(echo "scale=4; $sum / $count" | bc -l 2>/dev/null || echo "0")
|
|
398
423
|
gen_num=$(echo "$gen" | sed 's/gen0*//')
|
|
399
424
|
# Track max generation number
|
|
400
|
-
if [[ $gen_num -gt $max_gen_num ]]; then
|
|
425
|
+
if [[ $gen_num =~ ^[0-9]+$ ]] && [[ $gen_num -gt $max_gen_num ]]; then
|
|
401
426
|
max_gen_num=$gen_num
|
|
402
427
|
fi
|
|
403
428
|
color=$(get_gen_color "$gen_num")
|
|
@@ -417,18 +442,45 @@ print(f'max_id=\\\"{max_id}\\\"')
|
|
|
417
442
|
|
|
418
443
|
# Generate dual plot
|
|
419
444
|
if [[ -s "$data_file" ]]; then
|
|
420
|
-
#
|
|
445
|
+
# Debug: show data file content
|
|
446
|
+
# echo "DEBUG: Data file content:"
|
|
447
|
+
# cat "$data_file"
|
|
448
|
+
# echo "DEBUG: max_gen_num=$max_gen_num"
|
|
449
|
+
|
|
450
|
+
# Plot all algorithms in order of completion, colored by generation
|
|
421
451
|
plot_cmd=""
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
452
|
+
gen_plots_added=0
|
|
453
|
+
|
|
454
|
+
# Find all generations that have data
|
|
455
|
+
generations=($(awk '{if(NR>1) print $4}' "$data_file" | sort -n | uniq))
|
|
456
|
+
|
|
457
|
+
for gen_num in "${generations[@]}"; do
|
|
458
|
+
if [[ -n $gen_num ]]; then
|
|
459
|
+
color=$(get_gen_color "$gen_num")
|
|
460
|
+
if [[ $gen_plots_added -gt 0 ]]; then
|
|
461
|
+
plot_cmd="$plot_cmd, \\"$'\n'
|
|
462
|
+
fi
|
|
463
|
+
plot_cmd="${plot_cmd} \"$data_file\" using (\$4==$gen_num?\$1:1/0):3 with linespoints linewidth 2 linecolor rgb \"$color\" pointsize 1.2 title \"Gen $gen_num\""
|
|
464
|
+
((gen_plots_added++))
|
|
426
465
|
fi
|
|
427
|
-
plot_cmd="${plot_cmd} \"$data_file\" using (\$4==$i?\$1:1/0):3 with linespoints linewidth 2 linecolor rgb \"$color\" pointsize 0.8 title \"Gen $i\""
|
|
428
466
|
done
|
|
467
|
+
|
|
429
468
|
# Add winner point
|
|
430
|
-
|
|
431
|
-
|
|
469
|
+
if [[ -n $max_id && -s "$winner_file" ]]; then
|
|
470
|
+
if [[ $gen_plots_added -gt 0 ]]; then
|
|
471
|
+
plot_cmd="$plot_cmd, \\"$'\n'
|
|
472
|
+
fi
|
|
473
|
+
plot_cmd="${plot_cmd} \"$winner_file\" using 1:3 with points pointtype 7 pointsize 3 linecolor rgb \"gold\" title \"Best ($max_id)\""
|
|
474
|
+
fi
|
|
475
|
+
|
|
476
|
+
# Fallback if no generation-specific plots
|
|
477
|
+
if [[ $gen_plots_added -eq 0 ]]; then
|
|
478
|
+
plot_cmd="\"$data_file\" using 1:3 with linespoints linewidth 2 linecolor rgb \"#1f77b4\" pointsize 1.2 title \"Evolution Progress\""
|
|
479
|
+
if [[ -n $max_id && -s "$winner_file" ]]; then
|
|
480
|
+
plot_cmd="$plot_cmd, \\"$'\n'
|
|
481
|
+
plot_cmd="${plot_cmd} \"$winner_file\" using 1:3 with points pointtype 7 pointsize 3 linecolor rgb \"gold\" title \"Best ($max_id)\""
|
|
482
|
+
fi
|
|
483
|
+
fi
|
|
432
484
|
|
|
433
485
|
# Build x-axis labels for generation chart
|
|
434
486
|
xtics_labels=""
|
|
@@ -448,11 +500,12 @@ set multiplot layout 2,1 margins 0.08,0.82,0.15,0.95 spacing 0.1,0.15
|
|
|
448
500
|
|
|
449
501
|
#=================== TOP PLOT: Performance Over Time ===================
|
|
450
502
|
set title "Algorithm Evolution Performance Over Time" font ",14"
|
|
451
|
-
set xlabel "
|
|
503
|
+
set xlabel "Completion Order (Algorithm #)"
|
|
452
504
|
set ylabel "Performance Score"
|
|
453
505
|
set grid
|
|
454
506
|
set key outside right
|
|
455
|
-
set xtics
|
|
507
|
+
set xtics 1
|
|
508
|
+
set autoscale y
|
|
456
509
|
|
|
457
510
|
# Define colors for generations
|
|
458
511
|
plot $plot_cmd
|
|
@@ -71,7 +71,10 @@ reader = csv.reader(sys.stdin)
|
|
|
71
71
|
next(reader) # Skip header
|
|
72
72
|
count = 0
|
|
73
73
|
for row in reader:
|
|
74
|
-
|
|
74
|
+
# If row has fewer than 5 fields, treat as pending
|
|
75
|
+
if len(row) < 5:
|
|
76
|
+
count += 1
|
|
77
|
+
elif len(row) >= 5 and (row[4] == 'pending' or row[4] == ''):
|
|
75
78
|
count += 1
|
|
76
79
|
print(count)
|
|
77
80
|
"
|
package/lib/csv-lock.sh
CHANGED
|
@@ -162,7 +162,15 @@ with open('$csv_file', 'r') as f:
|
|
|
162
162
|
# Find first pending candidate
|
|
163
163
|
candidate_id = None
|
|
164
164
|
for i in range(1, len(rows)):
|
|
165
|
-
|
|
165
|
+
# If row has fewer than 5 fields, it's pending
|
|
166
|
+
if len(rows[i]) < 5:
|
|
167
|
+
candidate_id = rows[i][0]
|
|
168
|
+
# Ensure row has 5 fields before setting status
|
|
169
|
+
while len(rows[i]) < 5:
|
|
170
|
+
rows[i].append('')
|
|
171
|
+
rows[i][4] = 'running' # Update status
|
|
172
|
+
break
|
|
173
|
+
elif len(rows[i]) >= 5 and (rows[i][4] == 'pending' or rows[i][4] == ''):
|
|
166
174
|
candidate_id = rows[i][0]
|
|
167
175
|
rows[i][4] = 'running' # Update status
|
|
168
176
|
break
|
package/lib/csv_helper.py
CHANGED
|
@@ -12,7 +12,11 @@ def find_pending_row(csv_path):
|
|
|
12
12
|
reader = csv.reader(f)
|
|
13
13
|
next(reader) # Skip header
|
|
14
14
|
for row_num, row in enumerate(reader, start=2):
|
|
15
|
-
#
|
|
15
|
+
# If row has fewer than 5 fields, it's pending
|
|
16
|
+
if len(row) < 5:
|
|
17
|
+
return row_num
|
|
18
|
+
|
|
19
|
+
# Ensure row has at least 5 fields for status check
|
|
16
20
|
while len(row) < 5:
|
|
17
21
|
row.append('')
|
|
18
22
|
|