diff --git a/org.fortiss.af3.exploration.alg/trunk/src/org/fortiss/af3/exploration/alg/dse/backend/opt4j/Opt4JExplorerBackend.java b/org.fortiss.af3.exploration.alg/trunk/src/org/fortiss/af3/exploration/alg/dse/backend/opt4j/Opt4JExplorerBackend.java index aaf7084367441623ae8f1091d044470f14fde97a..34e4d322eb3f2b60d82c2ee35dd0a235d4c43423 100644 --- a/org.fortiss.af3.exploration.alg/trunk/src/org/fortiss/af3/exploration/alg/dse/backend/opt4j/Opt4JExplorerBackend.java +++ b/org.fortiss.af3.exploration.alg/trunk/src/org/fortiss/af3/exploration/alg/dse/backend/opt4j/Opt4JExplorerBackend.java @@ -22,6 +22,7 @@ import static org.fortiss.tooling.kernel.utils.EcoreUtils.pickInstanceOf; import java.util.ArrayList; import java.util.Collection; +import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Map.Entry; @@ -298,8 +299,10 @@ public class Opt4JExplorerBackend extends ExplorerBackendBase<EAOptimizer> { // Create a new archive with the same individuals that have only objective evaluations. // TODO: For robust optimization, we should also consider a distance metric to the // constraint's bounds. + Map<Individual, Objectives> completeObjectives = new HashMap<>(); for(Individual curIndividual : feasibleIndividuals) { Objectives oldObjectives = curIndividual.getObjectives(); + completeObjectives.put(curIndividual, oldObjectives); Objectives reducedObjectives = new Objectives(); for(Entry<Objective, Value<?>> singleObjective : oldObjectives) { if(objectiveSet.contains(singleObjective.getKey())) { @@ -310,6 +313,13 @@ public class Opt4JExplorerBackend extends ExplorerBackendBase<EAOptimizer> { archive.update(curIndividual); } + // However, readd the complete objective set afterwards such that all evaluations are + // available (including the constraint evaluations). + for(Individual curIndividual : feasibleIndividuals) { + Objectives origObjectives = completeObjectives.get(curIndividual); + curIndividual.setObjectives(origObjectives); + } + rval = new Opt4JExplorationSolutionSet<ArchitectureSolution>(archive, targetAssocMap, archExplorationProblemModule);