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

net.sourceforge.cilib.pso.crossover.pbestupdate.CrossoverOffspringPBestProvider Maven / Gradle / Ivy

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

import java.util.List;
import net.sourceforge.cilib.entity.operators.crossover.CrossoverStrategy;
import net.sourceforge.cilib.entity.operators.crossover.real.ParentCentricCrossoverStrategy;
import net.sourceforge.cilib.pso.particle.Particle;
import net.sourceforge.cilib.type.types.container.StructuredType;

public class CrossoverOffspringPBestProvider extends OffspringPBestProvider {

    private CrossoverStrategy crossoverStrategy;

    public CrossoverOffspringPBestProvider() {
        this.crossoverStrategy = new ParentCentricCrossoverStrategy();
    }

    @Override
    public StructuredType f(List parent, Particle offspring) {
        return crossoverStrategy.crossover(parent).get(0).getCandidateSolution();
    }

    public CrossoverStrategy getCrossoverStrategy() {
        return crossoverStrategy;
    }

    public void setCrossoverStrategy(CrossoverStrategy crossoverStrategy) {
        this.crossoverStrategy = crossoverStrategy;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy