Hehe… if you write one, send it to a game company… they’ll pay for it
Seriously, there are many (and many proprietary) algorithms to do this out there, but all of them (as far as i know) require hand tweaking to yield the best results.
An algorithm can usually give you a good base to work with, and might even create perfect cells/portals for simple architecture, but the complexity of such algorithms usually equals something like the complexity of the level design squared. There will most likely never be an algorithm that gives you the best possible results for any case and complexity of architecture.