Jainam Gala

Supply chain · Excel to Python · MILP

Chip Warehousing and Shipping Optimization

A seven-day plan for 9,215 orders. Modeled warehouse cost fell by $141,691.76, and no warehouse broke its daily capacity.

← Back to portfolio

Project overview

The question was practical: can the current network handle these orders, and is there a cheaper assignment that still works? Excel and Power Query checked examples. Python repeated those checks across the full dataset. A mixed-integer linear program chose the warehouse, the shipping route, and the processing day together.

This is a public portfolio case built on the Brunel Supply Chain Logistics Problem Dataset. It is not a client engagement.

Key results

MeasureSaved result
Orders assigned / daily capacity violations9,215 / 0
Historical assignment warehouse cost at current rates$15,633,221.91
New plan warehouse cost$15,491,530.16
Warehouse-cost reduction$141,691.76 · 0.9%
Orders moved to another warehouse1,611
Plan freight / total cost$22,065.48 / $15,513,595.64
Remaining possible improvement$4,394.34 · 0.0283%
Final solver time3.66 seconds

The solver met its 1% tolerance and kept the starting plan. Exact optimality was not proved. Solver time excludes preparation. The remaining gap is possible improvement, not savings already achieved.

Dataset and tools

Scope. 9,215 orders, 19 warehouses, and 1,540 freight-rate records. Seven tables: OrderList, FreightRates, PlantPorts, ProductsPerPlant, VmiCustomers, WhCapacities, and WhCosts.

Tools. Excel, Power Query, Python, pandas, NumPy, openpyxl, SciPy, and HiGHS (highspy).

Visual findings

The charts use the same colors as the rest of the site. Navy is the plan, slate is the historical baseline, copper is the constraint, and gold marks a remainder that is real but small.

1. PLANT03 is the bottleneck

Historical assignments exceed the current seven-day capacity by 1,450 orders. This comparison does not establish that those orders were late in history.

PLANT03 can't handle its historical workload Seven-day capacity is 7,091 orders. Historical orders are 8,541, which is 1,450 orders over capacity. PLANT03 can't handle its historical workload Capacity = 1,013 orders/day × 7 days (planning assumption) 0 2,000 4,000 6,000 8,000 Orders 7,091 8,541 7-day capacity Historical orders 1,450 orders over capacity
PLANT03: 8,541 historical orders versus 7,091 seven-day capacity.

2. Most orders have no warehouse alternative

7,562 orders have one eligible warehouse. 1,653 have alternatives. PLANT03 must handle 7,043 of them, leaving only 48 spare slots over seven days. A required warehouse can still leave the route and the day open.

Most orders cannot change warehouse Of 9,215 orders, 7,043 can only use PLANT03, 519 have another single warehouse, 1,587 have two choices, and 66 have three choices. Most orders cannot change warehouse 9,215 orders · 82.06% have only one eligible warehouse PLANT03 only · 7,043 orders · 76.43% Another single warehouse · 519 · 5.63% Two warehouse choices · 1,587 · 17.22% Three warehouse choices · 66 · 0.72% A fixed warehouse can still leave shipping-route and day choices open.
Warehouse choices: PLANT03 only 7,043; another single warehouse 519; two choices 1,587; three choices 66.

3. Reassignment reduces dependence

1,611 orders changed warehouse. The chart shows net workload changes. PLANT03's load fell by 1,498 orders.

1,611 orders moved to a different warehouse PLANT03 lost 1,498 orders. PLANT02 gained 686, PLANT04 gained 386, and smaller gains and losses appear at the other plants. 1,611 orders moved to a different warehouse Only warehouses whose workload changed are shown ◀ Orders moved away Orders gained ▶ PLANT02 +686 PLANT04 +386 PLANT10 +183 PLANT05 +180 PLANT07 +102 PLANT09 +62 PLANT13 +12 PLANT12 −12 PLANT08 −101 PLANT03 −1,498 Net change in orders (plan − historical)
Net order changes by warehouse after reassignment.

4. Warehouse costs fall

Both assignments use the same current warehouse rates. Incomplete historical freight matches prevent a full total-cost savings comparison.

Warehouse cost: about $142,000 lower Historical routing costs $15,633,222. The optimized plan costs $15,491,530. Warehouse cost: about $142,000 lower 0.9% reduction · freight excluded (historical rates unavailable) Historical routing $15,633,222 Optimized plan $15,491,530 $0M $4M $8M $12M $16M $20M Warehouse cost (unit quantity × cost per unit)
Historical assignment $15,633,221.91 versus the new plan $15,491,530.16.

5. Freight is a small share under this model

Freight is 0.14% of scenario cost. The slice is drawn at its true size and has not been enlarged.

Warehouse cost dominates this modeled plan Warehouse cost is $15,491,530.16, or 99.86 percent. Freight is $22,065.48, or 0.14 percent. Total scenario cost is $15,513,595.64. Warehouse cost dominates this modeled plan Total scenario cost: $15,513,595.64 Warehouse · 99.86% $15,491,530.16 Freight · 0.14% $22,065.48 Freight is a very thin slice; its size has not been enlarged. Scenario pricing only; historical freight savings could not be established.
Cost split: warehouse 99.86% and freight 0.14%.

Decision trees

These show the decision rules and the reasoning. They are not separate experiments for every branch.

Choose the approach

Validate examples in Excel

Historical routing fits seven-day capacity?

No · PLANT03 exceeds capacity

Build a feasible reassignment

Another eligible warehouse?

Yes · 1,653 orders

Allow warehouse choices

No · 7,562 orders

Keep the required warehouse

Keep valid route and day choices

Use Python and MILP

Yes

Keep the baseline and assess cost

This path skips reassignment and joins the freight question below.

Complete historical freight baseline?

No · this dataset

Compare warehouse cost. Report plan freight separately.

Yes

Compare total costs on the same basis.

Why MILP? Orders stay whole, while warehouse capacity and shared freight pricing connect their decisions.

Solve and validate

Original search: over six hours without a plan

Simplify pricing and remove unnecessary options

Build a starting schedule

Coverage, eligibility, capacity, and weight checks pass?

No

Repair and recheck

Return to the same checks until they pass.

Yes

Save the starting plan. Search with choices open.

Requested cost gap reached?

Yes

Save the best plan and report the gap.

No

Time budget exhausted?

No

Keep searching with choices open.

Yes

Keep the best checked plan. Report that the search is unfinished.

Obstacles and decisions

ObstacleResponse
No customer feedback; unclear timing fieldsTested network feasibility without claiming service failures.
Spare capacity and independent cheapest choices were misleadingCounted orders, enforced eligibility, and shared capacity.
Million-row Excel joins; missing Column12; connection-only sheetsFixed query steps, loaded summaries, and automated the checks in Python.
Rounded IDs, missing pip, read-only arraysPreserved original IDs and corrected the setup.
Historical carrier and weight-band mismatchesAvoided forced matches. Limited the savings comparison to warehouse costs.
Actual shipping groups unknownModeled compatible orders that share a route and a day.
Six-hour search returned no planSimplified equivalent calculations and supplied a checked starting plan.
Grouping could restrict choicesKept all orders and allowed final warehouse, route, and day changes.
Other studies reported different totalsCompared scope and pricing rules, and kept one run's results together.

Assumptions and limits

Seven days is a planning scenario. All orders are available at the start. Processing and dispatch share a day. No delivery deadlines or delay penalties are modeled.

Whole orders must satisfy product, customer, port, service, and daily order-capacity rules. Warehouse cost is quantity times the unit rate, not a daily holding cost.

Compatible orders on the same route and day share a weight band. AIR charges apply per order. GROUND charges apply per group. Customer-arranged freight costs the company nothing in freight, and the warehouse cost still applies.

The 48-slot PLANT03 cushion is arithmetic. A capacity-loss stress test has not been completed.

Project files and running

FilesPurpose
README.md, images/Project story, decision trees, and five charts
Supply chain logisitcs problem.xlsxOriginal seven-table data
supply chain analysis.xlsxExcel and Power Query workflow
supply chain analysis.pyAutomated checks, model, and exports
requirements.txt, .gitignoreDependencies and excluded working files
starting_plan_orders.csv, best_plan_orders.csvInitial and retained order assignments
starting_plan_daily_capacity.csv, best_plan_daily_capacity.csvDaily warehouse workloads
starting_plan_freight_groups.csv, best_plan_freight_groups.csvGroup weights, bands, and freight charges
starting_plan_cost.json, best_plan_cost.jsonCost totals
solve_summary.json, solver.logSettings, status, runtime, bound, and gap

Keep the script beside the original workbook.

python -m pip install -r requirements.txt
python "supply chain analysis.py"

Each run creates a timestamped folder under shipping_results/. Keep its ten outputs together. The final search uses a 300-second budget and a 1% gap target.