Class SAPEREGradient
-
- All Implemented Interfaces:
-
it.unibo.alchemist.model.Actionable
,it.unibo.alchemist.model.Reaction
,java.io.Serializable
,java.lang.Comparable
public final class SAPEREGradient<P extends Position<P>> extends AbstractReaction<T>
This class provides a fast and stable gradient implementation, inspired on the NBR construct used in Proto.
-
-
Field Summary
Fields Modifier and Type Field Description public final TimeDistribution<T>
timeDistribution
public final Node<T>
node
-
Constructor Summary
Constructors Constructor Description SAPEREGradient(Environment<List<ILsaMolecule>, P> environment, ILsaNode node, ILsaMolecule sourceTemplate, ILsaMolecule gradientTemplate, int valuePosition, String expression, ILsaMolecule contextTemplate, double gradThreshold, TimeDistribution<List<ILsaMolecule>> timeDistribution)
Builds a new SAPERE Gradient. SAPEREGradient(Environment<List<ILsaMolecule>, P> environment, ILsaNode node, TimeDistribution<List<ILsaMolecule>> timeDistribution, String sourceTemplate, String gradientTemplate, int valuePosition, String expression, String contextTemplate, double gradThreshold)
Builds a new SAPERE Gradient.
-
Method Summary
Modifier and Type Method Description boolean
canExecute()
Reaction<List<ILsaMolecule>>
cloneOnNewNode(@Nonnull() Node<List<ILsaMolecule>> node, @Nonnull() Time currentTime)
void
execute()
List<Action<List<ILsaMolecule>>>
getActions()
List<Condition<List<ILsaMolecule>>>
getConditions()
ILsaNode
getLsaNode()
double
getRate()
-
Methods inherited from class it.unibo.alchemist.model.reactions.AbstractReaction
compareTo, equals, getInboundDependencies, getInputContext, getNode, getOutboundDependencies, getOutputContext, getTau, getTimeDistribution, hashCode, initializationComplete, setActions, setConditions, toString, update
-
Methods inherited from class it.unibo.alchemist.model.Actionable
getInboundDependencies, getOutboundDependencies
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
SAPEREGradient
SAPEREGradient(Environment<List<ILsaMolecule>, P> environment, ILsaNode node, ILsaMolecule sourceTemplate, ILsaMolecule gradientTemplate, int valuePosition, String expression, ILsaMolecule contextTemplate, double gradThreshold, TimeDistribution<List<ILsaMolecule>> timeDistribution)
Builds a new SAPERE Gradient.- Parameters:
environment
- the current environmentnode
- the node where this reaction is scheduledsourceTemplate
- a template ILsaMolecule representing the sourcegradientTemplate
- a template ILsaMolecule representing the gradient.valuePosition
- the point at which the computation of the new values should be inserted.expression
- the expression to use in order to calculate the new gradient value.contextTemplate
- a template ILsaMolecule.gradThreshold
- if the value of the gradient grows above this threshold, the gradient evaporatestimeDistribution
- Markovian Rate
-
SAPEREGradient
SAPEREGradient(Environment<List<ILsaMolecule>, P> environment, ILsaNode node, TimeDistribution<List<ILsaMolecule>> timeDistribution, String sourceTemplate, String gradientTemplate, int valuePosition, String expression, String contextTemplate, double gradThreshold)
Builds a new SAPERE Gradient.- Parameters:
environment
- the current environmentnode
- the node where this reaction is scheduledtimeDistribution
- Markovian RatesourceTemplate
- a template ILsaMolecule representing the sourcegradientTemplate
- a template ILsaMolecule representing the gradient.valuePosition
- the point at which the computation of the new values should be inserted.expression
- the expression to use in order to calculate the new gradient value.contextTemplate
- a template ILsaMolecule.gradThreshold
- if the value of the gradient grows above this threshold, the gradient evaporates
-
-
Method Detail
-
canExecute
boolean canExecute()
-
cloneOnNewNode
@Nonnull() Reaction<List<ILsaMolecule>> cloneOnNewNode(@Nonnull() Node<List<ILsaMolecule>> node, @Nonnull() Time currentTime)
-
execute
void execute()
-
getActions
@Nonnull() List<Action<List<ILsaMolecule>>> getActions()
-
getConditions
@Nonnull() List<Condition<List<ILsaMolecule>>> getConditions()
-
getLsaNode
ILsaNode getLsaNode()
- Returns:
the current node as ILsaNode
-
getRate
double getRate()
-
-
-
-