On Jul 13, 2005, at 7:08 PM, Robert Hovden wrote:
> When using ec.select.BestSelection, how do you declare "n" in the
> file? I cannot find it in the API docs.
For example, the default base -- which will probably be sufficient for
you, is just
Thanks for the heads-up, I've updated the classdocs.
> I would also like to know if there is a simple to way to do a rank
> where the individuals are organized by fitness and then various
> methods could be performed based on their rank value.
ECJ doesn't have rank selection among its selection methods (except for
an odd GP beast called "greedy overselection"). This is mostly
because, in my experience, rank selection has largely been supplanted
by tournament selection in the literature.
But there are lots of nifty uses for rank selection. How to implement
it? First, you need to generate the ranks. You'd do this most easily
by maintaining an array of arrays of integers (one subarray per
subpopulation) representing individuals' ranks. Do this in
prepareToProduce(...). Then in produce you need to pick individuals
according the ranks you've generated. The easiest way to do this is to
public int produce(final int subpopulation,
final EvolutionState state,
final int thread)
... leaving the other produce(...) to its default form (which calls
this one). The primary remaining issue is settling on a standard
procedure for selecting from among ranks; I'm not aware of one beyond
rank-proportionate selection (icky). Has anyone constructed such a
class? Let us know.