SAPEREGradient

constructor(environment: Environment<List<ILsaMolecule>, P>, node: ILsaNode, sourceTemplate: ILsaMolecule, gradientTemplate: ILsaMolecule, valuePosition: Int, expression: String, contextTemplate: ILsaMolecule, gradThreshold: Double, timeDistribution: TimeDistribution<List<ILsaMolecule>>)(source)

Builds a new SAPERE Gradient.

Parameters

environment

the current environment

node

the node where this reaction is scheduled

sourceTemplate

a template ILsaMolecule representing the source

gradientTemplate

a template ILsaMolecule representing the gradient. ALL the variables MUST be the same of sourceTemplate: no un-instanced variables are admitted when inserting tuples into nodes

valuePosition

the point at which the computation of the new values should be inserted. All the data after this position will be considered "additional information" propagated by the source. All the values before this one, instead, will be used to distinct different gradients

expression

the expression to use in order to calculate the new gradient value. #T and #D are admitted, plus every variable present in the gradient before valuePosition, and every variable matched by the contextTemplate

contextTemplate

a template ILsaMolecule. It can be used to match some contents of the local node in order to have local information to use in the gradient value computation

gradThreshold

if the value of the gradient grows above this threshold, the gradient evaporates

timeDistribution

Markovian Rate


constructor(environment: Environment<List<ILsaMolecule>, P>, node: ILsaNode, timeDistribution: TimeDistribution<List<ILsaMolecule>>, sourceTemplate: String, gradientTemplate: String, valuePosition: Int, expression: String, contextTemplate: String, gradThreshold: Double)(source)

Builds a new SAPERE Gradient. This constructor is slower, and is provided for compatibility with the YAML-based Alchemist loader. It should be avoided when possible, by relying on the other constructor instead.

Parameters

environment

the current environment

node

the node where this reaction is scheduled

sourceTemplate

a template ILsaMolecule representing the source

gradientTemplate

a template ILsaMolecule representing the gradient. ALL the variables MUST be the same of sourceTemplate: no un-instanced variables are admitted when inserting tuples into nodes

valuePosition

the point at which the computation of the new values should be inserted. All the data after this position will be considered "additional information" propagated by the source. All the values before this one, instead, will be used to distinct different gradients

expression

the expression to use in order to calculate the new gradient value. #T and #D are admitted, plus every variable present in the gradient before valuePosition, and every variable matched by the contextTemplate

contextTemplate

a template ILsaMolecule. It can be used to match some contents of the local node in order to have local information to use in the gradient value computation

gradThreshold

if the value of the gradient grows above this threshold, the gradient evaporates

timeDistribution

Markovian Rate