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.
14 function obj = ServiceRate(station,
jobclass, bounds, name)
15 if nargin < 4 || isempty(name)
16 name = [station.getName()
'_' jobclass.getName()
'_rate'];
18 obj@opt.DecisionVariable(name);
19 obj.station = station;
21 obj.minRate = bounds(1);
22 obj.maxRate = bounds(2);
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
29 function v = decode(obj, x)
30 v = obj.minRate + x(1) * (obj.maxRate - obj.minRate);
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));
45 function t = getVariableType(obj), t =
'service_rate'; end
47 function k = paramKey(obj)
48 k = opt.SensitivityData.paramKey(obj.station.getName(), obj.jobclass.getName());
50 function j = decodeJacobian(obj, ~)
51 j = obj.maxRate - obj.minRate;