An Optimal Control Strategy for Power Quality Enhancement in a Competitive Environment