Existence of optimal controls