Adjoint-based Optimization of Polymer Flooding Process with Free Terminal Time