LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
mexify.m
1%{
2%{
3 % @brief MATLAB Coder script to generate MEX functions for sn_ module.
4 %
5 % This script generates MEX (MATLAB Executable) versions of sn_ functions
6 % for improved performance. It configures the code generation settings
7 % and specifies the expected input types (primarily the sn structure).
8 %
9 % See also CODER, CODER.CONFIG, CODER.TYPEOF, CODEGEN.
10%}
11%}
12
13%% Create configuration object of class 'coder.CodeConfig'.
14cfg = coder.config('mex','ecoder',false);
15cfg.GenerateReport = false;
16cfg.ReportPotentialDifferences = false;
17cfg.GenCodeOnly = false;
18
19%% Define common types
20L_type = coder.typeof(0,[Inf Inf],[1 1]);
21N_type = coder.typeof(0,[1 Inf],[0 1]);
22vec_type = coder.typeof(0,[1 Inf],[0 1]);
23col_vec_type = coder.typeof(0,[Inf 1],[1 0]);
24mat_type = coder.typeof(0,[Inf Inf],[1 1]);
25
26%% Define sn structure type
27% We define a comprehensive sn structure to cover most use cases.
28% Fields must match the dynamic structure used in LINE.
29S_sn = struct();
30S_sn.nstations = 0;
31S_sn.nclasses = 0;
32S_sn.nchains = 0;
33S_sn.njobs = coder.typeof(0,[1 Inf],[0 1]);
34S_sn.nnodes = 0;
35S_sn.nstateful = 0;
36S_sn.nservers = coder.typeof(0,[Inf 1],[1 0]);
37S_sn.rates = coder.typeof(0,[Inf Inf],[1 1]);
38S_sn.scv = coder.typeof(0,[Inf Inf],[1 1]);
39S_sn.sched = coder.typeof(0,[Inf 1],[1 0]);
40S_sn.nodetype = coder.typeof(0,[Inf 1],[1 0]);
41S_sn.refstat = coder.typeof(0,[Inf 1],[1 0]);
42S_sn.chains = coder.typeof(0,[Inf Inf],[1 1]);
43S_sn.visits = coder.typeof({coder.typeof(0,[Inf Inf],[1 1])}, [Inf 1], [1 0]);
44S_sn.nodevisits = coder.typeof({coder.typeof(0,[Inf Inf],[1 1])}, [Inf 1], [1 0]);
45S_sn.inchain = coder.typeof({coder.typeof(0,[1 Inf],[0 1])}, [Inf 1], [1 0]);
46S_sn.nodeToStation = coder.typeof(0,[1 Inf],[0 1]);
47S_sn.nodeToStateful = coder.typeof(0,[1 Inf],[0 1]);
48S_sn.stationToStateful = coder.typeof(0,[1 Inf],[0 1]);
49S_sn.stationToNode = coder.typeof(0,[1 Inf],[0 1]);
50S_sn.statefulToNode = coder.typeof(0,[1 Inf],[0 1]);
51S_sn.refclass = coder.typeof(0,[1 Inf],[0 1]);
52
53% Additional fields often used
54S_sn.classprio = coder.typeof(0,[1 Inf],[0 1]);
55S_sn.lldscaling = coder.typeof(0,[Inf Inf],[1 1]);
56S_sn.fj = coder.typeof(0,[Inf Inf],[1 1]);
57S_sn.routing = coder.typeof(0,[Inf Inf],[1 1]);
58S_sn.procid = coder.typeof(0,[Inf Inf],[1 1]);
59S_sn.phases = coder.typeof(0,[Inf Inf],[1 1]);
60S_sn.phasessz = coder.typeof(0,[Inf Inf],[1 1]);
61S_sn.phaseshift = coder.typeof(0,[Inf Inf],[1 1]);
62S_sn.nvars = coder.typeof(0,[Inf Inf],[1 1]);
63S_sn.rt = coder.typeof(0,[Inf Inf],[1 1]);
64S_sn.rtnodes = coder.typeof(0,[Inf Inf],[1 1]);
65S_sn.state = coder.typeof({coder.typeof(0,[Inf Inf],[1 1])}, [Inf 1], [1 0]);
66S_sn.space = coder.typeof({coder.typeof(0,[Inf Inf],[1 1])}, [Inf 1], [1 0]);
67
68sn_type = coder.typeof(S_sn);
69
70%% Codegen commands
71
72% Extraction and Parameter getters
73codegen -config cfg sn_get_product_form_params -args {sn_type}
74codegen -config cfg sn_get_demands_chain -args {sn_type}
75
76% Property checkers
77codegen -config cfg sn_has_product_form -args {sn_type}
78codegen -config cfg sn_has_load_dependence -args {sn_type}
79codegen -config cfg sn_has_multi_class_heter_fcfs -args {sn_type}
80codegen -config cfg sn_has_priorities -args {sn_type}
81codegen -config cfg sn_has_fork_join -args {sn_type}
82codegen -config cfg sn_has_sd_routing -args {sn_type}
83codegen -config cfg sn_is_population_model -args {sn_type}
84
85%% ===== Additional boolean checkers (no SchedStrategy dependency) =====
86
87% Model type checkers
88codegen -config cfg sn_is_closed_model -args {sn_type}
89codegen -config cfg sn_is_open_model -args {sn_type}
90codegen -config cfg sn_is_mixed_model -args {sn_type}
91
92% Class checkers
93codegen -config cfg sn_has_closed_classes -args {sn_type}
94codegen -config cfg sn_has_open_classes -args {sn_type}
95codegen -config cfg sn_has_mixed_classes -args {sn_type}
96codegen -config cfg sn_has_single_class -args {sn_type}
97codegen -config cfg sn_has_multi_class -args {sn_type}
98codegen -config cfg sn_has_multiple_closed_classes -args {sn_type}
99codegen -config cfg sn_has_fractional_populations -args {sn_type}
100
101% Chain checkers
102codegen -config cfg sn_has_single_chain -args {sn_type}
103codegen -config cfg sn_has_multi_chain -args {sn_type}
104
105% Topology checkers
106codegen -config cfg sn_has_class_switching -args {sn_type}
107codegen -config cfg sn_has_multi_server -args {sn_type}