Food accounts for 40% of the world's water consumption.
Different foods from different places can have the same nutrition, but require very different amounts of water to make.
Given all the data available today, what's the optimal way to eat, to sustain both ourselves and the Earth?
eats just enough to be able to fight crime, while still conserving the planet's water
asian girl planeteer, with the power of water; probably also studies data science
statistics ninja; collected, cleaned, cross-referenced and analyzed all the data
arch-nemesis and cheaply designed palette swap of captain planet, i don't like him, galactus is cooler
arch-nemesis of the silver surfer, the hunger that never ceases, a deity from the far reaches of space who devours one world after the next
washed-up hacker that still likes watching cartoons
We first downloaded water footprint data from waterfootprint.org, which describes the water costs of producing a variety of raw staple foods across many countries around the world. These water costs are divided into 3 types of footprints: (1) "green": amount of rainwater used, (2) "blue": amount of irrigation water used, and (3) "grey": fresh water used to dillute pollution. In our analysis, we elected to measure the sum of the green and blue water footprints, since they are more directly related to generating the food product. You can click on the image to the right for a snapshot of what waterfootprint.org's data looks like. The data consisted of Excel spreadsheets; there was no API available. We also removed items that were not food-related (e.g. fabrics such as leather and hemp), and subselected the most common variations of various staple foods.
For each of the food items, we then queried nbd.nal.usda.gov to collect nutritional information. You can click on the image directly below for a snapshot of what this data looks like. For the purposes of this demonstration, we elected to only measure calories, proteins, and carbohydrates. However, the data also includes many more nutritional metrics, such as minerals. This cross-referencing between databases was complicated by the fact that waterfootprint.org and usda.gov did not use the same names or code numbers to refer the same foods, so a combination of both fuzzy string matching and manual labor was needed. In the end, we built a small database that cross-references waterfootprint data with nutritional data for 79 common food items, illustrated below.
The Knaspack problem is a classic problem from computer science, that goes like this: A burglar breaks into a museum, and wants to stuff the most valuable artifacts that he can find into a loot bag he's carrying, which can only support a known finite amount of weight. So he wants to choose artifacts that maximize the dollar value of his loot, while ensuring that the aggregate weight of his stash falls below the upper bound constraint imposed by his bag. Also, the artifiacts he steals are not divisible into smaller parts --- each must be stolen entirely, or not at all.
Similarly, when optimizing our diet to save the planet, we face the same problems as the burglar, only with the signs reversed! We typically eat whole numbers of objects (to avoid leftovers), and we want to minimize our water footprint (like dollar value), while ensuring that the aggregate nutritional content of our diet stays above a healthy lower bound. These problems are dual to each other, and in fact equivalent in this case because we are dealing with a linear program, so there is no duality gap. (Check out Wikipedia if you're interested in learning more!)
The classic way to solve the knapsack problem is to use dynamic programming, in which we build a table of volume vs. value and use memoization to fill out the table bottom-up.
However, since we have a multi-criterion knapsack problem with both upper and lower bounds in the constraints, and we want to flip the optimization direction to see how Galactus would behave, we chose to use the integer linear programming technique instead, which more easily allows for such modifications. With ILP, we use the simplex algorithm to solve a relaxed linear-program with no integer constraints, and then use divide-and-conquer to effectively find the best way to round this continous solution by repeatedly bisecting the search space at integer boundaries.
Captain Planet's eating choices will minimize the total water footprint of his food consumption, subject to having a balanced nutritional diet. w_i is the global minimal water footprint (in m3/ton) for the ith food. Caloriei (kcal), Proteini (g), and Carbohydratei (g) are the nutrition values present in one unit of the ith food.
Galactus's diet solves the opposite optimization problem, maximizing the water footprint under the same constraints.
Right now, Captain Planet only considers the concerns of Gi (the water planeteer), but in the future he can also easily incorporate the concerns of other planeteers such as Kwame (trees) and Linka (wind), by simply adding data-driven measures of carbon footprint, soil erosion, and wind energy usage into the objective function as regularization terms.
token black guy in the planeteers, with the power of earth; will bug capt. about carbon footprint of his diet in future episodes
The optimization problem described above can be easily extended to incorporate more kinds of climate footprints by adding them as extra terms into the objective function. For instance, minimizing a weighted combination of both water footprint and carbon footprint would appeal to other planeteers, such as Kwame, who wields the powers of trees.
We developed an app that allows users to specify their daily minimum and maximum constraints for calories, proteins, and carbohydrates. Upon submitting this information, the aformentioned integer linear program is solved, and the user is prescribed with "The Captain Planet Diet", which is a customized programme of foods that meet the user's nutritional constraints while also minimizing water footprint. An example screenshot is shown below, where the nutritional bounds were set based on recommended dietary guidelines found online. We see that Captain Planet primarily eats foods and vegetables, and he would get them from the indicated countries, mostly foreign. The bar graphs in the upper-right corner illustrate where the solution lies in the constraint space. Note that at least one of Captain Planet's lower-bound constraints must always be active.
By switching to "evil" mode, the user can alternatively play as Galactus and request a food programme that meets the nutritional constraints while maximizing water footprint. At least one of Galactus's upper-bound constraints must always be active. Below is a truncated portion of Galactus's diet programme, using the same nutritional constraints as before. Note that the water footprint is three orders of magnitude larger! (We typically observe a 2 to 3 orders of magnitude difference between Captain Planet and Galactus.)
If we outlaw carbohydrates (e.g., first phase of the Atkins diet), then the user must primarily eat of meats. Below are the meats that Galactus would eat under this regimen, which include swine carcasses, hams, goats, cows, and horses. (Outside of the United States, horses are eaten in many places, such as throughout Europe.)
Question: Which foods cost more water to produce?
At right is a wordcloud in which foods have been sized proportionally to their smallest possible water footprint amongst all countries in the dataset. We can see that nuts and meats are big, and vegetables such as lettuce tend to be small. (Small is good here.)
Question: How does the United States compare to other countries in terms of the water footprint of its products?
At right is a bar chart (click for a closer view) that considers several different food items and compares the footprint of producing it in the US (right-hand-side) with the footprint of producing it in the country with the minimal water footprint (left-hand-side). We see that the US is water-efficient in its production of fruits.
We would like to thank the organizers and sponsors of BERC Cleanweb Hackathon 2.0 for hosting this fun 24-hour contest on April 19-20, 2014!
To launch the diet calculator, click on the button below!
Note: Make sure you have both the Wolfram CDF Player Plugin and enough memory available to run this application --- 1 GB of spare RAM is suggested. (Hey it's a hackathon, we can't be perfect.)Launch The Captain Planet Diet!