From: <mma...@us...> - 2012-03-02 14:36:34
|
Revision: 9739 http://octave.svn.sourceforge.net/octave/?rev=9739&view=rev Author: mmarzolla Date: 2012-03-02 14:36:24 +0000 (Fri, 02 Mar 2012) Log Message: ----------- modifications Modified Paths: -------------- trunk/octave-forge/main/queueing/inst/qnclosedgb.m trunk/octave-forge/main/queueing/inst/qnclosedmultimva.m trunk/octave-forge/main/queueing/inst/qnclosedsinglemva.m trunk/octave-forge/main/queueing/test/Makefile Modified: trunk/octave-forge/main/queueing/inst/qnclosedgb.m =================================================================== --- trunk/octave-forge/main/queueing/inst/qnclosedgb.m 2012-03-02 11:45:52 UTC (rev 9738) +++ trunk/octave-forge/main/queueing/inst/qnclosedgb.m 2012-03-02 14:36:24 UTC (rev 9739) @@ -65,6 +65,13 @@ ## Web: http://www.moreno.marzolla.name/ function [X_lower X_upper Q_lower Q_upper] = qnclosedgb( N, L, Z, X_minus, X_plus ) + + ## This implementation is based on the paper: G.Casale, R.R.Muntz, + ## G.Serazzi. Geometric Bounds: a Noniterative Analysis Technique for + ## Closed Queueing Networks IEEE Transactions on Computers, + ## 57(6):780-794, Jun 2008. + ## http://doi.ieeecomputersociety.org/10.1109/TC.2008.37 + ## The original paper uses the symbol "L" instead of "D" to denote the ## loadings of service centers. In this function we adopt the same ## notation as the paper. @@ -132,10 +139,8 @@ Q_upper(i) = Y(i)./(1-Y(i)) .- (Y(i).^(N+1))./(1-Y(i)); # Eq. (13) ## now, handle the case of servers with demand equal to the maximum i=find(L==L_max); - Q_lower(i) = 1/m_max*(N-Z*X_plus - sum( Q_upper( find(L<L_max) ) ) ); \ - # Eq. (8) - Q_upper(i) = 1/m_max*(N-Z*X_minus - sum( Q_lower( find(L<L_max) \ - ) ) ); # Eq. (13) + Q_lower(i) = 1/m_max*(N-Z*X_plus - sum( Q_upper( L<L_max ))); # Eq. (8) + Q_upper(i) = 1/m_max*(N-Z*X_minus - sum( Q_lower( L<L_max ))); # Eq. (13) endfunction %!test @@ -183,16 +188,17 @@ %! m = ones(1,3); %! V = qnvisits(P); %! Nmax = 20; +%! tol = 1e-5; # compensate for numerical errors %! %! ## Test case with Z>0 %! for n=1:Nmax %! [X_gb_lower X_gb_upper Q_gb_lower Q_gb_upper] = qnclosedgb(n, S.*V, 2); %! [U R Q X] = qnclosed( n, S, V, m, 2 ); %! X_mva = X(1)/V(1); -%! assert( X_gb_lower <= X_mva ); -%! assert( X_gb_upper >= X_mva ); -%! assert( Q_gb_lower <= Q+1e-5 ); # compensate for numerical errors -%! assert( Q_gb_upper >= Q-1e-5 ); # compensate for numerical errors +%! assert( X_gb_lower <= X_mva+tol ); +%! assert( X_gb_upper >= X_mva-tol ); +%! assert( Q_gb_lower <= Q+tol ); # compensate for numerical errors +%! assert( Q_gb_upper >= Q-tol ); # compensate for numerical errors %! endfor %!test @@ -201,14 +207,15 @@ %! m = ones(1,3); %! V = qnvisits(P); %! Nmax = 20; +%! tol = 1e-5; # compensate for numerical errors %! %! ## Test case with Z=0 %! for n=1:Nmax %! [X_gb_lower X_gb_upper Q_gb_lower Q_gb_upper] = qnclosedgb(n, S.*V, 0); %! [U R Q X] = qnclosed( n, S, V, m, 0 ); %! X_mva = X(1)/V(1); -%! assert( X_gb_lower <= X_mva ); -%! assert( X_gb_upper >= X_mva ); -%! assert( Q_gb_lower <= Q ); -%! assert( Q_gb_upper >= Q ); +%! assert( X_gb_lower <= X_mva+tol ); +%! assert( X_gb_upper >= X_mva-tol ); +%! assert( Q_gb_lower <= Q+tol ); +%! assert( Q_gb_upper >= Q-tol ); %! endfor Modified: trunk/octave-forge/main/queueing/inst/qnclosedmultimva.m =================================================================== --- trunk/octave-forge/main/queueing/inst/qnclosedmultimva.m 2012-03-02 11:45:52 UTC (rev 9738) +++ trunk/octave-forge/main/queueing/inst/qnclosedmultimva.m 2012-03-02 14:36:24 UTC (rev 9739) @@ -128,8 +128,10 @@ ## ## @item R ## @code{@var{R}(c,k)} is the class @math{c} response time at -## center @math{k}. The total class @math{c} system response time -## can be computed as @code{dot(@var{R}, @var{V}, 2)}. +## center @math{k}. The class @math{c} @emph{residence time} +## at center @math{k} is @code{@var{R}(c,k) * @var{C}(c,k)}. +## The total class @math{c} system response time +## is @code{dot(@var{R}, @var{V}, 2)}. ## ## @item Q ## @code{@var{Q}(c,k)} is the average number of @@ -158,12 +160,19 @@ print_usage(); endif + ## basic sanity checks + isvector(N) && all( N>=0 ) || \ + usage( "N must be a vector >=0" ); + C = length(N); ## Number of classes + ( ndims(S) == 2 ) || \ + usage( "S must be a matrix" ); + if ( nargin == 2 ) V = ones(size(S)); endif ( ismatrix(V) && (ndims(V) == 2 || ndims(V) == 4) ) || \ - usage("The third parameter has %d dimensions (must be 2- or 4-dimensional)", ndims(V) ); + usage("The third parametermust be a 2- or 4-dimensional matrix" ); if ( ndims(V) == 2 ) [U R Q X] = __qnclosedmultimva_nocs( N, S, V, varargin{:} ); @@ -185,13 +194,13 @@ usage( "N must be >=0" ); N = N(:)'; # make N a row vector C = length(N); ## Number of classes + ( ndims(S) == 2 ) || \ + usage( "S must be a matrix" ); K = columns(S); ## Number of service centers - ( ndims(S) == 2 ) || \ - usage( "S must be a %dx%d matrix", C, K ); size(S) == [C,K] || \ usage( "S size mismatch (is %dx%d, should be %dx%d)", rows(S), columns(S), C, K ); ndims(P) == 4 && size(P) == [C,K,C,K] || \ - usage( "P size mismatch" ); + usage( "P size mismatch (should be %dx%dx%dx%d)",C,K,C,K ); if ( nargin < 4 ) m = ones(1,K); @@ -205,7 +214,7 @@ ## Check consistency of parameters all( all( S >= 0 ) ) || \ - usage( "S must be >0" ); + usage( "S must be >= 0" ); all( any(S>0,2) ) || \ usage( "S must contain at least a value >0 for each row" ); all( all( P >= 0 ) ) || \ @@ -217,7 +226,6 @@ [V ch] = qnvisits(P); ## 2. Identify chains - ## ch = qnchains(P); nch = max(ch); ## 3. Compute visit counts for the equivalent network @@ -311,7 +319,7 @@ ## Check consistency of parameters all( all( S >= 0 ) ) || \ - usage( "S must be >=0" ); + usage( "S must be >= 0" ); all( any(S>0,2) ) || \ usage( "S must contain at least a value >0 for each row" ); all( all( V >= 0 ) ) || \ Modified: trunk/octave-forge/main/queueing/inst/qnclosedsinglemva.m =================================================================== --- trunk/octave-forge/main/queueing/inst/qnclosedsinglemva.m 2012-03-02 11:45:52 UTC (rev 9738) +++ trunk/octave-forge/main/queueing/inst/qnclosedsinglemva.m 2012-03-02 14:36:24 UTC (rev 9739) @@ -79,8 +79,11 @@ ## ## @item R ## @code{@var{R}(k)} is the response time at center @math{k}. +## The @emph{Residence Time} at center @math{k} is +## @code{@var{R}(k) * @var{V}(k)}. ## The system response time @var{Rsys} -## can be computed as @code{@var{Rsys} = @var{N}/@var{Xsys} - Z} +## can be computed either as @code{@var{Rsys} = @var{N}/@var{Xsys} - Z} +## or as @code{@var{Rsys} = dot(@var{R},@var{V})} ## ## @item Q ## @code{@var{Q}(k)} is the average number of requests at center Modified: trunk/octave-forge/main/queueing/test/Makefile =================================================================== --- trunk/octave-forge/main/queueing/test/Makefile 2012-03-02 11:45:52 UTC (rev 9738) +++ trunk/octave-forge/main/queueing/test/Makefile 2012-03-02 14:36:24 UTC (rev 9739) @@ -5,7 +5,7 @@ ALL: check: - cd ../inst && octave -q ../test/fntests.m + cd ../inst && octave -qf ../test/fntests.m dist: ln $(DISTFILES) ../`cat ../fname`/test/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |