Liking cljdoc? Tell your friends :D

nature.core


evolveclj/s

(evolve allele-set
        genome-length
        population-size
        generations
        fitness-function
        binary-operators
        unary-operators)
(evolve allele-set
        genome-length
        population-size
        generations
        fitness-function
        binary-operators
        unary-operators
        options)

Create and evolve a population under the specified conditions until a termination criteria is reached allele-set is a collection of legal genome values genome-length is the enforced size of each genetic sequence population-size is the enforced number of individuals that will be created generations is the number of iterations the algorithm will cycle through fitness-function is a partial function accepting generated sequences to evaluate solution qualities binary-operators is a collection of partial functions accepting and returning 1 or more individuals unary-operators is a collection of partial functions accepting and returning exactly 1 individual options an optional map of pre-specified keywords to values that further tune the behavior of nature. Current examples follow: :carry-over an integer representing the top n individuals to be carried over between each generation. Default is 1 :solutions an integer representing the top n individuals to return after evolution completes. Default is 1 :monitors a sequence of functions, assumed to be side-effectful, to be executed against population and current-genration for run-time stats. Default is nil

Create and evolve a population under the specified conditions until a termination criteria is reached
`allele-set` is a collection of legal genome values
`genome-length` is the enforced size of each genetic sequence
`population-size` is the enforced number of individuals that will be created
`generations` is the number of iterations the algorithm will cycle through
`fitness-function` is a partial function accepting generated sequences to evaluate solution qualities
`binary-operators` is a collection of partial functions accepting and returning 1 or more individuals
`unary-operators` is a collection of partial functions accepting and returning exactly 1 individual
`options` an optional map of pre-specified keywords to values that further tune the behavior of nature.
Current examples follow:
`:carry-over` an integer representing the top n individuals to be carried over between each generation. Default is 1
`:solutions` an integer representing the top n individuals to return after evolution completes. Default is 1
`:monitors` a sequence of functions, assumed to be side-effectful, to be executed against `population` and `current-genration` for run-time stats. Default is nil
sourceraw docstring

evolve-cooperativelyclj/s

(evolve-cooperatively species-a species-b generations collaboration-fitness-fn)
(evolve-cooperatively species-a
                      species-b
                      generations
                      collaboration-fitness-fn
                      options)

Evolve two populations whose contextual fitness comes from collaboration.

Each species configuration contains :species-id, :population-size, :genome-generator, :binary-operators, and :unary-operators; optional :carry-over and :insert-new values default to 1 and 0. Binary operators accept two genomes and return one or more child genomes. Unary operators accept and return one genome. collaboration-fitness-fn accepts one genome from each species (in argument order) and returns a finite numeric score.

Options are :collaboration-mode (:balanced, the default, :cartesian, :panel, or :oracle), :opponents (K for balanced scheduling, default 1), :final-ratio (default 1.0), :final-evaluation-fn, and :monitors. Final evaluators accept the two genomes and may return any value. Each monitor accepts the complete state map.

All collaboration modes accept :credit-policy (default :mean): :maximum, :top-two-mean, :weighted (with :credit-weights), or a custom context-to-finite-scalar callback. See nature.credit and README for the contract.

Panel mode accepts a non-empty :panel-selection-fns sequence, defaulting when omitted to one random member. Generation zero uses random bootstrap panels; selectors use each completed scored population and bounded historical champions to build the next panels. See nature.panel-selectors for selector functions and README for context keys.

Oracle mode scores each species independently through :oracle-fitness-fns, a species-ID-to-genome-to-finite-score function map. :oracle-reference-metadata maps each species ID to a fixed metadata map with a non-blank string :reference-id. These references never reproduce. The pair fitness argument may be nil; an explicit :final-evaluation-fn is required for final ordinary Cartesian pairs. With :final-evaluation? false, final Cartesian evaluation is skipped and its callback is optional; full scored populations and ranked solutions still return.

:initial-populations optionally supplies the complete species-ID-to-population map instead of generating new populations. Identity, lineage, and age survive; supplied fitness is cleared before generation zero is evaluated using the new callbacks. Panels and historical scores start fresh. Each call performs the requested additional reproduction steps with local generations zero through G. This continues populations in a new context, not saved RNG or monitor state.

Oracle callbacks own all domain-specific evaluation and must be thread-safe on the JVM. Monitor state includes directional oracle encounters, references, :oracle-statistics, and :oracle-evaluation-count.

Evolve two populations whose contextual fitness comes from collaboration.

Each species configuration contains `:species-id`, `:population-size`,
`:genome-generator`, `:binary-operators`, and `:unary-operators`; optional
`:carry-over` and `:insert-new` values default to 1 and 0. Binary operators
accept two genomes and return one or more child genomes. Unary operators
accept and return one genome. `collaboration-fitness-fn` accepts one genome
from each species (in argument order) and returns a finite numeric score.

Options are `:collaboration-mode` (`:balanced`, the default, `:cartesian`, `:panel`, or `:oracle`),
`:opponents` (K for balanced scheduling, default 1), `:final-ratio` (default
1.0), `:final-evaluation-fn`, and `:monitors`. Final evaluators accept the two
genomes and may return any value. Each monitor accepts the complete state map.

All collaboration modes accept :credit-policy (default :mean): :maximum,
:top-two-mean, :weighted (with :credit-weights), or a custom context-to-finite-scalar
callback. See nature.credit and README for the contract.

Panel mode accepts a non-empty `:panel-selection-fns` sequence, defaulting
when omitted to one random member. Generation zero uses random bootstrap
panels; selectors use each completed scored population and bounded historical
champions to build the next panels.
See nature.panel-selectors for selector functions and README for context keys.

Oracle mode scores each species independently through :oracle-fitness-fns,
a species-ID-to-genome-to-finite-score function map. :oracle-reference-metadata
maps each species ID to a fixed metadata map with a non-blank string :reference-id.
These references never reproduce. The pair fitness argument may be nil; an
explicit :final-evaluation-fn is required for final ordinary Cartesian pairs.
With :final-evaluation? false, final Cartesian evaluation is skipped and its
callback is optional; full scored populations and ranked solutions still return.

:initial-populations optionally supplies the complete species-ID-to-population
map instead of generating new populations. Identity, lineage, and age survive;
supplied fitness is cleared before generation zero is evaluated using the new
callbacks. Panels and historical scores start fresh. Each call performs the
requested additional reproduction steps with local generations zero through G.
This continues populations in a new context, not saved RNG or monitor state.

Oracle callbacks own all domain-specific evaluation and must be thread-safe
on the JVM. Monitor state includes directional oracle encounters, references,
:oracle-statistics, and :oracle-evaluation-count.
sourceraw docstring

evolve-with-sequence-generatorclj/s

(evolve-with-sequence-generator generator-function
                                population-size
                                generations
                                fitness-function
                                binary-operators
                                unary-operators)
(evolve-with-sequence-generator generator-function
                                population-size
                                generations
                                fitness-function
                                binary-operators
                                unary-operators
                                options)

Same with evolve method, but takes a sequence generator function instead of an allele set and genome length. This method uses the sequence generator function to generate sequences for the initial population. :initial-population-retries optionally rebuilds the initial population when every fitness score is zero. Default is 0.

Same with evolve method, but takes a sequence generator function instead of an allele set and genome length.
This method uses the sequence generator function to generate sequences for the initial population.
`:initial-population-retries` optionally rebuilds the initial population when every fitness score is zero. Default is 0.
sourceraw docstring

refresh-cooperative-populationsclj/s

(refresh-cooperative-populations species-a
                                 species-b
                                 populations
                                 replacement-counts)

Replace explicit counts of the lowest-scored members in evaluated populations. Species configurations and populations have the same shape as coevolution. replacement-counts must map both species IDs to counts in [0, population-size]. Ties preserve source order; zero replacement preserves population order. Survivors keep identity, lineage, and age. New members have fresh GUIDs, initializer parents, and age zero. All returned fitness is nil; pass the result as :initial-populations to re-evaluate before any selection or reproduction. This boundary refresh is independent of each species' per-generation :insert-new.

Replace explicit counts of the lowest-scored members in evaluated populations.
Species configurations and populations have the same shape as coevolution.
replacement-counts must map both species IDs to counts in [0, population-size].
Ties preserve source order; zero replacement preserves population order.
Survivors keep identity, lineage, and age. New members have fresh GUIDs,
initializer parents, and age zero. All returned fitness is nil; pass the result
as :initial-populations to re-evaluate before any selection or reproduction.
This boundary refresh is independent of each species' per-generation :insert-new.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close