/* Copyright 2006 by Sean Luke Licensed under the Academic Free License version 3.0 See the file "LICENSE" for more information */ package ec.select; import ec.*; import ec.util.*; import ec.steadystate.*; /* * FirstSelection.java * * Created: Mon Aug 30 19:27:15 1999 * By: Sean Luke */ /** * Always picks the first individual in the subpopulation. This is mostly * for testing purposes. *
Default Base
select.first
*
* @author Sean Luke
* @version 1.0
*/
public class FirstSelection extends SelectionMethod implements SteadyStateBSourceForm
{
/** default base */
public static final String P_FIRST = "first";
public Parameter defaultBase()
{
return SelectDefaults.base().push(P_FIRST);
}
// I hard-code both produce(...) methods for efficiency's sake
public int produce(final int subpopulation,
final EvolutionState state,
final int thread)
{
return 0;
}
// I hard-code both produce(...) methods for efficiency's sake
public int produce(final int min,
final int max,
final int start,
final int subpopulation,
final Individual[] inds,
final EvolutionState state,
final int thread)
{
int n = 1;
if (n>max) n = max;
if (n