Stabilizing and Optimizing Control for Time-Delay Systems