Skip to content

Impact of Improved Consumable Availability - #1702

Draft
sakshimohan wants to merge 84 commits into
masterfrom
sakshi/consumable_impact_analysis_for_manuscript
Draft

Impact of Improved Consumable Availability#1702
sakshimohan wants to merge 84 commits into
masterfrom
sakshi/consumable_impact_analysis_for_manuscript

Conversation

@sakshimohan

Copy link
Copy Markdown
Collaborator

No description provided.

…cript

- add heatmaps
- add detailed table of average availability by consumable across scenarios
@sakshimohan sakshimohan changed the title sakshi/consumable_impact_analysis_for_manuscript Impact of Improved Consumable Availability Sep 10, 2025
@sakshimohan
sakshimohan marked this pull request as draft September 26, 2025 11:22
1. only levels 1a and 1b can receive
2. facilities only transfer stock that they have beyond 3 X AMC
- differentiate between tau_donor_keep and tau_max
and revert to the previous opening balance calculation method based on data for the current month.
- increase opening balance where p based on OB/AMC is lower than observed p
- fix errors in pooling which led to LB sometimes being higher than UB, specifically when tau_min X amc > OB for levels 2-4
…unds

Split create_consumable_redistribution_scenarios.py into a shorter
script and a new redistribution_utils.py holding the travel-time
matrix builders, clustering heuristic, the two optimisation models,
validation checks, smoke tests, and plotting functions.

Model changes:
- Pooling LP: drop the tau_min equity floor. LB is now pure donor
  protection, LB = min(OB, tau_keep*AMC), which makes LB <= UB and
  sum(LB) <= TotalStock hold by construction instead of needing
  post-hoc clamping.
- Pooling LP: replace the manual "reset p to baseline for ineligible
  facility levels" patch with an assertion, since the corrected
  UB already makes that reset unreachable.
- Pairwise MILP: restore the t <= M*y edge-activation constraint
  (previously commented out), without which the minimum-lot-size
  constraint didn't bind.
- Pairwise MILP: make the K_in/K_out exchange-count caps optional
  (default None = uncapped). The travel-time radius and the
  minimum-lot size already bound how many counterparties a facility
  can plausibly trade with in a month, so no separate degree cap is
  imposed by default; the parameters remain available for a stricter
  delivery-capacity sensitivity run.
- Fix CBC solver numerical wobble (~1e-6) being misread as a real
  stock movement, which could trip the non-eligible-unchanged check.

Add validate_redistribution_output() enforcing five invariants
(non-eligible availability unchanged, no-harm, stock conservation,
donor protection, ceiling respected), plus run_smoke_tests() against
synthetic data covering both models.

Add plot_stockout_prevention()/plot_stockout_prevention_by_month() to
summarise how much anticipated stock-out risk each scenario averts.
…ing_lp

- Add pooling_level="national" (pools across the whole country per item/month).
- Fix cluster pooling: build_capacity_clusters_all now keys its cluster map on
  (district, fac_name) instead of fac_name alone, avoiding a many-to-many merge
  when a facility name recurs across districts (caused row duplication and
  conservation/ceiling violations).
- Fix write-back: a facility's solved allocation is now split proportionally
  across any duplicate raw rows for that facility/pool, instead of writing the
  full amount to each row.
- National pooling disambiguates facilities via an internal (district, fac_name)
  node key, so two differently-located facilities that share a name are never
  silently merged into one LP node.
- Add regression smoke tests for all of the above (cross-district name
  collisions in both cluster and national pooling, duplicate raw rows).
…y across scenarios

- shows mean, median, and IQR
Without the cleaned district names in T_car, districts with spaces in their names are ignored in the pairwise LP
- the RFs were overwritten by master to deal with the conflict resulting from PR #1819.
@sakshimohan sakshimohan assigned sakshimohan and unassigned tbhallett Aug 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants