Sunday, February 5, 2017

Markov Chains for Inventory, Supply Chain, Accounts

Markov Chains were originally in the syllabus for my linear algebra class. However, the teacher announced that he'd always considered it something nice to cover, but that he knew we could skip if we needed to. And so, based on his observations, we are skipping it (why do I get the feeling though, that if I weren't in the class that it would still be covered with confidence? I say this in jest. I'm still catching up to everyone else is all).

However, I'd already started reading ahead just to stay on pace with my more math savvy classmates. I had read the Markov Chains chapter and done the homework. Since we weren't covering Markov Chains in class, it wouldn't be on our first test the following week. In the middle of studying for the test, I re-read the chapter anyway, just to get a grasp of what seemed like an interesting concept whose name I had come a cross a handful of times before I started taking classes.

When I re-read it, I got one of those "ah-hah!" moments. I wish this concept was something I had known while I doing some freelance financial modeling work a year or two ago.

Essentially, I put together two financial spreadsheet models for two different clients that had some combination of physical inventory (and associated multi-faceted cost accounting associated with it), up-front payments (and therefore more complicated accounting), various product lines (more complications), and various market-based outcomes (even more complications).

Both models were monsters in size and breadth. Looking back I always wondered how I could have made them simpler.

Markov Chains essentially do that for you. A chain considers how market conditions or combinations of inputs and outputs might change or transition over the course of a given period in the form of a row-by-column matrix. Each one of these individual transitions are represented by figure between 0 and 1 (0% to 100%), adding up to between 0 and 1 in each column, in the matrix P, called the matrix of transition probabilities. This matrix represents percentage / probability of occurrence in a given period applied to an original market condition X (say X is, for example, is the number of total items sold into a market, with each market represented by a row in X). When you multiply P*X the output Y is your new market condition.

Keep multiplying the same Markov matrix / matrix of transition probabilities and you get the assumed cumulative condition of that market overtime. The one thing I wonder though, is what happens if you have new transition probabilities. I guess instead of multiplying by the same exact matrix of transition probabilities in the given time period, you multiply by a new / adjusted version instead?

Either way, potentially, 10 large tabs in an Excel spreadsheet file could have been reduced to 1-3 more compact ones. Though I'm not sure if Excel can really handle matrices to begin with.

On top of all that, being actually able to apply this method and execute it correctly is a whole other matter.

Still, this feels like adding another compartment/notch to Batman's utility belt. More math seems to give you more options to choose from.