|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--jaga.evolve.EvolveLib
This Library contains useful functions used within the evolve package.
Constructor Summary | |
EvolveLib()
|
Method Summary | |
static int |
pickPosition(double[] cumProb)
Chooses a position from an array according to the cumulative probabilities stored in that array. |
static BitSet |
randomize(BitSet blob)
|
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public EvolveLib()
Method Detail |
public static int pickPosition(double[] cumProb)
Note cumProb.length = pop.size() + 1. The index returned by this procedure is in the range [ 0, cumProb.length - 2 ] since there is an extra element.
A random number r is generated and this method searches the array for the position p such that cumProb[ p ] < r < cumProb[ p + 1 ]. Binary chop algorithm is used to guarantee O(log(n)) time of search. WARNING: does not work with negative probabilities!
public static BitSet randomize(BitSet blob)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |