Optimization of connectome weights for a neural network model generating both forward and backward locomotion in C. elegans