1## Copyright (C) 2008, 2009, 2010, 2011, 2012, 2016 Moreno Marzolla
2##
3## This file is part of the queueing toolbox.
4##
5## The queueing toolbox is free software: you can redistribute it and/or
6## modify it under the terms of the GNU General Public License as
7## published by the Free Software Foundation, either version 3 of the
8## License, or (at your option) any later version.
9##
10## The queueing toolbox is distributed in the hope that it will be
11## useful, but WITHOUT ANY WARRANTY; without even the implied warranty
12## of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13## General Public License for more details.
14##
15## You should have received a copy of the GNU General Public License
16## along with the queueing toolbox. If not, see <http://www.gnu.org/licenses/>.
17
18## -*- texinfo -*-
19##
20## @deftypefn {Function File} {[@var{Xl}, @var{Xu}, @var{Rl}, @var{Ru}] =} qnosaba (@var{lambda}, @var{D})
21## @deftypefnx {Function File} {[@var{Xl}, @var{Xu}, @var{Rl}, @var{Ru}] =} qnosaba (@var{lambda}, @var{S}, @var{V})
22## @deftypefnx {Function File} {[@var{Xl}, @var{Xu}, @var{Rl}, @var{Ru}] =} qnosaba (@var{lambda}, @var{S}, @var{V}, @var{m})
23##
24## @cindex bounds, asymptotic
25## @cindex open network
26##
27## Compute Asymptotic Bounds for open, single-class networks with @math{K} service centers.
28##
29## @strong{INPUTS}
30##
31## @table @code
32##
33## @item @var{lambda}
34## Arrival rate of requests (scalar, @code{@var{lambda} @geq{} 0}).
35##
36## @item @var{D}(k)
37## service demand at center @math{k}.
38## (vector of length @math{K}, @code{@var{D}(k) @geq{} 0}).
39##
40## @item @var{S}(k)
41## mean service time at center @math{k}.
42## (vector of length @math{K}, @code{@var{S}(k) @geq{} 0}).
43##
44## @item @var{V}(k)
45## mean number of visits to center @math{k}.
46## (vector of length @math{K}, @code{@var{V}(k) @geq{} 0}).
47##
48## @item @var{m}(k)
49## number of servers at center @math{k}.
50## This function only supports @math{M/M/1} queues, therefore
51## @var{m} must be @code{ones(size(S))}.
52##
53## @end table
54##
55## @strong{OUTPUTS}
56##
57## @table @code
58##
59## @item @var{Xl}
60## @item @var{Xu}
61## Lower and upper bounds on the system throughput. @var{Xl} is
62## always set to @math{0} since there can be no lower bound on the
63## throughput of open networks (scalar).
64##
65## @item @var{Rl}
66## @item @var{Ru}
67## Lower and upper bounds on the system response time. @var{Ru}
68## is always set to @code{+inf} since there can be no upper bound on the
69## throughput of open networks (scalar).
70##
71## @end table
72##
73## @seealso{qnomaba}
74##
75## @end deftypefn
76
77## Author: Moreno Marzolla <moreno.marzolla(at)unibo.it>
78## Web: http://www.moreno.marzolla.name/
79
80function [X_lower X_upper R_lower R_upper] = qnosaba( varargin )
81  if ( nargin < 2 || nargin > 4 )
82    print_usage();
83  endif
84
85  [err lambda S V m] = qnoschkparam( varargin{:} );
86  isempty(err) || error(err);
87
88  all(m==1) || ...
89      error("this function supports M/M/1 servers only");
90
91  D = S .* V;
92
93  X_lower = 0;
94  X_upper = 1/max(D);
95  R_lower = sum(D);
96  R_upper = +inf;
97endfunction
98
99%!test
100%! fail( "qnosaba( 0.1, [] )", "vector" );
101%! fail( "qnosaba( 0.1, [0 -1])", "nonnegative" );
102%! fail( "qnosaba( 0, [1 2] )", "lambda" );
103%! fail( "qnosaba( -1, [1 2])", "lambda" );
104%! fail( "qnosaba( 1, [1 2 3], [1 2] )", "incompatible size");
105%! fail( "qnosaba( 1, [1 2 3], [-1 2 3] )", "nonnegative");
106
107%!test
108%! [Xl Xu Rl Ru] = qnosaba( 1, [1 1] );
109%! assert( Xl, 0 );
110%! assert( Ru, +inf );
111