An efficient supervised training algorithm for multilayer spiking neural networks