Helper functions.
libs/ | Helper functions. |
check-payoff-reset | Procedure to reset short or long time payoffs if <short-time> or <long-time> periods are completed. |
get-technology-by-id | Gives a technology by technology-id. |
get-technology-by-name | Gives a technology by technology->technology-name. |
get-technologies-by-name | Gives a list of technologies by their technology->technology-names. |
get-agent | Gives an agent by agent->agent-id. |
get-dimension | Gives the number of the dimension given by name |
get-edge-technology-banned | Reports which technologies are (temporarily) banned, allowed or (completely) impossible to use on the calling edge. |
get-from-node | Gives from-node of edge |
get-to-node | Gives to-node of edge |
sort-edges | Sort edges by their ID or their predecessor and successor nodes |
fpp | Floating point precision, checks precision for all list elements Fix for known NetLogo floating point precision issue |
add-all-but-first | Adds all list elements execpt the first |
decrease-count-agents-node | Decreases the first dimension “capacity” by subtracting the given parameter from short-time-pay-offs |
decrease-count-agents-edge | Decreases the first dimension “capacity” by subtracting the given parameter from short-time-pay-offs |
increase-count-agents-node | Increases the first dimension “capacity” by adding the given parameter to all pay-offs |
increase-count-agents-edge | Increase the first dimension “capacity” by adding the given parameter to all pay-offs |
check-first-dimension | Checks if first dimension of given list is set to the given value |
check-death | Handles check of death for all objects that can die: nodes, edges, agents, technologies |
check-technologies-death | Checks possible death of technologies, due to end of lifetime |
check-nodes-death | Checks possible death of nodes, due to end of lifetime |
check-edges-death | Checks possible death of edges, due to end of lifetime (or death of a node connected to that edge, see check-nodes-death.) |
check-agents-death | Checks possible death of agents due to several reasons: reaching a final node, exceeding limits etc. |
reset-agent-technologies | Creates new technology-objects based on the present ones, will be called when hatching agents. |
reset-agent-state-variables | Sets agent-state-variables to zero values, to be used when hatching agents or in agent setup. |
increase-deaths | Increases count of death of respective type if an agent dies. |
check-death-by-location | Checks if an agent has reached a final node and should be removed from the simulation |
check-death-by-limit | Checks if an agent has exceeded one of his long-time-limits and should be removed from simulation. |
set-edge-overcrowded | Handle overcrowded status for edges |
set-node-overcrowded | Handle overcrowded status for nodes |
get-node | Gives a node by node-id. |
check-dontcare | Replace every occurence of “e” (Euler’s number) in a list by false (is used to encode “don’t care” in input files of SimCo). |
calculate-degree-vector | Calculates the degree vector of the calling entity |
degree | Report the degree of a value compared to its limits |
calculate-degree | Calculate degree for value between lower and upper limit |
payoff | Reports the actual value of respective object (agent, node, edge) for the given dimension and time. |
limits | Reports the two limits given for a specific dimension, either for short- or long-time, depending on the callers breed! |
limit | Reports the limit (if specified) or false (if limit is set to “don’t care”) |
technology-allowed-on? | Checks wether a technology is allowed to be used on an infrastructure element. |
technology-available? | Checks wether the given technology is in the set of agent.agent-technologies-available and still alive |
technology-available-by-name? | Checks wether the technology, given by its technology.technology-name is in the set of agent.agent-technologies-available |
technology-in-use? | Checks wether the given technology actually is used by the agent |
technology-type-in-use? | Checks wether the a technology corresponding to the given technology-type actually is used by the agent |
add-technologies-allowed | Parses edges from origin to all destinations and adds technology->technology-names of that <technlogies> that are allowed on the edge as well as on the respective destination node to the resulting list |
get-technologies-allowed | Gives all allowed technologies on the given element (node or edge) |
remove-technology | Removes a technology from the set of an agent’s agent->agent-technologies-available. |
number-of-technologies-banned | Gives the number of banned technologies on the given infrastructure element (node or edge) |
hatch-agent | Creates a duplicate of an agent by calling the function hatch on the agent calling the function and changes the new agent’s agent.agent-id to an id unused until now. |
get-technology-type | Returns a technology-type with the same technology-type->technology-type-name as the technology->technology-name of the given technology |
get-technology-type-by-name | Returns a technology-type with the same technology-type->technology-type-name as given |
calculate-edge-delay | Calculates edge-delay by considering edge-values, technology-values and (if present) factors influenced by controlling interventions |
calculate-costs-benefits | Calculates costs benefits based on an agent’s action; depends on location (node/edge), <technology-used>, control-factor and technology-dependency |
check-technology-dependencies | Checks, wether the technologie’s factor shall be used when calculating costs-benefits |
replace-technology-name-in-actions | Replaces the technology in a (set of) actions by its <technology-name> |
names-of-technologies | Reports the names of all technologies |
names-of-technology-types | Reports the names of all technology-types |
technology-usage | Reports the number of agents using each of the technologies that are part of the scenario running. |
technology-usage-percentage | Reports the npercentage of turtles using each of the technologies that are part of the scenario running. |
technology-usage-per-agentType | Reports the number of turtles of each type who are using each of the technologies that are part of the scenario running. |
technology-usage-per-agentType-percentage | Reports the percentage of turtles of each type who are using each of the technologies that are part of the scenario running. |
count-agent-type | Counts agents per agent-type |
agent-types-alive | Reports the number of agents of each agent-type still alive. |
node-condition-id | Reports true if the the id of the given node is part of the id-list given . |
node-condition-type | Reports true if the the cost-benefits-value in my-dimension equals my-value. |
get-node-condition-type-value | Reports the cost-benefits-value of the node given in the dimension given |
get-agent-destination-repetitive-value | |
increase-agent-destinations-repetitive-position | Increases the actual position of the agent-destinations-repetitive-pointer by 1 |
create-technology | Instantiates a new technology object based on the technology-type reffered to via my-technology-type-name |
count-technology-usage | Counts number of ticks each technology was used in previous time within the running simulation. |
get-unknown-technologies | Returns those technologies present in the scenario that were never used by the agent and that s/he actually does not own. |
get-buyable-technologies | |
update-pay-offs-node | Updates the pay-offs (and degree) for node by adding the given values to pay-offs |
update-pay-offs-agent | Updates the pay-off- and degree-vectors for an agent |
update-pay-offs-edge | Updates the pay-offs (and degree) for edge with the given technology factor |
update-node-degree | Updates the degree vectors of the calling node as well as edge-overcrowded?. |
update-edge-degree | Updates the degree vectors of the calling edge as well as edge-overcrowded?. |
update-edge-pay-offs-external | Updates the pay-offs for externals, considering the technology given. |
update-node-pay-offs-external | Updates the pay-offs for externals, considering the technology given. |
to-report get-technology-by-id [id]
Gives a technology by technology-id.
id | integer, id of technology |
<technology> | technology with given technology->technology-id |
to-report get-technology-by-name [name]
Gives a technology by technology->technology-name.
name | name of technology |
<technology> | technology with given technology->technology-name |
to-report get-technologies-by-name [list-of-technology-names]
Gives a list of technologies by their technology->technology-names.
name | list, names of technologies |
list | technologies with given technology->technology-names |
to-report get-agent [id]
Gives an agent by agent->agent-id.
id | integer, id of agent |
<agent> | agent with given agent->agent-id |
to-report get-edge-technology-banned
Reports which technologies are (temporarily) banned, allowed or (completely) impossible to use on the calling edge.
list | ”0” indicating technology allowed, -1 technology not usable, 1 technology banned |
to-report get-from-node [edge]
Gives from-node of edge
<edge> | edge to search for |
<node> | from-node for edge |
to-report sort-edges [ A B order?]
Sort edges by their ID or their predecessor and successor nodes
A | first edge to be compared |
B | second edge to be compared |
order? | bool, true: order by ID, false: order by nodes (predecessor node first, if both edges share the same predecessor node, successor node is used for comparison) |
<edges>-list | edges ordered |
to-report fpp [my-content]
Floating point precision, checks precision for all list elements Fix for known NetLogo floating point precision issue
my-content | single floating point value or (nested) list of floating point values to be checked |
floating point numbers(s) | input number(s), shortended to 12 decimal places. |
to check-technologies-death [my-technologies]
Checks possible death of technologies, due to end of lifetime
my-technologies | agentset of technologies that shall be checked for death. Usually, these will be agent->agent-technologies-available, when called by single agents. |
to check-edges-death
Checks possible death of edges, due to end of lifetime (or death of a node connected to that edge, see check-nodes-death.).
to-report get-node [id]
Gives a node by node-id.
id | node->node-id to search for |
<node> | with given node->node-id |
to-report calculate-degree-vector [time]
Calculates the degree vector of the calling entity
time | the time horizon for which the degree-vector shall be calculated: “short” or “long” |
vector | of degree-values for all dimensions (shortened using fpp within calculate-degree). |
to-report degree [dimension time]
Report the degree of a value compared to its limits
dimension | the dimension for which the degree-value shall be calculated |
time | the time horizon that should be used for calculation, “short” or “long” (as limits may differ for the two time-ranges possible) |
floating point number | calculated degree |
to-report calculate-degree [my-lower-limit my-upper-limit my-value]
Calculate degree for value between lower and upper limit
my-lower-limit | lower limit |
my-upper-limit | upper limit |
my-value | value to calculate degree for |
floating point number | degree based on given value and limits, shortened using fpp |
to-report get-payoff [dimension time]
Reports the actual value of respective object (agent, node, edge) for the given dimension and time.
dimension | int, dimension to report payoff for |
time | time scope (“short” or “long”) |
floating point number | payoff of calling entity (node, edge, or agent) for given dimension and time |
to-report limits [dimension time]
Reports the two limits given for a specific dimension, either for short- or long-time, depending on the callers breed!
dimension | int, dimension to report limits for |
time | time scope to report limits for (“short” or “long”) |
tupel of float and/or bool | limits of caller for dimension and time |
to-report technology-allowed-on? [my-IE my-technology]
Checks wether a technology is allowed to be used on an infrastructure element.
my-IE | infrastructure element (node or edge) to check permission for |
my-technology | technology->technology-name of technology to check |
true | if technology is allowed to be used on the given node or edge. |
false | otherwise. |
to-report technology-available? [my-technology]
Checks wether the given technology is in the set of agent.agent-technologies-available and still alive
my-technology | technology to be checked |
bool | true if technology is avaiblable to the agent |
to-report technology-available-by-name? [my-technology-name]
Checks wether the technology, given by its technology.technology-name is in the set of agent.agent-technologies-available
my-technology | technology.technology-name to be checked |
bool | true if technology is avaiblable to the agent |
to-report technology-in-use? [my-technology]
Checks wether the given technology actually is used by the agent
my-technology | technology to be checked |
bool | true if technology is in use |
to-report technology-type-in-use? [my-technology-type]
Checks wether the a technology corresponding to the given technology-type actually is used by the agent
my-technology-type | technology-type to be checked |
bool | true if technology is in use |
to-report add-technologies-allowed [my-origin my-destinations]
Parses edges from origin to all destinations and adds technology->technology-names of that <technlogies> that are allowed on the edge as well as on the respective destination node to the resulting list
my-origin | the node edges should start at. |
destinations | a list with nodes to be reached. |
nested ordered list | containing a node and the <technolog->technology-names> of technologies allowed on edge from my-origin-node to destination-node and destination-node. |
empty list | if there is no such path. |
to remove-technology [my-technology]
Removes a technology from the set of an agent’s agent->agent-technologies-available.
my-technology | the technology to be removed |
to hatch-agent
Creates a duplicate of an agent by calling the function hatch on the agent calling the function and changes the new agent’s agent.agent-id to an id unused until now.
to-report get-technology-type [my-technology]
Returns a technology-type with the same technology-type->technology-type-name as the technology->technology-name of the given technology
my-technology | the technology to be used for searching a technology-type |
technology-type | with the same technology-type.technology-type-name |
to-report get-technology-type-by-name [my-technology-type-name]
Returns a technology-type with the same technology-type->technology-type-name as given
my-technologytype-name | the <technology-type-name> to be used for searching a technology-type |
technology-type | with the same technology-type->technology-type-name |
to-report calculate-edge-delay [my-edge my-technology]
Calculates edge-delay by considering edge-values, technology-values and (if present) factors influenced by controlling interventions
my-edge | the edge entered |
my-technology | the technology used to enter the edge |
int | delay, the time an agent needs to wait on an edge until reaching the next node, measured in ticks. |
to-report calculate-costs-benefits [my-ie my-technology my-agent]
Calculates costs benefits based on an agent’s action; depends on location (node/edge), <technology-used>, control-factor and technology-dependency
my-ie | infrastructure element (node/edge) that is entered by an agent. |
my-technology | the technology used to enter my-ie |
list of vectors | one vector of costs-benefits, used to update pay-offs and degree, for a) my-agent, b) my-ie, c) external each |
to-report check-technology-dependencies [my-technology-factor my-technology-dependencies]
Checks, wether the technologie’s factor shall be used when calculating costs-benefits
my-technology-factor | vector of integers |
my-technology-tependencies | true/false-vector |
list | based on my-technology-factor, where values without technology-dependency are substituted by “1” |
to-report replace-technology-name-in-actions [list-of-actions]
Replaces the technology in a (set of) actions by its <technology-name>
list-of-actions | [possibly nested] list of actions, item 2 contains technology-object |
(nested) list | same length as input list, but item 2 of each action replaced by <technology-name> |
to-report names-of-technology-types
Reports the names of all technology-types
list | of technology-type.technology-type-names |
to-report technology-usage [agentset]
Reports the number of agents using each of the technologies that are part of the scenario running.
agentset | the agentset whose technology-usage shall be returned. Returns: |
list | technology-type and number of turtles using it, formatted to be printed on screen or in output-files |
to-report technology-usage-percentage [agentset]
Reports the npercentage of turtles using each of the technologies that are part of the scenario running.
agentset | the agentset whose technology-usage shall be returned. Returns: |
list | technology-type and percentage of turtles using it, formatted to be printed on screen or in output-files |
to-report technology-usage-per-agentType
Reports the number of turtles of each type who are using each of the technologies that are part of the scenario running.
nested list | (agent-type, technology-type )and number of turtles using it, formatted to be printed on screen or in output-files |
to-report technology-usage-per-agentType-percentage
Reports the percentage of turtles of each type who are using each of the technologies that are part of the scenario running.
nested list | (agent-type, technology-type )and percentage of turtles using it, formatted to be printed on screen or in output-files |
to-report node-condition-id [my-node my-agent]
Reports true if the the id of the given node is part of the id-list given . May be used by specifying in input files and using runresult.
my-node | node-object, indicating the node whose ID shall be compared with those goven by ID within <agent-destinations-once> |
bool | true or false. |
to-report node-condition-type [ my-val my-node]
Reports true if the the cost-benefits-value in my-dimension equals my-value. May be used by specifying in input files and using runresult.
my-node | node-object, indicating the node whose ID shall be compared with those goven by ID within <agent-destinations-once> |
bool | true or false. |
to-report get-node-condition-type-value [my-dimension my-node]
Reports the cost-benefits-value of the node given in the dimension given
my-dimension | int, the dimension to be considered |
my-node | the node to be considered |
int | value specified by parameters and node-costs-benefits-agents |
to-report create-technology [my-technology-type-name]
Instantiates a new technology object based on the technology-type reffered to via my-technology-type-name
my-technology-type-name | string, indicating the <technoloy-type> to be used as base for the news technology |
<technology> | the newly created technology |
to-report count-technology-usage
Counts number of ticks each technology was used in previous time within the running simulation.
table | technology->technology-name as key, value: number of ticks the respective technology was used by the calling agent. |
to-report get-unknown-technologies [previously-used-technologies]
Returns those technologies present in the scenario that were never used by the agent and that s/he actually does not own.
previusly-used-technologies | table, key: technology-name, value: number of ticks the respective technology was used by the agent. |
list | of technology-names |
Procedure to reset short or long time payoffs if short-time or long-time periods are completed.
to check-payoff-reset
Gives a technology by technology-id.
to-report get-technology-by-id [id]
Gives a technology by technology->technology-name.
to-report get-technology-by-name [name]
Gives a list of technologies by their technology->technology-names.
to-report get-technologies-by-name [list-of-technology-names]
Gives an agent by agent->agent-id.
to-report get-agent [id]
Gives the number of the dimension given by name
to-report get-dimension [dimension-name]
Reports which technologies are (temporarily) banned, allowed or (completely) impossible to use on the calling edge.
to-report get-edge-technology-banned
Gives from-node of edge
to-report get-from-node [edge]
Gives to-node of edge
to-report get-to-node [edge]
Sort edges by their ID or their predecessor and successor nodes
to-report sort-edges [ A B order?]
Floating point precision, checks precision for all list elements Fix for known NetLogo floating point precision issue
to-report fpp [my-content]
Adds all list elements execpt the first
to-report add-all-but-first [list-a list-b]
Decreases the first dimension “capacity” by subtracting the given parameter from short-time-pay-offs
to decrease-count-agents-node [my-count]
Decreases the first dimension “capacity” by subtracting the given parameter from short-time-pay-offs
to decrease-count-agents-edge [my-count]
Increases the first dimension “capacity” by adding the given parameter to all pay-offs
to increase-count-agents-node [my-count]
Increase the first dimension “capacity” by adding the given parameter to all pay-offs
to increase-count-agents-edge [my-count]
Checks if first dimension of given list is set to the given value
to-report check-first-dimension [my-list my-value]
Handles check of death for all objects that can die: nodes, edges, agents, technologies
to check-death
Checks possible death of technologies, due to end of lifetime
to check-technologies-death [my-technologies]
Checks possible death of nodes, due to end of lifetime
to check-nodes-death
Checks possible death of edges, due to end of lifetime (or death of a node connected to that edge, see check-nodes-death.)
to check-edges-death
Checks possible death of agents due to several reasons: reaching a final node, exceeding limits etc.
to check-agents-death
Creates new technology-objects based on the present ones, will be called when hatching agents.
to reset-agent-technologies
Sets agent-state-variables to zero values, to be used when hatching agents or in agent setup.
to reset-agent-state-variables
Increases count of death of respective type if an agent dies.
to increase-deaths
Checks if an agent has reached a final node and should be removed from the simulation
to-report check-death-by-location
Checks if an agent has exceeded one of his long-time-limits and should be removed from simulation.
to-report check-death-by-limit
Handle overcrowded status for edges
to set-edge-overcrowded
Handle overcrowded status for nodes
to set-node-overcrowded
Gives a node by node-id.
to-report get-node [id]
Replace every occurence of “e” (Euler’s number) in a list by false (is used to encode “don’t care” in input files of SimCo).
to-report check-dontcare [list-to-check]
Calculates the degree vector of the calling entity
to-report calculate-degree-vector [time]
Report the degree of a value compared to its limits
to-report degree [dimension time]
Calculate degree for value between lower and upper limit
to-report calculate-degree [my-lower-limit my-upper-limit my-value]
Reports the actual value of respective object (agent, node, edge) for the given dimension and time.
to-report get-payoff [dimension time]
Reports the two limits given for a specific dimension, either for short- or long-time, depending on the callers breed!
to-report limits [dimension time]
Checks wether a technology is allowed to be used on an infrastructure element.
to-report technology-allowed-on? [my-IE my-technology]
Checks wether the given technology is in the set of agent.agent-technologies-available and still alive
to-report technology-available? [my-technology]
Checks wether the technology, given by its technology.technology-name is in the set of agent.agent-technologies-available
to-report technology-available-by-name? [my-technology-name]
Checks wether the given technology actually is used by the agent
to-report technology-in-use? [my-technology]
Checks wether the a technology corresponding to the given technology-type actually is used by the agent
to-report technology-type-in-use? [my-technology-type]
Parses edges from origin to all destinations and adds technology->technology-names of that technlogies that are allowed on the edge as well as on the respective destination node to the resulting list
to-report add-technologies-allowed [my-origin my-destinations]
Gives all allowed technologies on the given element (node or edge)
to-report get-technologies-allowed [ie]
Removes a technology from the set of an agent’s agent->agent-technologies-available.
to remove-technology [my-technology]
Gives the number of banned technologies on the given infrastructure element (node or edge)
to-report number-of-technologies-banned [ie]
Creates a duplicate of an agent by calling the function hatch on the agent calling the function and changes the new agent’s agent.agent-id to an id unused until now.
to hatch-agent
Returns a technology-type with the same technology-type->technology-type-name as the technology->technology-name of the given technology
to-report get-technology-type [my-technology]
Returns a technology-type with the same technology-type->technology-type-name as given
to-report get-technology-type-by-name [my-technology-type-name]
Calculates edge-delay by considering edge-values, technology-values and (if present) factors influenced by controlling interventions
to-report calculate-edge-delay [my-edge my-technology]
Calculates costs benefits based on an agent’s action; depends on location (node/edge), technology-used, control-factor and technology-dependency
to-report calculate-costs-benefits [my-ie my-technology my-agent]
Checks, wether the technologie’s factor shall be used when calculating costs-benefits
to-report check-technology-dependencies [my-technology-factor my-technology-dependencies]
Replaces the technology in a (set of) actions by its technology-name
to-report replace-technology-name-in-actions [list-of-actions]
Reports the names of all technologies
to-report names-of-technologies
Reports the names of all technology-types
to-report names-of-technology-types
Reports the number of agents using each of the technologies that are part of the scenario running.
to-report technology-usage [agentset]
Reports the npercentage of turtles using each of the technologies that are part of the scenario running.
to-report technology-usage-percentage [agentset]
Reports the number of turtles of each type who are using each of the technologies that are part of the scenario running.
to-report technology-usage-per-agentType
Reports the percentage of turtles of each type who are using each of the technologies that are part of the scenario running.
to-report technology-usage-per-agentType-percentage
Counts agents per agent-type
to-report count-agent-type
Reports the number of agents of each agent-type still alive.
to-report agent-types-alive
Reports true if the the id of the given node is part of the id-list given .
to-report node-condition-id [my-node my-agent]
Reports true if the the cost-benefits-value in my-dimension equals my-value.
to-report node-condition-type [ my-val my-node]
Reports the cost-benefits-value of the node given in the dimension given
to-report get-node-condition-type-value [my-dimension my-node]
to-report get-agent-destination-repetitive-value
Increases the actual position of the agent-destinations-repetitive-pointer by 1
to increase-agent-destinations-repetitive-position
Instantiates a new technology object based on the technology-type reffered to via my-technology-type-name
to-report create-technology [my-technology-type-name]
Counts number of ticks each technology was used in previous time within the running simulation.
to-report count-technology-usage
Returns those technologies present in the scenario that were never used by the agent and that s/he actually does not own.
to-report get-unknown-technologies [previously-used-technologies]
to-report get-buyable-technologies
Updates the pay-offs (and degree) for node by adding the given values to pay-offs
to update-pay-offs-node [my-costs-benefits]
Updates the pay-off- and degree-vectors for an agent
to update-pay-offs-agent [my-costs-benefits]
Updates the pay-offs (and degree) for edge with the given technology factor
to update-pay-offs-edge [my-costs-benefits]
Updates the degree vectors of the calling node as well as edge-overcrowded?.
to update-node-degree
Updates the degree vectors of the calling edge as well as edge-overcrowded?.
to update-edge-degree
Updates the pay-offs for externals, considering the technology given.
to update-edge-pay-offs-external [my-costs-benefits]
Updates the pay-offs for externals, considering the technology given.
to update-node-pay-offs-external [my-costs-benefits]