An optimal artificial selection protocol should be designed by considering its impact over an entire stochastic evolutionary trajectory that follows. As a result, a seemingly suboptimal intervention at a given time can be globally optimal as it can open opportunities for more desirable actions in the future; see schematic Fig. REF B. An optimal artificial selection protocol at each time point \(\mathbf {u}^*(\mathbf {x},t)\)  assumes that the selection strategies implemented in the future are also optimal. This criteria is known as Bellman's “principle of optimality" [1]}, and allows us to express the optimal control problem in a recursive form, known as dynamic programming in computer science [1]} (Appendix ). As a result, we can formulate a dynamical equation for the cost-to-go function, known as Hamilton-Jacobi-Bellman (HJB) equation [3]},
\(\nonumber -\frac{\partial J({\bf x},t) }{\partial t}=\min _{\bf u}\left[ \Omega ({\bf x}_t ,{\bf u}_t)+ A({\bf x}_t)\cdot \nabla J + \frac{1}{2} {\text{\bf Tr}}K \nabla _{{\bf x}{\bf x}} J\right]\\\) 
