Fix candidate evaluation for multi-file projects (#402) #404
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes an issue where OpenEvolve was not properly evaluating programs that depend on multiple files (e.g., Java projects with multiple .java files).
Problem
When using OpenEvolve with non-Python programs that have dependencies on other files in the same directory, the evaluator was only writing the modified program code to a temporary file without copying the supporting files. This caused evaluations to always use the initial program content instead of the evolved code.
Solution
Modified the
Evaluatorclass to:initial_program_pathparameterChanges
initial_program_pathparameter toEvaluator.__init__()evaluate_program()to copy source directory for non-Python filesControllerto pass the initial program path to the evaluatorTesting
The fix ensures that multi-file projects (like Java with TestFile.java + CodeFile.java) work correctly by providing all necessary files to the evaluation environment.
Fixes #402