Using an efficient method based on genetic algorithms, we have searched for
an optimum set of parameters for the interaction between NGC 5194 (M 51) a
nd NGC 5195. The preferred model is one where the time of closest passage w
as 900 Myr ago. The orbit of NGC 5195 is almost perpendicular to the plane
of the sky, and is slightly hyperbolic. The results from the search among n
on-self-gravitating models are confirmed by a fully self-gravitating simula
tion. Our model, which is limited to the outer regions of NGC 5194, reprodu
ces the density distribution of the giant Hi arm of NGC 5194 accurately, bu
t is not able to find a perfect representation of the velocity field. We ar
gue that this is caused by deficiencies in the initial disc model used for
NGC 5194, rather than a failure of our search method. In general, we argue
that genetic algorithms are ideally suited for investigations of tidally in
teracting galaxies, where a large number of parameters need to be determine
d, and the goodness of fit for models contains a significant irregular comp
onent, with several local optima.