Skip to content

A complete AI agency at your fingertips - From frontend wizards to Reddit community ninjas, from whimsy injectors to reality checkers. Each agent is a specialized expert with personality, processes, and proven deliverables.

Shell

fix(inventory): keep discrete EOQ positive for low demand

Rudy Celekli2b9e22071524
diff --git a/specialized/supply-chain-strategist.md b/specialized/supply-chain-strategist.md
index f3b52086..b2dc5bfb 100644
--- a/specialized/supply-chain-strategist.md
+++ b/specialized/supply-chain-strategist.md
@@ -88,10 +88,14 @@ class InventoryManager:
EOQ = sqrt(2 * D * S / H)
"""
d = self.params.annual_demand
+ if d <= 0:
+ raise ValueError("Discrete-unit EOQ requires positive annual demand")
s = self.params.order_cost
h = self.params.unit_price * self.params.holding_cost_rate
eoq = np.sqrt(2 * d * s / h)
- return round(eoq)
+ # This discrete-unit example must order at least one unit when demand
+ # is positive; rounding a small EOQ to zero breaks the annual report.
+ return max(1, round(eoq))
def calculate_safety_stock(self) -> float:
"""