implement the optimization for E.