Package jline.gen

Class Cluster

java.lang.Object
jline.gen.Cluster

public class Cluster extends Object
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:

Solvers are passed by class reference (e.g. SolverMVA.class) and instantiated via the conventional Solver(Network) constructor.

  • Constructor Details

  • Method Details

    • setNumStations

      public Cluster setNumStations(int M)
      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

      public Cluster setArrivalRate(double lambda)
      Single-class arrival rate.
    • setArrivalRates

      public Cluster setArrivalRates(double[] lambdas)
      Per-class arrival rates.
    • setServiceRate

      public Cluster setServiceRate(double mu)
      Single service rate, broadcast across all (server, class) pairs.
    • setServiceRates

      public Cluster setServiceRates(double[][] rates)
      Per-(server, class) service rates as a (numStations x R) matrix.
    • setDispatching

      public Cluster setDispatching(RoutingStrategy d)
      Sets the dispatching strategy applied at the router.
    • setScheduling

      public Cluster setScheduling(SchedStrategy s)
      Sets the scheduling discipline used at every server.
    • setProbabilities

      public Cluster setProbabilities(double[] probs)
      Configures probabilistic dispatching with per-server probabilities (broadcast to all classes). Each call also flips the dispatching strategy to RoutingStrategy.PROB.
    • setProbabilities

      public Cluster setProbabilities(double[][] probs)
      Configures probabilistic dispatching with per-class, per-server probabilities. Rows index classes (length R) and columns index servers (length numStations). Flips dispatching to RoutingStrategy.PROB.
    • setArrivalSCV

      public Cluster setArrivalSCV(double scv)
      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

      public Cluster setArrivalSCV(double[] scvs)
      Per-class arrival SCV. Length must equal the number of classes.
    • setServiceSCV

      public Cluster setServiceSCV(double scv)
      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

      public Cluster setServiceSCV(double[][] scvs)
      Per-(server, class) service SCV. Outer dim must equal numStations.
    • setKChoices

      public Cluster setKChoices(int k)
      Configures power-of-K-choices dispatching: pick the best of k randomly chosen servers. Flips dispatching to RoutingStrategy.KCHOICES.
    • setKChoices

      public Cluster setKChoices(int k, boolean withMemory)
      Configures power-of-K-choices dispatching with the given memory flag.
    • setWeights

      public Cluster setWeights(int[] weights)
      Configures weighted round-robin dispatching with per-server integer weights. Flips dispatching to RoutingStrategy.WRROBIN.
    • setStationCounts

      public Cluster setStationCounts(int[] counts)
      Sets per-server multiplicity (default: all 1).
    • setClosed

      public Cluster setClosed(int population, double thinkTime)
      Switches the cluster to the closed variant with a single class.
      Parameters:
      population - number of jobs in the closed network
      thinkTime - per-job think time at the delay
    • setClosed

      public Cluster setClosed(int[] population, double[] thinkTimes)
      Switches the cluster to the closed variant with one entry per class.
    • build

      public Network build()
      Builds the Network model 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 - NetworkSolver subclass with a Solver(Network) constructor
      policies - 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 default Solver(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 - NetworkSolver subclass with a Solver(Network) constructor
      disciplines - 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 as sweepArrivalRate(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 as sweepNumStations(int[], Class) but with a custom solver factory.