File size: 1,962 Bytes
ea8c728 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | #!/usr/bin/env bash
# Run all math examples with OpenEvolve using Claude Opus 4.6
# Usage: ./run_all_math.sh [problem_name]
# Without args: runs all 17 math problems sequentially
# With arg: runs only the specified problem (e.g., ./run_all_math.sh circle_packing)
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
OPENEVOLVE_DIR="$(cd "$SCRIPT_DIR/../.." && pwd)"
RUNNER="$OPENEVOLVE_DIR/openevolve-run.py"
# Load .env if present (for ANTHROPIC_API_KEY)
if [ -f "$OPENEVOLVE_DIR/.env" ]; then
set -a; source "$OPENEVOLVE_DIR/.env"; set +a
fi
if [ -z "${ANTHROPIC_API_KEY:-}" ]; then
echo "ERROR: ANTHROPIC_API_KEY not set. Export it or add to $OPENEVOLVE_DIR/.env"
exit 1
fi
PROBLEMS=(
circle_packing
circle_packing_rect
erdos_min_overlap
first_autocorr_ineq
heilbronn_convex_13
heilbronn_convex_14
heilbronn_triangle
hexagon_packing_11
hexagon_packing_12
matmul
minimizing_max_min_dist_2d
minimizing_max_min_dist_3d
second_autocorr_ineq
signal_processing
sums_diffs_finite_sets
third_autocorr_ineq
uncertainty_ineq
)
# Filter to single problem if specified
if [ $# -ge 1 ]; then
PROBLEMS=("$1")
fi
for problem in "${PROBLEMS[@]}"; do
PROBLEM_DIR="$SCRIPT_DIR/$problem"
if [ ! -d "$PROBLEM_DIR" ]; then
echo "SKIP: $problem (directory not found)"
continue
fi
echo "========================================"
echo "Running: $problem"
echo "========================================"
OUTPUT_DIR="$PROBLEM_DIR/openevolve_output"
mkdir -p "$OUTPUT_DIR"
python "$RUNNER" \
"$PROBLEM_DIR/initial_program.py" \
"$PROBLEM_DIR/evaluator.py" \
--config "$PROBLEM_DIR/config.yaml" \
--output "$OUTPUT_DIR" \
--iterations 100 \
2>&1 | tee "$PROBLEM_DIR/evolution.log"
echo "Finished: $problem"
echo ""
done
echo "All math problems complete!"
|