An economic comparison of continuous sampling plans under a four-component cost model with transition costs (CSP-1 / CSP-2 / CSP-3)
| File | Description |
|---|---|
csp_classic_plans.py |
Classical MIL-STD-1235 / Dodge–Torrey CSP-1/2/3 model (closed-form, incl. the new two-defect CSP-2 form) + exact-rule discrete-event simulator + validation self-test |
csp_multiplan.py |
Unifying k-stage generalization (CSPMultiPlanModel) + optimizer + comparator + simulator + self-test |
run_dominance_classic.py |
Economic dominance over the classical plans → dominance_classic.csv (with explicit tie handling) |
run_dominance.py |
Base factorial over the k-stage family → dominance.csv |
run_dominance_v2.py |
Expanded 210-cell classical factorial (7×6×5, intermediate levels) with strict subset-tie rule + ±10% robustness distinguishing nominal vs real flips → dominance_v2.csv, robustness_v2.csv. Replaces analyze_dominance.py (which used argmin without a tie category, on the k-stage family) |
_fig_dominance_v2.py |
Regenerates fig_dominance_v2.{png,pdf} (300 dpi, 5 panels by c_rej, explicit tie categories) |
_regen_heatmap.py |
Regenerates the dominance heatmap with an explicit Tie category (CSP-2 vs tie); supersedes the old argmin colouring |
upgrade_q2_analysis.py |
ANOVA, main effects, surface-response metamodel, cost-variance simulation, literature-anchored scenarios |
run_twopart_transition.py |
Two-part (fixed-plus-variable) transition costs over the classical plans: cost per reversion = c_fix + c_var·u → twopart_dominance.csv (360-cell factorial, explicit ties) |
run_spotty_markov.py |
Markov-modulated ("spotty") quality extension: two-state chain (p_G, p_B, λ, μ), unit-by-unit walker validated by reduction (p_B=p_G reproduces the closed forms), CRN-paired optimization and evaluation → spotty_dominance.csv |
run_csp3_full_check.py |
Definitional-fidelity check for CSP-3: walker parametrized by (burst, window) — (0,i)=CSP-2, (4,0)=burst-only CSP-3, (4,i)=full Dodge–Torrey rule CSP-3F — validated by reduction at both ends; Part A re-optimizes CSP-3F over the 36-cell i.i.d. factorial, Part B re-runs the 24-cell spotty factorial with four plans → csp3full_iid.csv, csp3full_spotty.csv |
run_inspection_error_check.py |
Closed-form Type-I/Type-II misclassification extension (dynamics on p_app = p'(1−β)+(1−p')α, cost accounting separating true/apparent events), validated against a unit-by-unit simulation of the misclassified rule, then swept over 24 (α,β) settings × 36 base cells = 864 scenarios → inspection_error_dominance.csv |
revision1_checks.py |
Deterministic reviewer checks: tie-threshold sensitivity (δ=1 / δ=0 / relative 0.1%) on base, expanded and two-part grids → delta_sensitivity_base36.csv, delta_sensitivity_v2_210.csv; variance decomposition (η²) of the k-stage factorial; goodness of fit + LOO-CV of the logistic metamodel; floor-residual decomposition |
_fig_surface_v2.py |
Regenerates fig_surface_response.{png,pdf} from the refitted metamodel (strict-win outcome, standardized features incl. the p'·c_esc interaction) |
_fig_spotty.py |
Regenerates fig_spotty_dominance.{png,pdf} (300 dpi) from spotty_dominance.csv |
dominance_classic.csv |
Classical-plan factorial: ETC per plan and winner (ties labelled TIE) |
dominance.csv |
k-stage factorial |
twopart_dominance.csv |
Two-part transition-cost factorial: ETC and optimal (i,f) per plan, winner with tie category, CSP-3 gap |
spotty_dominance.csv |
Spotty-quality factorial (24 cells): paired ETC per plan, optimal (i,f), strict winner / explicit tie, paired gap ± SE |
csp3full_iid.csv / csp3full_spotty.csv |
Full-rule CSP-3F vs closed-form optima (36 i.i.d. cells) and four-plan spotty factorial (24 cells) |
dominance_v2.csv / robustness_v2.csv |
Expanded classical factorial (210 cells): ETC and optimal (i,f) per plan, subset-tie winner; nominal vs real flip counts per cell |
literature_scenarios.csv |
Six industrial scenarios anchored on literature parameter ranges |
python csp_classic_plans.py→ validates the classical CSP-2/CSP-3 closed forms against a discrete-event simulation of the exact rule (AFI/AOQ within 1%).python run_dominance_classic.py→ CSP-2 unique optimum in 21/36 (58.3%), 15/36 ties, CSP-3 never wins; identical winners to the k-stage family (definition-robust).python run_twopart_transition.py→ CSP-3 strict winner in 0/360 cells even with c_fix up to 5000 and a per-unit screening-duration premium c_var up to 5; both axes widen CSP-2's advantage (mean CSP-3 gap 0.4 → 69.0 → 95.6).python run_spotty_markov.py(~7 min) → under Markov-modulated quality CSP-3 is the strict winner in 7/24 cells (severe/persistent bad spells + high escape cost, savings up to 8.2% over CSP-2); CSP-2 wins 14, 3 explicit ties, CSP-1 never wins.python run_inspection_error_check.py(~1 min) → CSP-3 strict winner in 0/864 error-augmented scenarios (α up to 0.20, β up to 0.20); the CSP-3 gap widens monotonically with the Type-I rate (13.5 → 26.3 → 70.2 → 522.8 at β=0.10) and CSP-2's strict-win count grows 18 → 33/36: inspection errors strengthen, not weaken, CSP-2's dominance under i.i.d. quality.python revision1_checks.py(~2 min) → tie rule not load-bearing: under a relative 0.1% tolerance CSP-1/CSP-3 win nowhere (0/36, 0/210, 0/360) and CSP-2's strict count rises (18→20, 103→126); pure-argmin "wins" of CSP-1/CSP-3 are collapse-floor numerical dust (≤0.001 units base/expanded, ≤0.25 units two-part). η²: plan 0.21%, c_rej 0.08%, interaction 0.10%, regime (p', c_esc) 99.6%. Metamodel: acc 0.83 / McFadden 0.58 / AUC 0.94 / LOO 0.75; adding p'·c_esc separates perfectly (LOO 36/36).python run_csp3_full_check.py(~8 min) → the full Dodge–Torrey CSP-3 rule (CSP-3F, post-burst alert window) beats CSP-2 in 0/36 i.i.d. cells and burst-only CSP-3 in 0/36 (negative results hold a fortiori); in the spotty factorial CSP-3F never enters the winner set (0/24) while the burst-only CSP-3 region persists — the advantage belongs to the burst, not the alert window.python run_dominance_v2.py(~15 min) → expanded 210-cell grid: CSP-2 strict 103 (49.0%), 75 all-three ties (collapse), 32 CSP-2/CSP-3 partial ties (very low p'); ±10% robustness: 96.4% nominal, 100% real stability (no perturbation removes the recommended plan from the optimal set); 33/36 agreement with the base factorial (the 3 differences are argmin residues at c_rej=100 corrected by the subset-tie rule).
Python >= 3.9; numpy, scipy, pandas, matplotlib, seaborn, scikit-learn.
python csp_classic_plans.py # validate classical CSP-1/2/3 models
python run_dominance_classic.py # classical economic dominance
python csp_multiplan.py # validate the k-stage generalization
python run_dominance.py # k-stage factorial
python upgrade_q2_analysis.py # ANOVA / metamodel / variance / literature
python _regen_heatmap.py # dominance heatmap with Tie categoryAll scripts use relative paths and run in the project root directory.