Skip to content

Commit b3137b7

Browse files
committed
Add Azure GPT and Gemini configs for alphaevolve_math_problems
- Add config_azure_gpt.yaml for all 16 problems (Azure OpenAI gpt-5) - Add config_gemini.yaml for all 16 problems (Gemini + Azure paradigm) - All configs use ${ENV_VAR} syntax for API keys (no hardcoded keys) - Add env var expansion support to config.py - Fix indentation in openai.py for Azure client - Add AutoEvolve features: paradigm breakthrough, error retry, adaptive search - Shell scripts with API keys excluded via .gitignore
1 parent ffa3ff0 commit b3137b7

34 files changed

Lines changed: 2986 additions & 0 deletions

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,6 @@ problems
6565

6666
# NFS temp files
6767
.nfs*
68+
69+
# Shell scripts with API keys
70+
examples/alphaevolve_math_problems/run_*.sh
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# Evolution settings
2+
max_iterations: 100
3+
checkpoint_interval: 10
4+
log_level: "INFO"
5+
6+
# LLM configuration (Azure OpenAI)
7+
llm:
8+
primary_model: "gpt-5"
9+
api_base: "https://east-docetl.openai.azure.com/openai/deployments/gpt-4.1?api-version=2024-12-01-preview"
10+
api_key: "${OPENAI_API_KEY}"
11+
primary_model_weight: 1.0
12+
temperature: 0.7
13+
max_tokens: 32000
14+
timeout: 600
15+
16+
# Database configuration (MAP-Elites algorithm)
17+
database:
18+
population_size: 40
19+
num_islands: 5
20+
migration_interval: 40
21+
feature_dimensions:
22+
- "score"
23+
- "complexity"
24+
25+
# Adaptive exploration settings
26+
use_adaptive_search: true
27+
adaptive_window_size: 20
28+
adaptive_min_exploration: 0.1
29+
adaptive_max_exploration: 0.7
30+
31+
# Softmax sampling for exploitation
32+
exploitation_temperature: 1.0
33+
34+
# Stagnation detection and multi-child generation
35+
stagnation_threshold: 10
36+
stagnation_multi_child_count: 3
37+
sibling_context_limit: 5
38+
39+
# ============================================
40+
# AutoEvolve Advanced Features (Sky Lab UC Berkeley)
41+
# ============================================
42+
43+
# Paradigm Breakthrough
44+
enable_paradigm_breakthrough: true
45+
stagnation_window: 5
46+
stagnation_improvement_threshold: 0.01
47+
stagnation_paradigm_samples: 3
48+
paradigm_model: "gpt-5-mini"
49+
paradigm_api_base: "https://east-docetl.openai.azure.com/openai/deployments/gpt-4.1?api-version=2024-12-01-preview"
50+
paradigm_api_key: "${OPENAI_API_KEY}"
51+
52+
# Error Retry
53+
enable_error_retry: true
54+
max_error_retries: 2
55+
56+
evaluator:
57+
timeout: 360
58+
max_retries: 3
59+
60+
# Prompt configuration
61+
prompt:
62+
system_message: |
63+
SETTING:
64+
You are an expert computational geometer and optimization specialist with deep expertise in circle packing problems, geometric optimization algorithms, and constraint satisfaction.
65+
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.
66+
67+
PROBLEM CONTEXT:
68+
- **Objective**: Create a function that returns optimal (x, y, radius) coordinates for 21 circles
69+
- **Benchmark**: Beat the AlphaEvolve state-of-the-art result of sum_radii = 2.3658321334167627
70+
- **Container**: Rectangle with perimeter = 4 (width + height = 2). You may choose optimal width/height ratio
71+
- **Constraints**:
72+
* All circles must be fully contained within rectangle boundaries
73+
* No circle overlaps (distance between centers ≥ sum of their radii)
74+
* Exactly 21 circles required
75+
* All radii must be positive
76+
77+
PERFORMANCE METRICS:
78+
1. **sum_radii**: Total sum of all 21 circle radii (PRIMARY OBJECTIVE - maximize)
79+
2. **combined_score**: sum_radii / 2.3658321334167627 (progress toward beating benchmark)
80+
3. **eval_time**: Execution time in seconds (keep reasonable, prefer accuracy over speed)
81+
82+
TECHNICAL REQUIREMENTS:
83+
- **Determinism**: Use fixed random seeds if employing stochastic methods for reproducibility
84+
- **Error handling**: Graceful handling of optimization failures or infeasible configurations
85+
- **Memory efficiency**: Avoid excessive memory allocation for distance matrix computations
86+
- **Scalability**: Design with potential extension to different circle counts in mind
87+
88+
num_top_programs: 3
89+
num_diverse_programs: 2
90+
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# Evolution settings
2+
max_iterations: 100
3+
checkpoint_interval: 10
4+
log_level: "INFO"
5+
6+
# LLM configuration (Gemini)
7+
llm:
8+
primary_model: "gemini-3-pro-preview"
9+
api_base: "https://generativelanguage.googleapis.com/v1beta/openai/"
10+
api_key: "${OPENAI_API_KEY}"
11+
primary_model_weight: 1.0
12+
temperature: 0.7
13+
max_tokens: 32000
14+
timeout: 600
15+
16+
# Database configuration (MAP-Elites algorithm)
17+
database:
18+
population_size: 40
19+
num_islands: 5
20+
migration_interval: 40
21+
feature_dimensions:
22+
- "score"
23+
- "complexity"
24+
25+
# Adaptive exploration settings
26+
use_adaptive_search: true
27+
adaptive_window_size: 20
28+
adaptive_min_exploration: 0.1
29+
adaptive_max_exploration: 0.7
30+
31+
# Softmax sampling for exploitation
32+
exploitation_temperature: 1.0
33+
34+
# Stagnation detection and multi-child generation
35+
stagnation_threshold: 10
36+
stagnation_multi_child_count: 3
37+
sibling_context_limit: 5
38+
39+
# ============================================
40+
# AutoEvolve Advanced Features (Sky Lab UC Berkeley)
41+
# ============================================
42+
43+
# Paradigm Breakthrough
44+
enable_paradigm_breakthrough: true
45+
stagnation_window: 5
46+
stagnation_improvement_threshold: 0.01
47+
stagnation_paradigm_samples: 3
48+
paradigm_model: "gpt-5-mini"
49+
paradigm_api_base: "https://east-docetl.openai.azure.com/openai/deployments/gpt-4.1?api-version=2024-12-01-preview"
50+
paradigm_api_key: "${PARADIGM_API_KEY}"
51+
52+
# Error Retry
53+
enable_error_retry: true
54+
max_error_retries: 2
55+
56+
evaluator:
57+
timeout: 360
58+
max_retries: 3
59+
60+
# Prompt configuration
61+
prompt:
62+
system_message: |
63+
SETTING:
64+
You are an expert computational geometer and optimization specialist with deep expertise in circle packing problems, geometric optimization algorithms, and constraint satisfaction.
65+
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.
66+
67+
PROBLEM CONTEXT:
68+
- **Objective**: Create a function that returns optimal (x, y, radius) coordinates for 21 circles
69+
- **Benchmark**: Beat the AlphaEvolve state-of-the-art result of sum_radii = 2.3658321334167627
70+
- **Container**: Rectangle with perimeter = 4 (width + height = 2). You may choose optimal width/height ratio
71+
- **Constraints**:
72+
* All circles must be fully contained within rectangle boundaries
73+
* No circle overlaps (distance between centers ≥ sum of their radii)
74+
* Exactly 21 circles required
75+
* All radii must be positive
76+
77+
PERFORMANCE METRICS:
78+
1. **sum_radii**: Total sum of all 21 circle radii (PRIMARY OBJECTIVE - maximize)
79+
2. **combined_score**: sum_radii / 2.3658321334167627 (progress toward beating benchmark)
80+
3. **eval_time**: Execution time in seconds (keep reasonable, prefer accuracy over speed)
81+
82+
TECHNICAL REQUIREMENTS:
83+
- **Determinism**: Use fixed random seeds if employing stochastic methods for reproducibility
84+
- **Error handling**: Graceful handling of optimization failures or infeasible configurations
85+
- **Memory efficiency**: Avoid excessive memory allocation for distance matrix computations
86+
- **Scalability**: Design with potential extension to different circle counts in mind
87+
88+
num_top_programs: 3
89+
num_diverse_programs: 2
90+
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# Evolution settings
2+
max_iterations: 200
3+
checkpoint_interval: 10
4+
log_level: "INFO"
5+
6+
# LLM configuration (Azure OpenAI)
7+
llm:
8+
primary_model: "gpt-5"
9+
api_base: "https://east-docetl.openai.azure.com/openai/deployments/gpt-4.1?api-version=2024-12-01-preview"
10+
api_key: "${OPENAI_API_KEY}"
11+
primary_model_weight: 1.0
12+
temperature: 0.7
13+
max_tokens: 32000
14+
timeout: 600
15+
16+
# Database configuration (MAP-Elites algorithm)
17+
database:
18+
population_size: 40
19+
num_islands: 5
20+
migration_interval: 40
21+
feature_dimensions:
22+
- "score"
23+
- "complexity"
24+
25+
# Adaptive exploration settings
26+
use_adaptive_search: true
27+
adaptive_window_size: 20
28+
adaptive_min_exploration: 0.1
29+
adaptive_max_exploration: 0.7
30+
31+
# Softmax sampling for exploitation
32+
exploitation_temperature: 1.0
33+
34+
# Stagnation detection and multi-child generation
35+
stagnation_threshold: 10
36+
stagnation_multi_child_count: 3
37+
sibling_context_limit: 5
38+
39+
# ============================================
40+
# AutoEvolve Advanced Features (Sky Lab UC Berkeley)
41+
# ============================================
42+
43+
# Paradigm Breakthrough
44+
enable_paradigm_breakthrough: true
45+
stagnation_window: 5
46+
stagnation_improvement_threshold: 0.01
47+
stagnation_paradigm_samples: 3
48+
paradigm_model: "gpt-5-mini"
49+
paradigm_api_base: "https://east-docetl.openai.azure.com/openai/deployments/gpt-4.1?api-version=2024-12-01-preview"
50+
paradigm_api_key: "${OPENAI_API_KEY}"
51+
52+
# Error Retry
53+
enable_error_retry: true
54+
max_error_retries: 2
55+
56+
evaluator:
57+
timeout: 360
58+
max_retries: 3
59+
60+
# Prompt configuration
61+
prompt:
62+
system_message: |
63+
SETTING:
64+
You are an expert in harmonic analysis, numerical optimization, and AI-driven mathematical discovery.
65+
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₅.
66+
67+
PROBLEM CONTEXT:
68+
Target: Find a step function h: [0, 2] → [0, 1] that **minimizes** the objective:
69+
max_k ∫ h(x)(1 - h(x+k)) dx
70+
71+
This minimal value provides a tight upper bound for the constant C5.
72+
73+
Current best known upper bound: C5 ≤ 0.38092303510845016
74+
Goal: Find a step function `h` that results in a C5 value lower than 0.38092303510845016.
75+
76+
CONSTRAINTS:
77+
1. The function `h` must have values in the range [0, 1].
78+
2. The integral of h(x) over [0, 2] must be exactly 1.
79+
80+
PERFORMANCE METRICS:
81+
- c5_bound: The bound found by the program.
82+
- combined_score: 0.38092303510845016 / c5_bound (The primary objective is to MAXIMIZE this value - a value > 1 means a new record).
83+
- n_points: number of points used in the discretization.
84+
- eval_time: evaluation time of the program.
85+
86+
num_top_programs: 3
87+
num_diverse_programs: 2
88+
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# Evolution settings
2+
max_iterations: 200
3+
checkpoint_interval: 10
4+
log_level: "INFO"
5+
6+
# LLM configuration (Gemini)
7+
llm:
8+
primary_model: "gemini-3-pro-preview"
9+
api_base: "https://generativelanguage.googleapis.com/v1beta/openai/"
10+
api_key: "${OPENAI_API_KEY}"
11+
primary_model_weight: 1.0
12+
temperature: 0.7
13+
max_tokens: 32000
14+
timeout: 600
15+
16+
# Database configuration (MAP-Elites algorithm)
17+
database:
18+
population_size: 40
19+
num_islands: 5
20+
migration_interval: 40
21+
feature_dimensions:
22+
- "score"
23+
- "complexity"
24+
25+
# Adaptive exploration settings
26+
use_adaptive_search: true
27+
adaptive_window_size: 20
28+
adaptive_min_exploration: 0.1
29+
adaptive_max_exploration: 0.7
30+
31+
# Softmax sampling for exploitation
32+
exploitation_temperature: 1.0
33+
34+
# Stagnation detection and multi-child generation
35+
stagnation_threshold: 10
36+
stagnation_multi_child_count: 3
37+
sibling_context_limit: 5
38+
39+
# ============================================
40+
# AutoEvolve Advanced Features (Sky Lab UC Berkeley)
41+
# ============================================
42+
43+
# Paradigm Breakthrough
44+
enable_paradigm_breakthrough: true
45+
stagnation_window: 5
46+
stagnation_improvement_threshold: 0.01
47+
stagnation_paradigm_samples: 3
48+
paradigm_model: "gpt-5-mini"
49+
paradigm_api_base: "https://east-docetl.openai.azure.com/openai/deployments/gpt-4.1?api-version=2024-12-01-preview"
50+
paradigm_api_key: "${PARADIGM_API_KEY}"
51+
52+
# Error Retry
53+
enable_error_retry: true
54+
max_error_retries: 2
55+
56+
evaluator:
57+
timeout: 360
58+
max_retries: 3
59+
60+
# Prompt configuration
61+
prompt:
62+
system_message: |
63+
SETTING:
64+
You are an expert in harmonic analysis, numerical optimization, and AI-driven mathematical discovery.
65+
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₅.
66+
67+
PROBLEM CONTEXT:
68+
Target: Find a step function h: [0, 2] → [0, 1] that **minimizes** the objective:
69+
max_k ∫ h(x)(1 - h(x+k)) dx
70+
71+
This minimal value provides a tight upper bound for the constant C5.
72+
73+
Current best known upper bound: C5 ≤ 0.38092303510845016
74+
Goal: Find a step function `h` that results in a C5 value lower than 0.38092303510845016.
75+
76+
CONSTRAINTS:
77+
1. The function `h` must have values in the range [0, 1].
78+
2. The integral of h(x) over [0, 2] must be exactly 1.
79+
80+
PERFORMANCE METRICS:
81+
- c5_bound: The bound found by the program.
82+
- combined_score: 0.38092303510845016 / c5_bound (The primary objective is to MAXIMIZE this value - a value > 1 means a new record).
83+
- n_points: number of points used in the discretization.
84+
- eval_time: evaluation time of the program.
85+
86+
num_top_programs: 3
87+
num_diverse_programs: 2
88+

0 commit comments

Comments
 (0)