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.procid = coder.typeof(0,[Inf Inf],[1 1]);
55S_sn.phases = coder.typeof(0,[Inf Inf],[1 1]);
56S_sn.phasessz = coder.typeof(0,[Inf Inf],[1 1]);
57S_sn.phaseshift = coder.typeof(0,[Inf Inf],[1 1]);
58S_sn.nvars = coder.typeof(0,[Inf Inf],[1 1]);
59S_sn.rt = coder.typeof(0,[Inf Inf],[1 1]);
60S_sn.rtnodes = coder.typeof(0,[Inf Inf],[1 1]);
61S_sn.state = coder.typeof({coder.typeof(0,[Inf Inf],[1 1])}, [Inf 1], [1 0]);
62S_sn.space = coder.typeof({coder.typeof(0,[Inf Inf],[1 1])}, [Inf 1], [1 0]);
63
64sn_type = coder.typeof(S_sn);
65
66%% Codegen commands
67
68% Extraction and Parameter getters
69codegen -config cfg sn_get_product_form_params -args {sn_type}
70codegen -config cfg sn_get_demands_chain -args {sn_type}
71
72% Property checkers
73codegen -config cfg sn_has_product_form -args {sn_type}
74codegen -config cfg sn_has_load_dependence -args {sn_type}
75codegen -config cfg sn_has_multi_class_heter_fcfs -args {sn_type}
76codegen -config cfg sn_has_priorities -args {sn_type}
77codegen -config cfg sn_has_fork_join -args {sn_type}
78codegen -config cfg sn_has_sd_routing -args {sn_type}
79codegen -config cfg sn_is_population_model -args {sn_type}