LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
infer_lqn_setparams.m
1function model = infer_lqn_setparams(model, paramSpec, a)
2% INFER_LQN_SETPARAMS Apply a parameter vector to a LayeredNetwork.
3%
4% MODEL = INFER_LQN_SETPARAMS(MODEL, PARAMSPEC, A) sets the LQN parameters
5% named in PARAMSPEC to the values in the vector A, in place, and returns
6% the (same handle) MODEL. This is the parameter-injection half of the LQN
7% parameter identification method (see INFER_LQN).
8%
9% PARAMSPEC is a struct array; PARAMSPEC(i) has fields:
10% .type : 'hostdem' (activity mean host demand) or
11% 'think' (task mean think time)
12% .name : name of the activity ('hostdem') or task ('think')
13%
14% Mean values are injected as exponential distributions (SCV = 1), which is
15% the assumption of the CASCON 2005 tracking method. The cached layered
16% struct (MODEL.lsn) is invalidated so the next getStruct/solve re-reads the
17% mutated model objects.
18%
19% Copyright (c) 2012-2026, Imperial College London
20% All rights reserved.
21
22np = numel(paramSpec);
23if numel(a) ~= np
24 line_error(mfilename, 'Length of parameter vector does not match paramSpec.');
25end
26
27for i = 1:np
28 val = a(i);
29 switch lower(paramSpec(i).type)
30 case 'hostdem'
31 act = infer_lqn_findbyname(model.activities, paramSpec(i).name);
32 if isempty(act)
33 line_error(mfilename, sprintf('Activity ''%s'' not found.', paramSpec(i).name));
34 end
35 act.setHostDemand(val);
36 case 'think'
37 tsk = infer_lqn_findbyname(model.tasks, paramSpec(i).name);
38 if isempty(tsk)
39 line_error(mfilename, sprintf('Task ''%s'' not found.', paramSpec(i).name));
40 end
41 tsk.setThinkTime(val);
42 otherwise
43 line_error(mfilename, sprintf('Unknown parameter type ''%s''.', paramSpec(i).type));
44 end
45end
46
47% invalidate the cached layered struct so the next solve re-reads the objects
48model.lsn = [];
49end
Definition Station.m:245