Optimization flow control. I. Basic algorithm and convergence | Synapse