How to ensure the right workers are in the right houses?

Over time, this will happen completely on its own. All workers will try to live as close to their work place as possible.

That said, family ties can cause problems here. A Forester and a Blacksmith living together may be a problem. You can manipulate this by reassigning jobs, or building a boarding house (to break family ties) and temporarily closing down homes to relocate people.


Over-time the game automatically optimizes location if possible, however I've noticed that reassigning jobs can speed up this process if you find it necessary.

For example, when I notice I'm starting to make less food than I use I start looking at paths. Occasionally I notice that my Gatherers have to walk long distances but my foresters live in the house right next to the forester lodge and gathering hut.

Resetting House Locations:

  • Set all gatherers and foresters to laborers.
  • Reassign the jobs in the order you want them to take first pick at housing.

So for my example above, reassign the gatherers before the foresters to have them take housing priority.

Builders:

I've also noticed that builders quite commonly cause issues with this. Since their job moves they quite commonly are is just the worst locations possible, quite commonly taking a location that would be better suited to another job. I use this method to fix that as well.

Conclusion:

This isn't a fix-all as the game does automatically do this over-time (as mentioned in Nicole's answer), however it has been quite helpful for me in speeding up the situations occasionally.


So I just recently tried this, and it actually worked pretty decently:

  • Pause gameplay
  • Use "Remove Structures" on all houses
  • Quickly un-pause and re-pause the game
  • Reclaim all houses (somewhat tedious)
  • Un-pause the game

All your people should have re-housed themselves according to where they work, with the obvious exception to there not being enough housing in certain areas.