Package jline.api.cache
Class CacheSojourn
java.lang.Object
jline.api.cache.CacheSojourn
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classA phase-type clock:dphi/dt = phi A,phi(0) = phi0, densityphi c.static interfaceThe drift of the cache mean field.static final classOutput ofcache_sojourn_ode(jline.api.cache.CacheSojourn.Drift, double[], double[], jline.api.cache.CacheSojourn.Clock): the time gridtout(nt), the occupancy trajectoryxtraj(dim x nt) and the clock-weighted averagesj(null when no clock was given), as MATLAB[tout, xtraj, sj] = cache_sojourn_ode(...).static final classA sojourn average: occupancyxbar(null whenwtotis 0), clock mass, per-user miss rate. -
Method Summary
Modifier and TypeMethodDescriptionstatic CacheSojourn.Resultaverage(CacheSojourn.Drift f, double[] x0, double t1, CacheSojourn.Clock clk) Integrates the augmented system over [0, t1] fromx0and returns the clock-weighted average, with the MATLAB cache_miss_rmf tolerances (AbsTol 1e-10, RelTol 1e-8).static CacheSojourn.OdeResultcache_sojourn_ode(CacheSojourn.Drift f, double[] tspan, double[] x0, CacheSojourn.Clock clk) Java twin of MATLABcache_sojourn_ode(drift, tspan, x0, wgen, odeopt)with theode15sdefault tolerances (RelTol 1e-3, AbsTol 1e-6).static CacheSojourn.OdeResultcache_sojourn_ode(CacheSojourn.Drift f, double[] tspan, double[] x0, CacheSojourn.Clock clk, double relTol, double absTol) Integratesdx/dt = f(x)overtspanfromx0and, whenclkis 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.static CacheSojourn.ClockholdingClock(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 islamtimes real time:A = D0/lam,c = -D0 1/lam,phi0 = map_pie, so thatint_0^T g = F(T/lam)with F the holding-time CDF.static double[]Per-user miss rateMU(v) = sum_i lambda_v(i) pi0(i)of a per-item out-of-cache probabilitypi0, the same functional as the transientMU_t, which is affine in the occupancy.
-
Method Details
-
holdingClock
The holding-time clock of a random-environment stage whose holding time is the MAP {D0,D1}, in a drift time unit that islamtimes real time:A = D0/lam,c = -D0 1/lam,phi0 = map_pie, so thatint_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 MATLABcache_sojourn_ode(drift, tspan, x0, wgen, odeopt)with theode15sdefault tolerances (RelTol 1e-3, AbsTol 1e-6). Withclk == nullthe integration is the plain drift andsjis 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) Integratesdx/dt = f(x)overtspanfromx0and, whenclkis 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-elementtspan = [t0, t1]returns the integrator's own (adaptive) steps, as MATLABode15s; a longertspanreturns the solution at exactly those instants.relTol/absTolplay the role ofodeopt(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] fromx0and returns the clock-weighted average, with the MATLAB cache_miss_rmf tolerances (AbsTol 1e-10, RelTol 1e-8). Shorthand forcache_sojourn_ode(jline.api.cache.CacheSojourn.Drift, double[], double[], jline.api.cache.CacheSojourn.Clock). -
missRate
Per-user miss rateMU(v) = sum_i lambda_v(i) pi0(i)of a per-item out-of-cache probabilitypi0, the same functional as the transientMU_t, which is affine in the occupancy.
-