From 32300d734601f97f872d28d81b7818bd10e46f7c Mon Sep 17 00:00:00 2001 From: Acquent0 <12232633@mail.sustech.edu.cn> Date: Tue, 10 Mar 2026 01:44:17 +0800 Subject: [PATCH 1/2] add more examples --- example/acrobot/run_eoh.py | 34 +++++++++++++++++++ example/admissible_set/run_eoh.py | 34 +++++++++++++++++++ example/bactgrow/run_eoh.py | 34 +++++++++++++++++++ example/bp_1d_construct/run_eoh.py | 34 +++++++++++++++++++ example/bp_2d_construct/run_eoh.py | 34 +++++++++++++++++++ example/car_mountain/run_eoh.py | 34 +++++++++++++++++++ example/car_mountain_continue/run_eoh.py | 34 +++++++++++++++++++ example/cflp_construct/run_eoh.py | 34 +++++++++++++++++++ example/feynman_srsd/run_eoh.py | 34 +++++++++++++++++++ example/graph_colouring_co_bench/run_eoh.py | 34 +++++++++++++++++++ example/jssp_construct/run_eoh.py | 34 +++++++++++++++++++ example/knapsack_construct/run_eoh.py | 34 +++++++++++++++++++ .../run_eoh.py | 34 +++++++++++++++++++ example/moon_lander/run_eoh.py | 34 +++++++++++++++++++ example/ode_1d/run_eoh.py | 34 +++++++++++++++++++ example/online_bin_packing_2O/run_eoh.py | 34 +++++++++++++++++++ example/oscillator1/run_eoh.py | 34 +++++++++++++++++++ example/oscillator2/run_eoh.py | 34 +++++++++++++++++++ example/ovrp_construct/run_eoh.py | 34 +++++++++++++++++++ example/pendulum/run_eoh.py | 34 +++++++++++++++++++ example/qap_construct/run_eoh.py | 34 +++++++++++++++++++ example/set_cover_construct/run_eoh.py | 34 +++++++++++++++++++ example/stresstrain/run_eoh.py | 34 +++++++++++++++++++ example/tsp_gls_2O/run_eoh.py | 34 +++++++++++++++++++ .../run_eoh.py | 34 +++++++++++++++++++ 25 files changed, 850 insertions(+) create mode 100644 example/acrobot/run_eoh.py create mode 100644 example/admissible_set/run_eoh.py create mode 100644 example/bactgrow/run_eoh.py create mode 100644 example/bp_1d_construct/run_eoh.py create mode 100644 example/bp_2d_construct/run_eoh.py create mode 100644 example/car_mountain/run_eoh.py create mode 100644 example/car_mountain_continue/run_eoh.py create mode 100644 example/cflp_construct/run_eoh.py create mode 100644 example/feynman_srsd/run_eoh.py create mode 100644 example/graph_colouring_co_bench/run_eoh.py create mode 100644 example/jssp_construct/run_eoh.py create mode 100644 example/knapsack_construct/run_eoh.py create mode 100644 example/maximal_independent_set_co_bench/run_eoh.py create mode 100644 example/moon_lander/run_eoh.py create mode 100644 example/ode_1d/run_eoh.py create mode 100644 example/online_bin_packing_2O/run_eoh.py create mode 100644 example/oscillator1/run_eoh.py create mode 100644 example/oscillator2/run_eoh.py create mode 100644 example/ovrp_construct/run_eoh.py create mode 100644 example/pendulum/run_eoh.py create mode 100644 example/qap_construct/run_eoh.py create mode 100644 example/set_cover_construct/run_eoh.py create mode 100644 example/stresstrain/run_eoh.py create mode 100644 example/tsp_gls_2O/run_eoh.py create mode 100644 example/vehicle_routing_period_routing_co_bench/run_eoh.py diff --git a/example/acrobot/run_eoh.py b/example/acrobot/run_eoh.py new file mode 100644 index 00000000..d85bd0f4 --- /dev/null +++ b/example/acrobot/run_eoh.py @@ -0,0 +1,34 @@ +### Test Only ### +# Set system path + +import sys + +sys.path.append('../../') # This is for finding all the modules + +from llm4ad.task.machine_learning.acrobot import AcrobotEvaluation +from llm4ad.tools.llm.llm_api_https import HttpsApi +from llm4ad.method.eoh import EoH, EoHProfiler + + +def main(): + llm = HttpsApi(host='xxx', # your host endpoint, e.g., 'api.openai.com', 'api.deepseek.com' + key='sk-xxx', # your key, e.g., 'sk-abcdefghijklmn' + model='xxx', # your llm, e.g., 'gpt-3.5-turbo' + timeout=100) + + task = AcrobotEvaluation() + + method = EoH(llm=llm, + profiler=EoHProfiler(log_dir='logs', log_style='complex'), + evaluation=task, + max_sample_nums=100, + max_generations=10, + pop_size=20, + num_samplers=4, + num_evaluators=4) + + method.run() + + +if __name__ == '__main__': + main() diff --git a/example/admissible_set/run_eoh.py b/example/admissible_set/run_eoh.py new file mode 100644 index 00000000..8043cd1d --- /dev/null +++ b/example/admissible_set/run_eoh.py @@ -0,0 +1,34 @@ +### Test Only ### +# Set system path + +import sys + +sys.path.append('../../') # This is for finding all the modules + +from llm4ad.task.optimization.admissible_set import ASPEvaluation +from llm4ad.tools.llm.llm_api_https import HttpsApi +from llm4ad.method.eoh import EoH, EoHProfiler + + +def main(): + llm = HttpsApi(host='xxx', # your host endpoint, e.g., 'api.openai.com', 'api.deepseek.com' + key='sk-xxx', # your key, e.g., 'sk-abcdefghijklmn' + model='xxx', # your llm, e.g., 'gpt-3.5-turbo' + timeout=100) + + task = ASPEvaluation() + + method = EoH(llm=llm, + profiler=EoHProfiler(log_dir='logs', log_style='complex'), + evaluation=task, + max_sample_nums=100, + max_generations=10, + pop_size=20, + num_samplers=4, + num_evaluators=4) + + method.run() + + +if __name__ == '__main__': + main() diff --git a/example/bactgrow/run_eoh.py b/example/bactgrow/run_eoh.py new file mode 100644 index 00000000..61450501 --- /dev/null +++ b/example/bactgrow/run_eoh.py @@ -0,0 +1,34 @@ +### Test Only ### +# Set system path + +import sys + +sys.path.append('../../') # This is for finding all the modules + +from llm4ad.task.science_discovery.bactgrow import BGEvaluation +from llm4ad.tools.llm.llm_api_https import HttpsApi +from llm4ad.method.eoh import EoH, EoHProfiler + + +def main(): + llm = HttpsApi(host='xxx', # your host endpoint, e.g., 'api.openai.com', 'api.deepseek.com' + key='sk-xxx', # your key, e.g., 'sk-abcdefghijklmn' + model='xxx', # your llm, e.g., 'gpt-3.5-turbo' + timeout=100) + + task = BGEvaluation() + + method = EoH(llm=llm, + profiler=EoHProfiler(log_dir='logs', log_style='complex'), + evaluation=task, + max_sample_nums=100, + max_generations=10, + pop_size=20, + num_samplers=4, + num_evaluators=4) + + method.run() + + +if __name__ == '__main__': + main() diff --git a/example/bp_1d_construct/run_eoh.py b/example/bp_1d_construct/run_eoh.py new file mode 100644 index 00000000..27e6abc7 --- /dev/null +++ b/example/bp_1d_construct/run_eoh.py @@ -0,0 +1,34 @@ +### Test Only ### +# Set system path + +import sys + +sys.path.append('../../') # This is for finding all the modules + +from llm4ad.task.optimization.bp_1d_construct import BP1DEvaluation +from llm4ad.tools.llm.llm_api_https import HttpsApi +from llm4ad.method.eoh import EoH, EoHProfiler + + +def main(): + llm = HttpsApi(host='xxx', # your host endpoint, e.g., 'api.openai.com', 'api.deepseek.com' + key='sk-xxx', # your key, e.g., 'sk-abcdefghijklmn' + model='xxx', # your llm, e.g., 'gpt-3.5-turbo' + timeout=100) + + task = BP1DEvaluation() + + method = EoH(llm=llm, + profiler=EoHProfiler(log_dir='logs', log_style='complex'), + evaluation=task, + max_sample_nums=100, + max_generations=10, + pop_size=20, + num_samplers=4, + num_evaluators=4) + + method.run() + + +if __name__ == '__main__': + main() diff --git a/example/bp_2d_construct/run_eoh.py b/example/bp_2d_construct/run_eoh.py new file mode 100644 index 00000000..5ed013ee --- /dev/null +++ b/example/bp_2d_construct/run_eoh.py @@ -0,0 +1,34 @@ +### Test Only ### +# Set system path + +import sys + +sys.path.append('../../') # This is for finding all the modules + +from llm4ad.task.optimization.bp_2d_construct import BP2DEvaluation +from llm4ad.tools.llm.llm_api_https import HttpsApi +from llm4ad.method.eoh import EoH, EoHProfiler + + +def main(): + llm = HttpsApi(host='xxx', # your host endpoint, e.g., 'api.openai.com', 'api.deepseek.com' + key='sk-xxx', # your key, e.g., 'sk-abcdefghijklmn' + model='xxx', # your llm, e.g., 'gpt-3.5-turbo' + timeout=100) + + task = BP2DEvaluation() + + method = EoH(llm=llm, + profiler=EoHProfiler(log_dir='logs', log_style='complex'), + evaluation=task, + max_sample_nums=100, + max_generations=10, + pop_size=20, + num_samplers=4, + num_evaluators=4) + + method.run() + + +if __name__ == '__main__': + main() diff --git a/example/car_mountain/run_eoh.py b/example/car_mountain/run_eoh.py new file mode 100644 index 00000000..8418ac3e --- /dev/null +++ b/example/car_mountain/run_eoh.py @@ -0,0 +1,34 @@ +### Test Only ### +# Set system path + +import sys + +sys.path.append('../../') # This is for finding all the modules + +from llm4ad.task.machine_learning.car_mountain import CarMountainEvaluation +from llm4ad.tools.llm.llm_api_https import HttpsApi +from llm4ad.method.eoh import EoH, EoHProfiler + + +def main(): + llm = HttpsApi(host='xxx', # your host endpoint, e.g., 'api.openai.com', 'api.deepseek.com' + key='sk-xxx', # your key, e.g., 'sk-abcdefghijklmn' + model='xxx', # your llm, e.g., 'gpt-3.5-turbo' + timeout=100) + + task = CarMountainEvaluation() + + method = EoH(llm=llm, + profiler=EoHProfiler(log_dir='logs', log_style='complex'), + evaluation=task, + max_sample_nums=100, + max_generations=10, + pop_size=20, + num_samplers=4, + num_evaluators=4) + + method.run() + + +if __name__ == '__main__': + main() diff --git a/example/car_mountain_continue/run_eoh.py b/example/car_mountain_continue/run_eoh.py new file mode 100644 index 00000000..1701986f --- /dev/null +++ b/example/car_mountain_continue/run_eoh.py @@ -0,0 +1,34 @@ +### Test Only ### +# Set system path + +import sys + +sys.path.append('../../') # This is for finding all the modules + +from llm4ad.task.machine_learning.car_mountain_continue import CarMountainCEvaluation +from llm4ad.tools.llm.llm_api_https import HttpsApi +from llm4ad.method.eoh import EoH, EoHProfiler + + +def main(): + llm = HttpsApi(host='xxx', # your host endpoint, e.g., 'api.openai.com', 'api.deepseek.com' + key='sk-xxx', # your key, e.g., 'sk-abcdefghijklmn' + model='xxx', # your llm, e.g., 'gpt-3.5-turbo' + timeout=100) + + task = CarMountainCEvaluation() + + method = EoH(llm=llm, + profiler=EoHProfiler(log_dir='logs', log_style='complex'), + evaluation=task, + max_sample_nums=100, + max_generations=10, + pop_size=20, + num_samplers=4, + num_evaluators=4) + + method.run() + + +if __name__ == '__main__': + main() diff --git a/example/cflp_construct/run_eoh.py b/example/cflp_construct/run_eoh.py new file mode 100644 index 00000000..4b48011c --- /dev/null +++ b/example/cflp_construct/run_eoh.py @@ -0,0 +1,34 @@ +### Test Only ### +# Set system path + +import sys + +sys.path.append('../../') # This is for finding all the modules + +from llm4ad.task.optimization.cflp_construct import CFLPEvaluation +from llm4ad.tools.llm.llm_api_https import HttpsApi +from llm4ad.method.eoh import EoH, EoHProfiler + + +def main(): + llm = HttpsApi(host='xxx', # your host endpoint, e.g., 'api.openai.com', 'api.deepseek.com' + key='sk-xxx', # your key, e.g., 'sk-abcdefghijklmn' + model='xxx', # your llm, e.g., 'gpt-3.5-turbo' + timeout=100) + + task = CFLPEvaluation() + + method = EoH(llm=llm, + profiler=EoHProfiler(log_dir='logs', log_style='complex'), + evaluation=task, + max_sample_nums=100, + max_generations=10, + pop_size=20, + num_samplers=4, + num_evaluators=4) + + method.run() + + +if __name__ == '__main__': + main() diff --git a/example/feynman_srsd/run_eoh.py b/example/feynman_srsd/run_eoh.py new file mode 100644 index 00000000..95c4bbfc --- /dev/null +++ b/example/feynman_srsd/run_eoh.py @@ -0,0 +1,34 @@ +### Test Only ### +# Set system path + +import sys + +sys.path.append('../../') # This is for finding all the modules + +from llm4ad.task.science_discovery.feynman_srsd import FeynmanEvaluation +from llm4ad.tools.llm.llm_api_https import HttpsApi +from llm4ad.method.eoh import EoH, EoHProfiler + + +def main(): + llm = HttpsApi(host='xxx', # your host endpoint, e.g., 'api.openai.com', 'api.deepseek.com' + key='sk-xxx', # your key, e.g., 'sk-abcdefghijklmn' + model='xxx', # your llm, e.g., 'gpt-3.5-turbo' + timeout=100) + + task = FeynmanEvaluation() + + method = EoH(llm=llm, + profiler=EoHProfiler(log_dir='logs', log_style='complex'), + evaluation=task, + max_sample_nums=100, + max_generations=10, + pop_size=20, + num_samplers=4, + num_evaluators=4) + + method.run() + + +if __name__ == '__main__': + main() diff --git a/example/graph_colouring_co_bench/run_eoh.py b/example/graph_colouring_co_bench/run_eoh.py new file mode 100644 index 00000000..97e810aa --- /dev/null +++ b/example/graph_colouring_co_bench/run_eoh.py @@ -0,0 +1,34 @@ +### Test Only ### +# Set system path + +import sys + +sys.path.append('../../') # This is for finding all the modules + +from llm4ad.task.optimization.co_bench.graph_colouring_co_bench import GCEvaluationCB +from llm4ad.tools.llm.llm_api_https import HttpsApi +from llm4ad.method.eoh import EoH, EoHProfiler + + +def main(): + llm = HttpsApi(host='xxx', # your host endpoint, e.g., 'api.openai.com', 'api.deepseek.com' + key='sk-xxx', # your key, e.g., 'sk-abcdefghijklmn' + model='xxx', # your llm, e.g., 'gpt-3.5-turbo' + timeout=100) + + task = GCEvaluationCB() + + method = EoH(llm=llm, + profiler=EoHProfiler(log_dir='logs', log_style='complex'), + evaluation=task, + max_sample_nums=100, + max_generations=10, + pop_size=20, + num_samplers=4, + num_evaluators=4) + + method.run() + + +if __name__ == '__main__': + main() diff --git a/example/jssp_construct/run_eoh.py b/example/jssp_construct/run_eoh.py new file mode 100644 index 00000000..5dfe038e --- /dev/null +++ b/example/jssp_construct/run_eoh.py @@ -0,0 +1,34 @@ +### Test Only ### +# Set system path + +import sys + +sys.path.append('../../') # This is for finding all the modules + +from llm4ad.task.optimization.jssp_construct import JSSPEvaluation +from llm4ad.tools.llm.llm_api_https import HttpsApi +from llm4ad.method.eoh import EoH, EoHProfiler + + +def main(): + llm = HttpsApi(host='xxx', # your host endpoint, e.g., 'api.openai.com', 'api.deepseek.com' + key='sk-xxx', # your key, e.g., 'sk-abcdefghijklmn' + model='xxx', # your llm, e.g., 'gpt-3.5-turbo' + timeout=100) + + task = JSSPEvaluation() + + method = EoH(llm=llm, + profiler=EoHProfiler(log_dir='logs', log_style='complex'), + evaluation=task, + max_sample_nums=100, + max_generations=10, + pop_size=20, + num_samplers=4, + num_evaluators=4) + + method.run() + + +if __name__ == '__main__': + main() diff --git a/example/knapsack_construct/run_eoh.py b/example/knapsack_construct/run_eoh.py new file mode 100644 index 00000000..f73b4d2a --- /dev/null +++ b/example/knapsack_construct/run_eoh.py @@ -0,0 +1,34 @@ +### Test Only ### +# Set system path + +import sys + +sys.path.append('../../') # This is for finding all the modules + +from llm4ad.task.optimization.knapsack_construct import KnapsackEvaluation +from llm4ad.tools.llm.llm_api_https import HttpsApi +from llm4ad.method.eoh import EoH, EoHProfiler + + +def main(): + llm = HttpsApi(host='xxx', # your host endpoint, e.g., 'api.openai.com', 'api.deepseek.com' + key='sk-xxx', # your key, e.g., 'sk-abcdefghijklmn' + model='xxx', # your llm, e.g., 'gpt-3.5-turbo' + timeout=100) + + task = KnapsackEvaluation() + + method = EoH(llm=llm, + profiler=EoHProfiler(log_dir='logs', log_style='complex'), + evaluation=task, + max_sample_nums=100, + max_generations=10, + pop_size=20, + num_samplers=4, + num_evaluators=4) + + method.run() + + +if __name__ == '__main__': + main() diff --git a/example/maximal_independent_set_co_bench/run_eoh.py b/example/maximal_independent_set_co_bench/run_eoh.py new file mode 100644 index 00000000..4725c66d --- /dev/null +++ b/example/maximal_independent_set_co_bench/run_eoh.py @@ -0,0 +1,34 @@ +### Test Only ### +# Set system path + +import sys + +sys.path.append('../../') # This is for finding all the modules + +from llm4ad.task.optimization.co_bench.maximal_independent_set_co_bench import MISEvaluationCB +from llm4ad.tools.llm.llm_api_https import HttpsApi +from llm4ad.method.eoh import EoH, EoHProfiler + + +def main(): + llm = HttpsApi(host='xxx', # your host endpoint, e.g., 'api.openai.com', 'api.deepseek.com' + key='sk-xxx', # your key, e.g., 'sk-abcdefghijklmn' + model='xxx', # your llm, e.g., 'gpt-3.5-turbo' + timeout=100) + + task = MISEvaluationCB() + + method = EoH(llm=llm, + profiler=EoHProfiler(log_dir='logs', log_style='complex'), + evaluation=task, + max_sample_nums=100, + max_generations=10, + pop_size=20, + num_samplers=4, + num_evaluators=4) + + method.run() + + +if __name__ == '__main__': + main() diff --git a/example/moon_lander/run_eoh.py b/example/moon_lander/run_eoh.py new file mode 100644 index 00000000..9699089b --- /dev/null +++ b/example/moon_lander/run_eoh.py @@ -0,0 +1,34 @@ +### Test Only ### +# Set system path + +import sys + +sys.path.append('../../') # This is for finding all the modules + +from llm4ad.task.machine_learning.moon_lander import MoonLanderEvaluation +from llm4ad.tools.llm.llm_api_https import HttpsApi +from llm4ad.method.eoh import EoH, EoHProfiler + + +def main(): + llm = HttpsApi(host='xxx', # your host endpoint, e.g., 'api.openai.com', 'api.deepseek.com' + key='sk-xxx', # your key, e.g., 'sk-abcdefghijklmn' + model='xxx', # your llm, e.g., 'gpt-3.5-turbo' + timeout=100) + + task = MoonLanderEvaluation() + + method = EoH(llm=llm, + profiler=EoHProfiler(log_dir='logs', log_style='complex'), + evaluation=task, + max_sample_nums=100, + max_generations=10, + pop_size=20, + num_samplers=4, + num_evaluators=4) + + method.run() + + +if __name__ == '__main__': + main() diff --git a/example/ode_1d/run_eoh.py b/example/ode_1d/run_eoh.py new file mode 100644 index 00000000..f3023e1c --- /dev/null +++ b/example/ode_1d/run_eoh.py @@ -0,0 +1,34 @@ +### Test Only ### +# Set system path + +import sys + +sys.path.append('../../') # This is for finding all the modules + +from llm4ad.task.science_discovery.ode_1d import ODEEvaluation +from llm4ad.tools.llm.llm_api_https import HttpsApi +from llm4ad.method.eoh import EoH, EoHProfiler + + +def main(): + llm = HttpsApi(host='xxx', # your host endpoint, e.g., 'api.openai.com', 'api.deepseek.com' + key='sk-xxx', # your key, e.g., 'sk-abcdefghijklmn' + model='xxx', # your llm, e.g., 'gpt-3.5-turbo' + timeout=100) + + task = ODEEvaluation() + + method = EoH(llm=llm, + profiler=EoHProfiler(log_dir='logs', log_style='complex'), + evaluation=task, + max_sample_nums=100, + max_generations=10, + pop_size=20, + num_samplers=4, + num_evaluators=4) + + method.run() + + +if __name__ == '__main__': + main() diff --git a/example/online_bin_packing_2O/run_eoh.py b/example/online_bin_packing_2O/run_eoh.py new file mode 100644 index 00000000..67918b2e --- /dev/null +++ b/example/online_bin_packing_2O/run_eoh.py @@ -0,0 +1,34 @@ +### Test Only ### +# Set system path + +import sys + +sys.path.append('../../') # This is for finding all the modules + +from llm4ad.task.optimization.online_bin_packing_2O import OBP_2O_Evaluation +from llm4ad.tools.llm.llm_api_https import HttpsApi +from llm4ad.method.eoh import EoH, EoHProfiler + + +def main(): + llm = HttpsApi(host='xxx', # your host endpoint, e.g., 'api.openai.com', 'api.deepseek.com' + key='sk-xxx', # your key, e.g., 'sk-abcdefghijklmn' + model='xxx', # your llm, e.g., 'gpt-3.5-turbo' + timeout=100) + + task = OBP_2O_Evaluation() + + method = EoH(llm=llm, + profiler=EoHProfiler(log_dir='logs', log_style='complex'), + evaluation=task, + max_sample_nums=100, + max_generations=10, + pop_size=20, + num_samplers=4, + num_evaluators=4) + + method.run() + + +if __name__ == '__main__': + main() diff --git a/example/oscillator1/run_eoh.py b/example/oscillator1/run_eoh.py new file mode 100644 index 00000000..06b7f10a --- /dev/null +++ b/example/oscillator1/run_eoh.py @@ -0,0 +1,34 @@ +### Test Only ### +# Set system path + +import sys + +sys.path.append('../../') # This is for finding all the modules + +from llm4ad.task.science_discovery.oscillator1 import OscillatorEvaluation1 +from llm4ad.tools.llm.llm_api_https import HttpsApi +from llm4ad.method.eoh import EoH, EoHProfiler + + +def main(): + llm = HttpsApi(host='xxx', # your host endpoint, e.g., 'api.openai.com', 'api.deepseek.com' + key='sk-xxx', # your key, e.g., 'sk-abcdefghijklmn' + model='xxx', # your llm, e.g., 'gpt-3.5-turbo' + timeout=100) + + task = OscillatorEvaluation1() + + method = EoH(llm=llm, + profiler=EoHProfiler(log_dir='logs', log_style='complex'), + evaluation=task, + max_sample_nums=100, + max_generations=10, + pop_size=20, + num_samplers=4, + num_evaluators=4) + + method.run() + + +if __name__ == '__main__': + main() diff --git a/example/oscillator2/run_eoh.py b/example/oscillator2/run_eoh.py new file mode 100644 index 00000000..386e594e --- /dev/null +++ b/example/oscillator2/run_eoh.py @@ -0,0 +1,34 @@ +### Test Only ### +# Set system path + +import sys + +sys.path.append('../../') # This is for finding all the modules + +from llm4ad.task.science_discovery.oscillator2 import OscillatorEvaluation2 +from llm4ad.tools.llm.llm_api_https import HttpsApi +from llm4ad.method.eoh import EoH, EoHProfiler + + +def main(): + llm = HttpsApi(host='xxx', # your host endpoint, e.g., 'api.openai.com', 'api.deepseek.com' + key='sk-xxx', # your key, e.g., 'sk-abcdefghijklmn' + model='xxx', # your llm, e.g., 'gpt-3.5-turbo' + timeout=100) + + task = OscillatorEvaluation2() + + method = EoH(llm=llm, + profiler=EoHProfiler(log_dir='logs', log_style='complex'), + evaluation=task, + max_sample_nums=100, + max_generations=10, + pop_size=20, + num_samplers=4, + num_evaluators=4) + + method.run() + + +if __name__ == '__main__': + main() diff --git a/example/ovrp_construct/run_eoh.py b/example/ovrp_construct/run_eoh.py new file mode 100644 index 00000000..771e30b5 --- /dev/null +++ b/example/ovrp_construct/run_eoh.py @@ -0,0 +1,34 @@ +### Test Only ### +# Set system path + +import sys + +sys.path.append('../../') # This is for finding all the modules + +from llm4ad.task.optimization.ovrp_construct import OVRPEvaluation +from llm4ad.tools.llm.llm_api_https import HttpsApi +from llm4ad.method.eoh import EoH, EoHProfiler + + +def main(): + llm = HttpsApi(host='xxx', # your host endpoint, e.g., 'api.openai.com', 'api.deepseek.com' + key='sk-xxx', # your key, e.g., 'sk-abcdefghijklmn' + model='xxx', # your llm, e.g., 'gpt-3.5-turbo' + timeout=100) + + task = OVRPEvaluation() + + method = EoH(llm=llm, + profiler=EoHProfiler(log_dir='logs', log_style='complex'), + evaluation=task, + max_sample_nums=100, + max_generations=10, + pop_size=20, + num_samplers=4, + num_evaluators=4) + + method.run() + + +if __name__ == '__main__': + main() diff --git a/example/pendulum/run_eoh.py b/example/pendulum/run_eoh.py new file mode 100644 index 00000000..a1ffd102 --- /dev/null +++ b/example/pendulum/run_eoh.py @@ -0,0 +1,34 @@ +### Test Only ### +# Set system path + +import sys + +sys.path.append('../../') # This is for finding all the modules + +from llm4ad.task.machine_learning.pendulum import PendulumEvaluation +from llm4ad.tools.llm.llm_api_https import HttpsApi +from llm4ad.method.eoh import EoH, EoHProfiler + + +def main(): + llm = HttpsApi(host='xxx', # your host endpoint, e.g., 'api.openai.com', 'api.deepseek.com' + key='sk-xxx', # your key, e.g., 'sk-abcdefghijklmn' + model='xxx', # your llm, e.g., 'gpt-3.5-turbo' + timeout=100) + + task = PendulumEvaluation() + + method = EoH(llm=llm, + profiler=EoHProfiler(log_dir='logs', log_style='complex'), + evaluation=task, + max_sample_nums=100, + max_generations=10, + pop_size=20, + num_samplers=4, + num_evaluators=4) + + method.run() + + +if __name__ == '__main__': + main() diff --git a/example/qap_construct/run_eoh.py b/example/qap_construct/run_eoh.py new file mode 100644 index 00000000..64a86e6e --- /dev/null +++ b/example/qap_construct/run_eoh.py @@ -0,0 +1,34 @@ +### Test Only ### +# Set system path + +import sys + +sys.path.append('../../') # This is for finding all the modules + +from llm4ad.task.optimization.qap_construct import QAPEvaluation +from llm4ad.tools.llm.llm_api_https import HttpsApi +from llm4ad.method.eoh import EoH, EoHProfiler + + +def main(): + llm = HttpsApi(host='xxx', # your host endpoint, e.g., 'api.openai.com', 'api.deepseek.com' + key='sk-xxx', # your key, e.g., 'sk-abcdefghijklmn' + model='xxx', # your llm, e.g., 'gpt-3.5-turbo' + timeout=100) + + task = QAPEvaluation() + + method = EoH(llm=llm, + profiler=EoHProfiler(log_dir='logs', log_style='complex'), + evaluation=task, + max_sample_nums=100, + max_generations=10, + pop_size=20, + num_samplers=4, + num_evaluators=4) + + method.run() + + +if __name__ == '__main__': + main() diff --git a/example/set_cover_construct/run_eoh.py b/example/set_cover_construct/run_eoh.py new file mode 100644 index 00000000..fd60ebe0 --- /dev/null +++ b/example/set_cover_construct/run_eoh.py @@ -0,0 +1,34 @@ +### Test Only ### +# Set system path + +import sys + +sys.path.append('../../') # This is for finding all the modules + +from llm4ad.task.optimization.set_cover_construct import SCPEvaluation +from llm4ad.tools.llm.llm_api_https import HttpsApi +from llm4ad.method.eoh import EoH, EoHProfiler + + +def main(): + llm = HttpsApi(host='xxx', # your host endpoint, e.g., 'api.openai.com', 'api.deepseek.com' + key='sk-xxx', # your key, e.g., 'sk-abcdefghijklmn' + model='xxx', # your llm, e.g., 'gpt-3.5-turbo' + timeout=100) + + task = SCPEvaluation() + + method = EoH(llm=llm, + profiler=EoHProfiler(log_dir='logs', log_style='complex'), + evaluation=task, + max_sample_nums=100, + max_generations=10, + pop_size=20, + num_samplers=4, + num_evaluators=4) + + method.run() + + +if __name__ == '__main__': + main() diff --git a/example/stresstrain/run_eoh.py b/example/stresstrain/run_eoh.py new file mode 100644 index 00000000..6d0be057 --- /dev/null +++ b/example/stresstrain/run_eoh.py @@ -0,0 +1,34 @@ +### Test Only ### +# Set system path + +import sys + +sys.path.append('../../') # This is for finding all the modules + +from llm4ad.task.science_discovery.stresstrain import SSEvaluation +from llm4ad.tools.llm.llm_api_https import HttpsApi +from llm4ad.method.eoh import EoH, EoHProfiler + + +def main(): + llm = HttpsApi(host='xxx', # your host endpoint, e.g., 'api.openai.com', 'api.deepseek.com' + key='sk-xxx', # your key, e.g., 'sk-abcdefghijklmn' + model='xxx', # your llm, e.g., 'gpt-3.5-turbo' + timeout=100) + + task = SSEvaluation() + + method = EoH(llm=llm, + profiler=EoHProfiler(log_dir='logs', log_style='complex'), + evaluation=task, + max_sample_nums=100, + max_generations=10, + pop_size=20, + num_samplers=4, + num_evaluators=4) + + method.run() + + +if __name__ == '__main__': + main() diff --git a/example/tsp_gls_2O/run_eoh.py b/example/tsp_gls_2O/run_eoh.py new file mode 100644 index 00000000..c0746ff9 --- /dev/null +++ b/example/tsp_gls_2O/run_eoh.py @@ -0,0 +1,34 @@ +### Test Only ### +# Set system path + +import sys + +sys.path.append('../../') # This is for finding all the modules + +from llm4ad.task.optimization.tsp_gls_2O import TSP_GLS_2O_Evaluation +from llm4ad.tools.llm.llm_api_https import HttpsApi +from llm4ad.method.eoh import EoH, EoHProfiler + + +def main(): + llm = HttpsApi(host='xxx', # your host endpoint, e.g., 'api.openai.com', 'api.deepseek.com' + key='sk-xxx', # your key, e.g., 'sk-abcdefghijklmn' + model='xxx', # your llm, e.g., 'gpt-3.5-turbo' + timeout=100) + + task = TSP_GLS_2O_Evaluation() + + method = EoH(llm=llm, + profiler=EoHProfiler(log_dir='logs', log_style='complex'), + evaluation=task, + max_sample_nums=100, + max_generations=10, + pop_size=20, + num_samplers=4, + num_evaluators=4) + + method.run() + + +if __name__ == '__main__': + main() diff --git a/example/vehicle_routing_period_routing_co_bench/run_eoh.py b/example/vehicle_routing_period_routing_co_bench/run_eoh.py new file mode 100644 index 00000000..e5ce3567 --- /dev/null +++ b/example/vehicle_routing_period_routing_co_bench/run_eoh.py @@ -0,0 +1,34 @@ +### Test Only ### +# Set system path + +import sys + +sys.path.append('../../') # This is for finding all the modules + +from llm4ad.task.optimization.co_bench.vehicle_routing_period_routing_co_bench import VRPREvaluationCB +from llm4ad.tools.llm.llm_api_https import HttpsApi +from llm4ad.method.eoh import EoH, EoHProfiler + + +def main(): + llm = HttpsApi(host='xxx', # your host endpoint, e.g., 'api.openai.com', 'api.deepseek.com' + key='sk-xxx', # your key, e.g., 'sk-abcdefghijklmn' + model='xxx', # your llm, e.g., 'gpt-3.5-turbo' + timeout=100) + + task = VRPREvaluationCB() + + method = EoH(llm=llm, + profiler=EoHProfiler(log_dir='logs', log_style='complex'), + evaluation=task, + max_sample_nums=100, + max_generations=10, + pop_size=20, + num_samplers=4, + num_evaluators=4) + + method.run() + + +if __name__ == '__main__': + main() From fa822f9961dd0a63d0a19c23aac47afe7f4be870 Mon Sep 17 00:00:00 2001 From: zx <12412509@mail.sustech.edu.com> Date: Tue, 31 Mar 2026 21:20:11 +0800 Subject: [PATCH 2/2] Remove API keys from example files and add DeepSeek-R1 support --- example/acrobot/run_eoh.py | 6 +++--- example/admissible_set/run_eoh.py | 6 +++--- example/bactgrow/run_eoh.py | 6 +++--- example/bp_1d_construct/run_eoh.py | 8 ++++---- llm4ad/tools/llm/llm_api_https.py | 5 +++-- 5 files changed, 16 insertions(+), 15 deletions(-) diff --git a/example/acrobot/run_eoh.py b/example/acrobot/run_eoh.py index d85bd0f4..32bcffa2 100644 --- a/example/acrobot/run_eoh.py +++ b/example/acrobot/run_eoh.py @@ -11,9 +11,9 @@ def main(): - llm = HttpsApi(host='xxx', # your host endpoint, e.g., 'api.openai.com', 'api.deepseek.com' - key='sk-xxx', # your key, e.g., 'sk-abcdefghijklmn' - model='xxx', # your llm, e.g., 'gpt-3.5-turbo' + llm = HttpsApi(host='api.bltcy.ai', # your host endpoint, e.g., 'api.openai.com', 'api.deepseek.com' + key='', # your key, e.g., 'sk-abcdefghijklmn' + model='gpt-5.3-codex-high', # your llm, e.g., 'gpt-3.5-turbo' timeout=100) task = AcrobotEvaluation() diff --git a/example/admissible_set/run_eoh.py b/example/admissible_set/run_eoh.py index 8043cd1d..35949af6 100644 --- a/example/admissible_set/run_eoh.py +++ b/example/admissible_set/run_eoh.py @@ -11,9 +11,9 @@ def main(): - llm = HttpsApi(host='xxx', # your host endpoint, e.g., 'api.openai.com', 'api.deepseek.com' - key='sk-xxx', # your key, e.g., 'sk-abcdefghijklmn' - model='xxx', # your llm, e.g., 'gpt-3.5-turbo' + llm = HttpsApi(host='api.bltcy.ai', # 智谱AI + key='', + model='gpt-5.3-codex-high', timeout=100) task = ASPEvaluation() diff --git a/example/bactgrow/run_eoh.py b/example/bactgrow/run_eoh.py index 61450501..b870fed0 100644 --- a/example/bactgrow/run_eoh.py +++ b/example/bactgrow/run_eoh.py @@ -11,9 +11,9 @@ def main(): - llm = HttpsApi(host='xxx', # your host endpoint, e.g., 'api.openai.com', 'api.deepseek.com' - key='sk-xxx', # your key, e.g., 'sk-abcdefghijklmn' - model='xxx', # your llm, e.g., 'gpt-3.5-turbo' + llm = HttpsApi(host='api.bltcy.ai', # 智谱AI + key='', + model='deepseek-ai/DeepSeek-R1', timeout=100) task = BGEvaluation() diff --git a/example/bp_1d_construct/run_eoh.py b/example/bp_1d_construct/run_eoh.py index 27e6abc7..8a071244 100644 --- a/example/bp_1d_construct/run_eoh.py +++ b/example/bp_1d_construct/run_eoh.py @@ -11,10 +11,10 @@ def main(): - llm = HttpsApi(host='xxx', # your host endpoint, e.g., 'api.openai.com', 'api.deepseek.com' - key='sk-xxx', # your key, e.g., 'sk-abcdefghijklmn' - model='xxx', # your llm, e.g., 'gpt-3.5-turbo' - timeout=100) + llm = HttpsApi(host='api.bltcy.ai', + key='', + model='deepseek-ai/DeepSeek-R1', + timeout=300) task = BP1DEvaluation() diff --git a/llm4ad/tools/llm/llm_api_https.py b/llm4ad/tools/llm/llm_api_https.py index a5fdfc44..0f662d67 100644 --- a/llm4ad/tools/llm/llm_api_https.py +++ b/llm4ad/tools/llm/llm_api_https.py @@ -121,8 +121,9 @@ def draw_sample(self, prompt: str | Any, *args, **kwargs) -> str: data = res.read().decode('utf-8') data = json.loads(data) - # Extract content from the standard response format - response = data['choices'][0]['message']['content'] + # Extract content from the standard response format (compatible with DeepSeek-R1) + message = data['choices'][0]['message'] + response = message.get('content') or message.get('reasoning_content', '') # Reset error counter on success if self.debug_mode: self._cumulative_error = 0