The automation of syllogistic - II. Optimization and complexity issues