Skip to content
Snippets Groups Projects
Commit 86dfad71 authored by Alexander Diewald's avatar Alexander Diewald
Browse files

- Readd the complete objective set to individuals after the calculation of the...

- 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.
parent 3dc57e74
No related branches found
No related tags found
No related merge requests found
......@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment