ramanshahdatascience / tshirts

The Bayesian t-shirts: a taste of optimal inventory
BSD 3-Clause "New" or "Revised" License
2 stars 1 forks source link

The Bayesian t-shirts: a taste of optimal inventory

This repo contains the homemade inventory system I use to manage the flow of promotional t-shirts I send out as gifts as part of my marketing.

Key assets:

Usage

# Create a CSV suitable for import into Shippo
./inventory_to_shippo_labels.py tshirt_inventory.xlsx xxxx-yy-zz-labels.csv

# Optimal order to console using a fast heuristic
./build_order.py tshirt_inventory.xlsx
./build_order.py tshirt_inventory.xlsx -m heuristic -o console

# Optimal order with some brute-force refinement
./build_order.py tshirt_inventory.xlsx -m optimized

# Write optimal order to the "Hypothetical order" row in the "inventory" sheet
./build_order.py tshirt_inventory.xlsx -o hypothetical

# Finalize optimal order to the "incoming" sheet with today's date
./build_order.py tshirt_inventory.xlsx -o final

Note: As of writing, the openpyxl calls that write the optimal order data to the spreadsheet are fiddly. To avoid errors, one must save the workbook in Excel, then close the workbook before writing to it with this script.

Prior/industry knowledge

According to this blog post by a t-shirt wholesaler, the global t-shirt size distribution is as follows:

This information can feed into an informative prior for building an optimal order.