EpsilonNeighborhoodCoupler implements Coupler { protected List<Set<Individual>> createNeighborhoods(List<Individual> survivorPool) { List<Set<Individual>> neighborhoods = new ArrayList<>(); Map<Objective, Double> objectiveAmplitudes = epsilonMapping .findObjectiveAmplitudes(new HashSet<>(survivorPool)); List<Individual> survivors = new ArrayList<>(survivorPool); while (!survivors.isEmpty()) { int idx = random.nextInt(survivors.size()); Individual reference = survivors.remove(idx); Set<Individual> neighborhood = new HashSet<>(); Objectives epsilonEnhancedObjectives = epsilonMapping.mapObjectives(reference.getObjectives(), adaptiveEpsilonNeighborhood.getEpsilon(), objectiveAmplitudes); for (Individual candidate : survivors) { if (epsilonEnhancedObjectives.dominates(candidate.getObjectives())) { neighborhood.add(candidate); } } survivors.removeAll(neighborhood); neighborhood.add(reference); neighborhoods.add(neighborhood); } boolean epsilonTooBig = neighborhoods.size() < plannedNeighborhoodNumber; epsilonAdaption.adaptEpsilon(adaptiveEpsilonNeighborhood, epsilonTooBig); return neighborhoods; } @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 testCreateNeighborhoods() { EpsilonNeighborhoodCoupler coupler = makeDefaultCoupler(); Map<Objective, Double> amplitudeMap = new HashMap<>(); amplitudeMap.put(firstObj, 0.001); amplitudeMap.put(secondObj, 0.001); List<Individual> survivors = getSurvivors(); List<Set<Individual>> neighborhoods = coupler.createNeighborhoods(survivors); assertEquals(3, neighborhoods.size()); verify(mockAdaption).adaptEpsilon(coupler.adaptiveEpsilonNeighborhood, true); coupler = new EpsilonNeighborhoodCoupler(new EpsilonMappingAdditive(), mockAdaption, new Random(), 2, 0.0001, 0, 0, 0); neighborhoods = coupler.createNeighborhoods(survivors); verify(mockAdaption).adaptEpsilon(coupler.adaptiveEpsilonNeighborhood, false); }