Add requirements based scheduling.

Adds scheduling constraints. See #367 for more details.
In case it wasn't clear, this issue must be fixed before merging.