Class Network
- All Implemented Interfaces:
Serializable,Copyable
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classResult class for isRoutingErgodic methodstatic class -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddItemSet(ItemSet itemSet) Adds an item set to the network model.voidaddJobClass(JobClass jobClass) Adds a job class to the network model.voidaddLink(int sourceNodeIdx, int destNodeIdx) voidvoidbooleanAdds a node to this network.Adds a finite capacity region to this network.voidvoidRemove all defined reward functions.static Networkcluster(Matrix lambda, Matrix D, SchedStrategy[] strategy, Matrix S, RoutingStrategy dispatching) Creates an open cluster network: Source -> Dispatcher (Router) -> Servers -> Sink.static NetworkclusterClosed(Matrix N, Matrix Z, Matrix D, SchedStrategy[] strategy, Matrix S, RoutingStrategy dispatching) Creates a closed cluster network: Think (Delay) -> Dispatcher (Router) -> Servers -> Think.static NetworkclusterFcfs(Matrix lambda, Matrix D, Matrix S, RoutingStrategy dispatching) Creates an open FCFS cluster with one server per queue.static NetworkclusterPs(Matrix lambda, Matrix D, RoutingStrategy dispatching) Creates an open PS cluster with one server per queue.static NetworkclusterPs(Matrix lambda, Matrix D, Matrix S, RoutingStrategy dispatching) Creates an open PS cluster.static Networkcyclic(Matrix N, Matrix D, SchedStrategy[] strategy, Matrix S) Creates a cyclic queueing network model with specified job populations, service demands, scheduling strategies, and server counts.static NetworkcyclicFcfs(Matrix N, Matrix D) Creates a cyclic queueing network with First Come First Served (FCFS) scheduling at all stations.static NetworkcyclicFcfs(Matrix N, Matrix D, Matrix S) Creates a cyclic queueing network with FCFS scheduling and specified server counts.static NetworkcyclicFcfsInf(Matrix N, Matrix D, Matrix Z) Creates a cyclic network with infinite server (delay) stations followed by FCFS queue stations.static NetworkcyclicFcfsInf(Matrix N, Matrix D, Matrix Z, Matrix S) Creates a cyclic network with infinite server stations followed by FCFS queue stations with specified server counts.static NetworkCreates a cyclic queueing network with Processor Sharing (PS) scheduling at all stations.static NetworkCreates a cyclic queueing network with PS scheduling and specified server counts.static NetworkcyclicPsInf(Matrix N, Matrix D, Matrix Z) Creates a cyclic network with infinite server (delay) stations followed by PS queue stations.static NetworkcyclicPsInf(Matrix N, Matrix D, Matrix Z, Matrix S) Creates a cyclic network with infinite server stations followed by PS queue stations with specified server counts.exportTikZ(String filePath) Exports this network to a PDF file using TikZ.voidexportTikZToFile(String filePath) Exports this network's TikZ code to a .tex file.protected voidbooleanReturns the list of job chains in this network.getClassByIndex(int index) getClassByName(String name) getClassChain(JobClass jobClass) intgetClassChainIndex(JobClass jobClass) Returns the list of job classes in this network.intgetClassIndex(String name) intgetClassIndex(JobClass jobclass) intgetClassLinks(Node node, JobClass jobClass) booleanReturns the indices of all closed job classes in this network.Returns the indices of all open job classes in this network.intintintGets the station index of the sourcegetJobClassFromIndex(int inIdx) Returns the job class at the specified index.intgetJobClassIndex(JobClass jobClass) Returns the index of the specified job class in this network.Gets the limited joint-class-dependent scaling tables and cutoffs for all stations.Gets the limited joint-dependent scaling tables and cutoffs for all stations.getNodeByIndex(int idx) getNodeByName(String name) getNodeByStatefulIndex(int idx) intgetNodeIndex(String name) intgetNodeIndex(Node node) getNodes()Returns the list of all nodes in this network.intintintintReturns the total number of nodes in this network.intintintReturns the total number of stations in this network.getProcessType(Distribution distr) Get a specific reward function by name.Get all defined reward functions.getRoutingMatrix(Matrix arvRates, int returnVal) getSink()int[]getSize()Returns the dimensions of this network as [nodes, classes].getState()getStatefulNodeFromIndex(int inIdx) intgetStatefulNodeIndex(String name) intgetStatefulNodeIndex(Node node) getStationByIndex(int index) getStationByName(String name) getStationFromIndex(int inIdx) intgetStationIndex(String name) intgetStationIndex(Node node) getStationIndexes(int index) Returns the list of stations in this network.getStruct(boolean wantInitialState) Returns the language features used by the given networkbooleanChecks if this network has any job classes defined.booleanbooleanChecks if this network contains any closed job classes.booleanhasDPS()booleanbooleanCheck if the network contains any Logger nodesbooleanhasFCFS()booleanhasFork()booleanhasGPS()booleanbooleanhasHOL()booleanhasHomogeneousScheduling(SchedStrategy strategy) booleanhasINF()booleanbooleanhasJoin()booleanhasLCFS()booleanbooleanhasLEPT()booleanhasLJF()booleanbooleanbooleanbooleanbooleanbooleanChecks if this network contains any open job classes.booleanChecks if this network has a product-form solution.booleanhasPS()booleanbooleanCheck if any rewards are defined.booleanhasSEPT()booleanbooleanbooleanhasSIRO()booleanhasSJF()voidvoidinitFromAvgQLen(Matrix AvgQLen) voidvoidvoidvoidbooleanChecks if this network is a Java native (JNetwork) implementation.booleanbooleanChecks if this network is a MATLAB native (MNetwork) implementation.Check if the queueing network routing matrix is ergodic (irreducible).Check if the queueing network routing matrix is ergodic (irreducible).booleanvoidvoidvoidlinkAndLog(RoutingMatrix P, boolean[] isNodeLogged, String logPath) Links the network with logging capability Creates Logger nodes before and after specified stations and updates routing matrixvoidvoidplot()Displays an interactive visualization of this queueing network.voidDisplays an interactive visualization of this queueing network.voidDisplays an interactive visualization of this queueing network.voidvoidRefreshes balking configuration in the network structure.voidvoidrefreshChains(boolean propagate) voidRefreshes the deadline configuration for all job classes in the network structure.voidvoidPopulates heterogeneous server configuration in NetworkStruct.voidvoidvoidvoidrefreshLST(List<Integer> statSet, List<Integer> classSet) voidvoidvoidvoidrefreshProcesses(List<Integer> statSet, List<Integer> classSet) voidrefreshProcessPhases(List<Integer> statSet, List<Integer> classSet) voidvoidrefreshProcessTypes(List<Integer> statSet, List<Integer> classSet) boolean[]refreshRates(List<Integer> statSet, List<Integer> classSet) Populate finite capacity region information in sn struct.voidRefreshes retrial configuration in the network structure.voidrefreshRoutingMatrix(Matrix rates) voidvoidvoidrefreshStruct(boolean hardRefresh) voidvoidvoidRelink the network from a modified rtorig map.voidreset()voidreset(boolean resetState) voidvoidresetModel(boolean resetState) voidresetNetwork(boolean deleteCSNodes) Resets the topology of the current networkvoidResets the struct of a given networkvoidResolves Signal placeholders to OpenSignal or ClosedSignal based on network structure.voidsanitize()static RoutingMatrixserialRouting(List<JobClass> jobClasses, List<Node> nodes) Creates a serial routing matrix connecting nodes in sequence.static RoutingMatrixserialRouting(List<JobClass> jobClasses, Node... nodes) Creates a serial routing matrix connecting nodes in sequence.static RoutingMatrixserialRouting(List<Node> nodes) Creates a serial routing matrix for all job classes in the network.static RoutingMatrixserialRouting(JobClass jobClass, List<Node> nodes) Creates a serial routing matrix for a single job class.static RoutingMatrixserialRouting(JobClass jobClass, Node... nodes) Creates a serial routing matrix for a single job class.static RoutingMatrixserialRouting(Node... nodes) Creates a serial routing matrix for all job classes in the network.voidsetAllowReplace(boolean allowReplace) voidsetChecks(boolean doChecks) Enables or disables validation checks for this network.voidsetConnectionMatrix(Matrix connection) voidsetCsMatrix(Matrix csMatrix) voidsetHasStruct(boolean hasStruct) voidsetInitialized(boolean initStatus) Sets the initialization status of this network.voidsetJoinNodeRequired(int nodeIdx, JobClass jobClass, int njobs) voidsetJoinNodeStrategy(int nodeIdx, JobClass jobClass, JoinStrategy joinStrategy) voidsetLogPath(String logPath) voidsetNodeRouting(int nodeIdx, JobClass jobClass, RoutingStrategy routingStrategy) voidsetReward(String name, RewardFunction rewardFn) Define a reward function for CTMC reward computation.voidsetSn(NetworkStruct sn) voidvoidsetUsedLangFeature(String feature) doublesub_jsq(int ind, int jnd, int r, int s, Matrix linksmat, Map<Node, Matrix> state_before, Map<Node, Matrix> state_after) doublesub_kchoices(int ind, int jnd, int r, int s, Matrix linksmat, Map<Node, Matrix> state_before, Map<Node, Matrix> state_after) Power-of-K choices marginal routing probability.doublesub_rl(int ind, int jnd, int r, int s, Matrix linksmat, Map<Node, Matrix> state_before, Map<Node, Matrix> state_after) Reinforcement-learning routing marginal probability.doublesub_rr_wrr(int ind, int jnd, int r, int s, Matrix linksmat, Map<Node, Matrix> state_before, Map<Node, Matrix> state_after) voidsummary()static Networktandem(Matrix lambda, Matrix D, SchedStrategy[] strategy, Matrix S) Creates a tandem queueing network with specified arrival rates and service demands.static NetworktandemFcfs(Matrix lambda, Matrix D, Matrix S) static NetworktandemFcfsInf(Matrix lambda, Matrix D) Creates a tandem network with FCFS infinite servers.static NetworktandemFcfsInf(Matrix lambda, Matrix D, Matrix Z) Creates a tandem network with FCFS infinite servers and delay centers.static NetworktandemFcfsInf(Matrix lambda, Matrix D, Matrix Z, Matrix S) Creates a tandem network with FCFS infinite servers, delays, and specified server counts.static Networkstatic NetworktandemPsInf(Matrix lambda, Matrix D) Creates a tandem network with processor sharing infinite servers.static NetworktandemPsInf(Matrix lambda, Matrix D, Matrix Z) Creates a tandem network with processor sharing infinite servers and delays.static NetworktandemPsInf(Matrix lambda, Matrix D, Matrix Z, Matrix S) voidtikzExportPNG(String filePath) Exports this network to a PNG file using TikZ.voidtikzExportPNG(String filePath, int dpi) Exports this network to a PNG file using TikZ with custom DPI.voidtikzView()Displays this network as a TikZ diagram in a PDF viewer.voidtikzView(TikZOptions options) Displays this network as a TikZ diagram with custom options.toTikZ()Generates TikZ code for visualizing this network.toTikZ(TikZOptions options) Generates TikZ code with custom options.voidunLink()voidUpdates sn.rtorig without replacing the entire NetworkStruct.voidview()Methods inherited from class jline.lang.Model
getName, getVersion, setName, setVersion
-
Field Details
-
nodes
-
-
Constructor Details
-
Network
Creates a new queueing network model with the specified name. Initializes all internal data structures and sets default configuration.- Parameters:
modelName- the name for this network model
-
-
Method Details
-
cyclic
Creates a cyclic queueing network model with specified job populations, service demands, scheduling strategies, and server counts.- Parameters:
N- matrix of job populations for each class [1 x R] where R is the number of job classesD- matrix of service demands [M x R] where M is the number of stations and R is the number of classesstrategy- array of scheduling strategies for each station [M x 1]S- matrix or vector specifying number of servers for each station [M x 1]- Returns:
- a configured closed queueing network model
- Throws:
RuntimeException- if server count matrix dimensions are invalid
-
cyclicFcfs
Creates a cyclic queueing network with First Come First Served (FCFS) scheduling at all stations.- Parameters:
N- matrix of job populations for each class [1 x R] where R is the number of job classesD- matrix of service demands [M x R] where M is the number of stations and R is the number of classes- Returns:
- a configured closed queueing network model with FCFS scheduling
-
cyclicFcfs
Creates a cyclic queueing network with FCFS scheduling and specified server counts.- Parameters:
N- matrix of job populations for each class [1 x R] where R is the number of job classesD- matrix of service demands [M x R] where M is the number of stations and R is the number of classesS- matrix specifying number of servers for each station [M x 1]- Returns:
- a configured closed queueing network model with FCFS scheduling
-
cyclicFcfsInf
Creates a cyclic network with infinite server (delay) stations followed by FCFS queue stations.- Parameters:
N- matrix of job populations for each class [1 x R] where R is the number of job classesD- matrix of service demands at queue stations [M x R]Z- matrix of think times at delay stations [MZ x R] where MZ is the number of delay stations- Returns:
- a configured mixed queueing network model with delay and FCFS queue stations
-
cyclicFcfsInf
Creates a cyclic network with infinite server stations followed by FCFS queue stations with specified server counts.- Parameters:
N- matrix of job populations for each class [1 x R] where R is the number of job classesD- matrix of service demands at queue stations [M x R]Z- matrix of think times at delay stations [MZ x R] where MZ is the number of delay stationsS- matrix specifying number of servers for queue stations [M x 1]- Returns:
- a configured mixed queueing network model with delay and FCFS queue stations
-
cyclicPs
Creates a cyclic queueing network with Processor Sharing (PS) scheduling at all stations.- Parameters:
N- matrix of job populations for each class [1 x R] where R is the number of job classesD- matrix of service demands [M x R] where M is the number of stations and R is the number of classes- Returns:
- a configured closed queueing network model with PS scheduling
-
cyclicPs
Creates a cyclic queueing network with PS scheduling and specified server counts.- Parameters:
N- matrix of job populations for each class [1 x R] where R is the number of job classesD- matrix of service demands [M x R] where M is the number of stations and R is the number of classesS- matrix specifying number of servers for each station [M x 1]- Returns:
- a configured closed queueing network model with PS scheduling
-
cyclicPsInf
Creates a cyclic network with infinite server (delay) stations followed by PS queue stations.- Parameters:
N- matrix of job populations for each class [1 x R] where R is the number of job classesD- matrix of service demands at queue stations [M x R]Z- matrix of think times at delay stations [MZ x R] where MZ is the number of delay stations- Returns:
- a configured mixed queueing network model with delay and PS queue stations
-
cyclicPsInf
Creates a cyclic network with infinite server stations followed by PS queue stations with specified server counts.- Parameters:
N- matrix of job populations for each class [1 x R] where R is the number of job classesD- matrix of service demands at queue stations [M x R]Z- matrix of think times at delay stations [MZ x R] where MZ is the number of delay stationsS- matrix specifying number of servers for queue stations [M x 1]- Returns:
- a configured mixed queueing network model with delay and PS queue stations
-
serialRouting
Creates a serial routing matrix connecting nodes in sequence. Jobs flow from each node to the next in the provided order. The last node connects back to the first unless it's a Sink.- Parameters:
jobClasses- list of job classes to routenodes- nodes to connect in serial order- Returns:
- routing matrix with serial connections
-
serialRouting
Creates a serial routing matrix connecting nodes in sequence. Jobs flow from each node to the next in the provided order. The last node connects back to the first unless it's a Sink.- Parameters:
jobClasses- list of job classes to routenodes- list of nodes to connect in serial order- Returns:
- routing matrix with serial connections
-
serialRouting
Creates a serial routing matrix for a single job class.- Parameters:
jobClass- the job class to routenodes- nodes to connect in serial order- Returns:
- routing matrix with serial connections
-
serialRouting
Creates a serial routing matrix for a single job class.- Parameters:
jobClass- the job class to routenodes- list of nodes to connect in serial order- Returns:
- routing matrix with serial connections
-
serialRouting
Creates a serial routing matrix for all job classes in the network.- Parameters:
nodes- nodes to connect in serial order- Returns:
- routing matrix with serial connections
-
serialRouting
Creates a serial routing matrix for all job classes in the network.- Parameters:
nodes- list of nodes to connect in serial order- Returns:
- routing matrix with serial connections
-
tandem
Creates a tandem queueing network with specified arrival rates and service demands.- Parameters:
lambda- matrix of arrival rates [classes x sources]D- matrix of service demands [stations x classes]strategy- array of scheduling strategies for each stationS- matrix of server counts [stations x classes]- Returns:
- configured tandem network model
-
tandemFcfs
-
tandemFcfsInf
Creates a tandem network with FCFS infinite servers.- Parameters:
lambda- arrival rate matrixD- service demand matrix- Returns:
- configured tandem FCFS infinite server network
-
tandemFcfsInf
Creates a tandem network with FCFS infinite servers and delay centers.- Parameters:
lambda- arrival rate matrixD- service demand matrixZ- delay time matrix- Returns:
- configured tandem FCFS infinite server network with delays
-
tandemFcfsInf
Creates a tandem network with FCFS infinite servers, delays, and specified server counts.- Parameters:
lambda- arrival rate matrixD- service demand matrixZ- delay time matrixS- server count matrix- Returns:
- configured tandem FCFS infinite server network
-
tandemPs
-
tandemPsInf
Creates a tandem network with processor sharing infinite servers.- Parameters:
lambda- arrival rate matrixD- service demand matrix- Returns:
- configured tandem PS infinite server network
-
tandemPsInf
Creates a tandem network with processor sharing infinite servers and delays.- Parameters:
lambda- arrival rate matrixD- service demand matrixZ- delay time matrix- Returns:
- configured tandem PS infinite server network with delays
-
tandemPsInf
-
cluster
public static Network cluster(Matrix lambda, Matrix D, SchedStrategy[] strategy, Matrix S, RoutingStrategy dispatching) Creates an open cluster network: Source -> Dispatcher (Router) -> Servers -> Sink.The dispatcher is a
Routerthat distributes incoming jobs to the M parallel server queues according to the suppliedRoutingStrategy(RAND, RROBIN, JSQ, ...).- Parameters:
lambda- arrival rate matrix [1 x R]; entry r is the per-class arrival rateD- service time matrix [M x R]; entry (i, r) is the mean service time of class r at server istrategy- per-server scheduling strategies (length M)S- server count matrix [M x 1]; entry i is the multiplicity of server i (1 = single server)dispatching- dispatching policy applied at the router for every class- Returns:
- configured open cluster model
-
clusterFcfs
Creates an open FCFS cluster with one server per queue.- Parameters:
lambda- arrival rate matrix [1 x R]D- service time matrix [M x R]S- server count matrix [M x 1]dispatching- dispatching policy applied at the router- Returns:
- configured open cluster with FCFS servers
-
clusterPs
Creates an open PS cluster.- Parameters:
lambda- arrival rate matrix [1 x R]D- service time matrix [M x R]S- server count matrix [M x 1]dispatching- dispatching policy applied at the router- Returns:
- configured open cluster with PS servers
-
clusterPs
Creates an open PS cluster with one server per queue.- Parameters:
lambda- arrival rate matrix [1 x R]D- service time matrix [M x R]dispatching- dispatching policy applied at the router- Returns:
- configured open cluster with single-server PS queues
-
clusterClosed
public static Network clusterClosed(Matrix N, Matrix Z, Matrix D, SchedStrategy[] strategy, Matrix S, RoutingStrategy dispatching) Creates a closed cluster network: Think (Delay) -> Dispatcher (Router) -> Servers -> Think.The think station is the reference station for every closed class; jobs cycle from the delay to the dispatcher, are dispatched to one of the parallel servers, and return to the delay on completion.
- Parameters:
N- per-class population matrix [1 x R]Z- per-class think time matrix [1 x R]D- service time matrix [M x R]strategy- per-server scheduling strategies (length M)S- server count matrix [M x 1]dispatching- dispatching policy applied at the router for every class- Returns:
- configured closed cluster model
-
addItemSet
Adds an item set to the network model. Item sets define the types of resources or items that can be processed by the network nodes.- Parameters:
itemSet- the item set to add to the network- Throws:
RuntimeException- if an item set with the same name already exists
-
addJobClass
Adds a job class to the network model. Job classes define different types of jobs that traverse the network with potentially different service requirements and routing.- Parameters:
jobClass- the job class to add to the network- Throws:
RuntimeException- if a class with the same name already exists (when validation is enabled)
-
addLink
-
addLink
public void addLink(int sourceNodeIdx, int destNodeIdx) -
addLinks
-
addNode
Adds a node to this network. If the node is a station, it's also added to the stations list. If allowReplace is true and a node with the same name already exists, it will be replaced.- Parameters:
node- the node to add to the network- Returns:
- true if the node replaced an existing node, false otherwise
-
addRegion
Adds a finite capacity region to this network.- Parameters:
nodes- list of nodes forming the capacity region- Returns:
- the created finite capacity region
-
clearCaches
public void clearCaches() -
generateClassLinks
protected void generateClassLinks() -
getAttribute
-
getAvgArvRHandles
-
getAvgHandles
-
getAvgQLenHandles
-
getAvgResidTHandles
-
getAvgRespTHandles
-
getAvgTputHandles
-
getAvgUtilHandles
-
getChains
Returns the list of job chains in this network. Job chains group classes that follow similar routing patterns.- Returns:
- list of job chains
-
getClassByIndex
-
getClassByName
-
getClassChain
-
getClassChainIndex
-
getClassIndex
-
getClassIndex
-
getClassLinks
-
getClassNames
-
getClassSwitchingMask
-
getClasses
Returns the list of job classes in this network.- Returns:
- list of job classes
-
getConnectionMatrix
-
setConnectionMatrix
-
getCsMatrix
-
setCsMatrix
-
getDemands
-
getDemandsChain
-
getForkJoins
-
getHasStruct
public boolean getHasStruct() -
setHasStruct
public void setHasStruct(boolean hasStruct) -
getAllowReplace
public boolean getAllowReplace() -
setAllowReplace
public void setAllowReplace(boolean allowReplace) -
getIndexClosedClasses
Returns the indices of all closed job classes in this network.- Returns:
- list of indices for closed job classes
-
getIndexOpenClasses
Returns the indices of all open job classes in this network.- Returns:
- list of indices for open job classes
-
getIndexSinkNode
public int getIndexSinkNode() -
getIndexSourceNode
public int getIndexSourceNode() -
getIndexSourceStation
public int getIndexSourceStation()Gets the station index of the source- Returns:
- -
-
getIndexStatefulNodes
-
getJobClassFromIndex
Returns the job class at the specified index.- Parameters:
inIdx- index of the job class- Returns:
- job class at the given index
- Throws:
IndexOutOfBoundsException- if index is invalid
-
getJobClassIndex
Returns the index of the specified job class in this network.- Parameters:
jobClass- the job class to find- Returns:
- index of the job class, or -1 if not found
-
getJobClasses
-
getLimitedClassDependence
-
getLimitedLoadDependence
-
getLimitedJointDependence
Gets the limited joint-dependent scaling tables and cutoffs for all stations.- Returns:
- a Pair containing: (1) Map of station -> linearized scaling table, (2) Map of station -> per-class cutoffs
-
getLimitedJointClassDependence
Gets the limited joint-class-dependent scaling tables and cutoffs for all stations. Each class has its own scaling table indexed by the population vector.- Returns:
- a Pair containing: (1) Map of station -> (Map of class -> scaling table), (2) Map of station -> per-class cutoffs
-
getLinkedRoutingMatrix
-
getLogPath
-
setLogPath
-
getNodeByIndex
-
getNodeByName
-
getNodeByStatefulIndex
-
getNodeIndex
-
getNodeIndex
-
getNodeNames
-
getNodeTypes
-
getNodes
Returns the list of all nodes in this network.- Returns:
- list of nodes including stations and non-station nodes
-
getNumberOfChains
public int getNumberOfChains() -
getNumberOfClasses
public int getNumberOfClasses() -
getNumberOfOpenClasses
public int getNumberOfOpenClasses() -
getNumberOfClosedClasses
public int getNumberOfClosedClasses() -
getNumberOfJobs
-
getNumberOfNodes
public int getNumberOfNodes()Returns the total number of nodes in this network.- Returns:
- number of nodes
-
getNumberOfStatefulNodes
public int getNumberOfStatefulNodes() -
getNumberOfStations
public int getNumberOfStations()Returns the total number of stations in this network.- Returns:
- number of service stations
-
getProcessType
-
getProductFormChainParameters
-
getProductFormParameters
-
getReferenceClasses
-
getReferenceStations
-
getRegions
-
getRoutingMatrix
-
getRoutingStrategyFromNodeAndClassPair
-
getSink
-
getSize
public int[] getSize()Returns the dimensions of this network as [nodes, classes].- Returns:
- array containing [number of nodes, number of job classes]
-
getSource
-
getState
-
getStatefulNodeFromIndex
-
getStatefulNodeIndex
-
getStatefulNodeIndex
-
getStatefulNodeNames
-
getStatefulNodes
-
getStatefulServers
-
getStationByIndex
-
getStationByName
-
getStationFromIndex
-
getStationIndex
-
getStationIndex
-
getStationIndexes
-
getStationNames
-
getStationScheduling
-
getStationServers
-
getStations
Returns the list of stations in this network. Stations are nodes that can provide service to jobs.- Returns:
- list of service stations
-
getStruct
-
setStruct
-
getStruct
-
getTranHandles
-
getTranQLenHandles
-
getTranTputHandles
-
getTranUtilHandles
-
getUsedLangFeatures
Returns the language features used by the given network- Returns:
- - the language features used by the given network
-
hasClassSwitching
public boolean hasClassSwitching() -
hasClasses
public boolean hasClasses()Checks if this network has any job classes defined.- Returns:
- true if job classes exist, false otherwise
-
hasClosedClasses
public boolean hasClosedClasses()Checks if this network contains any closed job classes. Closed classes have fixed populations with no external arrivals.- Returns:
- true if closed classes exist, false otherwise
-
hasDPS
public boolean hasDPS() -
hasDPSPrio
public boolean hasDPSPrio() -
hasFCFS
public boolean hasFCFS() -
hasFork
public boolean hasFork() -
hasGPS
public boolean hasGPS() -
hasGPSPrio
public boolean hasGPSPrio() -
hasHOL
public boolean hasHOL() -
hasHomogeneousScheduling
-
hasINF
public boolean hasINF() -
hasInitState
public boolean hasInitState() -
hasJoin
public boolean hasJoin() -
hasLCFS
public boolean hasLCFS() -
hasLCFSPR
public boolean hasLCFSPR() -
hasLEPT
public boolean hasLEPT() -
hasLJF
public boolean hasLJF() -
hasMultiChain
public boolean hasMultiChain() -
hasMultiClass
public boolean hasMultiClass() -
hasMultiClassFCFS
public boolean hasMultiClassFCFS() -
hasMultiClassHeterFCFS
public boolean hasMultiClassHeterFCFS() -
hasMultiServer
public boolean hasMultiServer() -
hasOpenClasses
public boolean hasOpenClasses()Checks if this network contains any open job classes. Open classes have external arrivals and departures.- Returns:
- true if open classes exist, false otherwise
-
hasPS
public boolean hasPS() -
hasPSPrio
public boolean hasPSPrio() -
hasProductFormSolution
public boolean hasProductFormSolution()Checks if this network has a product-form solution. Product-form networks can be solved efficiently using MVA methods.- Returns:
- true if the network has product-form, false otherwise
-
hasSEPT
public boolean hasSEPT() -
hasSIRO
public boolean hasSIRO() -
hasSJF
public boolean hasSJF() -
hasSingleChain
public boolean hasSingleChain() -
hasSingleClass
public boolean hasSingleClass() -
isRoutingErgodic
Check if the queueing network routing matrix is ergodic (irreducible). This checks only the routing structure, not the full CTMC state space. A routing is ergodic if all stations communicate, meaning the routing matrix does not create absorbing states or disconnected components.- Returns:
- RoutingErgodicityResult containing isErgodic flag and details
-
isRoutingErgodic
Check if the queueing network routing matrix is ergodic (irreducible).- Parameters:
P- Optional RoutingMatrix. If null, will be computed from network structure.- Returns:
- RoutingErgodicityResult containing isErgodic flag and details
-
initDefault
public void initDefault() -
initFromAvgQLen
-
initFromAvgTable
-
initFromMarginal
-
initFromMarginalAndRunning
-
initFromMarginalAndStarted
-
initRoutingMatrix
-
isJavaNative
public boolean isJavaNative()Checks if this network is a Java native (JNetwork) implementation. Always returns true for JNetwork implementations.- Returns:
- true, as this is a Java implementation
-
isLimitedLoadDependent
public boolean isLimitedLoadDependent() -
isMatlabNative
public boolean isMatlabNative()Checks if this network is a MATLAB native (MNetwork) implementation. Always returns false for JNetwork implementations.- Returns:
- false, as this is a Java implementation
-
isStateValid
public boolean isStateValid() -
jsimgView
public void jsimgView() -
jsimwView
public void jsimwView() -
toTikZ
Generates TikZ code for visualizing this network.- Returns:
- Complete LaTeX document with TikZ diagram
-
toTikZ
Generates TikZ code with custom options.- Parameters:
options- Configuration options for the visualization- Returns:
- Complete LaTeX document with TikZ diagram
-
tikzView
public void tikzView()Displays this network as a TikZ diagram in a PDF viewer. Requires pdflatex to be installed on the system. -
tikzView
Displays this network as a TikZ diagram with custom options.- Parameters:
options- Configuration options for the visualization
-
tikzExportPNG
Exports this network to a PNG file using TikZ.- Parameters:
filePath- The output file path (.png extension added if missing)- Throws:
IOException- If file operations fail
-
tikzExportPNG
Exports this network to a PNG file using TikZ with custom DPI.- Parameters:
filePath- The output file path (.png extension added if missing)dpi- Resolution in dots per inch- Throws:
IOException- If file operations fail
-
exportTikZ
Exports this network to a PDF file using TikZ.- Parameters:
filePath- The output file path (without extension)- Returns:
- The generated PDF file
- Throws:
IOException- If file operations fail
-
exportTikZToFile
Exports this network's TikZ code to a .tex file.- Parameters:
filePath- The output file path- Throws:
IOException- If file operations fail
-
link
-
linkAndLog
Links the network with logging capability Creates Logger nodes before and after specified stations and updates routing matrix- Parameters:
P- the routing matrixisNodeLogged- boolean array indicating which nodes should be loggedlogPath- path where log files will be stored (optional, uses existing logPath if null)- Returns:
- array containing [loggersBefore, loggersAfter] as List arrays
-
printRoutingMatrix
public void printRoutingMatrix() -
refreshCapacity
public void refreshCapacity() -
refreshRegions
Populate finite capacity region information in sn struct.region is a CellMatrix of size F (number of regions). region.get(f) is Matrix(M, K+1) where: entry (i,r) = max jobs of class r at station i in region f entry (i,K) = global max jobs at station i in region f -1 = infinite capacity
- Returns:
- the updated NetworkStruct
-
refreshChains
public void refreshChains(boolean propagate) -
refreshJobs
public void refreshJobs() -
refreshLST
-
refreshLocalVars
public void refreshLocalVars() -
refreshPetriNetNodes
public void refreshPetriNetNodes() -
refreshPriorities
public void refreshPriorities() -
refreshDeadlines
public void refreshDeadlines()Refreshes the deadline configuration for all job classes in the network structure. Extracts deadline values from JobClass objects and populates the classdeadline matrix. -
refreshProcessPhases
-
refreshProcessRepresentations
public void refreshProcessRepresentations() -
refreshImpatience
public void refreshImpatience() -
refreshBalking
public void refreshBalking()Refreshes balking configuration in the network structure. Extracts balking strategy and thresholds from all station-class pairs. -
refreshRetrial
public void refreshRetrial()Refreshes retrial configuration in the network structure. Extracts retrial delay distributions and max attempts from all station-class pairs. -
refreshHeterogeneousServers
public void refreshHeterogeneousServers()Populates heterogeneous server configuration in NetworkStruct.This method extracts heterogeneous server type information from Queue nodes and populates the corresponding fields in NetworkStruct:
- nservertypes - number of server types per station
- servertypenames - names of server types per station
- serverspertype - number of servers per type per station
- servercompat - compatibility matrix (server type x job class)
- heterorates - service rates per server type per class
- heteroproc - PH process representation per server type per class
- heteroprocid - process type per server type per class
- heteroschedpolicy - heterogeneous scheduling policy per station
-
refreshProcessTypes
-
refreshProcesses
-
refreshProcesses
public void refreshProcesses() -
refreshRates
-
refreshRoutingMatrix
-
refreshScheduling
public void refreshScheduling() -
refreshStruct
public void refreshStruct() -
refreshStruct
public void refreshStruct(boolean hardRefresh) -
refreshSync
public void refreshSync() -
refreshGlobalSync
public void refreshGlobalSync() -
relink
-
relinkFromRtorig
Relink the network from a modified rtorig map. Converts the map to a RoutingMatrix and calls link(). This matches MATLAB's relink(P) behavior when P comes from getLinkedRoutingMatrix. -
updateRtorig
Updates sn.rtorig without replacing the entire NetworkStruct. Used by RoutingMatrix.setRouting() to preserve computed fields (rates, isstatedep, etc.) when re-linking during solver iteration. -
reset
public void reset() -
reset
public void reset(boolean resetState) -
resetHandles
public void resetHandles() -
hasExistingLoggers
public boolean hasExistingLoggers()Check if the network contains any Logger nodes- Returns:
- true if Logger nodes exist in the network
-
resetModel
public void resetModel(boolean resetState) -
resetNetwork
public void resetNetwork() -
resetNetwork
Resets the topology of the current network- Parameters:
deleteCSNodes- - flag to indicate whether to delete the class switch nodes
-
resetStruct
public void resetStruct()Resets the struct of a given network -
sanitize
public void sanitize() -
resolveSignals
public void resolveSignals()Resolves Signal placeholders to OpenSignal or ClosedSignal based on network structure.This method is called during model finalization (refreshStruct) to convert Signal placeholder objects to their concrete types. For open networks (with Source), Signal becomes OpenSignal. For closed networks (no Source), Signal becomes ClosedSignal.
-
setChecks
public void setChecks(boolean doChecks) Enables or disables validation checks for this network.- Parameters:
doChecks- true to enable validation checks, false to disable
-
setInitialized
public void setInitialized(boolean initStatus) Sets the initialization status of this network.- Parameters:
initStatus- true if the network is initialized, false otherwise
-
setJoinNodeRequired
-
setJoinNodeStrategy
-
setNodeRouting
-
setSn
-
setUsedLangFeature
-
sub_jsq
-
sub_kchoices
public double sub_kchoices(int ind, int jnd, int r, int s, Matrix linksmat, Map<Node, Matrix> state_before, Map<Node, Matrix> state_after) Power-of-K choices marginal routing probability. Matches LDES semantics in Solver_ssj.kt:selectKChoicesDestinationWithClass: enumerate all m^k ordered tuples of eligible destinations sampled WITH replacement, break ties by first occurrence in the tuple, and return the fraction of tuples for which jnd is the JSQ winner. With memory, the prior pick is forced as the last candidate and only m^(k-1) tuples are enumerated. -
sub_rl
public double sub_rl(int ind, int jnd, int r, int s, Matrix linksmat, Map<Node, Matrix> state_before, Map<Node, Matrix> state_after) Reinforcement-learning routing marginal probability. Mirrors MATLAB sub_rl in refreshRoutingMatrix.m. Three branches:- rlStateSize == 0: tabular value function lookup over per-queue occupancies.
- rlStateSize > 0: linear approximation (1 + x_i + x_i*x_j features).
- otherwise: JSQ fallback.
-
sub_rr_wrr
-
summary
public void summary() -
unLink
public void unLink() -
view
public void view() -
modelView
public void modelView() -
setReward
Define a reward function for CTMC reward computation. The reward function maps a state vector and network structure to a scalar reward value. Multiple rewards can be defined with different names.- Parameters:
name- The unique name for this rewardrewardFn- The reward function: (state, sn) -> double Example:// Queue length reward model.setReward("qlen", (state, sn) -> state.get(0, 1)); // Throughput reward model.setReward("throughput", (state, sn) -> { double n = state.get(0, 1); return n > 0 ? n * sn.rates.get(1, 0) / n : 0; });
-
getRewards
Get all defined reward functions.- Returns:
- Map from reward name to reward function, or null if no rewards defined
-
getReward
Get a specific reward function by name.- Parameters:
name- The reward name- Returns:
- The reward function, or null if not found
-
clearRewards
public void clearRewards()Remove all defined reward functions. -
hasRewards
public boolean hasRewards()Check if any rewards are defined.- Returns:
- true if at least one reward is defined
-
plot
public void plot()Displays an interactive visualization of this queueing network. Uses default window title and dimensions. -
plot
Displays an interactive visualization of this queueing network.- Parameters:
title- the window title
-
plot
Displays an interactive visualization of this queueing network.- Parameters:
title- the window titlewidth- the window widthheight- the window height
-