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

net.sourceforge.cilib.pso.crossover.pbestupdate.RandomOffspringPBestProvider 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.pso.particle.Particle;
import net.sourceforge.cilib.type.types.container.StructuredType;
import net.sourceforge.cilib.type.types.container.Vector;

/**
 * This OffspringPBestProvider sets an offspring's pBest to a random position in
 * the search space.
 */
public class RandomOffspringPBestProvider extends OffspringPBestProvider {
    @Override
    public StructuredType f(List parent, Particle offspring) {
        return Vector.newBuilder().copyOf(offspring.getPosition()).buildRandom();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy