R6 class for managing a collection of trials with optional persistence.
Existing JSONL records are loaded when log_dir already contains a log.
New trials are appended one record at a time; matching trial IDs are
idempotent, while conflicting records with the same ID are rejected. The
trials.jsonl journal is authoritative. metadata.json, README.md, and
best_program.rds are independently refreshed, best-effort derived views;
they may lag after an interruption and are rebuilt by a later successful
save. Persistent Unix logs require an effective-user-owned directory with a
safe parent chain and reject symbolic-link targets; Windows uses the
account's filesystem ACLs, which base R cannot verify as owner-only, and
fails closed if stable device and file identifiers are unavailable.
Public fields
optimizer_nameName of the optimizer using this log.
log_dirDirectory for persistence (NULL for in-memory only).
trialsList of Trial objects.
metadataAdditional metadata about the optimization run.
Methods
TrialLog$new()
Create or resume a TrialLog. Existing JSONL records are loaded without rewriting the file.
Usage
TrialLog$new(optimizer_name, log_dir = NULL, metadata = NULL)TrialLog$add_trial()
Add a trial to the log. Persisted trials atomically append one authoritative JSONL record. Derived metadata, summaries, and the best program are then refreshed independently on a best-effort basis.
TrialLog$save()
Save the trial log to disk. Only records missing from the destination are appended to the authoritative journal. Derived files are independently refreshed on a best-effort basis and may lag if that refresh warns.