- Configurable: Set 2 to 16 algorithms per generation
- Default: 6 algorithms per round
- UI Control: "Algorithms/Round" field in GUI
# Config
algorithms_per_round: int = 6 # 2-16 range50% Variants + 50% New Algorithms (configurable)
Variants (n/2):
- Improved versions of current best
- Focus on weakest metrics
- Must be fundamentally different (not just parameter tweaks)
New Algorithms (n/2):
- Completely original approaches
- Not based on existing code
- Creative algorithmic diversity
# Example: 6 algorithms per round
# → 3 variants + 3 new algorithms
variant_ratio: float = 0.5 # AdjustableNO MORE LAZY PARAMETER CHANGES!
enforce_code_difference: bool = True
min_code_difference_ratio: float = 0.3 # At least 30% differentHow it works:
- Normalizes code (removes comments, whitespace)
- Calculates character-level differences
- Checks structural differences (keywords, patterns)
- Rejects algorithms that are <30% different
Example of REJECTED lazy change:
# Original
for i in 1:n
sum += i
end
# REJECTED (only parameter changed)
for i in 1:100 # Just changed n to 100!
sum += i
end
# ACCEPTED (different approach)
sum = n * (n + 1) ÷ 2 # Gauss formula!No manual testing needed!
auto_calculate_expected: bool = True
validation_runs: int = 5Process:
- Runs initial code 5 times
- Verifies results are consistent
- Auto-extracts expected value
- Uses for all subsequent benchmarks
GUI:
- Leave "Expected" field empty → auto-calculates
- Or provide manual expected value
Example:
function factorial(n::Int)::Int
n <= 1 ? 1 : n * factorial(n-1)
endInput: 5
Auto-calculated: 120
Automatically extracts and preserves imports!
using LinearAlgebra
using Statistics
using BenchmarkTools
function matrix_norm(A::Matrix{Float64})::Float64
return norm(A) # Uses LinearAlgebra
endFeatures:
- Extracts
usingandimportstatements - Tracks project packages
- Includes in all generated variants
- Validates package availability
Variants Prompt:
CRITICAL REQUIREMENTS:
- Use FUNDAMENTALLY DIFFERENT logic/algorithm
- NOT just parameter tweaks
- Different data structures, algorithms, loop orders
- Mathematical identities, vectorization
New Algorithm Prompt:
Create a COMPLETELY DIFFERENT algorithmic approach
DO NOT copy patterns from previous attempts
Examples:
- Iterative vs recursive vs matrix math
- Different loop structures, vectorization
- Memoization, dynamic programming
- Bit manipulation, algebraic shortcuts
Multiple safeguards prevent bad algorithms:
- Syntax validation before benchmarking
- Minimum score threshold (300/1000)
- Accuracy-first weighting (30%)
- Code difference check (30% minimum)
- Consistent expected values (5 validation runs)
Evolution tab shows:
[Gen 2] fibonacci_Gen2_Variant1 - Score: 785.23 ([EXCELLENT])
Acc: 100.0%, Spd: 85.2%, Cplx: 30.0%, Coh: 92.5%
[Gen 2] fibonacci_Gen2_New1 - Score: 812.45 ([EXCELLENT])
Acc: 100.0%, Spd: 88.7%, Cplx: 25.0%, Coh: 95.0%
[REJECTED] Variant too similar to existing code
[IMPROVEMENT] fibonacci_Gen2_New1: 812.45
Algorithms/Round: 2-16 (default: 6) Rounds: -1 for unlimited, or specific number Model: Auto-detected from your Ollama models Input: Test value Expected: Leave empty for auto-calculation
☑ Auto-calculate expected values
- Runs initial code to determine expected output
- Validates consistency across 5 runs
☑ Enforce code differences
- Prevents lazy parameter tweaking
- Requires 30% structural difference
Edit Weights:
- accuracy: 0.3
- speed: 0.2
- complexity: 0.1
- coherence: 0.15
- stability: 0.15
- memory: 0.1
Initial (naive recursive O(2^n)):
function fibonacci(n::Int)::Int
n <= 1 ? n : fibonacci(n-1) + fibonacci(n-2)
endGeneration 1 Output:
- 3 variants (memoization, iterative, formula-based)
- 3 new approaches (matrix, lookup table, Binet's)
Generation 2 Output:
- 3 variants of best Gen1 (optimized matrix)
- 3 completely new (closed-form, generating function, etc.)
Final Result: O(log n) matrix exponentiation - [PERFECT] score
Initial (bubble sort O(n²)):
function sort_array(arr::Vector{Int})::Vector{Int}
n = length(arr)
result = copy(arr)
for i in 1:n
for j in 1:n-i
if result[j] > result[j+1]
result[j], result[j+1] = result[j+1], result[j]
end
end
end
return result
endInput: [64, 34, 25, 12, 22, 11, 90]
Auto-calculated Expected: [11, 12, 22, 25, 34, 64, 90]
Evolution produces:
- Quick sort variants
- Merge sort approaches
- Heap sort implementations
- Radix sort for integers
- Built-in sort! with optimizations
Initial:
using LinearAlgebra
using Statistics
function matrix_stats(A::Matrix{Float64})::Tuple{Float64, Float64, Float64}
"""Calculate mean, std, and norm of matrix"""
m = mean(A)
s = std(A)
n = norm(A)
return (m, s, n)
endPackage handling:
- Extracts:
using LinearAlgebra,using Statistics - Includes in all generated variants
- Validates packages are installed
- Offers to install if missing
Generate 6 variants of current best
→ Pick best variant
→ Repeat
Generate 3 variants of current best (must be 30% different)
+ Generate 3 completely new approaches
→ Track all codes to enforce diversity
→ Pick best from all 6
→ Repeat
def calculate_code_difference(code1, code2):
# 1. Normalize (remove comments, whitespace)
norm1 = normalize(code1)
norm2 = normalize(code2)
# 2. Character-level difference (70% weight)
char_diff = character_difference(norm1, norm2)
# 3. Structural difference (30% weight)
keywords1 = extract_keywords(code1) # for, while, if, etc.
keywords2 = extract_keywords(code2)
struct_diff = keyword_difference(keywords1, keywords2)
# 4. Weighted combination
return (char_diff * 0.7) + (struct_diff * 0.3)Thresholds:
- < 0.3: REJECTED (too similar)
- 0.3-0.5: Acceptable
- 0.5-0.8: Good diversity
-
0.8: Completely different
algorithms_per_round: 4 # 2 variants + 2 new
rounds: 10
temperature: 0.7
algorithms_per_round: 6 # 3 variants + 3 new
rounds: 15
temperature: 0.7
algorithms_per_round: 12 # 6 variants + 6 new
rounds: 20
temperature: 0.6
Small functions (< 20 lines):
- Convergence: 5-10 generations
- Total time: 5-15 minutes
Medium functions (20-50 lines):
- Convergence: 10-20 generations
- Total time: 15-30 minutes
Complex functions (50+ lines):
- Convergence: 20-40 generations
- Total time: 30-60 minutes
- Increase
temperature(more creativity) - Decrease
min_code_difference_ratio - Use larger model (better at diversity)
- Check initial code syntax
- Verify function returns consistent results
- Provide manual expected value
- GUI will offer to install missing packages
- Or manually:
julia -e 'using Pkg; Pkg.add("PackageName")'
Potential additions:
- Multi-objective optimization (Pareto front)
- Cross-breeding between algorithms
- Tournament selection with brackets
- Parallel variant generation
- GPU-accelerated benchmarking
- Export to Julia tournament file format
| Feature | V1 | V2 |
|---|---|---|
| Algorithms/round | 6 (fixed) | 2-16 (configurable) |
| Algorithm types | Variants only | 50% variants + 50% new |
| Code diversity | No enforcement | 30% difference required |
| Expected values | Manual | Auto-calculated |
| Packages | Not supported | Full support |
| Lazy parameters | Allowed | Blocked |
| Prompts | Generic | Enforces creativity |
V2 is a complete overhaul focused on:
- Diversity: No more lazy parameter tweaking
- Automation: Auto-calculates expected values
- Scalability: 2-16 algorithms per round
- Quality: Multiple validation layers
- Creativity: Forces genuinely different approaches
The result: Higher quality algorithms that truly explore the solution space! 🌊🚀