All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.sourceforge.cilib.niching.utils.JoinedTopologyProvider Maven / Gradle / Ivy

/**           __  __
 *    _____ _/ /_/ /_    Computational Intelligence Library (CIlib)
 *   / ___/ / / / __ \   (c) CIRG @ UP
 *  / /__/ / / / /_/ /   http://cilib.net
 *  \___/_/_/_/_.___/
 */
package net.sourceforge.cilib.niching.utils;

import net.sourceforge.cilib.entity.Entity;
import net.sourceforge.cilib.entity.EntityType;
import net.sourceforge.cilib.niching.NichingSwarms;
import net.sourceforge.cilib.type.types.Int;
import net.sourceforge.cilib.util.functions.Algorithms;
import fj.F;
import fj.data.List;

public class JoinedTopologyProvider extends TopologyProvider {
    @Override
    public List f(NichingSwarms a) {
        return List.join(
            List.cons(a._1(), a._2())
                .map(Algorithms.getTopology())
                .map(new F, List>() {
                    @Override
                    public List f(List a) {
                        return List.iterableList(((List)a).filter(new F() {
                            @Override
                            public Boolean f(Entity a) {
                                return ((Int) a.getProperties().get(EntityType.Coevolution.POPULATION_ID)).intValue() == 0;
                            }                            
                        }));
                    }
                })
            );
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy