@Test public void testMapObjectives() { Set<Individual> indis = getIndividualSet(); EpsilonMappingAdditive epsilonMapping = new EpsilonMappingAdditive(); Map<Objective, Double> amplitudeMap = epsilonMapping.findObjectiveAmplitudes(indis); Objectives objectives = new Objectives(); objectives.add(first, 0); objectives.add(second, 0); double epsilon = 0.5; Objectives epsilonEnhanced = epsilonMapping.mapObjectives(objectives, epsilon, amplitudeMap); assertEquals(1.5, epsilonEnhanced.get(first).getDouble(), 0.0); assertEquals(-1.0, epsilonEnhanced.get(second).getDouble(), 0.0); }
@Override public Objectives mapObjectives(Objectives original, double epsilon, Map<Objective, Double> objectiveAmplitudes) { Objectives result = new Objectives(); Iterator<Objective> iterator = original.getKeys().iterator(); double[] values = original.array(); for (int i = 0; i < original.size(); i++) { Objective obj = iterator.next(); double value = values[i] * (obj.getSign().equals(Sign.MIN) ? 1 : -1); if (objectiveAmplitudes.containsKey(obj)) { value += epsilon * objectiveAmplitudes.get(obj) * (obj.getSign().equals(Sign.MAX) ? 1 : -1); } result.add(obj, value); } return result; }
EpsilonMappingAdditive implements EpsilonMapping { @Override public Objectives mapObjectives(Objectives original, double epsilon, Map<Objective, Double> objectiveAmplitudes) { Objectives result = new Objectives(); Iterator<Objective> iterator = original.getKeys().iterator(); double[] values = original.array(); for (int i = 0; i < original.size(); i++) { Objective obj = iterator.next(); double value = values[i] * (obj.getSign().equals(Sign.MIN) ? 1 : -1); if (objectiveAmplitudes.containsKey(obj)) { value += epsilon * objectiveAmplitudes.get(obj) * (obj.getSign().equals(Sign.MAX) ? 1 : -1); } result.add(obj, value); } return result; } }
EpsilonMappingAdditive implements EpsilonMapping { @Override public Objectives mapObjectives(Objectives original, double epsilon, Map<Objective, Double> objectiveAmplitudes) { Objectives result = new Objectives(); Iterator<Objective> iterator = original.getKeys().iterator(); double[] values = original.array(); for (int i = 0; i < original.size(); i++) { Objective obj = iterator.next(); double value = values[i] * (obj.getSign().equals(Sign.MIN) ? 1 : -1); if (objectiveAmplitudes.containsKey(obj)) { value += epsilon * objectiveAmplitudes.get(obj) * (obj.getSign().equals(Sign.MAX) ? 1 : -1); } result.add(obj, value); } return result; }  }
EpsilonMappingAdditive implements EpsilonMapping { @Override public Objectives mapObjectives(Objectives original, double epsilon, Map<Objective, Double> objectiveAmplitudes) { Objectives result = new Objectives(); Iterator<Objective> iterator = original.getKeys().iterator(); double[] values = original.array(); for (int i = 0; i < original.size(); i++) { Objective obj = iterator.next(); double value = values[i] * (obj.getSign().equals(Sign.MIN) ? 1 : -1); if (objectiveAmplitudes.containsKey(obj)) { value += epsilon * objectiveAmplitudes.get(obj) * (obj.getSign().equals(Sign.MAX) ? 1 : -1); } result.add(obj, value); } return result; }  @Override Objectives mapObjectives(Objectives original, double epsilon, Map<Objective, Double> objectiveAmplitudes); @Override Map<Objective, Double> findObjectiveAmplitudes(Set<Individual> individuals); }
EpsilonMappingAdditive implements EpsilonMapping { @Override public Objectives mapObjectives(Objectives original, double epsilon, Map<Objective, Double> objectiveAmplitudes) { Objectives result = new Objectives(); Iterator<Objective> iterator = original.getKeys().iterator(); double[] values = original.array(); for (int i = 0; i < original.size(); i++) { Objective obj = iterator.next(); double value = values[i] * (obj.getSign().equals(Sign.MIN) ? 1 : -1); if (objectiveAmplitudes.containsKey(obj)) { value += epsilon * objectiveAmplitudes.get(obj) * (obj.getSign().equals(Sign.MAX) ? 1 : -1); } result.add(obj, value); } return result; }  @Override Objectives mapObjectives(Objectives original, double epsilon, Map<Objective, Double> objectiveAmplitudes); @Override Map<Objective, Double> findObjectiveAmplitudes(Set<Individual> individuals);  }