![]() ![]() ![]() in switch statement.ģ4 Methods on Process Flow Diagrams source.inject(int count) injects a count of entities into the source object (i.e. Can then compare to different state names, e.g. ![]() em(int i) gets item i from population collection add_populationname() Adds agent to that population remove_populationname() Removes agent from that populationģ2 Useful Java Code: Methods to Call on (or from within, using this ) an Agent a.getconnectionsnumber() returns number of connections between this agent and others get_main() gets reference to Main object tostring() gets string rendition of agent a.getconnections() gets a collection (linked) list of agents to which this agent is connected (& over which we can iterate) a.connectto(agent b) connects a to b a.disconnectfrom(agent b) disconnects b from a a.disconnectfromall() disconnects all agents from a a.getconnectedagent(int i) gets the ith agent connected to a a.isconnectedto(agent b) indicates if a is connected to bģ3 Methods on Statecharts (Called from within Agent code) isstateactive(intstatename) indicates whether agent is in a given state (composite or simple) getactivesimplestate() Get number of simple state. a random number in range 0 to x lognormal(double meannormal, double sigmastddevnormal, double minnormal) draws from a lognormal distribution normal(double meannormal, double sigmastddevnormal) draws from a normal distribution Many other probability distributionsģ1 Methods on Populations of Agents (in Main class) population.size() gets number of objects in collection population population.statname() retrieves the current value of the population statistic statname, as computed for population population. 27 Common Contextual Variables that are Used by Code Snippets In statistics: item indicates current agent In On Message Received handler for agent: msg indicates received message In Dynamic properties of an Agent s replicated line property: index indicates current person s index In Parameters properties of Agent populations (used to set properties of agents within population): index indicates the index of the current agent in the populationĢ8 Example code to Export Dataset FileOutputStream fos = new FileOutputStream( Filename ) PrintStream p = new PrintStream(fos) p.println(datasetname.tostring()) // outputs comma delimited valuesĢ9 Useful Bits of Java Code get_main() gets reference to Main object ace(str) outputs string to log Engine.getTime() gets the current time agents.size() gets number of objects in collection agents em(i) gets item i from agent collection uniform() generates a random number from 0.1ģ0 Useful Bits of Java Code : General Expressions aceln(Stringstr) outputs string to log time() gets the current internal model time (different from the time in the external world) Members of com.xj. uniform() generates a random number from 0.1 uniform(x) gen.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |