For the purposes of this question, we'll assume it involves a Janitor assigned to clean up trash in a building. Given that it is a building, it is safe to assume there are one or more rooms, walls, etceteras that act as physical obstacles.
It's time for the janitor to earn his paycheck, and he heads to the nearest piece of trash to clean up. We can resolve this in two ways:
- The cheap way. Simply do a distance check and head to the nearest.
- The expensive way, Path-find to pieces of trash and pick the one with the easiest/shortest route.
Now, (1) is cheap computationally but can give false results. A piece of trash could be on the other side of a wall but only 3 "squares" away - it'll actually take the janitor a lot more time to get there then say, a piece of trash in the same corridor 5-squares away.
(2) would give more accurate results, but requires a metric-ton more computation.
Are there better approaches to "nearest thing", or would you just have the janitor wander around on a pre-set route that covered "as much as possible" and just have him clean up as he goes?