evaluate: SLiM method evaluate

Description Usage Arguments Details Value Copyright Author(s)

View source: R/slim_lang.R

Description

Documentation for SLiM function evaluate, which is a method of the SLiM class InteractionType. Note that the R function is a stub, it does not do anything in R (except bring up this documentation). It will only do anything useful when used inside a slim_block function further nested in a slim_script function call, where it will be translated into valid SLiM code as part of a full SLiM script.

Usage

1
evaluate(subpops, immediate)

Arguments

subpops

An object of type null or Subpopulation object. The default value is NULL. See details for description.

immediate

An object of type logical. Must be of length 1 (a singleton). The default value is F. See details for description.

Details

Triggers evaluation of the interaction for the subpopulations specified by subpops (or for all subpopulations, if subpops is NULL). By default, the effects of this may be limited, however, since the underlying implementation may choose to postpone some computations lazily. At a minimum, is it guaranteed that this method will discard all previously cached data for the subpopulation(s), and will cache the current spatial positions of all individuals (so that individuals may then move without disturbing the state of the interaction at the moment of evaluation). Notably, interaction() callbacks may not be called in response to this method; instead, their evaluation may be deferred until required to satisfy queries (at which point the generation counter may have advanced by one, so be careful with the generation ranges used in defining such callbacks). If T is passed for immediate, the interaction will immediately and synchronously evaluate all interactions between all individuals in the subpopulation(s), calling any applicable interaction() callbacks as necessary – if the interaction is spatial (see below). However, depending upon what queries are later executed, this may represent considerable wasted computation. Immediate evaluation usually generates only a slight performance improvement even if the interactions between all pairs of individuals are eventually accessed; the main reason to choose immediate evaluation, then, is that deferred calculation of interactions would lead to incorrect results due to changes in model state. For non-spatial interactions, distances and interaction strengths are never cached since such caching would require O(N2) memory and time, which is deemed unacceptable in general; for non-spatial interactions, the immediate parameter is therefore ignored. You must explicitly call evaluate() at an appropriate time in the life cycle before the interaction is used, but after any relevant changes have been made to the population. SLiM will invalidate any existing interactions after any portion of the generation cycle in which new individuals have been born or existing individuals have died. In a WF model, these events occur just before late() events execute (see the WF generation cycle diagram in chapter 21), so late() events are often the appropriate place to put evaluate() calls, but early() events can work too if the interaction is not needed until that point in the generation cycle anyway. In nonWF models, on the other hand, new offspring are produced just before early() events and then individuals die just before late() events (see the nonWF generation cycle diagram in chapter 22), so interactions will be invalidated twice during each generation cycle. This means that in a nonWF model, an interaction that influences reproduction should usually be evaluated in a late() event, while an interaction that influences fitness or mortality should usually be evaluated in an early() event (and an interaction that affects both may need to be evaluated at both times). If an interaction is never evaluated for a given subpopulation, it is guaranteed that there will be essentially no memory or computational overhead associated with the interaction for that subpopulation. Furthermore, attempting to query an interaction for an individual in a subpopulation that has not been evaluated is guaranteed to raise an error.

Value

An object of type void.

Copyright

This is documentation for a function in the SLiM software, and has been reproduced from the official manual, which can be found here: http://benhaller.com/slim/SLiM_Manual.pdf. This documentation is Copyright © 2016–2020 Philipp Messer. All rights reserved. More information about SLiM can be found on the official website: https://messerlab.org/slim/

Author(s)

Benjamin C Haller (bhaller@benhaller.com) and Philipp W Messer (messer@cornell.edu)


rdinnager/slimrlang documentation built on June 20, 2020, 8:17 p.m.