@Override public void start( final Experiment experiment, final List<IdSet> feasiblePool, final HeuristicCallback callback) throws InterruptedException { final List<IdSet> improved = new ArrayList<IdSet>(feasiblePool.size()); final List<AttributeMappingId> candidates = MappingUtils.getCandidates(experiment.getModel()); Collections.sort( candidates, new WeightComparator(experiment.getModel(), experiment.getAlpha(), experiment.getBeta())); for (final IdSet solution : feasiblePool) { improved.add(improve(experiment.getModel(), solution, candidates)); } callback.finished(improved); }
@Override public void start(final Experiment experiment, final HeuristicCallback callback) throws InterruptedException { final AMModel model = experiment.getModel(); final List<AttributeMappingId> candidates = MappingUtils.getCandidates(model); Collections.sort( candidates, new WeightComparator(experiment.getModel(), experiment.getAlpha(), experiment.getBeta())); final List<AttributeMappingId> reverse = new ArrayList<AttributeMappingId>(candidates); Collections.reverse(reverse); for (final AttributeMappingId id : reverse) { if (MappingUtils.isIDset(candidates, model)) { break; } candidates.remove(id); } final IdSet solution = new IdSet(candidates); callback.finished(Arrays.asList(solution)); }