Robust optimization of discrete time systems and periodic operation with guaranteed stability