Perceptron learning by constrained optimization: the AdaTron algorithm