Engine control as a hybrid control problem: models and algorithms