Reduction in cogging torque using optimization algorithm