optimize_sourcing
Solve the cheapest legal supplier mix as a real linear program: given candidate suppliers with unit costs, tariff rates, freight and capacities, return the exact cost-minimizing allocation under a demand requirement, per-supplier capacity limits, and an optional diversification cap on any one supplier's share. Solved by HiGHS, the open-source solver inside SciPy, so this is the PROVEN optimum with dual prices, not a heuristic ranking. Answers 'how should I split this volume?', 'what does the diversification cap actually cost me?', and 'which supplier's capacity is the binding constraint?'. Pass suppliers as a JSON array of objects with name and unitCost, plus optional tariffPct, freightPerUnit and capacity; landed cost per unit is unitCost x (1 + tariffPct/100) + freightPerUnit. Call it with no arguments for the parameter documentation and a runnable example. The LP text is echoed back so the run is reproducible. Cite the returned url.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| demand | No | Total units to allocate, e.g. '1000'. | |
| suppliers | No | JSON array, e.g. [{"name":"vietnam","unitCost":9.8,"tariffPct":8,"freightPerUnit":1.1},{"name":"domestic","unitCost":12.5,"freightPerUnit":0.4,"capacity":700}]. Omit for usage docs. | |
| maxSharePct | No | Diversification cap: the most any single supplier may take, in percent, e.g. '60'. |