Class CacheSojourn

java.lang.Object
jline.api.cache.CacheSojourn

public final class CacheSojourn extends Object
The average of a cache mean-field trajectory against a phase-type clock, integrated WITH the drift. Java twin of MATLAB cache_sojourn_ode.m.

For a drift dx/dt = f(x) and a clock with row phase vector phi, dphi/dt = phi A, density g(t) = phi(t) c, it returns xbar = int_0^T x g dt / int_0^T g dt and wtot = int_0^T g dt, by augmenting the state with phi, int g x and int g. The value is accurate to the ODE tolerance and does NOT depend on any output grid: a Riemann sum over the grid did, and that is what made the adaptive (MATLAB) and fixed-grid (JAR/Python/C++) ENV cache mean fields differ in the third digit.

  • Method Details

    • holdingClock

      public static CacheSojourn.Clock holdingClock(Matrix D0in, Matrix D1in, double lam)
      The holding-time clock of a random-environment stage whose holding time is the MAP {D0,D1}, in a drift time unit that is lam times real time: A = D0/lam, c = -D0 1/lam, phi0 = map_pie, so that int_0^T g = F(T/lam) with F the holding-time CDF.
    • cache_sojourn_ode

      public static CacheSojourn.OdeResult cache_sojourn_ode(CacheSojourn.Drift f, double[] tspan, double[] x0, CacheSojourn.Clock clk)
      Java twin of MATLAB cache_sojourn_ode(drift, tspan, x0, wgen, odeopt) with the ode15s default tolerances (RelTol 1e-3, AbsTol 1e-6). With clk == null the integration is the plain drift and sj is null.
    • cache_sojourn_ode

      public static CacheSojourn.OdeResult cache_sojourn_ode(CacheSojourn.Drift f, double[] tspan, double[] x0, CacheSojourn.Clock clk, double relTol, double absTol)
      Integrates dx/dt = f(x) over tspan from x0 and, when clk is given, the clock-weighted average of the trajectory carried as extra state (phi, int g x, int g), so that it is accurate to the ODE tolerance and independent of the output grid. A two-element tspan = [t0, t1] returns the integrator's own (adaptive) steps, as MATLAB ode15s; a longer tspan returns the solution at exactly those instants. relTol/absTol play the role of odeopt (RelTol/AbsTol).
    • average

      public static CacheSojourn.Result average(CacheSojourn.Drift f, double[] x0, double t1, CacheSojourn.Clock clk)
      Integrates the augmented system over [0, t1] from x0 and returns the clock-weighted average, with the MATLAB cache_miss_rmf tolerances (AbsTol 1e-10, RelTol 1e-8). Shorthand for cache_sojourn_ode(jline.api.cache.CacheSojourn.Drift, double[], double[], jline.api.cache.CacheSojourn.Clock).
    • missRate

      public static double[] missRate(Matrix[] lambdaCache, double[] pi0)
      Per-user miss rate MU(v) = sum_i lambda_v(i) pi0(i) of a per-item out-of-cache probability pi0, the same functional as the transient MU_t, which is affine in the occupancy.