claude-evolve 1.3.39 → 1.3.41
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/README.md +80 -317
- package/bin/claude-evolve-analyze +34 -5
- package/bin/claude-evolve-cleanup +297 -0
- package/bin/claude-evolve-edit +293 -0
- package/bin/claude-evolve-ideate +6 -6
- package/bin/claude-evolve-main +51 -29
- package/bin/{claude-evolve-run-unified → claude-evolve-run} +135 -4
- package/bin/claude-evolve-status +220 -0
- package/bin/claude-evolve-worker +76 -13
- package/lib/config.sh +5 -3
- package/lib/csv-lock.sh +26 -4
- package/lib/csv_helper.py +1 -1
- package/package.json +1 -1
- package/templates/config.yaml +8 -7
- package/bin/claude-evolve-run-parallel.OLD +0 -389
- package/bin/claude-evolve-run.OLD +0 -662
package/README.md
CHANGED
|
@@ -1,365 +1,128 @@
|
|
|
1
1
|
# claude-evolve
|
|
2
2
|
|
|
3
|
-
Automated algorithm evolution
|
|
3
|
+
Automated algorithm evolution using AI. Start with a base algorithm, let Claude evolve better variants autonomously.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Install & Quick Start
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-

|
|
12
|
-
|
|
13
|
-
### How the Evolution System Works
|
|
7
|
+
```bash
|
|
8
|
+
# Install
|
|
9
|
+
npm install -g claude-evolve
|
|
14
10
|
|
|
15
|
-
|
|
11
|
+
# Set up project
|
|
12
|
+
claude-evolve setup
|
|
16
13
|
|
|
17
|
-
|
|
18
|
-
-
|
|
19
|
-
- 📊 **Evaluation Phase**: Tests performance against your custom evaluator
|
|
20
|
-
- 📈 **Analysis Phase**: Tracks evolution progress and identifies top performers
|
|
14
|
+
# Generate initial ideas
|
|
15
|
+
claude-evolve ideate
|
|
21
16
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
Ideate → Mutate → Evaluate → (Auto-Generate New Ideas) → Repeat Forever
|
|
17
|
+
# Start evolution (runs forever until Ctrl+C)
|
|
18
|
+
claude-evolve run
|
|
25
19
|
```
|
|
26
20
|
|
|
27
|
-
|
|
21
|
+
## How It Works
|
|
28
22
|
|
|
29
|
-
|
|
23
|
+
1. **Write your problem** in `evolution/BRIEF.md`
|
|
24
|
+
2. **Create base algorithm** in `evolution/algorithm.py`
|
|
25
|
+
3. **Define evaluation** in `evolution/evaluator.py`
|
|
26
|
+
4. **Generate ideas** - Claude creates algorithm variations
|
|
27
|
+
5. **Evolve automatically** - System tests variations, keeps best ones, generates new ideas
|
|
30
28
|
|
|
31
|
-
|
|
32
|
-
npm install -g claude-evolve
|
|
33
|
-
```
|
|
29
|
+
Evolution runs indefinitely until you stop it. Perfect for overnight optimization.
|
|
34
30
|
|
|
35
|
-
##
|
|
31
|
+
## Commands
|
|
36
32
|
|
|
37
33
|
```bash
|
|
38
|
-
claude-evolve
|
|
34
|
+
claude-evolve # Interactive menu
|
|
35
|
+
claude-evolve setup # Initialize workspace
|
|
36
|
+
claude-evolve ideate # Generate new algorithm ideas
|
|
37
|
+
claude-evolve run # Start evolution loop (runs forever)
|
|
38
|
+
claude-evolve analyze # View results and progress
|
|
39
|
+
claude-evolve status # Quick progress overview
|
|
40
|
+
claude-evolve edit # Manage candidate statuses
|
|
39
41
|
```
|
|
40
42
|
|
|
41
|
-
|
|
43
|
+
## Working with Multiple Projects
|
|
42
44
|
|
|
43
|
-
1. **Create evolution workspace** - Initialize the directory structure
|
|
44
|
-
2. **Write evolution/BRIEF.md** - Describe your optimization problem
|
|
45
|
-
3. **Customize evolution/evaluator.py** - Define how to measure algorithm performance
|
|
46
|
-
4. **Generate ideas** - Create initial algorithm candidates
|
|
47
|
-
5. **Start evolution** - Begin the automated evolution process
|
|
48
|
-
|
|
49
|
-
## Commands
|
|
50
|
-
|
|
51
|
-
### Main wrapper command
|
|
52
45
|
```bash
|
|
53
|
-
|
|
54
|
-
claude-evolve
|
|
55
|
-
claude-evolve ideate
|
|
56
|
-
claude-evolve run # Execute evolution candidates
|
|
57
|
-
claude-evolve analyze # Analyze evolution results
|
|
58
|
-
claude-evolve config # Manage configuration settings
|
|
46
|
+
# Use different working directory
|
|
47
|
+
claude-evolve --working-dir=my-project run
|
|
48
|
+
claude-evolve --working-dir=experiments/trading ideate
|
|
59
49
|
```
|
|
60
50
|
|
|
61
|
-
### Individual commands (if you know what you're doing)
|
|
62
|
-
|
|
63
|
-
#### claude-evolve-setup
|
|
64
|
-
Initializes your evolution workspace with:
|
|
65
|
-
- Directory structure
|
|
66
|
-
- Template files (BRIEF.md, algorithm.py, evaluator.py, config.yaml)
|
|
67
|
-
- CSV file for tracking evolution progress
|
|
68
|
-
|
|
69
|
-
#### claude-evolve-ideate
|
|
70
|
-
Generates new algorithm variation ideas using multi-strategy evolutionary approach:
|
|
71
|
-
- **Novel exploration** - Pure creativity for global search
|
|
72
|
-
- **Hill climbing** - Parameter tuning of top performers
|
|
73
|
-
- **Structural mutation** - Algorithmic changes to successful designs
|
|
74
|
-
- **Crossover hybrid** - Combines successful approaches
|
|
75
|
-
- Uses Claude Opus in megathinking mode for each strategy
|
|
76
|
-
- Configurable strategy distribution (default: 3+5+3+4 = 15 ideas)
|
|
77
|
-
|
|
78
|
-
#### claude-evolve-run
|
|
79
|
-
Executes evolution candidates in an **infinite loop**:
|
|
80
|
-
- Picks the next untested idea from your CSV
|
|
81
|
-
- Uses Claude to implement the mutation
|
|
82
|
-
- Runs your evaluator to measure performance
|
|
83
|
-
- Records results and updates the evolution log
|
|
84
|
-
- **When no candidates remain**: Automatically generates new ideas and continues
|
|
85
|
-
- **Runs forever until manually stopped** (Ctrl+C)
|
|
86
|
-
|
|
87
|
-
#### claude-evolve-analyze
|
|
88
|
-
Analyzes evolution progress and generates insights:
|
|
89
|
-
- Performance trends over time
|
|
90
|
-
- Best-performing algorithm variants
|
|
91
|
-
- Suggestions for future evolution directions
|
|
92
|
-
|
|
93
|
-
#### claude-evolve-config
|
|
94
|
-
Manages configuration settings:
|
|
95
|
-
- View current configuration
|
|
96
|
-
- Edit paths and behavior settings
|
|
97
|
-
- Reset to defaults
|
|
98
|
-
|
|
99
|
-
## How it Works
|
|
100
|
-
|
|
101
|
-
1. **Set up evolution workspace** - Define your optimization problem
|
|
102
|
-
2. **Create base algorithm** - Start with `evolution/algorithm.py`
|
|
103
|
-
3. **Define evaluation criteria** - Customize `evolution/evaluator.py`
|
|
104
|
-
4. **Generate initial ideas** - Run `claude-evolve ideate` to create variations
|
|
105
|
-
5. **Start evolution loop** - The system automatically:
|
|
106
|
-
- Picks the next candidate from your CSV
|
|
107
|
-
- Implements the mutation
|
|
108
|
-
- Evaluates performance
|
|
109
|
-
- Records results
|
|
110
|
-
- **Generates new ideas when candidates are exhausted**
|
|
111
|
-
- **Repeats forever until manually stopped**
|
|
112
|
-
|
|
113
|
-
## Monitoring Progress (Like Genetic Algorithms)
|
|
114
|
-
|
|
115
|
-
This isn't sci-fi level "sleep through the entire evolution" automation - it's more like controlled genetic algorithms. The system handles most mutations, but you should monitor it and guide the evolution when needed.
|
|
116
|
-
|
|
117
|
-
**Recommended monitoring approach:**
|
|
118
|
-
- **Check evolution.csv** - Track performance of all variants
|
|
119
|
-
- **Review top performers** - Look at the best algorithms generated so far
|
|
120
|
-
- **Monitor for convergence** - Watch for diminishing returns or local optima
|
|
121
|
-
- **Inject new ideas** - Add manual variations when evolution stagnates
|
|
122
|
-
|
|
123
|
-
**When you need to guide evolution:**
|
|
124
|
-
- **Add targeted ideas** - Use `claude-evolve ideate` with specific directions
|
|
125
|
-
- **Modify the evaluator** - Update `evolution/evaluator.py` to change selection pressure
|
|
126
|
-
- **Restart from best** - Copy top performer to `algorithm.py` and continue evolving
|
|
127
|
-
- **The system adapts** - New ideas will build on your guidance
|
|
128
|
-
|
|
129
|
-
**Infinite evolution with manual control:**
|
|
130
|
-
- **Runs forever** - automatically generates new generations of ideas
|
|
131
|
-
- **Hit Ctrl+C anytime** to stop the evolution process
|
|
132
|
-
- **Restart later** with `claude-evolve run` to continue from where you left off
|
|
133
|
-
- **Perfect for long-term optimization** - run overnight, over weekends, or while working on other projects
|
|
134
|
-
|
|
135
|
-
## Handling Failures and Recovery
|
|
136
|
-
|
|
137
|
-
Evolution experiments can fail for various reasons. The system tracks these failures and provides recovery options.
|
|
138
|
-
|
|
139
|
-
**Common failure types:**
|
|
140
|
-
- **Infrastructure failures** - Missing dependencies (e.g., xgboost not installed)
|
|
141
|
-
- **Code generation bugs** - Claude occasionally generates syntactically incorrect code
|
|
142
|
-
- **Evaluation errors** - Evaluator crashes or returns invalid output
|
|
143
|
-
- **Performance score 0** - Algorithm runs but produces no meaningful results (now marked as "failed")
|
|
144
|
-
|
|
145
|
-
**Failure tracking in evolution.csv:**
|
|
146
|
-
- `failed` - Evaluation error or performance score of 0
|
|
147
|
-
- `timeout` - Evaluation exceeded time limit
|
|
148
|
-
- `interrupted` - User interrupted with Ctrl+C
|
|
149
|
-
- Check the `status` column to identify failed candidates
|
|
150
|
-
|
|
151
|
-
**Manual recovery strategies:**
|
|
152
|
-
1. **Force retry of failed candidates:**
|
|
153
|
-
- Edit `evolution.csv` and change status from "failed" to "pending"
|
|
154
|
-
- Clear the performance value for that row
|
|
155
|
-
- Run `claude-evolve run` to retry the candidate
|
|
156
|
-
|
|
157
|
-
2. **Fix infrastructure issues:**
|
|
158
|
-
- Install missing dependencies: `pip install xgboost numpy scipy`
|
|
159
|
-
- Update Python environment if needed
|
|
160
|
-
- Check that evaluator.py has proper error handling
|
|
161
|
-
|
|
162
|
-
3. **Guide around persistent failures:**
|
|
163
|
-
- If a specific approach keeps failing, add constraints to BRIEF.md
|
|
164
|
-
- Use `claude-evolve ideate` with explicit directions to avoid problematic patterns
|
|
165
|
-
- Consider updating evaluator.py to catch and handle specific error types
|
|
166
|
-
|
|
167
|
-
**Future auto-recovery (planned):**
|
|
168
|
-
- Automatic retry with different prompts for code generation failures
|
|
169
|
-
- Dependency detection and installation suggestions
|
|
170
|
-
- Smart failure pattern recognition to avoid similar mutations
|
|
171
|
-
|
|
172
|
-
## Requirements
|
|
173
|
-
|
|
174
|
-
### Required
|
|
175
|
-
- Node.js >= 14.0.0
|
|
176
|
-
- Python 3.x (for algorithm execution)
|
|
177
|
-
- Automatically detected on all platforms
|
|
178
|
-
- Windows: Uses `python` if it's Python 3
|
|
179
|
-
- macOS/Linux: Prefers `python3`
|
|
180
|
-
- Can override in config.yaml: `python_cmd: "C:\\Python39\\python.exe"`
|
|
181
|
-
- Bash shell (Git Bash on Windows, native on macOS/Linux)
|
|
182
|
-
- [Claude CLI](https://docs.anthropic.com/en/docs/claude-code) (`claude` command)
|
|
183
|
-
|
|
184
|
-
### Optional (but recommended)
|
|
185
|
-
- [Codex CLI](https://github.com/aboutgaurav/codex) (`codex` command) - Uses o3-pro model for superior ideation when available
|
|
186
|
-
- Scientific Python libraries (numpy, scipy, etc.) depending on your algorithms
|
|
187
|
-
- Plotting libraries (matplotlib, plotly) for analyzing results
|
|
188
|
-
|
|
189
51
|
## Project Structure
|
|
190
52
|
|
|
191
|
-
Your evolution workspace will have:
|
|
192
53
|
```
|
|
193
54
|
your-project/
|
|
194
55
|
├── evolution/
|
|
195
|
-
│ ├── BRIEF.md # Problem description
|
|
196
|
-
│ ├── algorithm.py # Base algorithm
|
|
197
|
-
│ ├── evaluator.py # Performance
|
|
198
|
-
│ ├── config.yaml #
|
|
199
|
-
│ ├── evolution.csv #
|
|
200
|
-
│
|
|
201
|
-
│ ├── evolution_id2.py
|
|
202
|
-
│ └── ...
|
|
203
|
-
└── (your main project files)
|
|
56
|
+
│ ├── BRIEF.md # Problem description
|
|
57
|
+
│ ├── algorithm.py # Base algorithm
|
|
58
|
+
│ ├── evaluator.py # Performance measurement
|
|
59
|
+
│ ├── config.yaml # Settings
|
|
60
|
+
│ ├── evolution.csv # Progress tracking
|
|
61
|
+
│ └── evolution_*.py # Generated variants
|
|
204
62
|
```
|
|
205
63
|
|
|
206
|
-
## Evaluator
|
|
207
|
-
|
|
208
|
-
Your evaluator must output a performance score to stdout. The system looks for either `performance` or `score` fields. Four formats are supported:
|
|
209
|
-
|
|
210
|
-
### 1. Plain Number (Simplest)
|
|
211
|
-
Just output a single floating-point number:
|
|
212
|
-
```
|
|
213
|
-
1.077506371224117
|
|
214
|
-
```
|
|
64
|
+
## Evaluator Requirements
|
|
215
65
|
|
|
216
|
-
|
|
217
|
-
```json
|
|
218
|
-
{"score": 0.95}
|
|
219
|
-
```
|
|
66
|
+
Your `evaluator.py` must output a performance score to stdout:
|
|
220
67
|
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
```
|
|
68
|
+
```python
|
|
69
|
+
# Simple: just print a number
|
|
70
|
+
print(1.234)
|
|
225
71
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
```json
|
|
229
|
-
{
|
|
230
|
-
"performance": 0.95,
|
|
231
|
-
"fitness": 0.82,
|
|
232
|
-
"sharpe_ratio": 1.23,
|
|
233
|
-
"max_drawdown": -0.15,
|
|
234
|
-
"total_return": 0.42,
|
|
235
|
-
"win_rate": 0.65
|
|
236
|
-
}
|
|
72
|
+
# Advanced: JSON with metrics
|
|
73
|
+
print('{"performance": 1.234, "accuracy": 0.95}')
|
|
237
74
|
```
|
|
238
75
|
|
|
239
|
-
|
|
240
|
-
- The system accepts either `performance` or `score` (they are treated the same)
|
|
241
|
-
- Higher scores indicate better performance
|
|
242
|
-
- A score of 0 indicates complete failure and marks the candidate as "failed"
|
|
243
|
-
- Non-zero exit codes indicate evaluation errors
|
|
244
|
-
- Any additional output (warnings, logs) should go to stderr, not stdout
|
|
245
|
-
- Additional JSON fields will be automatically added as new CSV columns
|
|
246
|
-
- New columns are added after the standard columns (id, basedOnId, description, performance, status)
|
|
247
|
-
- Common additional fields include: fitness, sharpe, sortino, total_return, yearly_return, max_drawdown, volatility, total_trades, win_rate, profit_factor, final_value
|
|
248
|
-
|
|
249
|
-
## Environment Variables for Evaluators
|
|
76
|
+
Higher scores = better performance. Score of 0 = failure.
|
|
250
77
|
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
- Save experiment-specific output files
|
|
254
|
-
- Log metrics with experiment identifiers
|
|
255
|
-
- Implement experiment-aware logic
|
|
256
|
-
- Track which algorithm variant is being evaluated
|
|
257
|
-
|
|
258
|
-
Example usage in evaluator.py:
|
|
259
|
-
```python
|
|
260
|
-
import os
|
|
78
|
+
## Configuration
|
|
261
79
|
|
|
262
|
-
|
|
263
|
-
experiment_id = os.environ.get('EXPERIMENT_ID', 'unknown')
|
|
80
|
+
Edit `evolution/config.yaml`:
|
|
264
81
|
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
82
|
+
```yaml
|
|
83
|
+
# Files
|
|
84
|
+
algorithm_file: "algorithm.py"
|
|
85
|
+
evaluator_file: "evaluator.py"
|
|
86
|
+
evolution_csv: "evolution.csv"
|
|
268
87
|
|
|
269
|
-
#
|
|
270
|
-
|
|
88
|
+
# Evolution strategy
|
|
89
|
+
ideation_strategies:
|
|
90
|
+
total_ideas: 15
|
|
91
|
+
novel_exploration: 3 # Creative new approaches
|
|
92
|
+
hill_climbing: 5 # Parameter tuning
|
|
93
|
+
structural_mutation: 3 # Architecture changes
|
|
94
|
+
crossover_hybrid: 4 # Combine best features
|
|
95
|
+
|
|
96
|
+
# Auto-generate new ideas when queue empty
|
|
97
|
+
auto_ideate: true
|
|
98
|
+
|
|
99
|
+
# Parallel execution
|
|
100
|
+
parallel:
|
|
101
|
+
enabled: false
|
|
102
|
+
max_workers: 4
|
|
271
103
|
```
|
|
272
104
|
|
|
273
|
-
##
|
|
105
|
+
## Requirements
|
|
274
106
|
|
|
275
|
-
|
|
107
|
+
- Node.js 14+
|
|
108
|
+
- Python 3.x
|
|
109
|
+
- [Claude CLI](https://docs.anthropic.com/en/docs/claude-code)
|
|
110
|
+
- Bash shell (Git Bash on Windows)
|
|
276
111
|
|
|
277
|
-
|
|
278
|
-
# Working directory for evolution files
|
|
279
|
-
evolution_dir: "evolution"
|
|
112
|
+
## Tips
|
|
280
113
|
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
114
|
+
- **Start simple** - Basic algorithm, let evolution add complexity
|
|
115
|
+
- **Monitor progress** - Check `evolution.csv` for performance trends
|
|
116
|
+
- **Guide evolution** - Add manual ideas when stuck in local optima
|
|
117
|
+
- **Let it run** - Evolution works best over long periods
|
|
285
118
|
|
|
286
|
-
|
|
287
|
-
evolution_csv: "evolution.csv"
|
|
119
|
+
## Common Issues
|
|
288
120
|
|
|
289
|
-
|
|
290
|
-
parent_selection: "best" # or "random", "latest"
|
|
121
|
+
**Too many failures?** Check your evaluator handles edge cases and outputs valid scores.
|
|
291
122
|
|
|
292
|
-
|
|
293
|
-
ideation_strategies:
|
|
294
|
-
total_ideas: 15 # Total ideas per generation
|
|
295
|
-
novel_exploration: 3 # Pure creativity, global search
|
|
296
|
-
hill_climbing: 5 # Parameter tuning of top performers
|
|
297
|
-
structural_mutation: 3 # Algorithmic changes to top performers
|
|
298
|
-
crossover_hybrid: 4 # Combine successful approaches
|
|
299
|
-
num_elites: 3 # Number of top performers to use as parents
|
|
300
|
-
|
|
301
|
-
# Python command to use for evaluation
|
|
302
|
-
python_cmd: "python3"
|
|
303
|
-
```
|
|
123
|
+
**Stuck in local optimum?** Increase `novel_exploration` in config.yaml or add manual ideas.
|
|
304
124
|
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
The ideation system uses evolutionary algorithm principles with four complementary strategies:
|
|
308
|
-
|
|
309
|
-
**🎯 Novel Exploration (Global Search)**
|
|
310
|
-
- Generates completely new algorithmic approaches
|
|
311
|
-
- Prevents getting stuck in local optima
|
|
312
|
-
- Explores different paradigms, data structures, mathematical approaches
|
|
313
|
-
- Essential for breakthrough innovations
|
|
314
|
-
|
|
315
|
-
**⛰️ Hill Climbing (Exploitation)**
|
|
316
|
-
- Fine-tunes parameters of successful algorithms
|
|
317
|
-
- Adjusts constants, thresholds, iteration counts
|
|
318
|
-
- Quick wins through incremental improvements
|
|
319
|
-
- Builds on proven approaches
|
|
320
|
-
|
|
321
|
-
**🔧 Structural Mutation (Medium-Distance Search)**
|
|
322
|
-
- Redesigns implementation while keeping core insights
|
|
323
|
-
- Changes data structures, sub-algorithms, execution patterns
|
|
324
|
-
- Balances innovation with proven concepts
|
|
325
|
-
- Explores architectural variations
|
|
326
|
-
|
|
327
|
-
**🧬 Crossover Hybrid (Recombination)**
|
|
328
|
-
- Combines successful elements from different top performers
|
|
329
|
-
- Creates novel interactions between proven approaches
|
|
330
|
-
- Leverages diversity in the population
|
|
331
|
-
- Often produces unexpected breakthrough combinations
|
|
332
|
-
|
|
333
|
-
**⚖️ Strategy Balance**
|
|
334
|
-
The default 3+5+3+4 distribution provides:
|
|
335
|
-
- 20% wild exploration (escape local maxima)
|
|
336
|
-
- 33% focused exploitation (quick improvements)
|
|
337
|
-
- 20% structural innovation (medium jumps)
|
|
338
|
-
- 27% recombination (leverage diversity)
|
|
339
|
-
|
|
340
|
-
**🎛️ Tuning Your Evolution**
|
|
341
|
-
Adjust ratios based on your needs:
|
|
342
|
-
- **Stuck in local optimum?** Increase `novel_exploration` and `structural_mutation`
|
|
343
|
-
- **Need incremental gains?** Increase `hill_climbing`
|
|
344
|
-
- **Population too similar?** Increase `crossover_hybrid`
|
|
345
|
-
- **Want faster convergence?** Decrease `total_ideas`, increase `hill_climbing`
|
|
346
|
-
|
|
347
|
-
## Tips for Success
|
|
348
|
-
|
|
349
|
-
1. **Write a clear BRIEF.md** - Describe your optimization problem, constraints, and goals
|
|
350
|
-
2. **Create a robust evaluator** - Your evaluator.py determines evolution direction
|
|
351
|
-
3. **Start simple** - Begin with a basic algorithm and let evolution add complexity
|
|
352
|
-
4. **Monitor early cycles** - Watch the first few evolutions to ensure proper setup
|
|
353
|
-
5. **Guide when stuck** - Add manual ideas when evolution hits local optima
|
|
354
|
-
6. **Embrace failures** - Not every mutation will be better, that's how evolution works
|
|
355
|
-
|
|
356
|
-
## Example Use Cases
|
|
357
|
-
|
|
358
|
-
- **Algorithm optimization** - Improve sorting, searching, or mathematical algorithms
|
|
359
|
-
- **Machine learning** - Evolve model architectures or training procedures
|
|
360
|
-
- **Game AI** - Develop and optimize game-playing strategies
|
|
361
|
-
- **Numerical methods** - Improve solvers, optimizers, or approximation algorithms
|
|
362
|
-
- **Data structures** - Evolve efficient data organization strategies
|
|
125
|
+
**Evaluator crashes?** Make sure dependencies are installed and error handling is robust.
|
|
363
126
|
|
|
364
127
|
## License
|
|
365
128
|
|
|
@@ -77,7 +77,30 @@ if [[ ! -f $csv_file ]]; then
|
|
|
77
77
|
exit 1
|
|
78
78
|
fi
|
|
79
79
|
|
|
80
|
-
|
|
80
|
+
# Determine what we're evolving based on paths
|
|
81
|
+
EVOLUTION_CONTEXT=""
|
|
82
|
+
if [[ -n "$EVOLUTION_DIR" ]]; then
|
|
83
|
+
# Get the evolution directory name (e.g., "evolution-atr" -> "ATR")
|
|
84
|
+
EVOLUTION_NAME=$(basename "$EVOLUTION_DIR")
|
|
85
|
+
EVOLUTION_CONTEXT="${EVOLUTION_NAME#evolution-}"
|
|
86
|
+
EVOLUTION_CONTEXT=$(echo "$EVOLUTION_CONTEXT" | tr '[:lower:]' '[:upper:]')
|
|
87
|
+
fi
|
|
88
|
+
|
|
89
|
+
# If we can't determine from evolution dir, try from algorithm path
|
|
90
|
+
if [[ -z "$EVOLUTION_CONTEXT" && -n "$ALGORITHM_FILE" ]]; then
|
|
91
|
+
# Get algorithm file name
|
|
92
|
+
if [[ -f "$FULL_ALGORITHM_PATH" ]]; then
|
|
93
|
+
ALGO_NAME=$(basename "$FULL_ALGORITHM_PATH" .py)
|
|
94
|
+
EVOLUTION_CONTEXT="$ALGO_NAME"
|
|
95
|
+
fi
|
|
96
|
+
fi
|
|
97
|
+
|
|
98
|
+
# Default if we still can't determine
|
|
99
|
+
if [[ -z "$EVOLUTION_CONTEXT" ]]; then
|
|
100
|
+
EVOLUTION_CONTEXT="Algorithm"
|
|
101
|
+
fi
|
|
102
|
+
|
|
103
|
+
echo "=== Evolution Analysis Summary - $EVOLUTION_CONTEXT ==="
|
|
81
104
|
echo
|
|
82
105
|
|
|
83
106
|
# Count totals (pure shell)
|
|
@@ -402,6 +425,7 @@ with open('$csv_file', 'r') as f:
|
|
|
402
425
|
|
|
403
426
|
max_perf = 0
|
|
404
427
|
max_id = ''
|
|
428
|
+
max_desc = ''
|
|
405
429
|
max_order = 0
|
|
406
430
|
completed_order = 0
|
|
407
431
|
|
|
@@ -415,12 +439,16 @@ with open('$csv_file', 'r') as f:
|
|
|
415
439
|
max_perf = perf_val
|
|
416
440
|
max_order = completed_order
|
|
417
441
|
max_id = row[0]
|
|
442
|
+
max_desc = row[2] if len(row) > 2 else ''
|
|
418
443
|
except ValueError:
|
|
419
444
|
pass
|
|
420
445
|
|
|
421
446
|
print(f'max_perf={max_perf}')
|
|
422
447
|
print(f'max_row={max_order}')
|
|
423
448
|
print(f'max_id=\"{max_id}\"')
|
|
449
|
+
# Escape special characters in description for shell
|
|
450
|
+
desc_escaped = max_desc.replace('\\\\', '\\\\\\\\').replace('\"', '\\\\\"').replace('\$', '\\\\\$').replace('\`', '\\\\\`')
|
|
451
|
+
print(f'max_desc=\"{desc_escaped}\"')
|
|
424
452
|
")"
|
|
425
453
|
|
|
426
454
|
# Create generation averages file and track max generation
|
|
@@ -544,7 +572,7 @@ set multiplot layout 2,1 margins 0.08,0.82,0.15,0.95 spacing 0.1,0.15
|
|
|
544
572
|
|
|
545
573
|
#=================== TOP PLOT: Performance Over Time ===================
|
|
546
574
|
# AIDEV-NOTE: Removed x-axis to eliminate tick overlap and formatting issues
|
|
547
|
-
set title "Algorithm Evolution Performance Over Time" font ",14"
|
|
575
|
+
set title "$EVOLUTION_CONTEXT Algorithm Evolution Performance Over Time" font ",14"
|
|
548
576
|
unset xlabel
|
|
549
577
|
set ylabel "Performance Score"
|
|
550
578
|
set grid y # Only show horizontal grid lines
|
|
@@ -578,10 +606,11 @@ plot "$gen_avg_file" using 1:3 with boxes linecolor rgb "#4CAF50" notitle
|
|
|
578
606
|
|
|
579
607
|
unset multiplot
|
|
580
608
|
|
|
581
|
-
# Add winner label at bottom
|
|
582
|
-
set terminal png size 1200,
|
|
609
|
+
# Add winner label and description at bottom
|
|
610
|
+
set terminal png size 1200,850
|
|
583
611
|
set output "$output_file"
|
|
584
|
-
set label "Best Overall: $max_id (Score: $max_perf)" at screen 0.5, 0.
|
|
612
|
+
set label "Best Overall: $max_id (Score: $max_perf)" at screen 0.5, 0.07 center font ",12"
|
|
613
|
+
set label "$max_desc" at screen 0.5, 0.04 center font ",10" textcolor rgb "#666666"
|
|
585
614
|
replot
|
|
586
615
|
EOF
|
|
587
616
|
else
|