Class Agent
builder.Agent).
Declare its states either by name (Agent(String, List, String))
and add transitions with active(java.lang.String, java.lang.String, double, java.lang.String), passive(java.lang.String, java.lang.String, java.lang.String) and
immediate(java.lang.String, java.lang.String, java.lang.String), or by typed variables
(Agent(String, Map, Map)) and add guarded commands with
command(java.lang.String, double, java.util.function.Predicate<java.util.Map<java.lang.String, java.lang.Object>>, java.util.function.Function<java.util.Map<java.lang.String, java.lang.Object>, java.util.Map<java.lang.String, java.lang.Object>>); the local state of a typed-variable agent is then the tuple
of variable values, enumerated from the initial valuation. Rates and weights
may be functional, a ToDoubleFunction of the joint-state
StateView.
-
Constructor Summary
ConstructorsConstructorDescriptionTyped-variable agent:varsmaps each variable name to its finite domain of distinct values (in declaration order), andinitialgives a value to every variable. -
Method Summary
Modifier and TypeMethodDescriptionReference to an action of this agent, for use in synchronizations.Add an active transition with the given rate.Add a timed action with an event label alias and a priority.Add a timed action whose rate is a function of the joint state.active(String source, String action, ToDoubleFunction<StateView> rate, String target, String label, int priority) Add a timed action with a functional rate, an event label alias and a priority.Returnncopies ofprototypenamed<name>_0...command(String action, double rate, Predicate<Map<String, Object>> guard, Function<Map<String, Object>, Map<String, Object>> update) Active guarded command at a constant rate, priority 0 and no label.command(String action, String role, double value, Predicate<Map<String, Object>> guard, Function<Map<String, Object>, Map<String, Object>> update, int priority, String label) Add a guarded command to a typed-variable agent.command(String action, String role, ToDoubleBiFunction<Map<String, Object>, StateView> value, Predicate<Map<String, Object>> guard, Function<Map<String, Object>, Map<String, Object>> update, int priority, String label) Guarded command whose rate or weight reads the agent's variables and the joint state of the composition (a functional rate).command(String action, String role, ToDoubleFunction<Map<String, Object>> value, Predicate<Map<String, Object>> guard, Function<Map<String, Object>, Map<String, Object>> update, int priority, String label) Guarded command whose rate or weight is a function of the agent's own variables.double[]getName()State names; for a typed-variable agent, the rendered valuations reachable from the initial one.Add a zero-time action of weight 1 and priority 0.Add a zero-time action with the given weight and priority 0.Add a zero-time action.immediate(String source, String action, String target, ToDoubleFunction<StateView> weight, int priority, String label) Add a zero-time action whose weight is a function of the joint state.booleanTrue for an agent declared by typed variables.Add a passive transition of weight 1.Add a passive transition with the given positive weight.Add a passive transition whose weight is a function of the joint state.record()Immutable record of this agent (PythonAgent._record).setInitialDistribution(double[] distribution) Start the agent from a probability vector over its states, in state order.setInitialDistribution(Map<String, Double> distribution) Start the agent from a law over its states, given as a mapstate -> probability(absent states have probability 0).
-
Constructor Details
-
Agent
-
Agent
-
Agent
Typed-variable agent:varsmaps each variable name to its finite domain of distinct values (in declaration order), andinitialgives a value to every variable. Add transitions withcommand(java.lang.String, double, java.util.function.Predicate<java.util.Map<java.lang.String, java.lang.Object>>, java.util.function.Function<java.util.Map<java.lang.String, java.lang.Object>, java.util.Map<java.lang.String, java.lang.Object>>).
-
-
Method Details
-
getName
-
getStates
State names; for a typed-variable agent, the rendered valuations reachable from the initial one. -
getInitial
-
getTransitions
-
getInitialDistribution
public double[] getInitialDistribution() -
isTypedVariable
public boolean isTypedVariable()True for an agent declared by typed variables. -
active
Add an active transition with the given rate. -
active
public Agent active(String source, String action, double rate, String target, String label, int priority) Add a timed action with an event label alias and a priority. A timed action of this agent is disabled while one of the same agent with a higher priority is enabled.- Parameters:
label- event label, ornullforagent.action
-
active
Add a timed action whose rate is a function of the joint state. -
active
public Agent active(String source, String action, ToDoubleFunction<StateView> rate, String target, String label, int priority) Add a timed action with a functional rate, an event label alias and a priority. -
passive
Add a passive transition of weight 1. -
passive
Add a passive transition with the given positive weight. -
passive
public Agent passive(String source, String action, String target, ToDoubleFunction<StateView> weight) Add a passive transition whose weight is a function of the joint state. -
immediate
Add a zero-time action of weight 1 and priority 0. -
immediate
Add a zero-time action with the given weight and priority 0. -
immediate
public Agent immediate(String source, String action, String target, double weight, int priority, String label) Add a zero-time action. Immediate actions have maximal progress: in a state where any is enabled, only those of the highestpriorityfire, chosen in proportion toweight, and timed actions wait. The vanishing states this creates are eliminated by the solvers.- Parameters:
label- event label, ornullforagent.action
-
immediate
public Agent immediate(String source, String action, String target, ToDoubleFunction<StateView> weight, int priority, String label) Add a zero-time action whose weight is a function of the joint state. -
action
Reference to an action of this agent, for use in synchronizations. -
setInitialDistribution
Start the agent from a law over its states, given as a mapstate -> probability(absent states have probability 0). -
setInitialDistribution
Start the agent from a probability vector over its states, in state order. -
command
public Agent command(String action, double rate, Predicate<Map<String, Object>> guard, Function<Map<String, Object>, Map<String, Object>> update) Active guarded command at a constant rate, priority 0 and no label. -
command
public Agent command(String action, String role, double value, Predicate<Map<String, Object>> guard, Function<Map<String, Object>, Map<String, Object>> update, int priority, String label) Add a guarded command to a typed-variable agent.guardandupdatetake the map of the agent's variables;updatereturns the variables it changes. A command is disabled where its guard is false or its update leaves a domain.valueis the rate (roleactive) or the weight (passive/immediate).- Parameters:
guard- enabling predicate, ornullfor always enabledupdate- variable changes, ornullfor nonelabel- event label, ornullforagent.action
-
command
public Agent command(String action, String role, ToDoubleFunction<Map<String, Object>> value, Predicate<Map<String, Object>> guard, Function<Map<String, Object>, Map<String, Object>> update, int priority, String label) Guarded command whose rate or weight is a function of the agent's own variables. -
command
public Agent command(String action, String role, ToDoubleBiFunction<Map<String, Object>, StateView> value, Predicate<Map<String, Object>> guard, Function<Map<String, Object>, Map<String, Object>> update, int priority, String label) Guarded command whose rate or weight reads the agent's variables and the joint state of the composition (a functional rate). -
array
Returnncopies ofprototypenamed<name>_0...<name>_{n-1}; a label aliasLof the prototype becomesL[i]in copyi. -
record
Immutable record of this agent (PythonAgent._record).
-