rankSelection(
random,scores,selectionSize,objective): readonlynumber[]
Defined in: packages/evolution/src/selection.ts:143
Select source indices with replacement from exponential competition-rank weights.
Each result consumes one weighted-choice draw. Scores are validated and ranked once, remain unmodified, and the returned indices refer to the original score order.
Parameters
Section titled “Parameters”random
Section titled “random”scores
Section titled “scores”readonly number[]
selectionSize
Section titled “selectionSize”number
objective
Section titled “objective”Returns
Section titled “Returns”readonly number[]
Throws
Section titled “Throws”With code EMPTY_POPULATION for no scores, INVALID_SCORE for a non-finite
score, INVALID_SELECTION_SIZE for a negative or unsafe selection size, or INVALID_OBJECTIVE for an unsupported
objective.
Throws
Section titled “Throws”With code INVALID_SOURCE_VALUE when the random source returns a value outside
[0, 1).