network training and output solution to file