Nonlinear discrete-time systems: constrained optimization and application of nonquadratic costs | Synapse