Skip to content

auto_output_format_1

github-actions[bot] edited this page Nov 14, 2025 · 1 revision

Snippet from Output-Format.md

# Quick Parse: Load and Extract Key Signals
import json
from typing import Dict, Any

def audit_cert(cert_path: str) -> Dict[str, Any]:
    with open(cert_path, 'r') as f:
        cert = json.load(f)
    
    # Core audit
    model = cert['model']
    U = cert['utility']
    feas = cert['constraints']['feasible']
    shadows = cert['constraints']['shadow_prices']
    gap = cert['boundary']['utility_gap']
    flag = cert['boundary']['is_boundary']
    
    # Flags
    issues = []
    if not feas:
        issues.append("Infeasible route—check b.")
    if flag:
        issues.append(f"Boundary tie: gap={gap:.3f}, consider reroute.")
    if max(shadows) > 0.5:
        issues.append("Tight constraint—high shadow.")
    
    return {
        "model": model,
        "U": U,
        "issues": issues,
        "full": cert  # For deep dive
    }

# Example: Load Minimal
cert = '{"model": "fast", "U": 0.742}'
print(audit_cert('trace.json'))  # Expand to file

Clone this wiki locally