Only run targets which are necessary to run to produce the output files.

Basically, if an output file is changed on one branch of the workflow, we
do not wish to run the entire workflow again. Thus, we figure out which
targets depend on the changed file and only run those. If a target has been
checkpointed on the branch, we also check that the output files of the
target are newer than all files generated by the dependencies of the target.