Generalized Predictive Control-Part I. The Basic Algorithm