Machine-readable evaluation reports#

eval_report is an opt-in, versioned JSON report for controllers, experiment tools, and applications that need more than a scalar solver score. It records measurements and their provenance; it does not change how OptiProfiler solves, scores, or draws an experiment. It is not an agent execution mode.

Python#

Keep the ordinary three-output API and request a new report file:

scores, profile_scores, curves = benchmark(
    [solver_a, solver_b],
    plibs=['s2mpj'], ptype='u', mindim=1, maxdim=10,
    score_only=True,
    report_path='evaluation/eval_report.json',
)

report_path accepts a string or pathlib.Path. With no report path (or None or an empty string), the previous behavior is retained: the collector module is not even imported, no metadata is attached to solver results, and no extra file is touched. That opt-out is the default and costs nothing. An explicit path requests two JSON files: the small main report and one adjacent numeric companion. For evaluation/eval_report.json, the companion is evaluation/eval_report.plot_data.json. Both targets must be new: a collision with either file is refused before solvers execute. This also prevents a load/replot operation from replacing its source report.

For a saved problem-library experiment, completed numerical data is persisted to H5/MAT before the final numerical report is published. Python collects its numerical report updates in memory during this phase; the initially published request remains visible. A later report-write failure still raises an error, but the completed experiment can be recovered through load. Objective callbacks must return real scalars: complex values are invalid evaluations, recorded as NaN rather than silently reduced to their real components. Complex points, bounds, constraint values and derivative arrays are rejected as invalid real-optimization inputs; their imaginary parts are not discarded.

score_only=True still disables plots and raw experiment persistence. The two explicitly requested JSON files are the only additional outputs. Preparing plot coordinates does not create figures, require a rendering backend, or certify that a PDF exists. Numeric presentations and binned histories do not replace the complete H5/MAT archive.

The report can be read with the standard library:

import json
with open('evaluation/eval_report.json', encoding='utf-8') as stream:
    report = json.load(stream)
assert report['schema'] == 'optiprofiler.eval_report/2'
budget = report['problems'][0]['budget']['evaluations']
for run in report['problems'][0]['runs']:
    print(run['solver_index'], run['run_index'], run['evaluations'],
          run['budget_reached'], run['objective']['best'])

MATLAB#

The equivalent options-struct field preserves MATLAB’s three outputs:

options = struct('plibs', {{'s2mpj'}}, 'ptype', 'u', ...
    'mindim', 1, 'maxdim', 10, 'score_only', true);
options.report_path = 'evaluation/eval_report.json';
[scores, profile_scores, curves] = benchmark({@solver_a, @solver_b}, options);

Both implementations emit version 2 of the same contract (optiprofiler.eval_report/2, eval_report-v2.schema.json) with the same field names and the same one-based solver/run indices: version 2 adds the canonical feature specification and the experiment plans to configuration.effective. Version 1 (optiprofiler.eval_report/1, the immutable eval_report.schema.json) remains the contract of reports written before version 2, and a reader selects the schema from the document’s schema identifier and rejects identifiers it does not know. Runtime provenance, random-seed rules and error-band normalization remain language-specific; the report states which convention produced a value instead of changing either implementation to make them match (see Language-specific conventions).

Report structure#

The main-report schema, version 2, the main-report schema, version 1 and the numeric-companion schema are the single Python/MATLAB reader contract. Observation records (problems, runs, metrics, coverage, stages, plot records, history channels) allow only the declared keys, so a consumer never has to branch on the producing language for the same concept. The files are package resources of the Python distribution (optiprofiler/schemas/) and can be read at run time:

from optiprofiler.eval_report import load_schema, schema_for_document, schema_text
main_schema = load_schema('eval_report')          # current version (2), parsed dict
legacy_schema = load_schema('eval_report', 1)     # immutable version 1 (reports written before version 2)
companion_text = schema_text('plot_data')         # exact JSON text, for hashing/pinning
name, version = schema_for_document(report)       # from report['schema']; unknown versions raise

There is exactly one authoritative copy of each schema: the documentation downloads above, the installed Python test suite, the MATLAB test fixtures and external consumers all read the same files, so a consumer that pins a schema by its SHA256 compares against the packaged text. They require no additional runtime dependency in OptiProfiler; both test suites validate every produced report against them with a small built-in checker. Consumers should reject bare JSON NaN/Infinity tokens, select the schema by the document identifier, validate, and check tensor dimensions, references and artifact paths. The versions are independent of the package version and are listed separately: main report optiprofiler.eval_report/2 (Python and MATLAB) and /1 (reports written before version 2; immutable), numeric companion optiprofiler.plot_data/1 (unchanged), archive entry feature_pipeline-v3 (-v1/-v2 retained verbatim on load) and options_refined-v2.

Main fields#

Field

Meaning

configuration / source

configuration.request is what the caller supplied; configuration.effective is the resolved problem/profile options, the canonical feature specification (stage-local options only) and the experiment plans (run counts by role), stated once. For a load operation these describe reanalysis and rendering (experiment is empty), source is the receipt of the unchanged archive bytes (sha256) and configuration.retained_result_metadata is a sanitized copy of the archived metadata, not those bytes. Runtime facts of an executed role (execution strategy, runtime_policy) are stated once per role in experiment; the seed policy and the stage identities once in feature. A producer that observes these facts per run may add an optional runs[].runtime receipt (language, execution strategy, runtime and seed policy); Python emits none, and no receipt is ever synthesized for a copied run. Text fields of the feature block longer than the shared bound (or containing redacted content) are omitted, not clipped: the field is null and <field>_bytes / <field>_reason say why; the complete text stays in the archive and the refined options. The lists declared and stages longer than the shared item bound (256) are the encoder’s bounded object {values, total_items, reason}: the first 256 entries, the true count and the reason metadata_item_limit; a consumer accepts either the complete array or that object, takes total_items as the count, and reads the complete lists from the archive payload. No stage count is capped and nothing is truncated silently.

stages / coverage

Independent numerical, scoring, persistence and rendering states; selected, loaded and completed primary problems.

problems[]

Identity ([library, name, role]), dimension, type, selection and load status, the shared evaluation budget of the problem, the provider (when known) and the runs. The Python provider record adds the distribution version (for a bundled library, the OptiProfiler version that ships it) and the revision: for a plugin installed from a VCS URL, the commit that pip recorded; for a bundled library, the commit in problem_libs/bundled_revisions.json (the reviewed snapshot, not a check of the files). The MATLAB record adds the registry role and locked_revision, the commit named for the library in matlab_problem_libraries.lock (the reviewed snapshot, not a check of the installed checkout). null means unknown.

problems[].runs[]

Per-run facts only: evaluation count, budget_reached, returned, initial and best objective/constraint/merit values, invalid-value counts, abnormal-termination and fallback flags, actual-versus-repeated execution, oracle seed and elapsed time.

scores / profiles

Exact returned scores with named axes, actual convergence-work summaries, and references to numeric profile presentations.

semantics / plot_data

Shared meanings stated once, and the companion’s path, identity-linked contents and integrity receipt. Runs refer to its histories by ID.

artifacts / diagnostics

Existing output files with relative paths and hashes, and bounded structured event codes. Files marked present are not automatically certified scientifically correct or safe to publish. A profile export that raises records the rendering diagnostic profile_export_failed in both languages. MATLAB also records summary_pdf_not_owned when it leaves a summary.pdf that it does not own unchanged; see MATLAB output robustness in the MATLAB user guide.

report_files

The best-effort file-permission policy applied to the two JSON files and whether this platform applied it.

Solver/run/sample indices in observation fields use one-based indexing, including Python JSON. Options recorded in configuration retain the original language API conventions; for example, Python solvers_to_load still uses zero-based indices. The profile-score axes are solver, tolerance, history/output, and profile type. Objective, constraint and merit best values are componentwise minima: they need not belong to the same evaluated point. Work summaries reuse the existing profile convergence calculation; they do not introduce a new stopping rule.

Meaningful absence and meaningful nulls#

The main report keeps invariant meanings once in semantics rather than repeating the same prose in every run, and it omits keys that would only carry null. The rules are stated in semantics.run_defaults:

  • problems[].budget holds the evaluation cap shared by every run of the problem in this invocation (ceil(max_eval_factor * dimension)). A run record carries its own budget only as an explicit override. In a load operation the original budget is not retained, so budget.evaluations is null with a reason and every budget_reached is null; today’s max_eval_factor is never used to guess it.

  • budget_reached, evaluations, abnormal_termination, output_fallback, execution, oracle_seed and elapsed_seconds stay per run. Reaching the cap still does not prove the termination cause.

  • A run with output_fallback true returned no output. Its objective.output and constraint.output are the values at x0, and it has no output-based work: its entries of output in target_work have the value null and the output hits of convergence exclude it. output_work_semantics and the target_work entry of the companion’s semantics say the same.

  • There is no per-run convergence field. Convergence is never inferred from a solver return value; target_work in the companion observes the existing scoring predicate.

  • invalid_evaluations is the integer 0 when every retained evaluation was finite; otherwise it is the categorized count object, and first_invalid_evaluation_index is present. An absent availability_reason means the observation was available; when a history, count, returned or initial value is missing, the reason names what is missing (for example history_or_evaluation_count_unavailable for a merit history that a load with a new merit callback does not retain).

  • oracle_seed_reason and termination_metadata_reason appear only when the corresponding value could not be observed (old archives).

Absence or null must never be read as a successful zero measurement.

Three different kinds of data#

The main report is a concise index of facts. Its numeric companion contains histories, plots and target_work. The original H5/MAT archive is unchanged and remains the only complete source for reanalysis.

  • History summaries describe each problem/solver/run and each metric separately, excluding padded values beyond actual evaluations. Short histories of up to 64 observations use representation="exact_samples" and retain all values. Longer histories use representation="bin_extrema" and are lossy: at most 32 contiguous bins retain their first/last observations, finite minimum/maximum with true evaluation positions, and NaN and positive/negative infinity counts. Bin k of n retained evaluations covers evaluations (k-1)*n//32+1 to k*n//32 in both languages. Ties use the first occurrence. The order of observations inside a bin is not retained, and bins are never scoring inputs.

  • Numeric plot presentations contain the actual prepared coordinates, central curves and error bands from the same numeric preparation used by the renderer. exact_rendered_data means exact prepared display data, not a lossless copy of the raw experiment, pixel-identical rendering across machines, or evidence of a successful PDF. History display clipping (display_limit), nonfinite placeholders (nonfinite_policy), shifts, raw/cumulative views and block aggregation are recorded on each panel. observation_scope="rendering_inputs" identifies observations captured from the actual rendering path. When drawing is not requested, a representation can instead use retained_scoring_observations. These scopes are not interchangeable: a stateful custom merit callback can produce different values when the existing renderer calls it again. Reporting does not invoke that callback an extra time to make the two agree.

  • Target work retains the existing profile calculation’s work arrays and their problem/solver/run/tolerance identities. History-based work is the first evaluation meeting the existing target. Output-based work is the evaluation count associated with a passing returned output, not the first history hit. A run flagged output_fallback returned no output and has no output-based work. Never infer either value from a compressed curve or from a history preview.

Padded display aggregation#

Both renderers keep at most about 1000 interior points of a history plot. The rule is keyed on the padded history length ceil(max_eval_factor * dimension), recorded as padded_length on every history panel, not on the number of evaluations a solver actually used. Above 1002 the interior evaluations are grouped into blocks and one representative per block is kept (aggregation is min, mean or max, as configured by hist_aggregation); the first and the last actual evaluation are always kept, and the last one can therefore appear twice. Consequently an array position in series[].mean is not an evaluation number once padded_length exceeds 1002. Locate a sample through series[].evaluation_indices and read the value at that position. The lossy bins and the scalar facts in the main report are independent of this display aggregation: an isolated spike that a block drops from the display copy is still visible as a bin extremum and in best/first_invalid indices.

The scalar best ignores NaN and can be infinite. A bin’s finite_min and finite_max intentionally exclude infinities; they answer a different question. Exact scalar facts, abnormal/fallback flags and invalid counts remain available even if a short visual summary hides an event.

Language-specific conventions#

The vocabulary is shared, the science is not equalized. The report says which convention produced a value:

  • Error bands: Python retains its population standard deviation (std_ddof = 0); MATLAB retains its sample normalization (std_ddof = 1 for more than one run). semantics.error_bands in the companion states the emitting language’s rule.

  • Oracle seeds: each run’s oracle_seed is the seed actually given to the featured problem under the emitting language’s own rule (Python (23333*seed + 211*i) % 2**32 with 0-based i; MATLAB mod(23333*seed + 211*i_run, 2^32) with 1-based i_run). A repeated deterministic slot copies run 1 and says so.

  • Log-ratio bar identity: MATLAB retains which problem/run produced each sorted bar (problem_mapping = "bar_sources"); the Python renderer sorts anonymously, so it reports problem_mapping = null with a reason instead of guessing an identity from sorted values. target_work carries the unsorted identities in both languages.

  • Renderer variants: MATLAB records how its native PDF and portable SVG renderers draw the shared prepared data (renderer_variants_ref); prepared coordinates do not imply that every element was visibly drawn.

  • Direct user problems use the library label user in both languages, so the identity ["user", name, "primary"] is the same everywhere.

Reading without flooding an agent’s context#

First read the main report: stage statuses, coverage, exact scores, abnormal runs and per-run facts. Follow history_ref or profiles.plot_refs only for the problems or curves that need closer inspection. Repeated solver definitions, configuration and common semantics need not be copied into every feedback item. For a detailed diagnostic, use exact facts and target work first; use binned histories for shape, with the documented approximation limits.

One numeric companion serves the whole invocation; a new file is not created for every figure. Applications can index or selectively expose records from that companion. The core does not add an agent tool server or change Evolve’s fitness policy. A smaller report improves context use but is not a guarantee against erroneous agent conclusions.

Redacted metadata#

Reports describe an experiment without copying secrets or machine paths. The rules are the same in Python and MATLAB:

  • An option whose name contains password, passwd, passphrase, secret, credential, authorization, authentication, bearer, api_key (also apikey and api-key), private_key (also privatekey and private-key) or cookie, or whose name has pwd, auth or token at its end or before _ or - (auth_token, basicAuth, but not max_tokens or author), is not copied, in any letter case and at any depth. Python keeps the key with the reason redacted_sensitive_option; MATLAB omits the key.

  • A URL of any scheme and letter case (HTTPS://, git+https://, ssh://) is replaced by [redacted_url] in metadata text. A text that starts with a URL is replaced as a whole.

  • An absolute path is replaced too, in a whole text and inside a longer one. MATLAB also omits every option whose name contains path in any letter case (savepath, report_path). Python keeps savepath, with an absolute path in its value replaced, and does not record report_path.

  • The source of a reference record is scientific provenance: its URLs keep scheme, host, port and path; user information, query and fragment are removed and marked [url parameters removed]. A URL with a further :// in its host or path, such as a second URL glued to it, is replaced by [redacted_url] as a whole. The file names of history plots follow the same rule, because a report lists them; a name that the rule changes ends in a CRC-32 of the original name, so that names that differ only in what was removed keep two files. The checksum depends on the removed text, so a file name, like the identity of such a problem in a report, can confirm a guessed short password. Do not put credentials in problem names.

This is a safeguard for ordinary metadata, not a security boundary: a secret in a value that is neither a URL nor under a sensitive option name is not recognized.

Hash and permission fallbacks#

Artifact hashing refuses paths it can see are not plain files of the owned tree, and it detects ordinary concurrent changes; it is not an isolation guarantee against a hostile writer in the output directory, which the collector assumes to be private to the caller. On POSIX, Python opens every component below the benchmark-owned output tree relative to a directory descriptor with O_NOFOLLOW, so a symlink or a directory swapped during traversal is refused. Windows has no openat: there Python inspects each component with lstat (symlinks, junctions and any other reparse point that redirects the name are refused; cloud-file placeholders and compressed or deduplicated files are ordinary files), opens the file, and requires the opened handle’s identity (volume serial number and file index) to equal the identity recorded by that lstat. These checks are best effort: the ancestors are inspected before the file, so a redirection inserted between the ancestor inspection and the file’s lstat is seen by both the lstat and the open and is not caught; the ancestors are inspected again after hashing, which notices a redirection that is still present, not one that was removed in between. The MATLAB collector checks for links before opening and compares size and modification time after hashing without comparing the opened handle’s identity. When a check does trip, the artifact is omitted with an artifact_hash_unavailable diagnostic. On a platform with neither primitive, artifacts are listed as unverified with null hashes and the reason secure_artifact_hashing_unavailable_on_platform, persistence becomes partial, and the saved numerical archive remains loadable: a missing integrity receipt is not an assertion that the data is corrupt. Hash failures can also cause an entry to be omitted with a diagnostic. Neither implementation claims verified provenance it did not compute, and already computed scores are never lost. Without a JVM, MATLAB tries the system sha256sum or shasum utility. If neither is available, the main facts and numeric companion are still saved, but plot_data.status is partial with a null hash, the reason companion_sha256_unavailable, a diagnostic and a warning. This is not a successfully verified report pair.

Both collectors identify their two files by more than a file key. A device and inode alone would not notice a foreign in-place rewrite (the inode stays), and after a foreign replace-over-target the file system may hand the freed inode back (ext4 alternates between two inode numbers, so every second replacement restores the recorded one). The Python collector therefore records device, inode, size and nanosecond modification time; the MATLAB collector records Java’s file key together with the size and modification time on POSIX systems (without a JVM, stat supplies the same facts, with whole seconds on macOS). Windows exposes no file index to Java, so there the identity is the creation time, size and modification time of the file. A replaced or rewritten file between two publishes is detected in every case, forged timestamps are outside the model, and report_files.platform_note says so. For directories (the report’s parent, the artifact directory) only the file key, or the creation time on Windows, is used, because a directory’s modification time changes whenever the benchmark writes another file into it. Junctions and other name-redirecting reparse points are treated like symbolic links: Java exposes no reparse tag, so the collector compares the resolved real path of an entry with the resolved path of its parent joined with the entry’s canonical name, and an entry that exists but cannot be resolved (a dangling junction) is a link as well.

Both JSON files are written with a best-effort owner-only permission policy. Python creates them with mode 0600 (exclusive creation and mkstemp); MATLAB restricts group/other access with fileattrib after every publish. report_files.permissions_applied records whether the platform actually applied the policy: it is true on ordinary POSIX filesystems and false/null where modes are not enforced (Windows, some network or container filesystems). This is not operating-system-enforced privacy on every platform: the controller must still keep the output directory private.

Meaning and limitations#

  • An evaluation is one benchmark invocation, not an Evolve run, generation, or individual solver repetition. Its identity does not consume the random stream used by the scientific experiment.

  • Numerical execution, scoring, data persistence and rendering have separate states. A completed solver call need not satisfy the convergence test; reaching the evaluation cap is not proof of a particular termination reason.

  • Exceptions/fallbacks and invalid evaluations remain visible even when a benchmark produces scores. A failed PDF does not imply a failed solver.

  • Repeated copies of a deterministic solver result are distinguished from real executions when fresh-run metadata is available. Old archives cannot supply metadata they never recorded; unknown is not equivalent to false.

  • Problem identity includes the library and problem name. The optional plain reference experiment must not inflate the primary experiment’s coverage.

  • Profile scores retain their cohort-relative meaning. An effective problem reference now defines its convergence target; omitted references use the V1 empirical solver/plain minimum. problems[].reference_records keeps one raw fact or null per stored run, without recomputing a merit in the reporter. An absent field means the facts were not retained. An explicit reference can include x_ref in original problem coordinates, never featured coordinates. Points of up to 256 coordinates are embedded; larger ones have an explicit omission descriptor, with the full point retained in the numerical archive when one exists. reference_fallback_reasons records the first feature-triggered fallback for each stored run. A matched configuration hash alone is not a guarantee of comparability, nor does this report introduce an independent Arena scoring rule.

  • Binned histories and plot presentations are not inputs to scoring. Original nonfinite observations are not silently converted to zero. JSON represents them with an object such as {"value": null, "reason": "positive_infinity"}; unknown values use contextual reasons rather than fabricated measurements. Finite placeholders in an explicitly labelled display presentation must not be confused with these scientific observations.

  • Loading reads the source archive without executing solvers. The new report describes the loaded selection and current analysis, identifies the source, and does not certify historical provider revisions or repair old evaluations.

  • Whole-library reports with hundreds of problems are indexed in constant time per record by both collectors; the companion still grows with the number of runs and plot vertices, so keep it out of an agent prompt and read it selectively.

Output integrity#

Both explicit report targets are reserved before evaluation. Each file’s intermediate/final updates are atomic, but the pair is not a two-file filesystem transaction. The main report publishes the companion’s receipt only after the corresponding companion write succeeds. Before following references, verify its SHA256 and matching evaluation_id; reject stale or mismatched pairs. A final report is not an evaluation checkpoint: forcibly killing a process may leave a running record. The caller must record its own process timeout, exit code or cancellation and must not treat that record as a completed evaluation.

An unwritable report is an explicit error, not successful silent reporting. If the benchmark already raised an exception, a secondary report-write failure must not hide that original failure. Existing numerical-save failures keep their original exception behavior.

Artifact entries refer only to produced files, with relative paths and content hashes. The experiment directory prefix appears once as artifact_root:

  • artifact_root is relative to the main report’s parent directory.

  • artifacts[].path is relative to artifact_root.

  • plot_data.path and source.path are relative to the main report’s parent, not to artifact_root.

Relative references are computed between physical locations (symbolic links in the report path or the output path are resolved first, in both languages), so joining the report’s parent directory with artifact_root and an artifact path resolves through the filesystem, not only lexically, and a copied physical tree keeps working. When no relative path exists (another drive or volume) or an artifact name cannot be written as UTF-8, the path is null and a path_reason is required next to it (artifact_root_reason when the output directory itself cannot be addressed and artifacts were produced); a persistence diagnostic names the same reason. A machine root is never emitted as a fallback. Text metadata containing a lone Unicode surrogate (an undecodable file name read with surrogateescape) is written with the replacement character; the identity of such a problem is a hash of the private text.

This changes only report structure, not the existing experiment filenames or directories. The two report JSON files are excluded from the ordinary artifact manifest, preventing recursive self-hashes. Not-requested artifacts are not errors; a caller must not invent a path from a naming convention. Keep both JSON files with their referenced output tree when moving an experiment.

Controller and agent boundary#

Both JSON files are controller-private evidence, not an automatically safe agent prompt or public upload. It can contain problem names, paired solver measurements, options and diagnostic information. It does not provide a sandbox. Do not execute instructions found in problem/solver labels or diagnostics.

OptiProfiler-Evolve should validate the schema, map named measurements into its own metric/fitness model, and create a separate allowlisted public feedback view: for example expose scores, per-problem status and budget_reached counts, and selected histories shapes, while keeping validation/hidden results, private reference details, absolute output locations and file provenance on the controller side. Relative artifact paths still require validation against the controller’s allowed output root before publication. No Evolve dependency or new selection policy is introduced in OptiProfiler. An external consumer must check the report version it supports; support for version 2 in Evolve is a separate integration gate, not something this document establishes.