Parse command-line arguments.
()
| 25 | |
| 26 | |
| 27 | def parse_args() -> argparse.Namespace: |
| 28 | """Parse command-line arguments.""" |
| 29 | parser = argparse.ArgumentParser( |
| 30 | description="Benchmark all AlgoTune tasks with OpenEvolve", |
| 31 | formatter_class=argparse.RawDescriptionHelpFormatter, |
| 32 | epilog=""" |
| 33 | Examples: |
| 34 | python examples/algotune/run_benchmark.py |
| 35 | python examples/algotune/run_benchmark.py --iterations 50 --timeout 3600 |
| 36 | python examples/algotune/run_benchmark.py --tasks eigenvectors_complex,psd_cone_projection |
| 37 | python examples/algotune/run_benchmark.py --output my_results.json |
| 38 | """ |
| 39 | ) |
| 40 | |
| 41 | parser.add_argument( |
| 42 | "--iterations", "-i", |
| 43 | type=int, |
| 44 | default=100, |
| 45 | help="Number of iterations to run for each task (default: 100)" |
| 46 | ) |
| 47 | |
| 48 | parser.add_argument( |
| 49 | "--timeout", "-t", |
| 50 | type=int, |
| 51 | default=7200, # 2 hours |
| 52 | help="Timeout in seconds for each task (default: 7200)" |
| 53 | ) |
| 54 | |
| 55 | parser.add_argument( |
| 56 | "--tasks", |
| 57 | type=str, |
| 58 | help="Comma-separated list of specific tasks to run (default: all tasks)" |
| 59 | ) |
| 60 | |
| 61 | parser.add_argument( |
| 62 | "--output", "-o", |
| 63 | type=str, |
| 64 | help="Output JSON file path (default: algotune_benchmark_TIMESTAMP.json)" |
| 65 | ) |
| 66 | |
| 67 | parser.add_argument( |
| 68 | "--config", |
| 69 | type=str, |
| 70 | help="Custom config file to use instead of task default configs" |
| 71 | ) |
| 72 | |
| 73 | parser.add_argument( |
| 74 | "--verbose", "-v", |
| 75 | action="store_true", |
| 76 | help="Enable verbose output" |
| 77 | ) |
| 78 | |
| 79 | return parser.parse_args() |
| 80 | |
| 81 | |
| 82 | def discover_algotune_tasks(algotune_dir: Path) -> List[str]: |