LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
ThroughputConstraint.m
1classdef ThroughputConstraint < opt.Constraint
2 % ThroughputConstraint Throughput constraint: Tput >= minValue.
3 properties
4 station
5 jobclass = '';
6 minValue
7 end
8 methods
9 function obj = ThroughputConstraint(station, jobclass, minValue, name)
10 if nargin < 4, name = ''; end
11 obj@opt.Constraint(name);
12 obj.station = opt.Constraint.nameOf(station);
13 if nargin >= 2 && ~isempty(jobclass)
14 obj.jobclass = opt.Constraint.nameOf(jobclass);
15 end
16 obj.minValue = minValue;
17 end
18 function n = generateName(obj)
19 if ~isempty(obj.jobclass)
20 n = sprintf('Tput_%s_%s_ge_%g', obj.station, obj.jobclass, obj.minValue);
21 else
22 n = sprintf('Tput_%s_ge_%g', obj.station, obj.minValue);
23 end
24 end
25 function v = evaluate(obj, result, ~)
26 if ~isempty(obj.jobclass)
27 actual = result.getThroughput(obj.station, obj.jobclass);
28 else
29 actual = result.getThroughput(obj.station);
30 end
31 v = opt.Constraint.lowerBoundViolation(actual, obj.minValue);
32 end
33 end
34end