net.sourceforge.cilib.util.calculator.EntityBasedFitnessCalculator Maven / Gradle / Ivy
/** __ __
* _____ _/ /_/ /_ Computational Intelligence Library (CIlib)
* / ___/ / / / __ \ (c) CIRG @ UP
* / /__/ / / / /_/ / http://cilib.net
* \___/_/_/_/_.___/
*/
package net.sourceforge.cilib.util.calculator;
import net.sourceforge.cilib.algorithm.AbstractAlgorithm;
import net.sourceforge.cilib.algorithm.Algorithm;
import net.sourceforge.cilib.entity.Entity;
import net.sourceforge.cilib.problem.solution.Fitness;
/**
* A fitness calculator that is specialised to determine the fitness of
* an Entity instance.
*/
public class EntityBasedFitnessCalculator implements FitnessCalculator {
private static final long serialVersionUID = -5053760817332028741L;
/**
* {@inheritDoc}
*/
@Override
public EntityBasedFitnessCalculator getClone() {
return this;
}
/**
* {@inheritDoc}
*/
@Override
public Fitness getFitness(Entity entity) {
Algorithm algorithm = AbstractAlgorithm.get();
return algorithm.getOptimisationProblem().getFitness(entity.getCandidateSolution());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy