Function that pre-computes pairwise cost
Result figure for 5000 population and 500 generations