Optimally Safe Tank Changeover Operation Using a Smooth Optimization Formulation