Documentation for SLiM function setConstraints, 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.

setConstraints(
  who,
  sex,
  tag,
  minAge,
  maxAge,
  migrant,
  tagL0,
  tagL1,
  tagL2,
  tagL3,
  tagL4
)

Arguments

who

An object of type string. Must be of length 1 (a singleton). See details for description.

sex

An object of type null or string. Must be of length 1 (a singleton). The default value is NULL. See details for description.

tag

An object of type null or integer. Must be of length 1 (a singleton). The default value is NULL. See details for description.

minAge

An object of type null or integer. Must be of length 1 (a singleton). The default value is NULL. See details for description.

maxAge

An object of type null or integer. Must be of length 1 (a singleton). The default value is NULL. See details for description.

migrant

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

tagL0

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

tagL1

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

tagL2

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

tagL3

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

tagL4

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

Value

An object of type void.

Details

Documentation for this function can be found in the official SLiM manual: page 697.

Sets constraints upon which individuals can be receivers and/or exerters, making the target InteractionType measure interactions between only subsets of the population. The parameter who specifies upon whom the specified constraints apply; it may be "exerters" to set constraints upon exerters, "receivers" to set constraints upon receivers, or "both" to set constraints upon both. If "both" is used, the same constraints are set for both exerters and receivers; different constraints can be set for exerters versus receivers by making a separate call to setConstraints() for each. Constraints only affect queries that involve the concept of interaction; for example, they will affect the result of nearestInteractingNeighbors(), but not the result of nearestNeighbors(). The constraints specified by a given call to setConstraints() override all previously set constraints for the category specified (receivers, exerter, or both). There is a general policy for the remaining arguments: they are NULL by default, and if NULL is used, it specifies "no constraint" for that property (removing any currently existing constraint for that property). The sex parameter constrains the sex of individuals; it may be "M" or "F" (or "*" as another way of specifying no constraint, for historical reasons). If sex is "M" or "F", the individuals to which the constraint is applied (potential receivers/exerters) must belong to a sexual species. The tag parameter constrains the tag property of individuals; if this set, the individuals to which the constraint is applied must have defined tag values. The minAge and maxAge properties constrain the age property of individuals to the given minimum and/or maximum values; these constraints can only be used in nonWF models. The migrant property constraints the migrant property of individuals (T constrains to only migrants, F to only non-migrants). Finally, the tagL0, tagL1, tagL2, tagL3, and tagL4 properties constrain the corresponding logical properties of individuals, requiring them to be either T or F as specified; the individuals to which these constraints are applied must have defined values for the constrained property or properties. Again, NULL should be supplied (as it is by default) for any property which you do not wish to constrain. These constraints may be used in any combination, as desired. For example, calling setConstraints("receivers", sex="M", minAge=5, tagL0=T) constrains the interaction type's operation so that receivers must be males, with an age of at least 5, with a tagL0 property value of T. For that configuration the potential receivers used with the interaction type must be sexual (since sex is specified), must be in a nonWF model (since minAge is specified), and must have a defined value for their tagL0 property (since that property is constrained). Note that the sexSegregation parameter to initializeInteractionType() is a shortcut which does the same thing as the corresponding calls to setConstraints(). Exerter constraints are applied at evaluate() time, whereas receiver constraints are applied at query time; see the InteractionType class documentation (section 25.8) for further discussion. The interaction constraints for an interaction type are normally a constant in simulations; in any case, they cannot be changed when an interaction has already been evaluated, so either they should be set prior to evaluation, or unevaluate() should be called first.

Author

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