It's a marvel that we can actually understand these biological algorithms well enough to code them up. I wrote about an example of this in a blog post about EO Wilson's "Superorganisms" a while ago (http://corte.si/posts/books/superorganism/index.html). Bee hives need to find the right balance between foragers out in the field, and nectar producers staying home to work in the hive. They have an elegant way of doing this, that works even when each bee can only rely on local knowledge - that is, each bee makes a decision about what it can see around itself, without any global integrative intelligence required. The algorithm goes like this (see the blog post for more detail):
1 - Not enough nectar collectors in the field? If yes, and you also have immediate knowledge of a producing flower patch, perform the waggle dance.
2 - Is the flower patch rich or the weather fine or the day early or does the colony need substantially more food? Perform the dance with appropriately greater vivacity and persistence.
3 - Not enough active foragers to send into the field? Perform the shaking maneuver.
4 - Not enough nectar processors in the hive to handle the nectar inflow? Perform the tremble dance.
A variant of this algorithm, directly inspired by bees, has been used to balance resource allocation in server farms:
http://www2.isye.gatech.edu/~ctovey/publications/papers/bee....