LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
opt_robust_sizing.m
1% opt_robust_sizing Worst-case server sizing across an average-load and a
2% peak-load workload scenario (constraints enforced on all scenarios). Average
3% load needs 6 servers; the peak scenario pushes it to 9. Mirrors
4% opt_robust_sizing.py.
5
6base = buildMMc(3.0); % average load
7peak = buildMMc(4.5); % peak load scenario
8nodes = base.getNodes(); queue = nodes{2};
9
10problem = opt.OptimizationProblem(base);
11problem.addVariable(opt.ServerAllocation(queue, [1 12]));
12serverCost = containers.Map('KeyType','char','ValueType','double');
13serverCost('Server') = 10.0;
14problem.setObjective(opt.MinimizeCost(serverCost, [], [], {}));
15problem.addConstraint(opt.UtilizationConstraint(queue, 0.5));
16problem.addScenario(peak, 1.0);
17
18result = opt.BisectionSolver(problem).solve();
19
20fprintf('Robust servers : %d (6 for average load only)\n', result.getVariableValue('Server_servers'));
21fprintf('Cost : %.1f\n', result.objectiveValue);
22fprintf('Feasible : %d\n', result.feasible);
23
24function model = buildMMc(arrivalRate)
25 model = Network('MMc');
26 source = Source(model, 'Arrivals');
27 queue = Queue(model, 'Server', SchedStrategy.FCFS);
28 sink = Sink(model, 'Departures');
29 jobs = OpenClass(model, 'Jobs');
30 source.setArrival(jobs, Exp(arrivalRate));
31 queue.setService(jobs, Exp(1.0));
32 model.link(Network.serialRouting(source, queue, sink));
33end
Definition fjtag.m:157
Definition Station.m:245