EVOLVE-BLOCK-START and EVOLVE-BLOCK-END markers do not work
I was optimizing a c program where a c file has many functions, I only want to optimize a single function in the file. I tried several marks to let openevolve optimize only the function. such as:
// #EVOLVE-BLOCK-START/END // # EVOLVE-BLOCK-START/END // EVOLVE-BLOCK-START/END //EVOLVE-BLOCK-START/END
but all fails. I find openevolve will also change other functions in the file in the subsequent iterations.
I wonder how the EVOLVE-BLOCK-START/END is implemented in openevolve and how it can be used for program language other than python. I find a function parse_evolve_blocks in openevolve/utils/code_utils.py. I think it may related to the feature but I don't see any calls to parse_evolve_blocks.
The markers currently only serve as soft hints to the LLM via prompt instructions, with no programmatic enforcement that mutations stay within the marked regions.
A proper fix would need to:
- Call
parse_evolve_blocksincode_utils.pyafter the LLM generates a diff and validate that changes only target lines within evolve blocks - Reject or revert mutations that touch code outside the markers
- Support comment syntax beyond Python (
//for C/C++, etc.)
Would you be interested in submitting a PR for this? We'd appreciate the contribution.