Skip to content

Commit 0ed87f9

Browse files
committed
Update controller.py
1 parent e76a254 commit 0ed87f9

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

openevolve/controller.py

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -370,22 +370,18 @@ def _save_best_program(self, program: Optional[Program] = None) -> None:
370370
with open(code_path, "w") as f:
371371
f.write(program.code)
372372

373-
# Save metrics
374-
metrics_path = os.path.join(best_dir, "metrics.json")
375-
with open(metrics_path, "w") as f:
376-
import json
377-
json.dump(program.metrics, f, indent=2)
378-
379-
# Also save metadata about the best program
380-
meta_path = os.path.join(best_dir, "best_program_info.json")
381-
with open(meta_path, "w") as f:
373+
# Save complete program info including metrics
374+
info_path = os.path.join(best_dir, "best_program_info.json")
375+
with open(info_path, "w") as f:
382376
import json
383377
json.dump({
384378
"id": program.id,
385379
"generation": program.generation,
386380
"timestamp": program.timestamp,
387381
"parent_id": program.parent_id,
388-
"metrics": program.metrics
382+
"metrics": program.metrics,
383+
"language": program.language,
384+
"saved_at": time.time()
389385
}, f, indent=2)
390386

391-
logger.info(f"Saved best program to {code_path} with metrics to {metrics_path}")
387+
logger.info(f"Saved best program to {code_path} with program info to {info_path}")

0 commit comments

Comments
 (0)