Network
- class pyJMT.Network(name, maxTime=600, maxSamples=1000000)
Bases:
objectA class to represent a network.
- addLink(source, target)
Adds a link between two nodes
- Parameters:
source (Node) – The start node of the link
target (Node) – The end node of the link
- addLinks(linkList)
Adds many links between nodes, takes in a list of pairs of nodes.
- Parameters:
linkList ([(Node, Node)]) – The list of pairs of nodes to add links for.
- addMetric(jobclass, node, metric)
Adds a metric to a node and jobclass combination
- Parameters:
jobclass (JobClass) – The jobclass to add this parameter to
node (Node) – The node to add this metric to
metric (Metrics) – The metric to add
- getResults(seed=None)
Returns a dictionary of the results from the current network’s simulation without saving anything.
- Parameters:
seed (int, optional) – The seed for the simulation.
- init_routing_matrix()
Creates and returns a routing matrix for use with Network.link
- return:
Routing Matrix p
- jsimgOpen()
Opens the Network in JMT, very useful for debugging
- link(p)
Adds many between links nodes, takes in a routing matrix.
- Parameters:
p (Routing Matrix) – The routing matrix.
- printResults(seed=None)
Prints results to console without saving anything
- param seed:
The seed for the simulation.
- type seed:
int, optional
- removeLink(source, target)
Removes a link between two nodes.
- Parameters:
source (Node) – The start node of the link.
target (Node) – The end node of the link.
- removeLinks(linkList)
Removes many links between nodes, takes in a list of pairs of nodes.
- Parameters:
linkList ([(Node, Node)]) – The list of pairs of nodes to remove links for.
- removeNode(node)
Removes a node from the network
- Parameters:
node (Node) – The node to remove from this Network.
- saveNamedJsimg(fileName)
Saves the current network to a file in output_files with a given name.
- Parameters:
fileName (str) – The name of the file.
- saveResultsFileNamed(fileName, seed=None)
Runs a simulation and generates a JMT results file with the given fileName from this Network as well as a Jsimg file
- Parameters:
fileName (str) – The file name for the results file to be given.
seed (int, optional) – The seed for the simulation.
- saveTempJsimg()
Saves the current network to a file in output_files with a temporary name and returns the name.
- Returns:
temporary file name
- Return type:
str
- useDefaultMetrics(trueorfalse)
Set whether to use the default metrics. True by default.
- Parameters:
trueorfalse (bool) – The bool to set this parameter to