Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions openevolve/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,22 @@ async def run(
)

self.database.add(initial_program)

# Check if combined_score is present in the metrics
if "combined_score" not in initial_metrics:
# Calculate average of numeric metrics
numeric_metrics = [
v for v in initial_metrics.values()
if isinstance(v, (int, float)) and not isinstance(v, bool)
]
if numeric_metrics:
avg_score = sum(numeric_metrics) / len(numeric_metrics)
logger.warning(
f"⚠️ No 'combined_score' metric found in evaluation results. "
f"Using average of all numeric metrics ({avg_score:.4f}) for evolution guidance. "
f"For better evolution results, please modify your evaluator to return a 'combined_score' "
f"metric that properly weights different aspects of program performance."
)
else:
logger.info(
f"Skipping initial program addition (resuming from iteration {start_iteration} "
Expand Down
15 changes: 15 additions & 0 deletions openevolve/process_parallel.py
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,21 @@ async def run_evolution(
for k, v in child_program.metrics.items()
])
logger.info(f"Metrics: {metrics_str}")

# Check if this is the first program without combined_score
if not hasattr(self, '_warned_about_combined_score'):
self._warned_about_combined_score = False

if "combined_score" not in child_program.metrics and not self._warned_about_combined_score:
from openevolve.utils.metrics_utils import safe_numeric_average
avg_score = safe_numeric_average(child_program.metrics)
logger.warning(
f"⚠️ No 'combined_score' metric found in evaluation results. "
f"Using average of all numeric metrics ({avg_score:.4f}) for evolution guidance. "
f"For better evolution results, please modify your evaluator to return a 'combined_score' "
f"metric that properly weights different aspects of program performance."
)
self._warned_about_combined_score = True

# Check for new best
if self.database.best_program_id == child_program.id:
Expand Down