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

net.sourceforge.cilib.pso.dynamic.responsestrategies.ReinitialisationReevaluationReactionStrategy Maven / Gradle / Ivy

Go to download

A library of composable components enabling simpler Computational Intelligence

There is a newer version: 0.8
Show newest version
/**           __  __
 *    _____ _/ /_/ /_    Computational Intelligence Library (CIlib)
 *   / ___/ / / / __ \   (c) CIRG @ UP
 *  / /__/ / / / /_/ /   http://cilib.net
 *  \___/_/_/_/_.___/
 */
package net.sourceforge.cilib.pso.dynamic.responsestrategies;

import net.sourceforge.cilib.algorithm.population.PopulationBasedAlgorithm;
import net.sourceforge.cilib.entity.*;

/**
 * This reaction strategy reinitialises the specified
 * {@link #setReinitializationRatio(double) ratio} of randomly chosen entities in the given
 * {@link Topology}.
 *
 * @param  some {@link PopulationBasedAlgorithm population based algorithm}
 */
public class ReinitialisationReevaluationReactionStrategy extends ReinitialisationReactionStrategy {

    public ReinitialisationReevaluationReactionStrategy() {
        super();
    }

    public ReinitialisationReevaluationReactionStrategy(ReinitialisationReactionStrategy rhs) {
        super(rhs);
    }

    @Override
    public ReinitialisationReevaluationReactionStrategy getClone() {
        return new ReinitialisationReevaluationReactionStrategy(this);
    }

    /**
     * Reinitialise the {@link Entity entities} inside the topology.
     *
     * {@inheritDoc}
     */
    @Override
    public void performReaction(E algorithm) {
        Topology entities = algorithm.getTopology();
        int reinitializeCount = (int) Math.floor(reinitialisationRatio * entities.size());

        reinitialise(entities, reinitializeCount);

        //update the particles and neighbourhoodbest
        algorithm.performIteration();
    }



}





© 2015 - 2025 Weber Informatics LLC | Privacy Policy