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

net.sourceforge.cilib.controlparameter.initialisation.RandomParameterInitialisationStrategy Maven / Gradle / Ivy

Go to download

A library of composable components enabling simpler Computational Intelligence

The newest version!
/**           __  __
 *    _____ _/ /_/ /_    Computational Intelligence Library (CIlib)
 *   / ___/ / / / __ \   (c) CIRG @ UP
 *  / /__/ / / / /_/ /   http://cilib.net
 *  \___/_/_/_/_.___/
 */
package net.sourceforge.cilib.controlparameter.initialisation;

import net.sourceforge.cilib.controlparameter.SettableControlParameter;
import net.sourceforge.cilib.math.random.GaussianDistribution;
import net.sourceforge.cilib.math.random.ProbabilityDistributionFunction;

public class RandomParameterInitialisationStrategy implements ControlParameterInitialisationStrategy {
    private ProbabilityDistributionFunction random;
    
    public RandomParameterInitialisationStrategy() {
        random = new GaussianDistribution();
    }
    
    public RandomParameterInitialisationStrategy(RandomParameterInitialisationStrategy copy) {
        random = copy.random;
    }
    
    public ControlParameterInitialisationStrategy getClone() {
        return new RandomParameterInitialisationStrategy(this);
    }

    @Override
    public void initialise(SettableControlParameter parameter) {
        double value = random.getRandomNumber();
        parameter.setParameter(value);
    }

    public ProbabilityDistributionFunction getRandom() {
        return random;
    }

    public void setRandom(ProbabilityDistributionFunction random) {
        this.random = random;
    }
    
    
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy