ilusm.dev

sim

Simulation: discrete event, Monte Carlo, agent-based modeling.

Load with: use sim

Quick example

use sim

result = simev("value", "value", "value", 10)
prn(result)

Functions

Simulation clock

simne()

Creates a new instance.

Events

simev(tm, typ, data, fn)

Performs the operation. Takes tm, typ, data, fn.

simud()

Performs the operation.

Schedule event

smsch(s, ev)

Checks a condition. Takes s, ev.

simat(s, tm, typ, dat, fn)

Performs the operation. Takes s, tm, typ, dat, fn.

simnw(s, typ, dat, fn)

Performs the operation. Takes s, typ, dat, fn.

Process

smprc(fn)

Performs the operation. Takes fn.

Run simulation

simrn(s, until)

Performs the operation. Takes s, until.

smstp(s)

Performs the operation. Takes s.

State access

simgt(s, k)

Performs the operation. Takes s, k.

simst(s, k, v)

Sets a value or starts a process. Takes s, k, v.

Statistics collection

simrc(s, nm, v)

Performs the operation. Takes s, nm, v.

smstt(s, nm)

Performs the operation. Takes s, nm.

Monte Carlo

simmc(model, iters)

Performs the operation. Takes model, iters.

Random variates

simxp(lam)

Performs the operation. Takes lam.

smnrm(mu, sig)

Removes an item. Takes mu, sig.

simnf(a, b)

Performs the operation. Takes a, b.

smgmm(shp, scl)

Performs the operation. Takes shp, scl.

simps(lam)

Performs the operation. Takes lam.

smbnm(n, p)

Performs the operation. Takes n, p.

smbta(a, b)

Performs the operation. Takes a, b.

simwb(lam, k)

Performs the operation. Takes lam, k.

Correlated randoms

smcpl(n, corr)

Performs the operation. Takes n, corr.

Queueing models

smmm1(lam, mu, until)

Performs the operation. Takes lam, mu, until.

Markov chains

smmcn(p)

Performs the operation. Takes p.

smmcs(m)

Performs the operation. Takes m.

smmcr(m, n)

Creates a new instance. Takes m, n.

Markov decision process

smmdp(sts, acts, r, tr, gamma)

Performs the operation. Takes sts, acts, r, tr, gamma.

smvlt(mdp, eps)

Performs the operation. Takes mdp, eps.

smplm(mdp)

Returns limits or constraints. Takes mdp.

Agent-based model

smbmn()

Performs the operation.

smbmd(m, agt)

Performs the operation. Takes m, agt.

smbms(m, dt)

Performs the operation. Takes m, dt.

smbmr(m, steps, dt)

Performs the operation. Takes m, steps, dt.

System dynamics

simsd(stocks, flows)

Performs the operation. Takes stocks, flows.

Petri nets

simpn(places, trans, tokens)

Performs the operation. Takes places, trans, tokens.

smpnf(pn, tr)

Performs the operation. Takes pn, tr.

Brownian motion

simbm(st, mu, sig, dt, n)

Performs the operation. Takes st, mu, sig, dt, n.

Geometric Brownian motion

smgbm(st, mu, sig, dt, n)

Performs the operation. Takes st, mu, sig, dt, n.

Bootstrapping

simbt(data, n, fn)

Performs the operation. Takes data, n, fn.

Sensitivity analysis

smsns(model, params, rngs)

Performs the operation. Takes model, params, rngs.

Optimization via simulation

simpt(model, bounds, iters)

Performs the operation. Takes model, bounds, iters.

Notes

  • Simulation framework - discrete-event, agent-based.