@Test public void removeArchiveDominatedTest2() { Injector injector = Guice.createInjector(new MockProblemModule()); IndividualFactory factory = injector.getInstance(IndividualFactory.class); Objective o0 = new Objective("o0"); Objective o1 = new Objective("o1"); Individual iArchived0 = factory.create(); Objectives objectivesA0 = new Objectives(); objectivesA0.add(o0, 2); objectivesA0.add(o1, 3); iArchived0.setObjectives(objectivesA0); Individual iArchived1 = factory.create(); Objectives objectivesA1 = new Objectives(); objectivesA1.add(o0, 3); objectivesA1.add(o1, 2); iArchived1.setObjectives(objectivesA1); TestArchive archive = new TestArchive(); archive.addAll(iArchived0, iArchived1); Individual i0 = factory.create(); Objectives objectives0 = new Objectives(); objectives0.add(o0, 4); objectives0.add(o1, 4); i0.setObjectives(objectives0); List<Individual> list = new ArrayList<>(); list.add(i0); archive.removeArchiveDominated(list); Assert.assertTrue(list.isEmpty()); Assert.assertEquals(2, archive.size()); }
protected void removeArchiveDominated(List<Individual> candidates) { Iterator<Individual> i1; Iterator<Individual> i2; for (i1 = candidates.iterator(); i1.hasNext();) { Objectives o1 = i1.next().getObjectives(); for (i2 = this.iterator(); i2.hasNext();) { Objectives o2 = i2.next().getObjectives(); if (o2.weaklyDominates(o1)) { i1.remove(); break; } else if (o1.dominates(o2)) { i2.remove(); } } } }
AbstractArchive extends Archive { protected void removeArchiveDominated(List<Individual> candidates) { Iterator<Individual> i1; Iterator<Individual> i2; for (i1 = candidates.iterator(); i1.hasNext();) { Objectives o1 = i1.next().getObjectives(); for (i2 = this.iterator(); i2.hasNext();) { Objectives o2 = i2.next().getObjectives(); if (o2.weaklyDominates(o1)) { i1.remove(); break; } else if (o1.dominates(o2)) { i2.remove(); } } } } }
AbstractArchive extends Archive { protected void removeArchiveDominated(List<Individual> candidates) { Iterator<Individual> i1; Iterator<Individual> i2; for (i1 = candidates.iterator(); i1.hasNext();) { Objectives o1 = i1.next().getObjectives(); for (i2 = this.iterator(); i2.hasNext();) { Objectives o2 = i2.next().getObjectives(); if (o2.weaklyDominates(o1)) { i1.remove(); break; } else if (o1.dominates(o2)) { i2.remove(); } } } }  }
AbstractArchive extends Archive { protected void removeArchiveDominated(List<Individual> candidates) { Iterator<Individual> i1; Iterator<Individual> i2; for (i1 = candidates.iterator(); i1.hasNext();) { Objectives o1 = i1.next().getObjectives(); for (i2 = this.iterator(); i2.hasNext();) { Objectives o2 = i2.next().getObjectives(); if (o2.weaklyDominates(o1)) { i1.remove(); break; } else if (o1.dominates(o2)) { i2.remove(); } } } }  @Override boolean update(Set<? extends Individual> individuals); }
AbstractArchive extends Archive { protected void removeArchiveDominated(List<Individual> candidates) { Iterator<Individual> i1; Iterator<Individual> i2; for (i1 = candidates.iterator(); i1.hasNext();) { Objectives o1 = i1.next().getObjectives(); for (i2 = this.iterator(); i2.hasNext();) { Objectives o2 = i2.next().getObjectives(); if (o2.weaklyDominates(o1)) { i1.remove(); break; } else if (o1.dominates(o2)) { i2.remove(); } } } }  @Override boolean update(Set<? extends Individual> individuals);  }