LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
ServiceRate.m
1classdef ServiceRate < opt.DecisionVariable
2 % ServiceRate Optimize the exponential processing rate of a station for a
3 % job class. Continuous (differentiable): exposes paramKey/decodeJacobian
4 % for the analytic-gradient path. Mirrors native-Python ServiceRate.
5
6 properties
7 station
9 minRate
10 maxRate
11 end
12
13 methods
14 function obj = ServiceRate(station, jobclass, bounds, name)
15 if nargin < 4 || isempty(name)
16 name = [station.getName() '_' jobclass.getName() '_rate'];
17 end
18 obj@opt.DecisionVariable(name);
19 obj.station = station;
20 obj.jobclass = jobclass;
21 obj.minRate = bounds(1);
22 obj.maxRate = bounds(2);
23 end
24
25 function s = getStation(obj), s = obj.station; end
26 function c = getJobClass(obj), c = obj.jobclass; end
27 function b = getBounds(obj), b = opt.DecisionVariable.unitBounds(1); end
28
29 function v = decode(obj, x)
30 v = obj.minRate + x(1) * (obj.maxRate - obj.minRate);
31 end
32
33 function apply(obj, model, value)
34 cls = opt.DecisionVariable.resolveClass(model, obj.jobclass);
35 if isempty(cls), cls = obj.jobclass; end
36 nodes = model.getNodes();
37 for i = 1:numel(nodes)
38 if strcmp(nodes{i}.getName(), obj.station.getName())
39 nodes{i}.setService(cls, Exp(value));
40 return;
41 end
42 end
43 end
44
45 function t = getVariableType(obj), t = 'service_rate'; end
46
47 function k = paramKey(obj)
48 k = opt.SensitivityData.paramKey(obj.station.getName(), obj.jobclass.getName());
49 end
50 function j = decodeJacobian(obj, ~)
51 j = obj.maxRate - obj.minRate;
52 end
53 end
54end
Definition fjtag.m:157
Definition Station.m:245