soulless, few comments to your comments.
Lumberjacts has a "target" (number of sites) that are never dismantled for security reasons. Yes in a corner case all sites can be placed in infertile areas.
So if lumberjacks don't work after a while and there are foresters nearby ai can dismantle both
Yes, it might dismantle all lumberjacks and rangers in radius x, but consider:
What if these will be all rangers+lumberjacs the player has? This is in confilict with target 'policy', but also what if AI will have no building material to build new ones? Or if new ones will be build in the same territory?
By my opinion, the land quality should be considered mainly when placing ranges/foresters, but the infor is not available.
As for seafaring, it is even worse. AI is not capable to operate on two / more seas, it builds one shipyard only and presumes that all waters are interconnected. What if AI dont see how far the sea goes and have no idea whether this one is good for seafaring? Should it cheat (it can)? It would need (eventually) a logic to gave up on current sea and start building fleet on another one.
Seafaring is completely ommited from genetic algorithm being developed, so there is really a place for improvement, would be merged to trunk directly, and it is now even in separate file.
AI tries to build shipyard ASAP, just in case it is short of good spots, so checking/waiting for producers could interfere here, and could backfire.... But if somebody is willing to take care of this....
Generally, corner cases are just corner cases, AI will never cope with them well.