Optimizing targeted gene flow to maximize local genetic diversity: when and how to act under various scenarios of environmental change.