Optimal approach to quantum communication using dynamic programming | Synapse