Package jline.gen
Class Cluster
java.lang.Object
jline.gen.Cluster
Builder for cluster models with helpers to compare dispatching/scheduling
policies and to sweep parameters.
The builder produces models with the same topology as
Network.cluster(Matrix, Matrix, SchedStrategy[], Matrix, RoutingStrategy)
(open) or Network.clusterClosed(Matrix, Matrix, Matrix, SchedStrategy[], Matrix, RoutingStrategy)
(closed), and adds:
compareDispatching(Class, RoutingStrategy...)— solve the model under multiple dispatching policies and return the average tables side-by-side;compareScheduling(Class, SchedStrategy...)— analogous comparison over per-server scheduling disciplines;sweepArrivalRate(double[], Class)— open-model arrival-rate sweep;sweepNumStations(int[], Class)— sweep over the number of parallel servers.
Solvers are passed by class reference (e.g. SolverMVA.class) and instantiated
via the conventional Solver(Network) constructor.
-
Constructor Summary
ConstructorsConstructorDescriptionCluster()Creates a default cluster: 2 servers, single open class with arrival rate 1.0, service rate 1.0 at each server, PS scheduling, RAND dispatching. -
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds theNetworkmodel from the current configuration.compareDispatching(Class<? extends NetworkSolver> solverClass, RoutingStrategy... policies) Solves the cluster under each provided dispatching strategy.compareDispatching(Function<Network, NetworkAvgTable> solverFactory, RoutingStrategy... policies) Solves the cluster under each provided dispatching strategy using a custom solver factory.compareScheduling(Class<? extends NetworkSolver> solverClass, SchedStrategy... disciplines) Solves the cluster under each provided scheduling discipline.compareScheduling(Function<Network, NetworkAvgTable> solverFactory, SchedStrategy... disciplines) Solves the cluster under each provided scheduling discipline using a custom solver factory.setArrivalRate(double lambda) Single-class arrival rate.setArrivalRates(double[] lambdas) Per-class arrival rates.setArrivalSCV(double scv) Sets the squared coefficient of variation of the arrival process for every class (broadcast).setArrivalSCV(double[] scvs) Per-class arrival SCV.setClosed(int[] population, double[] thinkTimes) Switches the cluster to the closed variant with one entry per class.setClosed(int population, double thinkTime) Switches the cluster to the closed variant with a single class.Sets the dispatching strategy applied at the router.setKChoices(int k) Configures power-of-K-choices dispatching: pick the best ofkrandomly chosen servers.setKChoices(int k, boolean withMemory) Configures power-of-K-choices dispatching with the given memory flag.setNumStations(int M) Sets the number of parallel server queues.setProbabilities(double[] probs) Configures probabilistic dispatching with per-server probabilities (broadcast to all classes).setProbabilities(double[][] probs) Configures probabilistic dispatching with per-class, per-server probabilities.Sets the scheduling discipline used at every server.setServiceRate(double mu) Single service rate, broadcast across all (server, class) pairs.setServiceRates(double[][] rates) Per-(server, class) service rates as a(numStations x R)matrix.setServiceSCV(double scv) Sets the squared coefficient of variation of the service distribution for every (server, class) pair (broadcast).setServiceSCV(double[][] scvs) Per-(server, class) service SCV.setStationCounts(int[] counts) Sets per-server multiplicity (default: all 1).setWeights(int[] weights) Configures weighted round-robin dispatching with per-server integer weights.sweepArrivalRate(double[] rates, Class<? extends NetworkSolver> solverClass) Sweeps the (single-class) arrival rate of an open cluster and solves at each value.sweepArrivalRate(double[] rates, Function<Network, NetworkAvgTable> solverFactory) Same assweepArrivalRate(double[], Class)but with a custom solver factory.sweepNumStations(int[] counts, Class<? extends NetworkSolver> solverClass) Sweeps the number of parallel servers (homogeneous service rate replicated) and solves at each value.sweepNumStations(int[] counts, Function<Network, NetworkAvgTable> solverFactory) Same assweepNumStations(int[], Class)but with a custom solver factory.
-
Constructor Details
-
Cluster
public Cluster()Creates a default cluster: 2 servers, single open class with arrival rate 1.0, service rate 1.0 at each server, PS scheduling, RAND dispatching. Configure further via the chainableset*methods (e.g.setNumStations(int),setArrivalRate(double),setServiceRate(double)).
-
-
Method Details
-
setNumStations
Sets the number of parallel server queues. Replicates the current single-class service rate across all servers and resets the per-server multiplicity to all-1. -
setArrivalRate
Single-class arrival rate. -
setArrivalRates
Per-class arrival rates. -
setServiceRate
Single service rate, broadcast across all (server, class) pairs. -
setServiceRates
Per-(server, class) service rates as a(numStations x R)matrix. -
setDispatching
Sets the dispatching strategy applied at the router. -
setScheduling
Sets the scheduling discipline used at every server. -
setProbabilities
Configures probabilistic dispatching with per-server probabilities (broadcast to all classes). Each call also flips the dispatching strategy toRoutingStrategy.PROB. -
setProbabilities
Configures probabilistic dispatching with per-class, per-server probabilities. Rows index classes (length R) and columns index servers (length numStations). Flips dispatching toRoutingStrategy.PROB. -
setArrivalSCV
Sets the squared coefficient of variation of the arrival process for every class (broadcast). When SCV != 1 the arrival distribution becomes an APH fitted to the given mean and SCV instead of an exponential. -
setArrivalSCV
Per-class arrival SCV. Length must equal the number of classes. -
setServiceSCV
Sets the squared coefficient of variation of the service distribution for every (server, class) pair (broadcast). When SCV != 1 the service distribution becomes an APH fitted to the supplied mean and SCV instead of an exponential. -
setServiceSCV
Per-(server, class) service SCV. Outer dim must equal numStations. -
setKChoices
Configures power-of-K-choices dispatching: pick the best ofkrandomly chosen servers. Flips dispatching toRoutingStrategy.KCHOICES. -
setKChoices
Configures power-of-K-choices dispatching with the given memory flag. -
setWeights
Configures weighted round-robin dispatching with per-server integer weights. Flips dispatching toRoutingStrategy.WRROBIN. -
setStationCounts
Sets per-server multiplicity (default: all 1). -
setClosed
Switches the cluster to the closed variant with a single class.- Parameters:
population- number of jobs in the closed networkthinkTime- per-job think time at the delay
-
setClosed
Switches the cluster to the closed variant with one entry per class. -
build
Builds theNetworkmodel from the current configuration. -
compareDispatching
public Map<RoutingStrategy,NetworkAvgTable> compareDispatching(Class<? extends NetworkSolver> solverClass, RoutingStrategy... policies) Solves the cluster under each provided dispatching strategy.- Parameters:
solverClass-NetworkSolversubclass with aSolver(Network)constructorpolicies- dispatching strategies to compare- Returns:
- ordered map from policy to its average-metric table
-
compareDispatching
public Map<RoutingStrategy,NetworkAvgTable> compareDispatching(Function<Network, NetworkAvgTable> solverFactory, RoutingStrategy... policies) Solves the cluster under each provided dispatching strategy using a custom solver factory. Use this overload when the defaultSolver(Network)constructor is not adequate (for example, to pass simulation options or use an alternative solver). -
compareScheduling
public Map<SchedStrategy,NetworkAvgTable> compareScheduling(Class<? extends NetworkSolver> solverClass, SchedStrategy... disciplines) Solves the cluster under each provided scheduling discipline.- Parameters:
solverClass-NetworkSolversubclass with aSolver(Network)constructordisciplines- scheduling disciplines to compare- Returns:
- ordered map from discipline to its average-metric table
-
compareScheduling
public Map<SchedStrategy,NetworkAvgTable> compareScheduling(Function<Network, NetworkAvgTable> solverFactory, SchedStrategy... disciplines) Solves the cluster under each provided scheduling discipline using a custom solver factory. -
sweepArrivalRate
public Map<Double,NetworkAvgTable> sweepArrivalRate(double[] rates, Class<? extends NetworkSolver> solverClass) Sweeps the (single-class) arrival rate of an open cluster and solves at each value.- Throws:
IllegalStateException- if the cluster is closed or has more than one class
-
sweepArrivalRate
public Map<Double,NetworkAvgTable> sweepArrivalRate(double[] rates, Function<Network, NetworkAvgTable> solverFactory) Same assweepArrivalRate(double[], Class)but with a custom solver factory. -
sweepNumStations
public Map<Integer,NetworkAvgTable> sweepNumStations(int[] counts, Class<? extends NetworkSolver> solverClass) Sweeps the number of parallel servers (homogeneous service rate replicated) and solves at each value. -
sweepNumStations
public Map<Integer,NetworkAvgTable> sweepNumStations(int[] counts, Function<Network, NetworkAvgTable> solverFactory) Same assweepNumStations(int[], Class)but with a custom solver factory.
-