A dynamic optimization approach for preventive control in a DSA environment