Efficient on-line computation of constrained optimal control laws