# The Lawn Mowing Optimization Problem

### Back Story

Starting in high school I spent my weekends in the summer mowing lawns (and various other yard work) to make money. Often it was family members yards, they were willing to hire me for a fraction of a professional and were happy to send money my way. At one point I was mowing five lawns on saturdays, my grandfathers (two acres), his neighbors (three acres), my own (one acre), my uncles (three acres), and my uncles neighbors (one acre). I would start at 8am and end around 8pm, since I only had a push mower and no car it was a fair amount of walking or catching rides (if possible).

One thing I always tried to do was optimize my mowing, cutting as close as I could to rocks, ensuring the wheels followed a straight line to ensure maximum coverage (and it looked better), etc. Something that always bothered me was that even though many of the lawns were the same size the time to mow each lawn would vary wildly. Now, years later as my girlfriend is mowing my grandfathers lawn, I am wondering if there is an optimal way to mow a lawn and if so how to calculate it. This is the problem I will call The Lawn Mowing Optimization Problem not really imaginative, but to the point. I am curious on how to optimize for energy expenditure, fuel consumption, ease of mow, time, and potentially beauty/uniform lines. It may not be possible to optimize for each of the goals, however most of the goals will overlap and in turn provide a “close enough” solution.

### Identifying the Difficulties

Upon contemplation this is not as simple a problem as it seems. There are a fair number of variables and although the problem is solvable it is not easy nor straight forward.

Variables for The Lawn Mowing Problem:

• Yard Size
• Yard Shape
• House Size
• House Shape
• Lawn Mower Size
• Type of Lawn Mower
• Immovable Objects: Trees, Gardens, Playgrounds, etc.
• Movable Objects: Chairs, Tables, Hoses, etc.
• Land Variance: Hills, Ditches, etc.
• Weather Variables: Mud, Puddles, Wet Grass, Heat, etc.
• Grass: Length, Thickness, Type, Flexibility, etc.

Given some of the variables are contingent upon weather, species of grass, movable object, and type of lawn mower (i.e. engine), those variables will be kept constant throughout the problem. After making some of the variables constant, the remaining variables are:

1. Yard Size
2. Yard Shape
3. House Size
4. House Shape
6. Immovable Objects: Trees, Gardens, Playgrounds, etc.
7. Land Variance: Hills, Ditches, etc.

I removed the lawn mower type and size, but left blade length because the variance in length of blade can impact the results far more than the type of lawn mower and the mower size grow in proportion to blade size. The seven variables remaining are the heart of the problem and will always be apart of any lawn mow.

Variables regarding the actual dimensions of the yard are relatively easy to account for, such as yard shape/size, house shape/size, trees, gardens, etc. More difficult are items such as land variance, which can effect the difficulty of mowing significantly as well as the quality of cut (something I will probably not address).

### Graphing the Yard

In order to solve this problem computationally the real world layout of a plot of land must first be converted to a graph of some nature. Reducing the world to graph enables a various algorithms to be ran and in turn a solution to be found. The easiest way to generate a graph from a yard, is by “creating” or “placing” nodes uniformly distributed throughout the yard. That is to say, every three inches (or 7.62 cm) place a node and attach each adjacent node via an edge, like so:

Thereby allowing a computer to track where a virtual lawn mower has ran.

The above method allows for varying blade sizes and fairly high precision related to object location or mower position. Further, having a graph then enables a whole range of algorithms to be ran on the graph, most notably Dijkstra’s or Prim’s algorithm(s) which can be used to find the shortest path or minimum spanning tree. However, in both cases they would need to be slightly modified, because it is possible to have a yard which requires you to back up or pull the lawn mower, so we are not quite to a solution (yet).

### Mower Movement and Costs

Since we now have a graph representing the yard as well as what has been cut, we should now define movement. For simplicity I will make the following assumptions:

1. Forward motion is achieved by pushing the lawn mower.
2. A lawn mower will come with “self-propelled” feature, meaning forward motion is easier.
3. To turn 90 degrees on has to pull the lawn mower in reverse 90 degrees before going forward.
4. All 180 degree turns must be accomplished via two 90 degree turns.
5. Left and right movement is not allowed.

Assumption number two in particular is tricky, requiring angling of the pull to change over time.

Rather than attempting to account for that in the algorithm which will have to traverse the graph, I will make the assumption that a lawn mower can instantly turn 90 degrees.  With this in mind the following cost modifier will be associated with each movement:

Forward Motion: 1 (unmodified)
Backward Motion: 5
90 Degree Turn: (5 + 1) * <Length of Lawn Mower>

### Edge Weights

Most lawns are not flat, often there are hills or ditches and in order to take into account the added difficulty of traversing the terrain weights should be added to the associated edges.

This (darker colors representing “deeper” terrain):

is different than, this:

As such, they should have weights associated with them. For example, if one node is adjacent to another node which is only one shade “deeper” it should have a weight of two as opposed to one (one being the standard weight). Moreover, the direction of motion should also be taken into account, therefore edges not in the direction of motion will be marked as traversed (i.e. grass cut), but will not be taken into account for the total “cost” of mowing the yard. That is to say, only edges in the direction of motion will count towards the “cost” of mowing.

There is one caveat to this method of weighting, because it is difficult to maintain the path of the lawnmower on an angle (the first image) there should be a slight modifier applied based on the angle. In other words, if the mower is traversing terrain on a 20 degree angle a modifier of should be applied relative to the 20 degree angle.

Finally, because the angle is (more or less) logarithmically associated with difficulty (i.e. the difficulty between 10 and 20 degrees is far less than 20 to 30), the modifier should reflect this, and be based off the angle or difference in heights between tires. These exact values will be calculated/estimated at a later time.

### Closing Remarks

Due to my limited time this week I was only able to frame the problem. If you are interested in how to solve this problem I will be releasing a solution in about two weeks via my email list (sign up below) and a written blog post the following week. In the interim, feel free to discuss possible solutions in the comments section!

Following the theoretical solution I intend to implement the solution in a nice little program which will enable anyone to determine the optimal way to mow the lawn, so please stay tune!

## 4 thoughts on “The Lawn Mowing Optimization Problem”

1. Amber says:

This is actually fascinating! I clicked partly because I wanted to read an article on your blog today, and partly because my neighbor is actually mowing our lawn right now. He was mowing his lawn and I offered him \$15 to mow our lawn (my hubby isn’t really on top of it) and he was like “I’ll mow, but I won’t accept payment.” This is from a kid who just graduated high school! Lovely Indian family across the street, so generous! So he’s getting brownies.

I couldn’t help but be impressed that you did five large lawns in a day with a push mower! I used to mow before MS made my legs suck. Now I want a nice square unobstructed lawn (someday.)

1. Austin says:

Glad you found it interesting, it’s strange (at least for me) how much of our lives we spend doing mundane tasks, yet we don’t try to optimize them.

2. tommy says:

Hi there Austin,
I just found your post about the lawn mover optimization problem and wonder if there ever came a solution to it. I have set out to optimize my lawn moving this vacation and must say that your framing of the problem sounds really great.

3. Ian Bridges says:

Hey Tommy, please get back to me about this. I thought about coding this same problem during my mowing today but I have no idea how to implement it in any coding language. Do you have any idea how to go about it? Thanks and have a good one 🙂