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
12 changes: 6 additions & 6 deletions examples/circle_packing_with_artifacts/evaluator.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,9 +295,9 @@ def evaluate(program_path):
# Add successful packing stats for good solutions
if valid and target_ratio > 0.95: # Near-optimal solutions
artifacts["stdout"] = f"Excellent packing! Achieved {target_ratio:.1%} of target value"
artifacts["radius_stats"] = (
f"Min: {validation_details['min_radius']:.6f}, Max: {validation_details['max_radius']:.6f}, Avg: {validation_details['avg_radius']:.6f}"
)
artifacts[
"radius_stats"
] = f"Min: {validation_details['min_radius']:.6f}, Max: {validation_details['max_radius']:.6f}, Avg: {validation_details['avg_radius']:.6f}"

return EvaluationResult(
metrics={
Expand Down Expand Up @@ -404,9 +404,9 @@ def evaluate_stage1(program_path):

# Add validation issues if any
if not valid:
artifacts["stderr"] = (
f"Validation failed: {len(validation_details.get('boundary_violations', []))} boundary violations, {len(validation_details.get('overlaps', []))} overlaps"
)
artifacts[
"stderr"
] = f"Validation failed: {len(validation_details.get('boundary_violations', []))} boundary violations, {len(validation_details.get('overlaps', []))} overlaps"
artifacts["failure_stage"] = "stage1_geometric_validation"
if validation_details.get("boundary_violations"):
artifacts["boundary_issues"] = validation_details["boundary_violations"][
Expand Down
4 changes: 1 addition & 3 deletions examples/mlx_metal_kernel_opt/run_benchmarks.py
Original file line number Diff line number Diff line change
Expand Up @@ -457,9 +457,7 @@ def print_comparison_summary(comparison_results):
print(f" ⏱️ Average Time Reduction: {summary['avg_time_reduction_pct']:+.2f}%")

print(f"\n📊 ABSOLUTE PERFORMANCE:")
print(
f" 🔵 Standard MLX-LM: {summary['avg_standard_decode_speed']:.1f} tokens/sec average"
)
print(f" 🔵 Standard MLX-LM: {summary['avg_standard_decode_speed']:.1f} tokens/sec average")
print(
f" 🟠 Metal Kernel Optimized: {summary['avg_optimized_decode_speed']:.1f} tokens/sec average"
)
Expand Down
7 changes: 2 additions & 5 deletions openevolve/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,9 +376,7 @@ async def run(

# Specifically check if this is the new best program
if self.database.best_program_id == child_program.id:
logger.info(
f"🌟 New best solution found at iteration {i+1}: {child_program.id}"
)
logger.info(f"🌟 New best solution found at iteration {i+1}: {child_program.id}")
logger.info(f"Metrics: {format_metrics_safe(child_program.metrics)}")

# Save checkpoint
Expand All @@ -405,8 +403,7 @@ async def run(
break

except Exception as e:
logger.error(f"Error in iteration {i+1}: {str(e)}")
traceback.print_exc()
logger.exception(f"Error in iteration {i+1}: {str(e)}")
continue

# Get the best program using our tracking mechanism
Expand Down
19 changes: 16 additions & 3 deletions openevolve/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,22 @@ def add(

# Add to feature map (replacing existing if better)
feature_key = self._feature_coords_to_key(feature_coords)
if feature_key not in self.feature_map or self._is_better(
program, self.programs[self.feature_map[feature_key]]
):
should_replace = feature_key not in self.feature_map

if not should_replace:
# Check if the existing program still exists before comparing
existing_program_id = self.feature_map[feature_key]
if existing_program_id not in self.programs:
# Stale reference, replace it
should_replace = True
logger.debug(
f"Replacing stale program reference {existing_program_id} in feature map"
)
else:
# Program exists, compare fitness
should_replace = self._is_better(program, self.programs[existing_program_id])

if should_replace:
self.feature_map[feature_key] = program.id

# Add to specific island (not random!)
Expand Down
Loading