An Algorithmic Framework for Modeling Institutional Processes