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

ec.multiobjective.spea2.SPEA2TournamentSelection Maven / Gradle / Ivy

Go to download

ECJ, A Java-based Evolutionary Computation Research System. ECJ is a research EC system written in Java. It was designed to be highly flexible, with nearly all classes (and all of their settings) dynamically determined at runtime by a user-provided parameter file. All structures in the system are arranged to be easily modifiable. Even so, the system was designed with an eye toward efficiency. ECJ is developed at George Mason University's ECLab Evolutionary Computation Laboratory. The software has nothing to do with its initials' namesake, Evolutionary Computation Journal. ECJ's sister project is MASON, a multi-agent simulation system which dovetails with ECJ nicely.

The newest version!
/*
  Portions copyright 2010 by Sean Luke, Robert Hubley, and George Mason University
  Licensed under the Academic Free License version 3.0
  See the file "LICENSE" for more information
*/


package ec.multiobjective.spea2;
import ec.*;
import ec.select.*;
import ec.simple.*;

/* 
 * SPEA2TournamentSelection.java
 * 
 * Created: Sat Oct 16 11:24:43 EDT 2010
 * By: Sean Luke
 * Replaces earlier class by: Robert Hubley, with revisions by Gabriel Balan and Keith Sullivan
 */

/**
 * This is a special version of TournamentSelection which restricts the selection to only
 * the archive region (the top 'archiveSize' elements in the subpopulation).
 */

// This all assumes that the archive is the LAST N INDIVIDUALS in the individuals array
public class SPEA2TournamentSelection extends TournamentSelection
    {
    public int getRandomIndividual(int number, int subpopulation, EvolutionState state, int thread)
        {
        //Individual[] oldinds = state.population.subpops[subpopulation].individuals;
        int archiveSize = ((SimpleBreeder)(state.breeder)).numElites(state, subpopulation);
        int archiveStart = state.population.subpops[subpopulation].individuals.length - archiveSize;

        return archiveStart + state.random[thread].nextInt(archiveSize);
        }
    }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy