Optimal control of systems described by differential-difference equations