Optimization supports bilateral frequency regulation