Add option to require adaptation to the execution environment.
Fix typo and missing return value.
Include the submitted tasks in the optimal tasks that were computed at the beginning.