1 from __future__
import annotations
5 from functools
import lru_cache
6 from pathlib
import Path
9 from benchmarks.density_matrix.evidence_io
import write_artifact_bundle
11 REPO_ROOT = Path(__file__).resolve().parents[3]
12 if str(REPO_ROOT)
not in sys.path:
13 sys.path.insert(0, str(REPO_ROOT))
15 from benchmarks.density_matrix.partitioned_runtime.common
import (
16 PHASE3_RUNTIME_DENSITY_TOL,
17 PHASE3_RUNTIME_ENERGY_TOL,
19 from benchmarks.density_matrix.planner_calibration.claim_selection
import (
20 build_claim_selection_payload,
22 from benchmarks.density_matrix.planner_calibration.common
import (
23 PLANNER_CANDIDATE_SCHEMA_VERSION,
24 build_planner_candidates,
26 from benchmarks.density_matrix.planner_surface.common
import (
27 build_software_metadata,
30 CORRECTNESS_EVIDENCE_CASE_SCHEMA_VERSION =
"correctness_evidence_case_record_v2" 31 CORRECTNESS_EVIDENCE_NEGATIVE_RECORD_SCHEMA_VERSION =
"correctness_evidence_negative_record_v2" 32 CORRECTNESS_PACKAGE_SCHEMA_VERSION =
"correctness_evidence_package_v1" 33 CORRECTNESS_EVIDENCE_SUMMARY_SCHEMA_VERSION =
"correctness_evidence_summary_v1" 36 CORRECTNESS_EVIDENCE_PHASE31_CASE_SCHEMA_VERSION =
"correctness_evidence_phase31_case_record_v1" 37 CORRECTNESS_EVIDENCE_PHASE31_PACKAGE_SCHEMA_VERSION =
"correctness_evidence_phase31_package_v1" 38 CORRECTNESS_EVIDENCE_PHASE31_SUMMARY_SCHEMA_VERSION =
"correctness_evidence_phase31_summary_v1" 39 PHASE31_CORRECTNESS_EVIDENCE_STAGE_A_ROOT =
"phase31_stage_a" 41 CORRECTNESS_EVIDENCE_VALIDATION_SLICE_INTERNAL_ONLY =
"internal_only" 42 CORRECTNESS_EVIDENCE_VALIDATION_SLICE_INTERNAL_PLUS_EXTERNAL =
"internal_plus_external" 43 CORRECTNESS_EVIDENCE_REFERENCE_BACKEND_INTERNAL =
"sequential_density_descriptor_reference" 44 CORRECTNESS_EVIDENCE_REFERENCE_BACKEND_EXTERNAL =
"qiskit_aer_density_matrix" 45 CORRECTNESS_EVIDENCE_RUNTIME_CLASS_BASELINE =
"plain_partitioned_baseline" 47 DEFAULT_OUTPUT_ROOT = (
48 REPO_ROOT /
"benchmarks" /
"density_matrix" /
"artifacts" /
"correctness_evidence" 50 PLANNER_CALIBRATION_CLAIM_SELECTION_BUNDLE_PATH = (
55 /
"planner_calibration" 57 /
"claim_selection_bundle.json" 62 return DEFAULT_OUTPUT_ROOT / slice_dir_name
66 """Artifact subdirectory for Stage-A Phase 3.1 sibling bundles (isolated from default Phase 3).""" 67 return DEFAULT_OUTPUT_ROOT / PHASE31_CORRECTNESS_EVIDENCE_STAGE_A_ROOT / slice_dir_name
72 if PLANNER_CALIBRATION_CLAIM_SELECTION_BUNDLE_PATH.exists():
73 claim_payload = json.loads(
74 PLANNER_CALIBRATION_CLAIM_SELECTION_BUNDLE_PATH.read_text(encoding=
"utf-8")
78 selected = dict(claim_payload[
"selected_candidate"])
82 candidate = candidates_by_id[selected[
"candidate_id"]]
83 selected[
"candidate_schema_version"] = PLANNER_CANDIDATE_SCHEMA_VERSION
84 selected[
"planner_settings"] = candidate.planner_settings
85 selected[
"claim_selection_schema_version"] = claim_payload.get(
86 "schema_version", claim_payload.get(
"claim_selection_schema_version")
88 selected[
"claim_selection_rule"] = claim_payload.get(
89 "claim_selection_rule",
90 claim_payload.get(
"summary", {}).get(
"claim_selection_rule"),
92 selected[
"selected_candidate_id"] = selected[
"candidate_id"]
116 CORRECTNESS_EVIDENCE_VALIDATION_SLICE_INTERNAL_PLUS_EXTERNAL
117 if external_reference_required
118 else CORRECTNESS_EVIDENCE_VALIDATION_SLICE_INTERNAL_ONLY
def build_package_software_metadata()
def correctness_evidence_output_dir
def build_selected_candidate()
def build_software_metadata()
def build_correctness_evidence_selected_candidate()
def build_correctness_evidence_software_metadata()
def phase31_correctness_evidence_output_dir
def build_planner_candidates
def build_claim_selection_payload()
def build_validation_slice