Global Selection of Contrastive Batches via Optimization on Sample Permutations