1classdef ResponseTimeConstraint < opt.Constraint
2 % ResponseTimeConstraint Per-station response time constraint:
RT <= maxValue.
9 function obj = ResponseTimeConstraint(station,
jobclass, maxValue, name)
10 if nargin < 4, name =
''; end
11 obj@opt.Constraint(name);
12 obj.station = opt.Constraint.nameOf(station);
14 obj.jobclass = opt.Constraint.nameOf(
jobclass);
16 obj.maxValue = maxValue;
18 function n = generateName(obj)
19 if ~isempty(obj.jobclass)
20 n = sprintf('RT_%s_%s_le_%g', obj.station, obj.
jobclass, obj.maxValue);
22 n = sprintf('RT_%s_le_%g', obj.station, obj.maxValue);
25 function v = evaluate(obj, result, ~)
27 actual = result.getResponseTime(obj.station, obj.
jobclass);
29 actual = result.getResponseTime(obj.station);
31 v = opt.Constraint.upperBoundViolation(actual, obj.maxValue);