Files
aituner/runs/frontier-workload-regime-taxonomy-v0/plot_mock_boundary.py

74 lines
2.5 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env python3
"""Render the review-only schematic for the workload-regime experiment card."""
from pathlib import Path
import matplotlib.pyplot as plt
import numpy as np
def logistic(x: np.ndarray, center: float, width: float) -> np.ndarray:
return 1.0 / (1.0 + np.exp(-(x - center) / width))
rho = np.linspace(0.02, 1.25, 300)
families = {
"homogeneous / real": (0.54, "#1f77b4", "-"),
"homogeneous / simulator": (0.36, "#1f77b4", "--"),
"heterogeneous / real": (0.76, "#d95f02", "-"),
"heterogeneous / simulator": (0.68, "#d95f02", "--"),
}
fig, axes = plt.subplots(1, 2, figsize=(11.5, 4.6), constrained_layout=True)
for label, (center, color, style) in families.items():
state = 0.1 + 0.82 * logistic(rho, center, 0.055)
axes[0].plot(rho, state, color=color, linestyle=style, linewidth=2.2, label=label)
axes[0].axhline(0.5, color="0.35", linewidth=1, linestyle=":")
axes[0].set(
title="A. Closed-loop scheduler-state knee",
xlabel="Normalized decode offered load, ρ",
ylabel="State index (batch / occupancy)",
xlim=(0, 1.25),
ylim=(0, 1.02),
)
axes[0].legend(frameon=False, fontsize=8, loc="lower right")
homogeneous_slack = 0.32 - 0.82 * np.exp(-((rho - 0.45) / 0.18) ** 2) - 0.12 * rho
heterogeneous_slack = 0.38 - 0.43 * np.exp(-((rho - 0.72) / 0.20) ** 2) - 0.10 * rho
capacity_aligned = 0.18 + 0.18 * logistic(rho, 0.83, 0.07)
axes[1].plot(rho, homogeneous_slack, color="#1f77b4", linewidth=2.2, label="homogeneous")
axes[1].plot(rho, heterogeneous_slack, color="#d95f02", linewidth=2.2, label="heterogeneous")
axes[1].plot(rho, capacity_aligned, color="#2a9d8f", linewidth=2.2, label="capacity-aligned")
axes[1].axhline(0, color="black", linewidth=1.2)
axes[1].fill_between(rho, -0.55, 0, color="#d62728", alpha=0.09, label="ranking reversal")
axes[1].set(
title="B. Config-ranking decision boundary",
xlabel="Normalized decode offered load, ρ",
ylabel="Minimum signed decision slack",
xlim=(0, 1.25),
ylim=(-0.55, 0.55),
)
axes[1].legend(frameon=False, fontsize=8, loc="lower right")
for ax in axes:
ax.grid(alpha=0.18)
ax.text(
0.5,
0.94,
"MOCK / SCHEMATIC — NOT DATA",
transform=ax.transAxes,
ha="center",
va="top",
fontsize=10,
fontweight="bold",
color="#9d0208",
bbox={"facecolor": "white", "edgecolor": "#9d0208", "alpha": 0.86},
)
out = Path(__file__).with_name("mock_workload_regime_boundary.png")
fig.savefig(out, dpi=180)
print(out)