claude-evolve 1.3.13 → 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 +102 -45
- 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
|
|
|
@@ -319,70 +319,96 @@ if command -v gnuplot >/dev/null 2>&1 && [[ $valid_performance_count -gt 0 ]]; t
|
|
|
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
|
-
#
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
375
|
+
# Output max values for shell
|
|
376
|
+
print(f'max_perf={max_perf}')
|
|
377
|
+
print(f'max_row={max_order}')
|
|
378
|
+
print(f'max_id=\"{max_id}\"')
|
|
379
|
+
"
|
|
380
|
+
|
|
381
|
+
# Capture the output properly
|
|
382
|
+
eval "$("$PYTHON_CMD" -c "
|
|
383
|
+
import csv
|
|
384
|
+
import re
|
|
373
385
|
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
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
|
|
378
407
|
|
|
379
|
-
# Output max values for shell
|
|
380
408
|
print(f'max_perf={max_perf}')
|
|
381
|
-
print(f'max_row={
|
|
409
|
+
print(f'max_row={max_order}')
|
|
382
410
|
print(f'max_id=\"{max_id}\"')
|
|
383
|
-
"
|
|
384
|
-
eval "$line"
|
|
385
|
-
done
|
|
411
|
+
")"
|
|
386
412
|
|
|
387
413
|
# Create generation averages file and track max generation
|
|
388
414
|
gen_index=1
|
|
@@ -396,7 +422,7 @@ print(f'max_id=\"{max_id}\"')
|
|
|
396
422
|
avg=$(echo "scale=4; $sum / $count" | bc -l 2>/dev/null || echo "0")
|
|
397
423
|
gen_num=$(echo "$gen" | sed 's/gen0*//')
|
|
398
424
|
# Track max generation number
|
|
399
|
-
if [[ $gen_num -gt $max_gen_num ]]; then
|
|
425
|
+
if [[ $gen_num =~ ^[0-9]+$ ]] && [[ $gen_num -gt $max_gen_num ]]; then
|
|
400
426
|
max_gen_num=$gen_num
|
|
401
427
|
fi
|
|
402
428
|
color=$(get_gen_color "$gen_num")
|
|
@@ -407,24 +433,54 @@ print(f'max_id=\"{max_id}\"')
|
|
|
407
433
|
done
|
|
408
434
|
|
|
409
435
|
# Create winner data point
|
|
410
|
-
if [[ -n $max_id ]]; then
|
|
436
|
+
if [[ -n $max_id && -n $max_row && -n $max_perf ]]; then
|
|
411
437
|
echo "$max_row \"$max_id\" $max_perf" >"$winner_file"
|
|
438
|
+
else
|
|
439
|
+
# Create empty winner file to avoid gnuplot warning
|
|
440
|
+
echo "0 \"\" 0" >"$winner_file"
|
|
412
441
|
fi
|
|
413
442
|
|
|
414
443
|
# Generate dual plot
|
|
415
444
|
if [[ -s "$data_file" ]]; then
|
|
416
|
-
#
|
|
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
|
|
417
451
|
plot_cmd=""
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
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++))
|
|
422
465
|
fi
|
|
423
|
-
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\""
|
|
424
466
|
done
|
|
467
|
+
|
|
425
468
|
# Add winner point
|
|
426
|
-
|
|
427
|
-
|
|
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
|
|
428
484
|
|
|
429
485
|
# Build x-axis labels for generation chart
|
|
430
486
|
xtics_labels=""
|
|
@@ -444,11 +500,12 @@ set multiplot layout 2,1 margins 0.08,0.82,0.15,0.95 spacing 0.1,0.15
|
|
|
444
500
|
|
|
445
501
|
#=================== TOP PLOT: Performance Over Time ===================
|
|
446
502
|
set title "Algorithm Evolution Performance Over Time" font ",14"
|
|
447
|
-
set xlabel "
|
|
503
|
+
set xlabel "Completion Order (Algorithm #)"
|
|
448
504
|
set ylabel "Performance Score"
|
|
449
505
|
set grid
|
|
450
506
|
set key outside right
|
|
451
|
-
set xtics
|
|
507
|
+
set xtics 1
|
|
508
|
+
set autoscale y
|
|
452
509
|
|
|
453
510
|
# Define colors for generations
|
|
454
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
|
|