A general-purpose function to evolve an arbitrary code string with a custom evaluator. Args: initial_code: The initial code string to evolve. evaluator: A function that takes a program path and returns a metrics dictionary. iterations: The number of evolution iterat
(
initial_code: str, evaluator: Callable[[str], Dict[str, Any]], iterations: int = 100, **kwargs
)
| 408 | |
| 409 | |
| 410 | def evolve_code( |
| 411 | initial_code: str, evaluator: Callable[[str], Dict[str, Any]], iterations: int = 100, **kwargs |
| 412 | ) -> EvolutionResult: |
| 413 | """ |
| 414 | A general-purpose function to evolve an arbitrary code string with a custom evaluator. |
| 415 | |
| 416 | Args: |
| 417 | initial_code: The initial code string to evolve. |
| 418 | evaluator: A function that takes a program path and returns a metrics dictionary. |
| 419 | iterations: The number of evolution iterations. |
| 420 | **kwargs: Additional arguments for `run_evolution`. |
| 421 | |
| 422 | Returns: |
| 423 | An EvolutionResult with the optimized code. |
| 424 | """ |
| 425 | # This is a direct wrapper around the main run_evolution function. |
| 426 | return run_evolution( |
| 427 | initial_program=initial_code, evaluator=evaluator, iterations=iterations, **kwargs |
| 428 | ) |
nothing calls this directly
no test coverage detected