Class RandomEnvExamples

java.lang.Object
jline.examples.java.advanced.RandomEnvExamples

public class RandomEnvExamples extends Object
Examples demonstrating queueing networks in random environments. This class provides Java implementations corresponding to the example notebooks in jline.examples.java.advanced.randomEnv package.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    `example_mapqn2renv.m`: the same conversion reached through MAPQN2RENV, the named entry point, with the stage networks then solved one at a time.
    static void
    main(String[] args)
    Main method to run all random environment examples.
    Demonstrates a basic random environment model (renv_basic).
    static void
    `renv_container_terminal.m`: a daily-cycle container terminal, solved by the STATE-VECTOR analyzer and read against the exact joint chain.
    static void
    Demonstrates a random environment model with four stages (renv_fourstages_repairmen.ipynb).
    static void
    `renv_genqn.m`: the stage generator of the repairmen environments, solved on its own by MVA.
    static void
    `renv_lqn_twostages.m`: a LayeredNetwork operating in a two-stage random environment.
    static void
    `renv_map_fallback.m`: the random-environment fallback a solver takes when it cannot consume a non-renewal service process.
    static void
    `renv_rotterdam_blending.m`: the 24-environment exponential blending accuracy result of the Rotterdam container-terminal study, against its published simulation.
    static void
    Demonstrates a random environment model with three stages (renv_threestages_repairmen.ipynb).
    static void
    Demonstrates a random environment model with two stages (renv_twostages_repairmen.ipynb).

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • RandomEnvExamples

      public RandomEnvExamples()
  • Method Details

    • renv_twostages_repairmen

      public static void renv_twostages_repairmen() throws Exception
      Demonstrates a random environment model with two stages (renv_twostages_repairmen.ipynb). This example models a system that alternates between two environmental states, such as normal operation and degraded mode. The repairmen model captures how the system transitions between states and how performance varies in each state. Features: - Two-stage random environment - State-dependent service rates - Environmental state transitions - Analysis of availability and performance trade-offs
      Throws:
      Exception - if the solver encounters an error
    • renv_threestages_repairmen

      public static void renv_threestages_repairmen() throws Exception
      Demonstrates a random environment model with three stages (renv_threestages_repairmen.ipynb). This example extends the two-stage model to include three environmental states, allowing for more complex failure and recovery patterns. This could model systems with multiple failure modes or degradation levels. Features: - Three-stage random environment - Multiple degradation levels - Complex state transition patterns - Performance analysis across environmental states
      Throws:
      Exception - if the solver encounters an error
    • renv_fourstages_repairmen

      public static void renv_fourstages_repairmen() throws Exception
      Demonstrates a random environment model with four stages (renv_fourstages_repairmen.ipynb). This example shows a more complex random environment with four states, suitable for modeling systems with multiple components that can fail independently or systems with graduated performance levels based on environmental conditions. Features: - Four-stage random environment - Rich state space for complex systems - Analysis of multi-level degradation - Optimization of repair strategies
      Throws:
      Exception - if the solver encounters an error
    • renv_basic

      public static Environment renv_basic() throws Exception
      Demonstrates a basic random environment model (renv_basic). This is the fundamental example for random environments, showing a simple queueing system with a server that switches between two modes: Fast and Slow. Features: - Simple closed network with delay and server - Two-stage environment (Fast mode: rate 4.0, Slow mode: rate 1.0) - Exponential transitions (Fast->Slow at rate 0.5, Slow->Fast at rate 1.0) - Analysis using Fluid solver - Environment-averaged and stage-wise performance metrics
      Returns:
      the configured environment model
      Throws:
      Exception - if the solver encounters an error
    • renv_genqn

      public static void renv_genqn() throws Exception
      `renv_genqn.m`: the stage generator of the repairmen environments, solved on its own by MVA.

      The reference is a FUNCTION rather than a script, and it is what every environment above hands to `addStage`. Publishing it under its own name makes the two-station closed network the environments are built from visible, and solving it once by MVA states the steady state each stage would reach if the environment never switched.

      Throws:
      Exception - if the solver encounters an error
    • renv_map_fallback

      public static void renv_map_fallback() throws Exception
      `renv_map_fallback.m`: the random-environment fallback a solver takes when it cannot consume a non-renewal service process.

      A solver with no MAP/MMPP support does not reject the model: the NetworkSolver base class intercepts it, replaces every modulating chain by a set of random-environment stages in which the process is exponential with its phase-conditional intensity (`MAPQN2RENV.map2renv`), and solves the stages with the same solver through SolverENV. The interception is METHOD-AWARE, so a method that handles the process natively (MVA 'rqna', MAM, CTMC, FLD, SSA, JMT, LDES) runs unchanged.

      Throws:
      Exception - if the solver encounters an error
    • example_mapqn2renv

      public static void example_mapqn2renv() throws Exception
      `example_mapqn2renv.m`: the same conversion reached through MAPQN2RENV, the named entry point, with the stage networks then solved one at a time.

      `mapqn2renv` is a pure delegate to `map2renv`; it is kept because the reference names it, and because the per-stage solve below is the part that shows what the image is FOR. Each stage is an ordinary closed network that any solver can take: MVA cannot take the MMPP, but it can take these.

      Throws:
      Exception - if the solver encounters an error
    • renv_container_terminal

      public static void renv_container_terminal() throws Exception
      `renv_container_terminal.m`: a daily-cycle container terminal, solved by the STATE-VECTOR analyzer and read against the exact joint chain.

      The Rotterdam terminal of Dhingra et al.: container handling demand varies over the 24 hours of a day, each hour is one environment stage with its own demand intensity and random (exponential) duration, and the environment visits the stages in a fixed daily cycle. The semi-open SOQN of the original study is rendered as the equivalent finite-token CLOSED network that an environment stage must be: N straddle carriers cycle between a yard staging Delay and a multi-server quay-crane Queue, and the hourly demand modulates the yard staging rate, so the cranes congest during the peaks.

      WHAT THE THREE ROWS MEASURE. `statevec` carries the whole joint distribution across a stage switch, `meanfield` collapses it to marginal mean queue lengths, and `exact` is the stationary law of the full (hour x network-state) chain. The state-vector blend reproduces the exact answer to nine digits here, which is the property the example exists to show; the mean-field collapse does not.

      The second section repeats it with the internal handling (quay cranes -> stacking cranes) collapsed by Norton's theorem into one closed load-dependent FES, so `sn.lldscaling` reaches the state-vector analyzer's CTMC backend. The third analyses the OPEN counterpart, where the hourly demand is an MMPP(24) into a multi-server queue with an unbounded buffer: that is outside the closed-CTMC state-vector path and is what MAM solves exactly as a QBD.

      Throws:
      Exception - if the solver encounters an error
    • renv_rotterdam_blending

      public static void renv_rotterdam_blending() throws Exception
      `renv_rotterdam_blending.m`: the 24-environment exponential blending accuracy result of the Rotterdam container-terminal study, against its published simulation.

      The terminal is a SEMI-OPEN network: trucks arrive as a Poisson stream at the hour's rate, a pool of N tokens admits them, and a truck that finds no token waits outside. Inside, two flow-equivalent servers in tandem stand for the upstream half (entry gates, travel, 29 stacks) and the downstream half (travel to exit, exit gates), each calibrated by exact MVA on the closed subnetwork it replaces. That gives a level-dependent QBD whose blocks are the same ones the ENV state-vector analyzer assembles internally, which is why this example builds them directly rather than through SolverENV: the quantities it reports (external wait and external queue) live OUTSIDE the token pool and so outside any stage network's own metric table.

      The comparison is against Table 13 of the study's discrete-event simulation.

      Throws:
      Exception - if the solver encounters an error
    • renv_lqn_twostages

      public static void renv_lqn_twostages() throws Exception
      `renv_lqn_twostages.m`: a LayeredNetwork operating in a two-stage random environment.

      SolverENV runs over an LQN base model through the uniform model/solver interface, with no branching in ENV itself. The environment alternates between an UP stage (fast database) and a DOWN stage (slow database), and the environment-averaged total throughput must lie between the two single-stage LQN solutions: a slower database slows the whole system, so the average is bracketed rather than free.

      Three further properties are checked because each would fail differently: population conservation (the aggregate is still the closed stage population), monotonicity in P(UP) (the blend weights the stages by their stationary probability), and the same bracket under a THREE-stage environment, which exercises the E > 2 coupling rather than the two-stage special case.

      Throws:
      Exception - if the solver encounters an error
    • main

      public static void main(String[] args)
      Main method to run all random environment examples.
      Parameters:
      args - command line arguments (not used)