Text this: Global Algorithms for Nonlinear Discrete Optimization and Discrete-Valued Optimal Control Problems