So how about something different. I learned R programming here for climate software. Plotting, fitting curves, calculating stats and all kinds of linear algebra. Prior to that I had programmed in various forms of C, Basic, a few other arcane languages, assembly/machine, etc… I had written my own matrix multipliers and inverters multiple times. It was all low level engineering style languages for equipment integration, calculation and a literal ton of other applications. R turns out to be very flexible for most of what I had done in other languages, and could have handled a large portion of the problems with a much reduced development time.
Over the past couple of years, I’ve expanded my use of R to some unique applications. I have used the R algorithms to calculate some fairly sophisticated lenses, but interestingly have adopted the software to perform material requirement planning to a level difficult to find in commercial software. The ability to work with large matrices makes R well suited to the task. Lean manufacturing requires just in time delivery of components. Inventory is a significant cost to a company and is paid for in after-tax dollars so it must be controlled to a high degree for a company to succeed. In a mid-sized company as ours has become, we have over two thousand part numbers which turn into about 600 finished goods of various types. In our business case, these finished goods need to be stocked at appropriate levels to service our customers within a fixed range of part numbers.
So what we have is:
Forecast usage based on history and customer provided expectations
Target inventory levels for components
Manufacturing time for various processes
Shipment time for components
From those basic numbers and a variety of other information including bills of material (list of subcomponents in an assembly), lead times and manufacturing location, we use R software to calculate our manufacturing schedule, component ordering, required delivery dates and note any problems in the delivery time. Just in case you think this might be simple, our supply chain is quite long, sometimes as much as 13 weeks with various steps happening at planned points along the process.
A common example for us is where electronic components are ordered in the US, shipped overseas in 1 week, 1 week allowed for assembly to circuit boards, ship back to US by air 1 week, final assembly in us 1 week. In the meantime, other components for the same finished product, might be built to arrive at the same time as the circuit boards from another facility with a longer 3 week production time and those might be intended to ship by sea over 5 weeks to arrive simultaneously with the stock requirement of the circuit boards such that a production build happens on the correct date. Now even that isn’t terribly complicated but we utilize the same components in multiple part numbers. Each one forecast and stocked on independent schedules such that economic quantities of components must be delivered in time for the first of what sometimes is multiple builds. Expand that problem over two thousand active part numbers and that is our situation.
The software calculates its recommended orders and writes a huge 20,000 plus line file into excel, highlighting orders to be placed and even writes live equations into the cells such that if the buyer decides that the order needs to be altered, projected inventory is recalculated on the fly. Warning symbols are also generated by live equations in excel such that inventory overstock or under stock situations are highlighted.
It’s pretty interesting to me and a commercial version, which we have purchased but not yet implemented, is surprisingly expensive. While many people will tell you that their software can handle it, there are only a few on the market which perform these calculations to the level that our company has been able to implement and operate with for two years now.
And it was done in R.
The ability to program and plan like this gives us the ability to take our projected stock level as a matrix, multiplied by a vector of the true component costs to achieve our projected inventory value for the next 3.5 months with two lines like this:
totalinventorycost = sweep(projectedinventory,2,cost,”*”)
Slide that information into your cash flow planning and you have closed the loop between future inventory levels and expected cash needs for the next 3 months.
We have R software that calculates sales commissions for outside reps, checks delivery status and manufacturing status, recommends orders, designs lenses, calculates component usage, and a few tax related routines as well. In addition to that, I use it for all kinds of math driven electrical and mechanical engineering related tasks.
I’m pretty certain that the creators of R didn’t expect their statistical software to be abused in such a capitalistic manner. However, I do consider it a positive impact of the climate change nonsense the boys at Real Climate exposed all of us to. I also must give credit to Mr. McIntyre as it was his continued promotion of the language that got me started down this path.