Nonlinear impulsive integro-differential equations of mixed type and optimal controls