Mathematical modeling and optimal control of the COVID-19 dynamics