Gardening by Numbers

AKA what else can we turn into an engineering problem?

Last summer my wife and I bought a house, and for the first time we have our own garden. We were keen to grow some veg, but since we moved in the summer we had missed most of the growing season last year.

The garden isn’t enormous so we wanted to make efficient use of space. Looking for tips on the web, we found out about Square Foot Gardening which is a gardening method designed by an engineer! The name comes from the idea that you divide up growing space into square feet and plant a single kind of plant in each square. But the other important idea is that you build raised planting beds and fill them with a rich growing medium, rather than just planting in the ground.

So in the autumn I built our beds. Two of 8’ by 4’, about a foot deep, built with standard construction lumber. We lined the bottoms with chicken wire to try and prevent burrowing creatures from getting in. We filled the boxes with a 3:1 mixture of compost and vermiculite – this required over a ton of compost which was delivered to our driveway and we carried in buckets to the beds.

With the beds in place, we started planning what to plant in them. We made a list of what we wanted to grow, and then thought about how they could be arranged in the squares in the boxes. There are various constraints: for example, peas and beans have to go in the back row of squares, because only those will have climbing support. Squashes have to go in squares at the side of the box so they can droop outside. Shorter plants should go nearer the front so they aren’t in the shade of taller plants.

This started to sound like an optimization problem, and when I see those, I think ‘genetic algorithm’. So I knocked up a quick program (in Ruby of course) to help figure out the best placement for our vegetables, using the above rules and more. It generates random placements and scores them based on the rules, and can ‘mutate’ them by moving around plants.

Interestingly enough, the program would only get bad scores to start with, and we wondered if there was a problem with it. After some checking I found we had told it 12 squares worth of climbing plants, and we only have 8 squares where they can go. The program was fine once we changed the seasons on those so they could fit.

Now we are just waiting for winter to end so we can get planting.

One Trackback

  1. By The Junction » garden data on April 2, 2009 at 3:31 pm

    […] garden-related […]

Post a Comment

Your email is never published nor shared. Required fields are marked *