Class PopulationTracker

  • All Implemented Interfaces:
    org.opt4j.core.IndividualSetListener

    public class PopulationTracker
    extends Object
    implements org.opt4j.core.IndividualSetListener
    Stores all individuals ever added to the tracked population This is an IndividualSetListener that listens on the Population instance from the Opt4J Task. Additionally, a set Pareto-optimal candidates is maintained that can be retrieved by getParetoOptimalIndividuals().
    • Constructor Detail

      • PopulationTracker

        @Inject
        public PopulationTracker​(org.opt4j.core.optimizer.Population population)
    • Method Detail

      • individualAdded

        public void individualAdded​(org.opt4j.core.IndividualSet collection,
                                    org.opt4j.core.Individual individual)
        Specified by:
        individualAdded in interface org.opt4j.core.IndividualSetListener
      • individualRemoved

        public void individualRemoved​(org.opt4j.core.IndividualSet collection,
                                      org.opt4j.core.Individual individual)
        Specified by:
        individualRemoved in interface org.opt4j.core.IndividualSetListener
      • getParetoOptimalIndividuals

        public List<DSEIndividual> getParetoOptimalIndividuals()
        Careful: This can 20 minutes to calculate if you have over 1000 candidates in the PopulationTracker.
        Returns:
      • getIndividualForPhenotype

        public DSEIndividual getIndividualForPhenotype​(PCMPhenotype pheno)
        Returns the individual for the given phenotype or null if none can be found.
        Parameters:
        pheno -
        Returns:
        the individual or null
      • size

        public int size()
      • addIndividualsManually

        public boolean addIndividualsManually​(DSEIndividual individual)
        Has to be an evaluated individual.
        Parameters:
        individual -
        Throws:
        RuntimeException - if the individual is null or not yet evaluated (i.e. individual.isEvaluated returns false).