How should I credit a plagiarized paper in open source code?
I suggest you to be very careful to label the first paper a plagiarism, unless you are 100% sure that there are areas of a word-for-word equivalence with the original paper(s) without credit for original authors. Having said that, I noticed that the first paper's author cite the second one (authored by Beasley and Chu) - and another one by the same authors - as well as clearly state that the same (or similar) approach has already been used by Beasley and Chu (references #22 and #23), so it seems that some credit has been given (which is not to say that some is enough).

In regard to which paper(s) to reference, I would say that it depends on the following two aspects: 1) if the second paper is indeed a case of plagiarism, then it certainly doesn't make sense to cite it; 2) if it is not, then the decision should be made, based on whether there are distinctly different sets of ideas in both papers and whether you have used both sets or one.