-
Notifications
You must be signed in to change notification settings - Fork 950
Expand file tree
/
Copy pathscripts.sh
More file actions
82 lines (70 loc) · 3.08 KB
/
scripts.sh
File metadata and controls
82 lines (70 loc) · 3.08 KB
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
75
76
77
78
79
80
81
82
#!/bin/bash
# Define the number of problems for each split
declare -A split_counts=(
["bio_pop_growth"]=24
["chem_react"]=36
["matsci"]=25
["phys_osc"]=44
)
declare -A split_problem_dir_prefixes=(
["bio_pop_growth"]="BPG"
["chem_react"]="CRK"
["matsci"]="MatSci"
["phys_osc"]="PO"
)
base_problems_dir="./problems"
echo "Starting all experiments..."
for split_name in "${!split_counts[@]}"; do
count=${split_counts[$split_name]}
problem_dir_prefix=${split_problem_dir_prefixes[$split_name]}
# Check if a prefix is defined (it can be an empty string if paths are like "split_name/0/")
if [ -z "$problem_dir_prefix" ] && [ "${split_problem_dir_prefixes[$split_name]+_}" != "_" ]; then
# This means the key exists but the value is an empty string, which is allowed.
: # Do nothing, empty prefix is fine.
elif [ -z "$problem_dir_prefix" ]; then
echo ""
echo "Warning: No problem directory prefix defined for split '$split_name' in 'split_problem_dir_prefixes'. Skipping this split."
continue
fi
echo ""
echo "----------------------------------------------------"
echo "Processing Split: $split_name"
echo "Number of problems: $count"
echo "Problem directory prefix: '$problem_dir_prefix'" # Prefix like CRK, BPG, etc.
echo "Expected problem path structure: $base_problems_dir/$split_name/${problem_dir_prefix}[ID]/"
echo "----------------------------------------------------"
# Loop from problem_id 0 to count-1
for (( i=0; i<count; i++ )); do
# Construct the path to the specific problem's directory
# e.g., ./examples/symbolic_regression/problems/chem_react/CRK0
problem_dir="$base_problems_dir/$split_name/$problem_dir_prefix$i"
initial_program_path="$problem_dir/initial_program.py"
evaluator_path="$problem_dir/evaluator.py"
config_path="$problem_dir/config.yaml" # Assumes 'config.yaml' as in your original script
# --- Sanity checks for file existence (optional but recommended) ---
if [[ ! -f "$initial_program_path" ]]; then
echo " [Problem $i] SKIPPING: Initial program not found at $initial_program_path"
continue
fi
if [[ ! -f "$evaluator_path" ]]; then
echo " [Problem $i] SKIPPING: Evaluator not found at $evaluator_path"
continue
fi
if [[ ! -f "$config_path" ]]; then
echo " [Problem $i] SKIPPING: Config file not found at $config_path"
continue
fi
# --- End Sanity checks ---
echo " Launching $split_name - Problem $i ($initial_program_path)"
# Run the experiment in the background
cmd="python ../../openevolve-run.py "$initial_program_path" "$evaluator_path" --config "$config_path" --iterations 200"
eval $cmd &
done
wait # let's do split by split
done
echo ""
echo "All experiment processes have been launched in the background."
echo "Waiting for all background processes to complete..."
wait
echo ""
echo "All experiments have completed."