Buckets:
| #!/usr/bin/env python | |
| """Figure: per-PDR mean relative-to-best makespan gap (Claim 3 heuristic side). | |
| Bar chart of the 24 composite PDRs sorted by mean gap, LIFO+LIT highlighted as | |
| the best single fixed rule. Reproduces the ordering behind Table 5's heuristic | |
| block. | |
| """ | |
| from __future__ import annotations | |
| import json | |
| from pathlib import Path | |
| import matplotlib | |
| matplotlib.use("Agg") | |
| import matplotlib.pyplot as plt # noqa: E402 | |
| ROOT = Path("/home/ubuntu/samuel/dynasched-repro") | |
| GAPS = ROOT / "outputs" / "pdr_gaps.json" | |
| OUT = ROOT / "figs" / "pdr_gaps_bar.png" | |
| def main(): | |
| g = json.loads(GAPS.read_text()) | |
| ranked = g["ranked_rules"] | |
| mean_gap = g["mean_gap_pct"] | |
| vals = [mean_gap[r] for r in ranked] | |
| colors = [] | |
| for r in ranked: | |
| if r == "LIFO:LIT": | |
| colors.append("#0f766e") # highlight best | |
| elif r == "SPT:SPT": | |
| colors.append("#b91c1c") # highlight weak reference | |
| else: | |
| colors.append("#94a3b8") | |
| fig, ax = plt.subplots(figsize=(11, 6)) | |
| bars = ax.bar(range(len(ranked)), vals, color=colors) | |
| ax.set_xticks(range(len(ranked))) | |
| ax.set_xticklabels( | |
| [r.replace(":", "+") for r in ranked], rotation=60, ha="right", fontsize=8 | |
| ) | |
| ax.set_ylabel("Mean relative-to-best makespan gap (%)") | |
| ax.set_title( | |
| "DynaSched-Subset (70 instances): per-PDR mean gap vs best-observed\n" | |
| "24 composite priority dispatch rules — LIFO+LIT is the best single fixed rule" | |
| ) | |
| # annotate LIFO+LIT and SPT+SPT | |
| for i, r in enumerate(ranked): | |
| if r in ("LIFO:LIT", "SPT:SPT"): | |
| ax.text( | |
| i, | |
| vals[i] + max(vals) * 0.01, | |
| f"{vals[i]:.2f}%", | |
| ha="center", | |
| va="bottom", | |
| fontsize=8, | |
| fontweight="bold", | |
| ) | |
| best = g["best_rule"].replace(":", "+") | |
| ax.axhline(mean_gap[g["best_rule"]], color="#0f766e", ls="--", lw=0.8, alpha=0.6) | |
| ax.text( | |
| len(ranked) - 1, | |
| mean_gap[g["best_rule"]], | |
| f" best={best} {g['best_mean_gap']:.2f}% (paper 1.11%)", | |
| va="bottom", | |
| ha="right", | |
| color="#0f766e", | |
| fontsize=9, | |
| ) | |
| from matplotlib.patches import Patch | |
| ax.legend( | |
| handles=[ | |
| Patch(color="#0f766e", label="LIFO+LIT (best fixed rule)"), | |
| Patch(color="#b91c1c", label="SPT+SPT (weak reference)"), | |
| Patch(color="#94a3b8", label="other PDRs"), | |
| ], | |
| fontsize=8, | |
| ) | |
| plt.tight_layout() | |
| OUT.parent.mkdir(parents=True, exist_ok=True) | |
| fig.savefig(OUT, dpi=130) | |
| print(f"Wrote {OUT}") | |
| if __name__ == "__main__": | |
| main() | |
Xet Storage Details
- Size:
- 2.7 kB
- Xet hash:
- a8435985eefa6f57c2b2ed0b65ea102a8d732966d84359b48f2350eaa1c664ee
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.