Automatic synthesis of artificial neural networks with arbitrary feedforward connections