EpsilonNeighborhoodCoupler implements Coupler { protected Pair<Individual> pickCouple(Set<Individual> neighborhood) { if (neighborhood.size() == 1) { Individual hermit = neighborhood.iterator().next(); return new Pair<>(hermit, hermit); } List<Individual> individualList = new ArrayList<>(neighborhood); Individual first = individualList.remove(random.nextInt(individualList.size())); Individual second = individualList.remove(random.nextInt(individualList.size())); return new Pair<>(first, second); } @Inject  EpsilonNeighborhoodCoupler(EpsilonMapping epsilonMapping, EpsilonAdaptation epsilonAdaption, Random random,
			@Constant(value = "neighborhoodNumber", namespace = EpsilonNeighborhoodCoupler.class) int plannedNeighborhoodNumber,
			@Constant(value = "epsilonNeighborhood", namespace = EpsilonNeighborhoodCoupler.class) double epsilonNeighborhood,
			@Constant(value = "epsilonNeighborhoodDelta", namespace = EpsilonNeighborhoodCoupler.class) double epsilonNeighborhoodDelta,
			@Constant(value = "epsilonNeighborhoodDeltaMax", namespace = EpsilonNeighborhoodCoupler.class) double epsilonNeighborhoodDeltaMax,
			@Constant(value = "epsilonNeighborhoodDeltaMin", namespace = EpsilonNeighborhoodCoupler.class) double epsilonNeighborhoodDeltaMin); @Override Collection<Pair<Individual>> getCouples(int size, List<Individual> survivors);  }
@Test public void testGetCouple() { EpsilonNeighborhoodCoupler coupler = makeDefaultCoupler(); Individual first = mock(Individual.class); Individual second = mock(Individual.class); Set<Individual> indiSet = new HashSet<>(); indiSet.add(first); indiSet.add(second); Pair<Individual> couple = coupler.pickCouple(indiSet); assertTrue(couple.getFirst().equals(first) || couple.getSecond().equals(first)); assertTrue(couple.getFirst().equals(second) || couple.getSecond().equals(second)); indiSet.remove(first); couple = coupler.pickCouple(indiSet); assertTrue(couple.getFirst().equals(second)); assertTrue(couple.getSecond().equals(second)); }