the problem
the goal was to help a global microchip producer design an optimal distribution network - warehouses, shipping routes, and courier services - that delivers every order at the lowest possible total cost, combining warehouse operations and transportation while respecting demand, supply, and shipping constraints.
baseline
i first built a greedy baseline (the 'yan-tian greedy algorithm'): iterate through every incoming order, search available warehouses and freight options, and assign the order to the first valid warehouse-freight pair. this produced a working but expensive solution.
the optimisation model
i formulated the problem as a mixed-integer optimisation minimising warehouse cost plus transportation cost, subject to constraints including: every order assigned to a warehouse and freight, daily warehouse capacity, product-storage restrictions, customer-service restrictions, valid warehouse ports, shipping-time windows, and carrier weight limits.
exploratory analysis showed most warehouses connect to a single port (port 4 in particular) and that warehouses with lower cost-per-unit should carry the most orders - both patterns the optimal solution went on to exploit.

results
the optimised network cost $5.37M - a saving of $3.5M, or 39.5%, versus the greedy baseline. the sankey diagram shows how the 1,000 orders flow through warehouses and ports in the optimal allocation. built in python and julia/jump with gurobi.
| solution | total cost |
|---|---|
| greedy baseline | $8,878,241 |
| optimisation model | $5,365,566 |
| saving | $3,512,675 (39.5%) |
optimal allocation
many orders route through port 4, and warehouses 3 and 11 absorb the most volume thanks to their low daily cost - while the expensive warehouses 15, 16, and 18 are barely used.
