lang.layered
- LayeredNetworkStruct()
Data structure representation for a LayeredNetwork object
Copyright (c) 2012-2026, Imperial College London All rights reserved.
- class Activity
Bases:
LayeredNetworkElementA stage of service in a Task of a LayeredNetwork.
Copyright (c) 2012-2026, Imperial College London All rights reserved.
- Constructor Summary
- Activity(model, name, hostDemand, boundToEntry, callOrder)
OBJ = ACTIVITY(MODEL, NAME, HOSTDEMAND, BOUNDTOENTRY, CALLORDER)
- Property Summary
- asyncCallDests
string array
- asyncCallMeans
integer array
- boundToEntry
string
- callOrder
string, one of ‘STOCHASTIC’ or ‘DETERMINISTIC’
- hostDemand
- hostDemandMean
double
- hostDemandSCV
double
- parent
- parentName
string
- phase
phase number (1 or 2)
- Type:
integer
- scheduling
- syncCallDests
string array
- syncCallGroups
cell of struct(‘strategy’,RoutingStrategy,’dests’,{names})
- syncCallMeans
integer array
- thinkTime
Distribution object
- thinkTimeMean
double
- thinkTimeSCV
double
- Method Summary
- addCallGroup(strategy, synchCallDests, synchCallMean, caller)
OBJ = ADDCALLGROUP(OBJ, STRATEGY, SYNCHCALLDESTS, SYNCHCALLMEAN, CALLER)
Records a routed call group and its per-target call means.
- asynchCall(asynchCallDest, asynchCallMean)
OBJ = ASYNCHCALL(OBJ, ASYNCHCALLDEST, ASYNCHCALLMEAN)
- boundTo(entry)
OBJ = BOUNDTO(OBJ, ENTRY)
- getAsyncCallDests()
GETASYNCCALLDESTS Get the asynchronous call destinations
- getAsyncCallMeans()
GETASYNCCALLMEANS Get the asynchronous call means
- getBoundToEntry()
GETBOUNDTOENTRY Get the entry this activity is bound to
- getCallOrder()
GETCALLORDER Get the call order (STOCHASTIC or DETERMINISTIC)
- getHostDemand()
GETHOSTDEMAND Get the host demand distribution
- getHostDemandMean()
GETHOSTDEMANDMEAN Get the mean host demand
- getHostDemandSCV()
GETHOSTDEMANDSCV Get the SCV of host demand
- getParent()
GETPARENT Get the parent task
- getPhase()
GETPHASE Get the phase number (1 or 2)
- getSyncCallDests()
GETSYNCCALLDESTS Get the synchronous call destinations
- getSyncCallMeans()
GETSYNCCALLMEANS Get the synchronous call means
- getThinkTimeMean()
GETTHINKTIMEMEAN Get the mean think time
- on(parent)
OBJ = ON(OBJ, PARENT)
- recordCallGroup(strategy, destNames)
OBJ = RECORDCALLGROUP(OBJ, STRATEGY, DESTNAMES)
Records the grouping of synchronous calls this activity ALREADY declares. ADDCALLGROUP issues the member calls and then records them; the .lqnx reader has read them back as ordinary synch-call elements, so it records the grouping alone and must not issue them a second time.
- repliesTo(entry)
OBJ = REPLIESTO(OBJ, ENTRY)
- setCallOrder(callOrder)
OBJ = SETCALLORDER(OBJ, CALLORDER)
- setHostDemand(hostDemand)
OBJ = SETHOSTDEMAND(OBJ, HOSTDEMAND)
- setParent(parent)
OBJ = SETPARENT(OBJ, PARENT)
- setPhase(phaseNum)
OBJ = SETPHASE(OBJ, PHASENUM) Set the phase number for this activity. Phase 1: activities before the reply is sent Phase 2, 3: activities after the reply is sent (post-reply processing). The range is 1..3 because lqn-core.xsd bounds the phase attribute there; every consumer of lsn.actphase tests phase > 1, so 3 is served exactly as 2 is.
- setThinkTime(thinkTime)
OBJ = SETTHINKTIME(OBJ, THINKTIME)
- synchCall(synchCallDest, synchCallMean)
OBJ = SYNCHCALL(OBJ, SYNCHCALLDEST, SYNCHCALLMEAN)
- synchCallJSQ(synchCallDests, synchCallMean)
OBJ = SYNCHCALLJSQ(OBJ, SYNCHCALLDESTS, SYNCHCALLMEAN)
Dispatch synchronous calls to the least loaded of a set of target entries. Same contract as SYNCHCALLROUNDROBIN, with the cyclic pointer replaced by join-the-shortest-queue: each call goes to the target task whose station holds the fewest jobs at dispatch time, ties split uniformly.
Only the squashed (‘flat’) layering can represent this, and only a layer solver with state-dependent routing honours it; see SolverLN.assertCallGroups.
- synchCallRoundRobin(synchCallDests, synchCallMean)
OBJ = SYNCHCALLROUNDROBIN(OBJ, SYNCHCALLDESTS, SYNCHCALLMEAN)
Dispatch synchronous calls round-robin over a set of target entries. SYNCHCALLMEAN is the total mean number of calls per invocation; successive calls go to the targets in cyclic order, so each target receives SYNCHCALLMEAN/numel(SYNCHCALLDESTS) of them. The probabilistic model with the same per-target means is the ungrouped equivalent: the group adds the deterministic interleaving, not a different call rate.
Only the squashed (‘flat’) layering can represent this, because under ‘srvn’ the targets never share a submodel.
- lqn_dep_layer_handle(f, cols, R, model)
H = LQN_DEP_LAYER_HANDLE(F, COLS, R, MODEL)
Lift a service-rate dependence handle declared on a LayeredNetwork server to the layer station that represents it. F maps the per-operand population vector of that server (task j of a Host, entry j of a Task) to a scalar scaling shared by every operand or to a per-operand vector. COLS{j} lists the layer classes through which operand j occupies the station and R is the number of classes in the layer.
Solvers evaluate the handle in two different index spaces: CTMC and the exact recursions pass a per-class vector, while the AMVA and NC chain recursions pass a per-chain vector (solver_amvald works on Nchain throughout). The returned handle therefore reads NUMEL(N) to pick the space, aggregates the operand populations in it, and answers a vector of the SAME length, since the caller indexes the answer with the same index it passed in. An index that belongs to no operand keeps the neutral scaling 1.
Copyright (c) 2012-2026, Imperial College London All rights reserved.
- class SetupTask
Bases:
TaskSetupTask is a Task whose servers are switched off while idle.
A server resuming from the off state pays a setup (activation) time before serving the request that woke it up, and stays available for a delay-off (idle) period after emptying its queue before switching off. These are the setup and close-down times of a server with vacations: on-demand virtual machines and containers, power-managed servers under a timeout policy, warm-up delays, serverless cold start / keep-alive.
Both times are declared on the base Task class via setSetupTime() and setDelayOffTime(), so this subclass is a naming convenience.
Copyright (c) 2012-2026, Imperial College London All rights reserved.
- Constructor Summary
- SetupTask(model, name, multiplicity, scheduling)
self = SetupTask(model, name, multiplicity, scheduling) Create a Task that pays setup and delay-off times.
- Property Summary
- DelayOffTime
- DelayOffTimeMean
- DelayOffTimeSCV
- SetupTime
Backward-compatible property names (mapped to parent’s camelCase properties)
- SetupTimeMean
- SetupTimeSCV
- class LayeredNetworkElement
Bases:
ElementA generic element of a LayeredNetwork model.
Copyright (c) 2012-2026, Imperial College London All rights reserved.
- Constructor Summary
- LayeredNetworkElement(name)
SELF = LAYEREDNETWORKELEMENT(NAME)
- Property Summary
- lcdScaling
product-form class-dependent scaling, n counted over this server’s operands
- Type:
handle beta(n)
- lcdScalingPeak
peak rate scaling per operand, normalizes Util = T*S/peak
- linConA
admission constraint matrix on this server’s layer station
- Type:
Matrix(C,K)
- linConB
admission constraint capacities
- Type:
Matrix(C,1)
- linConRows
rows declared by operand name
- Type:
cell of struct(‘names’,cell,’coeffs’,vector,’cap’,scalar)
- ljdScaling
non-product-form joint-dependent scaling, n counted over this server’s operands
- Type:
handle eta(n)
- ljdScalingPeak
peak rate scaling per operand, normalizes Util = T*S/peak
- lldScaling
rate scaling of this server’s layer station when it holds n jobs
- Type:
vector alpha(n)
- model
pointer to model
- serverPools
heterogeneous pools with a compatibility graph over this server’s operands
- Type:
cell of struct(‘name’,’count’,’rate’,’compatible’)
- Method Summary
- addConstraint(operands, coeffs, cap)
self = ADDCONSTRAINT(self, OPERANDS, COEFFS, CAP)
Appends one admission constraint row naming its operands, so the meaning does not depend on declaration order:
T2.addConstraint([E2 E3], [1 1], 2); % n(E2) + n(E3) <= 2 T2.addConstraint(E3, 1, 1); % n(E3) <= 1
OPERANDS are the entries of a Task, or the tasks of a Host, given as handles, names, or a cell mixing the two. COEFFS is a matching vector, or a scalar applied to every operand, and defaults to all ones. Names are resolved against the model in LayeredNetwork.getStruct, where an operand that does not belong to this server is an error rather than a silent mis-mapping.
- addServerType(serverType)
self = ADDSERVERTYPE(self, SERVERTYPE)
Declares one pool of SERVERTYPE.numOfServers identical servers, each running at SERVERTYPE.rate, eligible only for the operands listed in SERVERTYPE.compatibleClasses:
P1.addServerType(ServerType(‘Fast’, 2, [T2])); P1.addServerType(ServerType(‘Shared’, 1, [T2 T3]));
The operands are the tasks of a Host, or the entries of a Task, given as handles or names. They are resolved against the model in LayeredNetwork.getStruct, where an operand that does not belong to this server is an error rather than a silent mis-mapping, exactly as for ADDCONSTRAINT.
SolverLN lowers the whole declaration to the activated-server rate of SN_COMPAT_RATE, carried onto the layer station as a joint dependence, so the pools are an APPROXIMATION in a layer for the same reason SETJOINTDEPENDENCE is.
- getLinearConstraints()
[A, B] = GETLINEARCONSTRAINTS(self)
- getRateDependence()
[ALPHA, BETA, BETAPEAK, ETA, ETAPEAK] = GETRATEDEPENDENCE(self)
- getServerTypes()
POOLS = GETSERVERTYPES(self) Declared compatibility pools.
- hasLinearConstraints()
TF = HASLINEARCONSTRAINTS(self)
- hasRateDependence()
TF = HASRATEDEPENDENCE(self)
- hasServerPools()
TF = HASSERVERPOOLS(self)
- setClassDependence(beta, peakRatePerOperand)
self = SETCLASSDEPENDENCE(self, BETA, PEAKRATEPEROPERAND)
BETA(n) is a function handle taking the per-operand population vector of this server: n(j) counts the jobs held on behalf of operand j, which is task j of a Host or entry j of a Task, in the same tasksof/entriesof order as the columns of SETCONSTRAINT. It returns a scalar shared by every operand, or a per-operand vector. PEAKRATEPEROPERAND is REQUIRED (scalar or per-operand vector) and normalizes Util = T*S/peak. Product form holds only where an operand occupies the layer station through a single job class; otherwise SolverLN emits the equivalent joint dependence, which is numerically identical but carries no exactness guarantee.
- setConstraint(A, b)
self = SETCONSTRAINT(self, A, B)
Raw form of ADDCONSTRAINT, for programmatic construction. Declares A*n <= B on the station that represents this server in its layer, where n counts the jobs in service or queueing at that station. Columns of A are indexed positionally by the entries of a Task, or by the tasks of a Host, in declaration order, so the mapping shifts if an entry is added later; prefer ADDCONSTRAINT, which names its operands. Only the column count is checked, in LayeredNetwork.getStruct, since entries may be added after this call. Rows from both forms are concatenated.
- setJointDependence(eta, peakRatePerOperand)
self = SETJOINTDEPENDENCE(self, ETA, PEAKRATEPEROPERAND)
ETA(n) reads the per-operand population vector of this server arbitrarily (e.g. min(n(1),c)) and is therefore non-product-form: solvers treat it as an approximation. Operand order and the required PEAKRATEPEROPERAND are as in SETCLASSDEPENDENCE.
- setLoadDependence(alpha)
self = SETLOADDEPENDENCE(self, ALPHA)
ALPHA(n) is the service-rate scaling of the station that represents this server in its layer when that station holds n jobs in total, as in Queue.setLoadDependence. The scaling multiplies the station rate on top of its multiplicity, so a multi-server host applies min(n,m)*ALPHA(n).
- subsindex()
IND = SUBSINDEX()
- class FunctionTask
Bases:
SetupTaskFunctionTask is the former name of SetupTask, kept for backward compatibility.
Setup and delay-off times are not specific to serverless (function-as-a-service) platforms, so the class carrying them is now named after the modelling primitive rather than after that application domain. Use SetupTask, or a plain Task with setSetupTime() and setDelayOffTime().
Copyright (c) 2012-2026, Imperial College London All rights reserved.
- Constructor Summary
- FunctionTask(model, name, multiplicity, scheduling)
self = FunctionTask(model, name, multiplicity, scheduling) Deprecated alias of SetupTask.
- class CacheTask
Bases:
TaskA software server in a LayeredNetwork.
Supports multi-level cache hierarchies with configurable capacities per level (e.g., L1, L2, L3 caches).
Copyright (c) 2012-2026, Imperial College London All rights reserved.
- Constructor Summary
- CacheTask(model, name, nitems, itemLevelCap, replStrat, multiplicity, scheduling)
self = CacheTask(model, name, nitems, itemLevelCap, replStrat, multiplicity, scheduling)
- itemLevelCap can be:
Scalar: Single-level cache with given capacity
Vector: Multi-level cache with capacity per level
- Property Summary
- itemLevelCap
Scalar or array for multi-level cache capacities
- items
- replacestrategy
- retrieval
delayed-hit retrieval on the miss path
- Method Summary
- getItemLevelCap(level)
CAP = GETITEMLEVELCAP(SELF, LEVEL)
Get capacity for a specific cache level or all levels.
- Parameters:
level – (optional) Cache level index (1-based)
- Returns:
cap – Capacity value(s) - scalar if level specified, array otherwise
- getNumberOfLevels()
N = GETNUMBEROFLEVELS(SELF)
Get the number of cache levels.
- Returns:
n – Number of levels (1 for single-level, >1 for multi-level)
- getTotalCapacity()
TOTAL = GETTOTALCAPACITY(SELF)
Get the sum of capacities across all cache levels.
- Returns:
total – Sum of all level capacities
- hasRetrieval()
- setItemLevelCap(caps)
SETITEMLEVELCAP(SELF, CAPS)
Set cache level capacities.
- Parameters:
caps – Scalar for single-level or vector for multi-level
- setRetrieval(retrieval)
SETRETRIEVAL(SELF, RETRIEVAL)
Enable a retrieval system with delayed-hit coalescing on the cache miss path. When set, concurrent misses for the same item arriving while a fetch (the miss-branch activity and its backend calls) is in flight are parked and released together as delayed hits when the fetch completes, instead of each triggering an independent fetch.
- class Task
Bases:
LayeredNetworkElementA software server in a LayeredNetwork.
Copyright (c) 2012-2026, Imperial College London All rights reserved.
- Constructor Summary
- Task(model, name, multiplicity, scheduling, thinkTime)
self = TASK(MODEL, NAME, MULTIPLICITY, SCHEDULING, THINKTIME)
- Property Summary
- activities
- delayOffTime
- delayOffTimeMean
double
- delayOffTimeSCV
double
- entries
- fanInSource
string, source task for fan-in
- fanInValue
int, fan-in value (load distribution count)
- fanOutDest
cell of strings, destination tasks for fan-out
- fanOutValue
vector of ints, fan-out values
- multiplicity
int
- parent
- precedences
- priority
int, priority level (0 = default/no priority)
- replication
int
- replyEntry
- scheduling
string
- setupTime
- setupTimeMean
double
- setupTimeSCV
double
- thinkTime
- thinkTimeMean
double
- thinkTimeSCV
double
- Method Summary
- addActivity(newAct)
self = ADDACTIVITY(self, NEWACT)
- addEntry(newEntry)
self = ADDENTRY(self, NEWENTRY)
- addPrecedence(newPrec)
self = ADDPRECEDENCE(self, NEWPREC)
- getDelayOffTimeMean()
GETDELAYOFFTIMEMEAN Get the mean delay-off time
- getMeanHostDemand(entryName)
MEANHOSTDEMAND = GETMEANHOSTDEMAND(self, ENTRYNAME)
- getMultiplicity()
GETMULTIPLICITY Get the multiplicity (number of task instances)
- getParent()
GETPARENT Get the parent host/processor
- getPrecedences()
GETPRECEDENCES Get the list of activity precedences
- getReplication()
GETREPLICATION Get the replication factor
- getScheduling()
GETSCHEDULING Get the scheduling strategy
- getSetupTimeMean()
GETSETUPTIMEMEAN Get the mean setup time
- getThinkTimeMean()
GETTHINKTIMEMEAN Get the mean think time
- getThinkTimeSCV()
GETTHINKTIMESCV Get the SCV of think time
- hasSetupDelayoff()
result = HASSETUPDELAYOFF(self) Check if this task has setup/delayoff configured (i.e., non-trivial values).
- on(parent)
self = ON(self, PARENT)
- removeActivity(index)
self = REMOVEACTIVITY(self, INDEX)
- setActivity(newAct, index)
self = SETACTIVITY(self, NEWACT, INDEX)
- setAsReferenceTask()
self = SETASREFERENCETASK(self)
- setDelayOffTime(delayOffTime)
self = SETDELAYOFFTIME(self, DELAYOFFTIME) Set the delay-off time (teardown time) for the task.
- setFanIn(source, value)
self = SETFANIN(self, SOURCE, VALUE)
- setFanOut(dest, value)
self = SETFANOUT(self, DEST, VALUE)
- setPriority(priority)
self = SETPRIORITY(self, PRIORITY)
- setReplication(replication)
- setReplyEntry(newReplyEntry)
self = SETREPLYENTRY(self, NEWREPLYENTRY)
- setSetupTime(setupTime)
self = SETSETUPTIME(self, SETUPTIME) Set the setup time (cold start time) for the task.
- setThinkTime(thinkTime)
self = SETTHINKTIME(self, THINKTIME)
- class Processor
Bases:
HostA hardware server in a LayeredNetwork.
Copyright (c) 2012-2026, Imperial College London All rights reserved.
- Constructor Summary
- Processor(model, name, multiplicity, scheduling, quantum, speedFactor)
OBJ = PROCESSOR(MODEL, NAME, MULTIPLICITY, SCHEDULING, QUANTUM, SPEEDFACTOR)
- class Host
Bases:
LayeredNetworkElementA hardware server in a LayeredNetwork.
Copyright (c) 2012-2026, Imperial College London All rights reserved.
- Constructor Summary
- Host(model, name, multiplicity, scheduling, quantum, speedFactor)
self = HOST(MODEL, NAME, MULTIPLICITY, SCHEDULING, QUANTUM, SPEEDFACTOR)
- Property Summary
- ID
int
- multiplicity
int
- quantum
double
- replication
int
- scheduling
ps, fcfs, inf, ref
- Type:
char
- speedFactor
double
- tasks
list of tasks
- Method Summary
- addTask(newTask)
self = ADDTASK(self, NEWTASK)
- getMultiplicity()
GETMULTIPLICITY Get the multiplicity (number of processor instances)
- getQuantum()
GETQUANTUM Get the time quantum for scheduling
- getReplication()
GETREPLICATION Get the replication factor
- getScheduling()
GETSCHEDULING Get the scheduling strategy
- getSpeedFactor()
GETSPEEDFACTOR Get the speed factor
- setReplication(replication)
- class Entry
Bases:
LayeredNetworkElementAn entry point of service for a Task.
Copyright (c) 2012-2026, Imperial College London All rights reserved.
- Constructor Summary
- Entry(model, name)
SELF = ENTRY(MODEL, NAME)
- Property Summary
- arrival
Open arrival distribution
- forwardingDests
- forwardingProbs
- parent
- replyActivity
- scheduling
- type
PH1PH2, can be NONE, etc.)
- Type:
string, entry type (default
- Method Summary
- forward(dest, prob)
SELF = FORWARD(SELF, DEST, PROB)
Add a forwarding call to another entry with a specified probability. Forwarding allows this entry to redirect the reply to another entry instead of replying directly to the original caller.
- Parameters:
dest - Destination entry object or entry name (string)
prob - Probability of forwarding (0.0 to 1.0)
- Returns:
self - This entry for method chaining
- getArrival()
GETARRIVAL Get the arrival distribution
- getForwardingDests()
GETFORWARDINGDESTS Get the forwarding destinations
- getForwardingProbs()
GETFORWARDINGPROBS Get the forwarding probabilities
- getParent()
GETPARENT Get the parent task
- getReplyActivity()
GETREPLYACTIVITY Get the reply activities for this entry
- on(parent)
SELF = ON(SELF, PARENT)
- setArrival(arvDist)
SETARRIVAL Sets the open arrival distribution for this entry
- Parameters:
arvDist - Arrival distribution (e.g., Exp, Erlang, HyperExp)
Examples
entry.setArrival(Exp(2.5)); % Exponential with rate 2.5 entry.setArrival(Erlang(2, 0.4)); % Erlang-2 with rate 0.4
- setType(type)
SELF = SETTYPE(self, TYPE) Set the entry type attribute (e.g., PH1PH2, NONE)
- class ActivityPrecedence
An auxiliary class to specify precedence among Activity elements.
Copyright (c) 2012-2026, Imperial College London All rights reserved.
- Constructor Summary
- ActivityPrecedence(preActs, postActs, preType, postType, preParams, postParams)
OBJ = ACTIVITYPRECEDENCE(PREACTS, POSTACTS, PRETYPE, POSTTYPE, PREPARAMS, POSTPARAMS)
- Property Summary
- postActs
string array
- postParams
double array
- postType
string
- preActs
string array
- preParams
double array
- preType
string
- Method Summary
- static AndFork(preAct, postActs)
AP = ANDFORK(PREACT, POSTACTS)
- static AndJoin(preActs, postAct, quorum)
AP = ANDJOIN(PREACTS, POSTACT, QUORUM)
- static CacheAccess(preAct, postActs)
AP = ORFORK(PREACT, POSTACTS, PROBS)
- static Loop(varargin)
- static Loop3para(preAct, postActs, counts)
AP = LOOP(PREACT, POSTACTS, COUNTS) Example: ActivityPrecedence.Loop(A20, {A21, A22}, 3) runs A20 once, then 3 times A21, then ends running A22 once.
- static Loop4para(preAct, loopAct, endAct, loopCounts)
- static OrFork(preAct, postActs, probs)
AP = ORFORK(PREACT, POSTACTS, PROBS)
OrFork is the terminology used in LQNs for a probabilistic or, where a call chooses a branch with given probability
- static OrJoin(preActs, postAct)
AP = ORJOIN(PREACTS, POSTACT)
- static Serial(varargin)
AP = SERIAL(VARARGIN)
- static Xor(preAct, postActs, probs)
AP = XOR(PREACT, POSTACTS, PROBS)
This is a pseudonym for OrFork