changeset 11065:054f2fa5b68d octave-forge

Added new functions for asymptotic bounds computation for open and closed networks
author mmarzolla
date Sat, 13 Oct 2012 16:47:05 +0000
parents 06f5ad59c9c1
children 32e9344b1687
files main/queueing/ChangeLog main/queueing/doc/queueingnetworks.txi main/queueing/inst/qnclosedbsb.m main/queueing/inst/qnopenab.m main/queueing/inst/qnopenmultiab.m main/queueing/inst/qnopensingleab.m
diffstat 6 files changed, 202 insertions(+), 44 deletions(-) [+]
line wrap: on
line diff
--- a/main/queueing/ChangeLog	Sat Oct 13 16:18:56 2012 +0000
+++ b/main/queueing/ChangeLog	Sat Oct 13 16:47:05 2012 +0000
@@ -8,6 +8,9 @@
 	* qnclosedsingleab() added
 	* qnclosedmultiab() added
 	* Changed interface for qnclosedab()
+	* qnopensingleab() added
+	* qnopenmultiab() added
+	* Changed interface for qnopenab()
 	* qnclosedsinglebsb() added
 	* Stub for qnclosedmultibsb() added
 	* Changed interface for qnclosedbsb()
--- a/main/queueing/doc/queueingnetworks.txi	Sat Oct 13 16:18:56 2012 +0000
+++ b/main/queueing/doc/queueingnetworks.txi	Sat Oct 13 16:47:05 2012 +0000
@@ -1128,6 +1128,10 @@
 @c
 @GETHELP{qnopenab}
 
+@GETHELP{qnopensingleab}
+
+@GETHELP{qnopenmultiab}
+
 @noindent @strong{REFERENCES}
 
 Edward D. Lazowska, John Zahorjan, G.  Scott Graham, and Kenneth
--- a/main/queueing/inst/qnclosedbsb.m	Sat Oct 13 16:18:56 2012 +0000
+++ b/main/queueing/inst/qnclosedbsb.m	Sat Oct 13 16:47:05 2012 +0000
@@ -17,13 +17,12 @@
 
 ## -*- texinfo -*-
 ##
-## @deftypefn {Function File} {[@var{Xl}, @var{Xu}, @var{Rl}, @var{Ru}] =} qnclosedbsb (@var{N}, @var{D})
-## @deftypefnx {Function File} {[@var{Xl}, @var{Xu}, @var{Rl}, @var{Ru}] =} qnclosedbsb (@var{N}, @var{D}, @var{Z})
+## @deftypefn {Function File} {[@var{Xl}, @var{Xu}, @var{Rl}, @var{Ru}] =} qnclosedbsb (@var{N}, @dots{} )
 ##
 ## @cindex bounds, balanced system
 ## @cindex closed network
 ##
-## This function computes Balanced System Bounds for throughput and response
+## Compute Balanced System Bounds for throughput and response
 ## time of closed, single class queueing networks. Multiclass networks
 ## might be supported in the future.
 ##
@@ -37,10 +36,9 @@
 ## Web: http://www.moreno.marzolla.name/
 
 function [Xl Xu Rl Ru] = qnclosedbsb( N, varargin )
-  if ( nargin < 2 || nargin > 5 )
+  if ( nargin < 1 )
     print_usage();
   endif
-
   if (isscalar(N))
     [Xl Xu Rl Ru] = qnclosedsinglebsb(N, varargin{:});
   else
--- a/main/queueing/inst/qnopenab.m	Sat Oct 13 16:18:56 2012 +0000
+++ b/main/queueing/inst/qnopenab.m	Sat Oct 13 16:47:05 2012 +0000
@@ -17,59 +17,31 @@
 
 ## -*- texinfo -*-
 ##
-## @deftypefn {Function File} {[@var{Xu}, @var{Rl}] =} qnopenab (@var{lambda}, @var{D})
+## @deftypefn {Function File} {[@var{Xu}, @var{Rl}] =} qnopenab (@var{lambda}, @dots{} )
 ##
 ## @cindex bounds, asymptotic
 ## @cindex open network
 ##
-## Compute Asymptotic Bounds for single-class, open Queueing Networks
-## with @math{K} service centers.
-##
-## @strong{INPUTS}
-##
-## @table @var
-##
-## @item lambda
-## overall arrival rate to the system (scalar). Abort if
-## @code{@var{lambda} @leq{} 0}
-##
-## @item D
-## @code{@var{D}(k)} is the service demand at center @math{k}.
-## The service demand vector @var{D} must be nonempty, and all demands
-## must be nonnegative (@code{@var{D}(k) @geq{} 0} for all @math{k}).
+## Compute Asymptotic Bounds for open networks with single or multiple classes of customers.
 ##
-## @end table
-##
-## @strong{OUTPUTS}
-##
-## @table @var
+## This function dispatches the computation to @code{qnopensingleab} or @code{qnopenmultiab}.
 ##
-## @item Xu
-## Upper bound on the system throughput.
-##
-## @item Rl
-## Lower bound on the system response time.
-##
-## @end table
-##
-## @seealso{qnopenbsb}
+## @seealso{qnopensingleab, qnopenmultiab}
 ##
 ## @end deftypefn
 
 ## Author: Moreno Marzolla <marzolla(at)cs.unibo.it>
 ## Web: http://www.moreno.marzolla.name/
 
-function [X_upper R_lower] = qnopenab( lambda, D )
-  if ( nargin != 2 )
+function [X_upper R_lower] = qnopenab( lambda, varargin )
+  if ( nargin < 1 )
     print_usage();
   endif
-  ( isscalar(lambda) && lambda > 0 ) || \
-      error( "lambda must be a positive scalar" );
-  ( isvector(D) && length(D)>0 && all( D>=0 ) ) || \
-      error( "D must be a vector of nonnegative scalars" );
-
-  X_upper = 1/max(D);
-  R_lower = sum(D);
+  if ( isscalar(lambda) )
+    [X_upper R_lower] = qnopensingleab(lambda, varargin{:} );
+  else
+    [X_upper R_lower] = qnopenmultiab(lambda, varargin{:} );
+  endif
 endfunction
 
 %!test
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main/queueing/inst/qnopenmultiab.m	Sat Oct 13 16:47:05 2012 +0000
@@ -0,0 +1,90 @@
+## Copyright (C) 2008, 2009, 2010, 2011, 2012 Moreno Marzolla
+##
+## This file is part of the queueing toolbox.
+##
+## The queueing toolbox is free software: you can redistribute it and/or
+## modify it under the terms of the GNU General Public License as
+## published by the Free Software Foundation, either version 3 of the
+## License, or (at your option) any later version.
+##
+## The queueing toolbox is distributed in the hope that it will be
+## useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+## of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with the queueing toolbox. If not, see <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+##
+## @deftypefn {Function File} {[@var{Xu}, @var{Rl}] =} qnopenmultiab (@var{lambda}, @var{S})
+## @deftypefnx {Function File} {[@var{Xu}, @var{Rl}] =} qnopenmultiab (@var{lambda}, @var{S}, @var{V})
+##
+## @cindex bounds, asymptotic
+## @cindex open network
+##
+## Compute Asymptotic Bounds for open, multiclass networks.
+##
+## @strong{INPUTS}
+##
+## @table @var
+##
+## @item lambda
+## @code{@var{lambda}(c)} is the class @math{c} arrival rate to the
+## system.
+##
+## @item S
+## @code{@var{S}(c, k)} is the mean service time of class @math{c}
+## requests at center @math{k}. (@code{@var{S}(c, k) @geq{} 0} for all
+## @math{k}).
+##
+## @item V
+## @code{@var{V}(c, k)} is the mean number of visits of class @math{c}
+## requests at center @math{k}. (@code{@var{V}(c, k) @geq{} 0} for all
+## @math{k}). Default is 1 for all @math{k}.
+##
+## @end table
+##
+## @strong{OUTPUTS}
+##
+## @table @var
+##
+## @item Xu
+## Upper bound on the system throughput.
+##
+## @item Rl
+## Lower bound on the system response time.
+##
+## @end table
+##
+## @seealso{qnopenbsb}
+##
+## @end deftypefn
+
+## Author: Moreno Marzolla <marzolla(at)cs.unibo.it>
+## Web: http://www.moreno.marzolla.name/
+
+function [X_upper R_lower] = qnopenmultiab( lambda, S, V )
+  if ( nargin < 2 || nargin > 3 )
+    print_usage();
+  endif
+  ( isvector(lambda) && all(lambda > 0) ) || \
+      error( "lambda must be a vector >= 0" );
+  lambda = lambda(:)';
+  C = length(lambda);
+  ( ismatrix(S) && rows(S)==C && all(all( S>=0 )) ) || \
+      error( "S must be a matrix >=0 with %d rows", C );
+  K = columns(S);
+  if ( nargin < 3 )
+    V = ones(size(S));
+  else
+    ( ismatrix(V) && size_equal(S,V) && all(all( V>=0 )) ) || \
+	error( "V must be a %d x %d matrix >=0", C, K);
+  endif
+  D = S.*V;
+  X_upper = 1./max(D,[],2)';
+  R_lower = sum(D,2)';
+endfunction
+
+%!test
+%! fail( "qnopenmultiab( [1 1], [1 1 1; 1 1 1; 1 1 1] )", "2 rows" );
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main/queueing/inst/qnopensingleab.m	Sat Oct 13 16:47:05 2012 +0000
@@ -0,0 +1,91 @@
+## Copyright (C) 2008, 2009, 2010, 2011, 2012 Moreno Marzolla
+##
+## This file is part of the queueing toolbox.
+##
+## The queueing toolbox is free software: you can redistribute it and/or
+## modify it under the terms of the GNU General Public License as
+## published by the Free Software Foundation, either version 3 of the
+## License, or (at your option) any later version.
+##
+## The queueing toolbox is distributed in the hope that it will be
+## useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+## of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with the queueing toolbox. If not, see <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+##
+## @deftypefn {Function File} {[@var{Xu}, @var{Rl}] =} qnopensingleab (@var{lambda}, @var{S})
+## @deftypefnx {Function File} {[@var{Xu}, @var{Rl}] =} qnopensingleab (@var{lambda}, @var{S}, @var{V})
+##
+## @cindex bounds, asymptotic
+## @cindex open network
+##
+## Compute Asymptotic Bounds for single-class, open networks.
+##
+## @strong{INPUTS}
+##
+## @table @var
+##
+## @item lambda
+## overall arrival rate to the system (scalar). Abort if
+## @code{@var{lambda} @leq{} 0}
+##
+## @item S
+## @code{@var{S}(k)} is the mean service time at center @math{k}.
+## (@code{@var{S}(k) @geq{} 0} for all @math{k}).
+##
+## @item V
+## @code{@var{V}(k)} is the mean number of visits at center @math{k}.
+## (@code{@var{V}(k) @geq{} 0} for all @math{k}). Default is 1
+## for all @math{k}.
+##
+## @end table
+##
+## @strong{OUTPUTS}
+##
+## @table @var
+##
+## @item Xu
+## Upper bound on the system throughput.
+##
+## @item Rl
+## Lower bound on the system response time.
+##
+## @end table
+##
+## @seealso{qnopenbsb}
+##
+## @end deftypefn
+
+## Author: Moreno Marzolla <marzolla(at)cs.unibo.it>
+## Web: http://www.moreno.marzolla.name/
+
+function [X_upper R_lower] = qnopensingleab( lambda, S, V )
+  if ( nargin < 2 || nargin > 3 )
+    print_usage();
+  endif
+  ( isscalar(lambda) && lambda > 0 ) || \
+      error( "lambda must be a positive scalar" );
+  ( isvector(S) && length(S)>0 && all( S>=0 ) ) || \
+      error( "S must be a vector of nonnegative scalars" );
+  S = S(:)';
+  if ( nargin < 3 )
+    V = ones(size(S));
+  else
+    ( isvector(V) && size_equal(S,V) && all( V>=0 ) ) || \
+	error( "V must be a vector >=0 with %d elements", length(S));
+    V = V(:)';
+  endif
+  D = S.*V;
+  X_upper = 1/max(D);
+  R_lower = sum(D);
+endfunction
+
+%!test
+%! fail( "qnopensingleab( 0.1, [] )", "vector" );
+%! fail( "qnopensingleab( 0.1, [0 -1])", "vector" );
+%! fail( "qnopensingleab( 0, [1 2] )", "lambda" );
+%! fail( "qnopensingleab( -1, [1 2])", "lambda" );
\ No newline at end of file