Optimization of Time-Varying Linear Systems With Nonstationary Inputs