From 86dfad7177c9a002ad263e9fc6f077da09a2fb52 Mon Sep 17 00:00:00 2001 From: Alexander Diewald <diewald@fortiss.org> Date: Tue, 18 Jul 2017 15:54:22 +0000 Subject: [PATCH] - Readd the complete objective set to individuals after the calculation of the Pareto-Front for which the "objective set" (that includes constraints and objectives) has been reduced such that it contained only objectives. --- .../alg/dse/backend/opt4j/Opt4JExplorerBackend.java | 10 ++++++++++ 1 file changed, 10 insertions(+) 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 aaf70843..34e4d322 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); -- GitLab