Skip to content

Commit 871819f

Browse files
add system messages to alphaevolve_math_problems
1 parent dee081c commit 871819f

File tree

16 files changed

+596
-128
lines changed

16 files changed

+596
-128
lines changed

examples/alphaevolve_math_problems/circle_packing_rect/config.yaml

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,25 +15,46 @@ llm:
1515

1616
# Database configuration (MAP-Elites algorithm)
1717
database:
18-
population_size: 50
19-
num_islands: 3
20-
migration_interval: 10
18+
population_size: 40
19+
num_islands: 5
20+
migration_interval: 40
2121
feature_dimensions: # MUST be a list, not an integer
2222
- "score"
2323
- "complexity"
2424

2525
# Evaluation settings
2626
evaluator:
27-
timeout: 60
27+
timeout: 360
2828
max_retries: 3
2929

3030
# Prompt configuration
3131
prompt:
3232
system_message: |
33-
You are an expert programmer. Your goal is to improve the code
34-
in the EVOLVE-BLOCK to achieve better performance on the task.
35-
36-
Focus on algorithmic improvements and code optimization.
33+
SETTING:
34+
You are an expert computational geometer and optimization specialist with deep expertise in circle packing problems, geometric optimization algorithms, and constraint satisfaction.
35+
Your mission is to evolve and optimize a constructor function that generates an optimal arrangement of exactly 21 non-overlapping circles within a rectangle, maximizing the sum of their radii.
36+
37+
PROBLEM CONTEXT:
38+
- **Objective**: Create a function that returns optimal (x, y, radius) coordinates for 21 circles
39+
- **Benchmark**: Beat the AlphaEvolve state-of-the-art result of sum_radii = 2.3658321334167627
40+
- **Container**: Rectangle with perimeter = 4 (width + height = 2). You may choose optimal width/height ratio
41+
- **Constraints**:
42+
* All circles must be fully contained within rectangle boundaries
43+
* No circle overlaps (distance between centers ≥ sum of their radii)
44+
* Exactly 21 circles required
45+
* All radii must be positive
46+
47+
PERFORMANCE METRICS:
48+
1. **sum_radii**: Total sum of all 21 circle radii (PRIMARY OBJECTIVE - maximize)
49+
2. **combined_score**: sum_radii / 2.3658321334167627 (progress toward beating benchmark)
50+
3. **eval_time**: Execution time in seconds (keep reasonable, prefer accuracy over speed)
51+
52+
TECHNICAL REQUIREMENTS:
53+
- **Determinism**: Use fixed random seeds if employing stochastic methods for reproducibility
54+
- **Error handling**: Graceful handling of optimization failures or infeasible configurations
55+
- **Memory efficiency**: Avoid excessive memory allocation for distance matrix computations
56+
- **Scalability**: Design with potential extension to different circle counts in mind
57+
3758
num_top_programs: 3
3859
num_diverse_programs: 2
3960

examples/alphaevolve_math_problems/erdos_min_overlap/config.yaml

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Evolution settings
2-
max_iterations: 100
2+
max_iterations: 200
33
checkpoint_interval: 10
44
parallel_evaluations: 1
55

@@ -15,25 +15,44 @@ llm:
1515

1616
# Database configuration (MAP-Elites algorithm)
1717
database:
18-
population_size: 50
19-
num_islands: 3
20-
migration_interval: 10
18+
population_size: 40
19+
num_islands: 5
20+
migration_interval: 40
2121
feature_dimensions: # MUST be a list, not an integer
2222
- "score"
2323
- "complexity"
2424

2525
# Evaluation settings
2626
evaluator:
27-
timeout: 60
27+
timeout: 360
2828
max_retries: 3
2929

3030
# Prompt configuration
3131
prompt:
3232
system_message: |
33-
You are an expert programmer. Your goal is to improve the code
34-
in the EVOLVE-BLOCK to achieve better performance on the task.
33+
SETTING:
34+
You are an expert in harmonic analysis, numerical optimization, and AI-driven mathematical discovery.
35+
Your task is to evolve and optimize a Python script to find a better **upper bound** for the Erdős minimum overlap problem constant C₅.
36+
37+
PROBLEM CONTEXT:
38+
Target: Find a step function h: [0, 2] → [0, 1] that **minimizes** the objective:
39+
max_k ∫ h(x)(1 - h(x+k)) dx
40+
41+
This minimal value provides a tight upper bound for the constant C5.
42+
43+
Current best known upper bound: C5 ≤ 0.38092303510845016
44+
Goal: Find a step function `h` that results in a C5 value lower than 0.38092303510845016.
45+
46+
CONSTRAINTS:
47+
1. The function `h` must have values in the range [0, 1].
48+
2. The integral of h(x) over [0, 2] must be exactly 1.
49+
50+
PERFORMANCE METRICS:
51+
- c5_bound: The bound found by the program.
52+
- combined_score: 0.38092303510845016 / c5_bound (The primary objective is to MAXIMIZE this value - a value > 1 means a new record).
53+
- n_points: number of points used in the discretization.
54+
- eval_time: evaluation time of the program.
3555
36-
Focus on algorithmic improvements and code optimization.
3756
num_top_programs: 3
3857
num_diverse_programs: 2
3958

examples/alphaevolve_math_problems/first_autocorr_ineq/config.yaml

Lines changed: 50 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Evolution settings
2-
max_iterations: 100
2+
max_iterations: 200
33
checkpoint_interval: 10
44
parallel_evaluations: 1
55

@@ -15,25 +15,67 @@ llm:
1515

1616
# Database configuration (MAP-Elites algorithm)
1717
database:
18-
population_size: 50
19-
num_islands: 3
20-
migration_interval: 10
18+
population_size: 40
19+
num_islands: 5
20+
migration_interval: 40
2121
feature_dimensions: # MUST be a list, not an integer
2222
- "score"
2323
- "complexity"
2424

2525
# Evaluation settings
2626
evaluator:
27-
timeout: 60
27+
timeout: 360
2828
max_retries: 3
2929

3030
# Prompt configuration
3131
prompt:
3232
system_message: |
33-
You are an expert programmer. Your goal is to improve the code
34-
in the EVOLVE-BLOCK to achieve better performance on the task.
33+
SETTING:
34+
You are an expert in functional analysis, harmonic analysis, numerical optimization, and AI-driven mathematical discovery.
35+
Your task is to evolve and optimize a Python script to find the optimal function that minimizes the upper bound of the constant C1.
3536
36-
Focus on algorithmic improvements and code optimization.
37+
PROBLEM CONTEXT:
38+
Target: Find a non-negative function f: R → R that minimizes the upper bound of the constant C1 in the inequality:
39+
max_{-1/2≤t≤1/2} f★f(t) ≥ C₁ (∫_{-1/4}^{1/4} f(x) dx)²
40+
where f★f(t) = ∫ f(t-x)f(x) dx is the autoconvolution.
41+
42+
Current best known bounds:
43+
* literature: 1.28 ≤ C1 ≤ 1.5098
44+
* alphaevolve: C1 ≤ 1.5052939684401607
45+
Goal: Beat the current upper bound of 1.5052939684401607 discovered by step functions and alphaevolve.
46+
47+
Constraint: The function f must be non-negative everywhere and have non-zero integral over [-1/4, 1/4].
48+
49+
MATHEMATICAL FORMULATION:
50+
Given: Discretized domain [-1/4, 1/4] with n_points equally-spaced grid points.
51+
Objective: Minimize min_{t∈[-1/2,1/2]} (f★f)(t) / (∫f dx)² over all non-negative functions f.
52+
Discretization: Use finite differences and discrete convolution to approximate integrals and autoconvolution.
53+
54+
PERFORMANCE METRICS:
55+
combined_score: The 1.5052939684401607/C1 constant achieved by the discovered function (PRIMARY OBJECTIVE - maximize this)
56+
c1: constant achieved (current best upper bound)
57+
eval_time: Time to reach best solution
58+
n_points: number of points used in the integral interval
59+
loss: loss valued of the function used in minimization
60+
61+
VALIDATION FRAMEWORK:
62+
Mathematical Validation: Verify the C1 computation using independent numerical integration
63+
Non-negativity Check: Ensure f(x) ≥ 0 everywhere (up to numerical tolerance)
64+
Integral Verification: Confirm ∫f dx > 0 to avoid degenerate solutions
65+
Consistency Check: Re-compute autoconvolution and verify inequality holds
66+
67+
TECHNICAL REQUIREMENTS:
68+
Reproducibility: Control random seeds for deterministic results
69+
Numerical Stability: Handle potential division by zero in integral ratios
70+
Memory Management: Discrete convolution can be memory-intensive for large grids
71+
Constraint Handling: Maintain non-negativity throughout optimization
72+
73+
SUCCESS CRITERIA:
74+
Primary: Achieving c1 < 1.5052939684401607 (beating current record)
75+
Secondary: Finding interpretable functions that achieve high C1 values
76+
Robustness: Solutions that work across multiple runs and parameter settings
77+
Efficiency: Fast convergence to high-quality solutions
78+
3779
num_top_programs: 3
3880
num_diverse_programs: 2
3981

examples/alphaevolve_math_problems/heilbronn_convex/13/config.yaml

Lines changed: 93 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Evolution settings
2-
max_iterations: 100
2+
max_iterations: 200
33
checkpoint_interval: 10
44
parallel_evaluations: 1
55

@@ -15,25 +15,109 @@ llm:
1515

1616
# Database configuration (MAP-Elites algorithm)
1717
database:
18-
population_size: 50
19-
num_islands: 3
20-
migration_interval: 10
18+
population_size: 40
19+
num_islands: 5
20+
migration_interval: 40
2121
feature_dimensions: # MUST be a list, not an integer
2222
- "score"
2323
- "complexity"
2424

2525
# Evaluation settings
2626
evaluator:
27-
timeout: 60
27+
timeout: 360
2828
max_retries: 3
2929

3030
# Prompt configuration
3131
prompt:
3232
system_message: |
33-
You are an expert programmer. Your goal is to improve the code
34-
in the EVOLVE-BLOCK to achieve better performance on the task.
35-
36-
Focus on algorithmic improvements and code optimization.
33+
SETTING:
34+
You are an expert computational geometer and optimization specialist with deep expertise in the Heilbronn triangle problem - a fundamental challenge in discrete geometry first posed by Hans Heilbronn in 1957.
35+
This problem asks for the optimal placement of n points within a convex region of unit area to maximize the area of the smallest triangle formed by any three of these points.
36+
Your expertise spans classical geometric optimization, modern computational methods, and the intricate mathematical properties that govern point configurations in constrained spaces.
37+
38+
PROBLEM SPECIFICATION:
39+
Design and implement a constructor function that generates an optimal arrangement of exactly 13 points within or on the boundary of a unit-area convex region. The solution must:
40+
- Place all 13 points within or on a convex boundary
41+
- Maximize the minimum triangle area among all C(13,3) = 286 possible triangles
42+
- Return deterministic, reproducible results
43+
- Execute efficiently within computational constraints
44+
45+
PERFORMANCE METRICS:
46+
1. **min_area_normalized**: (Area of smallest triangle) / (Area of convex hull) [PRIMARY - MAXIMIZE]
47+
2. **combined_score**: min_area_normalized / 0.030936889034895654 [BENCHMARK COMPARISON - TARGET > 1.0]
48+
3. **eval_time**: Execution time in seconds [EFFICIENCY - secondary priority]
49+
50+
TECHNICAL REQUIREMENTS:
51+
- **Determinism**: Use fixed random seeds if employing stochastic methods for reproducibility
52+
- **Error handling**: Graceful handling of optimization failures or infeasible configurations
53+
54+
MATHEMATICAL CONTEXT & THEORETICAL BACKGROUND:
55+
- **PROBLEM COMPLEXITY**: The Heilbronn problem is among the most challenging in discrete geometry, with optimal configurations rigorously known only for n ≤ 4 points
56+
- **ASYMPTOTIC BEHAVIOR**: For large n, the optimal value approaches O(1/n²) with logarithmic corrections, but the exact constant remains unknown
57+
- **GEOMETRIC CONSTRAINTS**: Points must balance competing objectives:
58+
* Interior points can form larger triangles but create crowding
59+
* Boundary points avoid area penalties but limit triangle formation
60+
* Edge cases arise when three points become nearly collinear
61+
- **SYMMETRY CONSIDERATIONS**: Optimal configurations often exhibit rotational symmetries (particularly 3-fold due to triangular geometry)
62+
- **SCALING INVARIANCE**: The problem is scale-invariant; solutions can be normalized to any convex region
63+
- **CRITICAL GEOMETRIC PROPERTIES**:
64+
* Delaunay triangulation properties and angle optimization
65+
* Voronoi diagram regularity as indicator of point distribution quality
66+
* Relationship between circumradius and triangle area
67+
* Connection to sphere packing and energy minimization principles
68+
69+
ADVANCED OPTIMIZATION STRATEGIES:
70+
- **MULTI-SCALE APPROACH**: Coarse global search → fine local refinement with adaptive step sizes
71+
- **CONSTRAINT HANDLING**: Penalty methods, barrier functions, or projection operators for convexity
72+
- **INITIALIZATION STRATEGIES**:
73+
* Perturbed regular grids (triangular, square, hexagonal lattices)
74+
* Random points with force-based relaxation
75+
* Symmetry-constrained configurations (3-fold, 6-fold rotational)
76+
* Hybrid boundary/interior distributions
77+
* Low-discrepancy sequences (Sobol, Halton) for uniform coverage
78+
- **OBJECTIVE FUNCTION DESIGN**:
79+
* Smooth approximations to min() function (LogSumExp, p-norms with p→∞)
80+
* Barrier methods for boundary constraints
81+
* Multi-objective formulations balancing multiple triangle areas
82+
* Weighted combinations of smallest k triangle areas
83+
- **ADVANCED TECHNIQUES**:
84+
* Riemannian optimization on manifolds
85+
* Variational methods treating point density as continuous field
86+
* Machine learning-guided search using learned geometric priors
87+
* Topological optimization considering point connectivity graphs
88+
* Continuation methods with parameter homotopy
89+
90+
GEOMETRIC INSIGHTS & HEURISTICS:
91+
- **BOUNDARY CONSIDERATIONS**: Points on boundary contribute to convex hull but may form smaller triangles
92+
- **TRIANGLE DEGENERACY**: Avoid near-collinear configurations that create arbitrarily small triangles
93+
- **LOCAL VS GLOBAL**: Balance between locally optimal triangle sizes and global configuration harmony
94+
- **SYMMETRY EXPLOITATION**: 3-fold rotational symmetry often appears in optimal configurations
95+
- **VORONOI RELATIONSHIPS**: Points should have roughly equal Voronoi cell areas for optimal distribution
96+
- **ENERGY ANALOGIES**: Treat as electrostatic repulsion or gravitational equilibrium problem
97+
- **HISTORICAL APPROACHES**:
98+
* Regular lattice arrangements (suboptimal but provide baselines)
99+
* Hexagonal close-packing adaptations
100+
* Force-based relaxation (treating points as mutually repelling particles)
101+
* Simulated annealing and evolutionary computation
102+
* Gradient descent with carefully designed objective functions
103+
104+
VALIDATION FRAMEWORK:
105+
- **Geometric constraint verification**:
106+
* Point count validation: Exactly 13 points required
107+
* Convexity check: All points within or on boundary of convex hull
108+
- **Data integrity checks**:
109+
* Coordinate bounds: All coordinates are finite real numbers
110+
* Point uniqueness: No duplicate points (within numerical tolerance)
111+
* Geometric consistency: Points form valid geometric configuration
112+
- **Solution quality assessment**:
113+
* Local optimality testing through small perturbations
114+
* Symmetry analysis: Detection of rotational/reflectional symmetries
115+
* Distribution quality: Voronoi cell area variance, nearest neighbor statistics
116+
* Convergence verification: For iterative methods, check convergence criteria
117+
- **Determinism verification**:
118+
* Multiple execution consistency: Same results across multiple runs
119+
* Seed effectiveness: Proper random seed implementation
120+
* Platform independence: Results stable across different computing environments
37121
num_top_programs: 3
38122
num_diverse_programs: 2
39123

examples/alphaevolve_math_problems/heilbronn_convex/14/config.yaml

Lines changed: 31 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Evolution settings
2-
max_iterations: 100
2+
max_iterations: 200
33
checkpoint_interval: 10
44
parallel_evaluations: 1
55

@@ -15,25 +15,47 @@ llm:
1515

1616
# Database configuration (MAP-Elites algorithm)
1717
database:
18-
population_size: 50
19-
num_islands: 3
20-
migration_interval: 10
18+
population_size: 40
19+
num_islands: 5
20+
migration_interval: 40
2121
feature_dimensions: # MUST be a list, not an integer
2222
- "score"
2323
- "complexity"
2424

2525
# Evaluation settings
2626
evaluator:
27-
timeout: 60
27+
timeout: 360
2828
max_retries: 3
2929

3030
# Prompt configuration
3131
prompt:
3232
system_message: |
33-
You are an expert programmer. Your goal is to improve the code
34-
in the EVOLVE-BLOCK to achieve better performance on the task.
35-
36-
Focus on algorithmic improvements and code optimization.
33+
SETTING:
34+
You are an expert computational geometer and optimization specialist with deep expertise in the Heilbronn triangle problem - a fundamental challenge in discrete geometry first posed by Hans Heilbronn in 1957.
35+
This problem asks for the optimal placement of n points within a convex region of unit area to maximize the area of the smallest triangle formed by any three of these points.
36+
Your expertise spans classical geometric optimization, modern computational methods, and the intricate mathematical properties that govern point configurations in constrained spaces.
37+
38+
PROBLEM SPECIFICATION:
39+
Design and implement a constructor function that generates an optimal arrangement of exactly 14 points within or on the boundary of a unit-area convex region. The solution must:
40+
- Place all 14 points within or on a convex boundary
41+
- Maximize the minimum triangle area among all C(14,3) = 364 possible triangles
42+
- Return deterministic, reproducible results
43+
- Execute efficiently within computational constraints
44+
45+
PERFORMANCE METRICS:
46+
1. **min_area_normalized**: (Area of smallest triangle) / (Area of convex hull) [PRIMARY - MAXIMIZE]
47+
2. **combined_score**: min_area_normalized / 0.027835571458482138 [BENCHMARK COMPARISON - TARGET > 1.0]
48+
3. **eval_time**: Execution time in seconds [EFFICIENCY - secondary priority]
49+
50+
BENCHMARK & PERFORMANCE TARGET:
51+
- **CURRENT STATE-OF-THE-ART**: min_area_normalized = 0.027835571458482138 (achieved by AlphaEvolve algorithm)
52+
- **PRIMARY METRIC**: min_area_normalized = (smallest triangle area) / (convex hull area)
53+
- **SUCCESS CRITERION**: combined_score = min_area_normalized / 0.027835571458482138 > 1.0
54+
- **SIGNIFICANCE**: Even marginal improvements (combined_score > 1.01) represent meaningful advances in this notoriously difficult problem
55+
56+
TECHNICAL REQUIREMENTS:
57+
- **Determinism**: Use fixed random seeds if employing stochastic methods for reproducibility
58+
- **Error handling**: Graceful handling of optimization failures or infeasible configurations
3759
num_top_programs: 3
3860
num_diverse_programs: 2
3961

0 commit comments

Comments
 (0)