Class LayeredNetwork
- All Implemented Interfaces:
Serializable,Copyable
Layered queueing networks extend traditional queueing networks by modeling software systems where processes can both serve requests and make requests to other processes, creating a layered architecture. This is particularly useful for analyzing:
- Multi-tier web applications (web server, application server, database)
- Service-oriented architectures and microservices
- Client-server systems with nested service calls
- Cloud computing and distributed systems
The network consists of:
- Hosts: Physical or virtual processors that execute tasks
- Tasks: Software processes that can serve requests and make calls
- Entries: Service interfaces exposed by tasks
- Activities: Individual processing steps within tasks
- Precedences: Execution order and control flow relationships
LayeredNetwork supports both open models (with external arrivals) and closed models (with fixed population), and can model complex interactions including synchronous calls, asynchronous messaging, fork-join parallelism, and probabilistic routing.
The model can be solved using various algorithms including Mean Value Analysis (MVA), simulation, and matrix-analytic methods to obtain performance metrics such as response times, throughputs, and resource utilizations.
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionLayeredNetwork(String name) Creates a new layered queueing network with the specified name. -
Method Summary
Modifier and TypeMethodDescriptionvoidGenerates the graph representation of the layered network.Gets the list of network models in this ensemble.getHosts()Gets the list of network layers in this layered network.getNodeByName(String nodeName) Retrieves a network element by its name.Gets the index of a network element in the node collection.Gets the names of all network elements (hosts, tasks, entries, activities).intGets the number of layers in the layered network.intGets the number of models in the layered network ensemble.Gets the structural representation of the layered network.getStruct(boolean regenerate) Gets the structural representation of the layered network.getTasks()Get the used language features by analyzing the layered network structurevoidinit()Initializes the layered network by generating the graph and setting default parameters.voidInitializes the layered network with default settings.voidInitialize the used features for each model in the ensemblestatic LayeredNetworkLoads a layered queueing network from an XML file with default verbose setting.static LayeredNetworkLoads a layered queueing network from an XML file.static LayeredNetworkParses a layered queueing network from an XML file with default verbose setting.static LayeredNetworkParses a layered queueing network from an XML file.voidplot()Displays an interactive graph visualization of this layered network using JUNG.voidDisplays an interactive graph visualization with custom title.voidDisplays an interactive graph visualization with custom title and dimensions.static LayeredNetworkReads a layered queueing network from an XML file with default verbose setting.static LayeredNetworkReads a layered queueing network from an XML file.static DiscreteDistributionreconstructDiscreteDistribution(ProcessType type, Matrix params, Double mean) Reconstruct a DiscreteDistribution object from primitive parameters.static DistributionreconstructDistribution(ProcessType type, Matrix params, Double mean, Double scv, MatrixCell proc) Reconstruct a Distribution object from primitive parameters.voidreset(boolean isHard) Resets the layered network to its initial state.voidsanitize()Validates the LayeredNetwork configuration.voidSends the model to a local server using the default IP address (127.0.0.1).voidSends the model to a server at the specified IP address and port.voidsetUsedFeatures(String feature) Set a language feature as usedvoidsummary()Prints a summary of the layered network structure to standard output.voidview()Views the layered network model using ModelVisualizer.static voidViews a layered queueing network model using the default JLQN path.static voidViews a layered queueing network model using the specified JLQN path.voidWrites the layered network to a JLQN file with default naming.voidWrites the layered network to a JLQN file.voidWrites the layered network to an XML file with default naming.voidWrites the layered network to an XML file.Methods inherited from class jline.lang.Ensemble
getModel, merge, merge, setEnsemble, size, toNetworkMethods inherited from class jline.lang.Model
getName, getVersion, setName, setVersion
-
Field Details
-
hosts
-
tasks
-
reftasks
-
activities
-
entries
-
nodes
-
-
Constructor Details
-
LayeredNetwork
Creates a new layered queueing network with the specified name.- Parameters:
name- the name of the layered network
-
-
Method Details
-
getHosts
-
getTasks
-
getEntries
-
getActivities
-
load
Loads a layered queueing network from an XML file.- Parameters:
filename- the path to the XML file to loadverbose- if true, enables verbose output during loading- Returns:
- the loaded LayeredNetwork instance
-
load
Loads a layered queueing network from an XML file with default verbose setting.- Parameters:
filename- the path to the XML file to load- Returns:
- the loaded LayeredNetwork instance
-
parseXML
Parses a layered queueing network from an XML file with default verbose setting.- Parameters:
filename- the path to the XML file to parse- Returns:
- the parsed LayeredNetwork instance
-
parseXML
Parses a layered queueing network from an XML file.- Parameters:
filename- the path to the XML file to parseverbose- if true, enables verbose output during parsing- Returns:
- the parsed LayeredNetwork instance
-
readXML
Reads a layered queueing network from an XML file with default verbose setting.- Parameters:
filename- the path to the XML file to read- Returns:
- the read LayeredNetwork instance
-
readXML
Reads a layered queueing network from an XML file.- Parameters:
filename- the path to the XML file to readverbose- if true, enables verbose output during reading- Returns:
- the read LayeredNetwork instance
-
viewModel
Views a layered queueing network model using the default JLQN path.- Parameters:
filename- the path to the model file to view
-
viewModel
Views a layered queueing network model using the specified JLQN path.- Parameters:
jlqnPath- the path to the JLQN executablefilename- the path to the model file to view
-
generateGraph
public void generateGraph()Generates the graph representation of the layered network. This method is currently not implemented. -
getEnsemble
Description copied from class:EnsembleGets the list of network models in this ensemble.- Overrides:
getEnsemblein classEnsemble- Returns:
- the list of network models
-
getLayers
Gets the list of network layers in this layered network.- Returns:
- the list of network layers
-
getNodeByName
Retrieves a network element by its name.- Parameters:
nodeName- the name of the node to find- Returns:
- the LayeredNetworkElement with the specified name, or null if not found
-
getNodeIndex
Gets the index of a network element in the node collection.- Parameters:
node- the network element to find the index for- Returns:
- the index of the node, or -1 if not found
-
getNodeNames
Gets the names of all network elements (hosts, tasks, entries, activities).- Returns:
- a list containing all node names in the network
-
getNumberOfLayers
public int getNumberOfLayers()Gets the number of layers in the layered network.- Returns:
- the number of layers
-
getNumberOfModels
public int getNumberOfModels()Gets the number of models in the layered network ensemble.- Returns:
- the number of models
-
getStruct
Gets the structural representation of the layered network.- Returns:
- the LayeredNetworkStruct containing the network structure
-
getStruct
Gets the structural representation of the layered network.- Parameters:
regenerate- if true, forces regeneration of the structure- Returns:
- the LayeredNetworkStruct containing the network structure
-
init
public void init()Initializes the layered network by generating the graph and setting default parameters. -
initDefault
public void initDefault()Initializes the layered network with default settings. Currently this method contains placeholder implementation. -
reset
public void reset(boolean isHard) Resets the layered network to its initial state.- Parameters:
isHard- if true, performs a hard reset clearing all network elements; if false, performs a soft reset clearing only the ensemble
-
sendModel
Sends the model to a local server using the default IP address (127.0.0.1).- Parameters:
outputPath- the path where the model output should be storedportNumber- the port number for the server connection
-
sendModel
Sends the model to a server at the specified IP address and port.- Parameters:
outputPath- the path where the model output should be storedipNumber- the IP address of the serverportNumber- the port number for the server connection
-
summary
public void summary()Prints a summary of the layered network structure to standard output. -
view
public void view()Views the layered network model using ModelVisualizer. -
plot
public void plot()Displays an interactive graph visualization of this layered network using JUNG.The visualization shows:
- Hosts as red pyramids
- Tasks as red parallelograms
- Entries as red rectangles
- Activities as red circles
The window includes menus for:
- Switching between different layout algorithms (Hierarchical, Circle, Force-Directed, etc.)
- Switching mouse modes (Pan/Zoom vs Pick/Move)
-
plot
Displays an interactive graph visualization with custom title.- Parameters:
title- the window title
-
plot
Displays an interactive graph visualization with custom title and dimensions.- Parameters:
title- the window titlewidth- the window width in pixelsheight- the window height in pixels
-
writeJLQN
Writes the layered network to a JLQN file with default naming.- Parameters:
filename- the path to write the JLQN file- Throws:
Exception- if there's an error writing the file
-
writeJLQN
Writes the layered network to a JLQN file.- Parameters:
filename- the path to write the JLQN fileabstractNames- if true, uses abstract names in the output- Throws:
Exception- if there's an error writing the file
-
writeXML
Writes the layered network to an XML file with default naming.- Parameters:
filename- the path to write the XML file
-
writeXML
Writes the layered network to an XML file.- Parameters:
filename- the path to write the XML fileabstractNames- if true, uses abstract names in the output
-
initUsedFeatures
public void initUsedFeatures()Initialize the used features for each model in the ensemble -
setUsedFeatures
Set a language feature as used- Parameters:
feature- the name of the feature to mark as used
-
getUsedLangFeatures
Get the used language features by analyzing the layered network structure- Returns:
- FeatureSet containing all features used in this layered network
-
sanitize
public void sanitize()Validates the LayeredNetwork configuration. Ensures that if entries are defined, activities are also defined to serve those entries. An entry without a bound activity is not a functional LQN model.- Throws:
RuntimeException- if entries exist but no activities are defined
-
reconstructDistribution
public static Distribution reconstructDistribution(ProcessType type, Matrix params, Double mean, Double scv, MatrixCell proc) Reconstruct a Distribution object from primitive parameters. This is the inverse of extractDistParams and enables migration away from storing Distribution objects in LayeredNetworkStruct.- Parameters:
type- The ProcessType of the distributionparams- The distribution parameters (may be null for some types)mean- The mean of the distributionscv- The squared coefficient of variationproc- The process representation (for PH, MAP types)- Returns:
- A Distribution object reconstructed from the primitives
-
reconstructDiscreteDistribution
public static DiscreteDistribution reconstructDiscreteDistribution(ProcessType type, Matrix params, Double mean) Reconstruct a DiscreteDistribution object from primitive parameters.- Parameters:
type- The ProcessType of the distributionparams- The distribution parameters (may be null for some types)mean- The mean of the distribution- Returns:
- A DiscreteDistribution object reconstructed from the primitives
-