MOO Dairy Farming

Image Credits: Wikimedia Commons

What do electricity and dairy farming have in common?

If you’re Oscar Dowson, quite a lot.

Oscar Dowson is a researcher at the University of Auckland Electric Power Optimization Centre (EPOC), which uses Julia to model and optimize power generation and distribution for New Zealand.

Like many New Zealanders, Dowson grew up on a dairy farm.

At first read, these might seem like two completely unrelated facts.

But on Dowson’s family dairy farm on the North Island of New Zealand, water can be used to grow grass, which is used to feed cows that produce milk. On the South Island of New Zealand, water is used to power turbines that deliver electricity to the New Zealand power grid.

Operating a dairy farm depends on variables such as rain, the price of the output (milk) and the price of substitutes, such as corn, which is an alternative to grass for feeding cows.

Operating a hydroelectric power plant also depends on rain, the price of the output (electricity) and the price of substitutes, such as coal, which is an alternative to water for generating electricity.

These variables have one thing in common: uncertainty.

So Dowson applied the same Julia optimization tools that EPOC is using to model power generation and distribution to optimize the use of water and other inputs for the production of milk.

The result? The Milk Output Optimizer, or MOO.

Dowson explains:

“A lot of our work involves solving mathematical models of the world in which the future is uncertain. Our workhorse is a solution algorithm called Stochastic Dual Dynamic Programming (SDDP). This works by solving hundreds of thousands of linear programs so speed is important.

“We chose Julia because the JuliaOpt ecosystem is first-in-class. The combination of Julia and the JuMP Julia library allowed us to easily build flexible, performant, high-level solution algorithms for these sorts of problems; something that wasn’t possible in other languages.

“EPOC has an implementation of the SDDP algorithm in C++, but it became very time-consuming to test new ideas, or modify the model. We re-wrote it from scratch in Julia and found that they gave identical results in a similar run-time. That gave us great confidence that both implementations were correct. However the Julia version is much easier to write while being more flexible! This has allowed us to rapidly test new ideas, and revisit old assumptions in a way that wasn't previously possible.

“Today EPOC increasingly uses Julia as the tool of choice for new research, as well as with its industrial clients. In addition, it turns out that there are some great similarities between cows and hydro-power stations. The knowledge and tools developed at EPOC over the last twenty years is now being applied to the New Zealand dairy industry (with the help of Julia). Our goal is to help New Zealand farmers develop management strategies that maximize their profitability, whilst minimizing their environmental footprint.

“That’s great for a more economically, and environmentally, sustainable New Zealand.”

our enterprise products

Dowson applied the same Julia optimization tools that EPOC is using to model power generation and distribution to optimize the use of water and other inputs for the production of milk.