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

com.vadeen.neat.gui.stats.NeatStats Maven / Gradle / Ivy

The newest version!
package com.vadeen.neat.gui.stats;

import com.vadeen.neat.generation.Generation;
import com.vadeen.neat.gui.stats.info.GenomeInfo;
import com.vadeen.neat.gui.stats.info.SpeciesInfo;
import com.vadeen.neat.species.Species;

import java.util.ArrayList;
import java.util.List;

/**
 * Gathers info about generations over time.
 */
public class NeatStats {

    /**
     * Species stats over time.
     */
    public List> speciesOverTime = new ArrayList<>();

    /**
     * Best genome stats over time.
     */
    public List bestGenomeOverTime = new ArrayList<>();

    public void addGeneration(Generation g) {
        addSpecies(g.getSpecies());
        bestGenomeOverTime.add(GenomeInfo.of(g.getBestGenome()));
    }

    private void addSpecies(List species) {
        List stats = new ArrayList<>();
        for (Species s : species)
            stats.add(SpeciesInfo.of(s));

        speciesOverTime.add(stats);
    }

    public List> getSpeciesOverTime() {
        return speciesOverTime;
    }

    public List getBestGenomeOverTime() {
        return bestGenomeOverTime;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy