This list is closed, nobody may subscribe to it.
2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(10) |
Aug
(5) |
Sep
(3) |
Oct
(41) |
Nov
(41) |
Dec
(33) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2002 |
Jan
(75) |
Feb
(10) |
Mar
(170) |
Apr
(174) |
May
(66) |
Jun
(11) |
Jul
(10) |
Aug
(44) |
Sep
(73) |
Oct
(28) |
Nov
(139) |
Dec
(52) |
2003 |
Jan
(35) |
Feb
(93) |
Mar
(62) |
Apr
(10) |
May
(55) |
Jun
(70) |
Jul
(37) |
Aug
(16) |
Sep
(56) |
Oct
(31) |
Nov
(57) |
Dec
(83) |
2004 |
Jan
(85) |
Feb
(67) |
Mar
(27) |
Apr
(37) |
May
(75) |
Jun
(85) |
Jul
(160) |
Aug
(68) |
Sep
(104) |
Oct
(25) |
Nov
(39) |
Dec
(23) |
2005 |
Jan
(10) |
Feb
(45) |
Mar
(43) |
Apr
(19) |
May
(108) |
Jun
(31) |
Jul
(41) |
Aug
(23) |
Sep
(65) |
Oct
(58) |
Nov
(44) |
Dec
(54) |
2006 |
Jan
(96) |
Feb
(27) |
Mar
(69) |
Apr
(59) |
May
(67) |
Jun
(35) |
Jul
(13) |
Aug
(461) |
Sep
(160) |
Oct
(399) |
Nov
(32) |
Dec
(72) |
2007 |
Jan
(316) |
Feb
(305) |
Mar
(318) |
Apr
(54) |
May
(194) |
Jun
(173) |
Jul
(282) |
Aug
(91) |
Sep
(227) |
Oct
(365) |
Nov
(168) |
Dec
(18) |
2008 |
Jan
(71) |
Feb
(111) |
Mar
(155) |
Apr
(173) |
May
(70) |
Jun
(67) |
Jul
(55) |
Aug
(83) |
Sep
(32) |
Oct
(68) |
Nov
(80) |
Dec
(29) |
2009 |
Jan
(46) |
Feb
(18) |
Mar
(95) |
Apr
(76) |
May
(140) |
Jun
(98) |
Jul
(84) |
Aug
(123) |
Sep
(94) |
Oct
(131) |
Nov
(142) |
Dec
(125) |
2010 |
Jan
(128) |
Feb
(158) |
Mar
(172) |
Apr
(134) |
May
(94) |
Jun
(84) |
Jul
(32) |
Aug
(127) |
Sep
(167) |
Oct
(109) |
Nov
(69) |
Dec
(78) |
2011 |
Jan
(39) |
Feb
(58) |
Mar
(52) |
Apr
(47) |
May
(56) |
Jun
(76) |
Jul
(55) |
Aug
(54) |
Sep
(165) |
Oct
(255) |
Nov
(328) |
Dec
(263) |
2012 |
Jan
(82) |
Feb
(147) |
Mar
(400) |
Apr
(216) |
May
(209) |
Jun
(160) |
Jul
(86) |
Aug
(141) |
Sep
(156) |
Oct
(6) |
Nov
|
Dec
|
2015 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
(1) |
Oct
|
Nov
(1) |
Dec
(2) |
2016 |
Jan
|
Feb
(2) |
Mar
(2) |
Apr
(1) |
May
(1) |
Jun
(2) |
Jul
(1) |
Aug
(1) |
Sep
|
Oct
|
Nov
(1) |
Dec
|
2019 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2021 |
Jan
|
Feb
|
Mar
|
Apr
(3) |
May
(4) |
Jun
(8) |
Jul
(2) |
Aug
(5) |
Sep
(9) |
Oct
|
Nov
|
Dec
|
From: <car...@us...> - 2012-04-11 19:11:19
|
Revision: 10198 http://octave.svn.sourceforge.net/octave/?rev=10198&view=rev Author: carandraug Date: 2012-04-11 19:11:07 +0000 (Wed, 11 Apr 2012) Log Message: ----------- im2int16: new function for image package and updated list of functinos on seealso help text Modified Paths: -------------- trunk/octave-forge/main/image/NEWS trunk/octave-forge/main/image/inst/im2double.m trunk/octave-forge/main/image/inst/im2single.m trunk/octave-forge/main/image/inst/im2uint16.m trunk/octave-forge/main/image/inst/im2uint8.m Added Paths: ----------- trunk/octave-forge/main/image/inst/im2int16.m Modified: trunk/octave-forge/main/image/NEWS =================================================================== --- trunk/octave-forge/main/image/NEWS 2012-04-11 18:30:27 UTC (rev 10197) +++ trunk/octave-forge/main/image/NEWS 2012-04-11 19:11:07 UTC (rev 10198) @@ -6,6 +6,7 @@ blockproc bwlabeln getrangefromclass + im2int16 im2single imabsdiff imadd Modified: trunk/octave-forge/main/image/inst/im2double.m =================================================================== --- trunk/octave-forge/main/image/inst/im2double.m 2012-04-11 18:30:27 UTC (rev 10197) +++ trunk/octave-forge/main/image/inst/im2double.m 2012-04-11 19:11:07 UTC (rev 10198) @@ -33,7 +33,7 @@ ## @item indexed, logical - converted to double class. ## @end itemize ## -## @seealso{im2bw, im2uint16, im2uint8} +## @seealso{im2bw, im2int16, im2single, im2uint8, im2uint16} ## @end deftypefn function im = im2double (im, indexed = false) Added: trunk/octave-forge/main/image/inst/im2int16.m =================================================================== --- trunk/octave-forge/main/image/inst/im2int16.m (rev 0) +++ trunk/octave-forge/main/image/inst/im2int16.m 2012-04-11 19:11:07 UTC (rev 10198) @@ -0,0 +1,66 @@ +## Copyright (C) 2012 Carn\xEB Draug <car...@gm...> +## +## This program 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. +## +## This program 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 +## this program; if not, see <http://www.gnu.org/licenses/>. + +## -*- texinfo -*- +## @deftypefn {Function File} @var{im2} = im2int16 (@var{im1}) +## Convert input image @var{im1} to int16 precision. +## +## The following images type are supported: double, single, uint8, uint16, int16, +## binary (logical). +## +## Processing will depend on the class of the input image @var{im1}: +## @itemize @bullet +## @item int16 - returns the same as input +## @item uint8, double, single, uint16, logical - output will be rescaled for the +## interval of the uint16 class [0 65535] +## @end itemize +## +## @seealso{im2bw, im2double, im2single, im2uint8, im2uint16} +## @end deftypefn + +function im = im2int16 (im) + + ## unlike the others for imconversion, this only accepts 1 argument so we check here + if (nargin != 1) + print_usage; + endif + ## Input checking (private function that is used for all im2class functions) + im_class = imconversion (nargin, "im2int16", false, im); + + switch im_class + case "int16" + ## do nothing, return the same + case {"single", "double"} + im = int16 (double (im * intmax ("uint16")) - double (intmax ("int16")) - 1); + case "logical" + im(im) = intmax ("int16"); + im(!im) = intmin ("int16"); + case "uint8" + ## 257 is the ratio between the max of uint8 and uint16 + ## double (intmax ("uint16")) / double (intmax ("uint8")) == 257 + im = int16 (double (257 * uint16 (im)) - double (intmax ("int16")) - 1); + case "uint16" + im = int16 (double (im) - double (intmax ("int16")) - 1); + otherwise + error ("unsupported image class %s", im_class); + endswitch + +endfunction + +%!assert(im2int16(int16([-2 2 3])), int16([-2 2 3])); # uint16 returns the same +%!assert(im2int16(uint8([0 255])), int16([-32768 32767])); # basic usage with uint8 +%!assert(im2int16(uint16([0 65535])), int16([-32768 32767])); # basic usage with uint16 +%!assert(im2int16([0 0.5 1]), int16([-32768 0 32767])); # basic usage with double +%!assert(im2int16([1 2]), int16([32767 32767])); # for double, above 1 is same as 1 Modified: trunk/octave-forge/main/image/inst/im2single.m =================================================================== --- trunk/octave-forge/main/image/inst/im2single.m 2012-04-11 18:30:27 UTC (rev 10197) +++ trunk/octave-forge/main/image/inst/im2single.m 2012-04-11 19:11:07 UTC (rev 10198) @@ -32,7 +32,7 @@ ## @item indexed, logical - converted to single class. ## @end itemize ## -## @seealso{im2bw, im2uint16, im2uint8} +## @seealso{im2bw, im2double, im2int16, im2uint8, im2uint16} ## @end deftypefn function im = im2single (im, indexed = false) Modified: trunk/octave-forge/main/image/inst/im2uint16.m =================================================================== --- trunk/octave-forge/main/image/inst/im2uint16.m 2012-04-11 18:30:27 UTC (rev 10197) +++ trunk/octave-forge/main/image/inst/im2uint16.m 2012-04-11 19:11:07 UTC (rev 10198) @@ -32,7 +32,7 @@ ## the max of the uint16 class (65535). ## @end itemize ## -## @seealso{im2bw, im2double, im2uint8} +## @seealso{im2bw, im2double, im2int16, im2single, im2uint8} ## @end deftypefn function im = im2uint16 (im, indexed = false) Modified: trunk/octave-forge/main/image/inst/im2uint8.m =================================================================== --- trunk/octave-forge/main/image/inst/im2uint8.m 2012-04-11 18:30:27 UTC (rev 10197) +++ trunk/octave-forge/main/image/inst/im2uint8.m 2012-04-11 19:11:07 UTC (rev 10198) @@ -32,7 +32,7 @@ ## the uint8 class (255). ## @end itemize ## -## @seealso{im2bw, im2uint16, im2double} +## @seealso{im2bw, im2double, im2int16, im2single, im2uint16} ## @end deftypefn function im = im2uint8 (im, indexed = false) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <car...@us...> - 2012-04-11 18:30:33
|
Revision: 10197 http://octave.svn.sourceforge.net/octave/?rev=10197&view=rev Author: carandraug Date: 2012-04-11 18:30:27 +0000 (Wed, 11 Apr 2012) Log Message: ----------- im2single: new function for image package Modified Paths: -------------- trunk/octave-forge/main/image/NEWS trunk/octave-forge/main/image/inst/im2double.m Added Paths: ----------- trunk/octave-forge/main/image/inst/im2single.m Modified: trunk/octave-forge/main/image/NEWS =================================================================== --- trunk/octave-forge/main/image/NEWS 2012-04-11 18:23:09 UTC (rev 10196) +++ trunk/octave-forge/main/image/NEWS 2012-04-11 18:30:27 UTC (rev 10197) @@ -6,6 +6,7 @@ blockproc bwlabeln getrangefromclass + im2single imabsdiff imadd imbothat Modified: trunk/octave-forge/main/image/inst/im2double.m =================================================================== --- trunk/octave-forge/main/image/inst/im2double.m 2012-04-11 18:23:09 UTC (rev 10196) +++ trunk/octave-forge/main/image/inst/im2double.m 2012-04-11 18:30:27 UTC (rev 10197) @@ -41,6 +41,10 @@ ## Input checking (private function that is used for all im2class functions) im_class = imconversion (nargin, "im2double", indexed, im); + ## READ BEFORE MAKE CHANGES: + ## this function is pretty much the same as im2single. Any changes on this code + ## should most likely also be done there + switch im_class case "double" ## do nothing, return the same Added: trunk/octave-forge/main/image/inst/im2single.m =================================================================== --- trunk/octave-forge/main/image/inst/im2single.m (rev 0) +++ trunk/octave-forge/main/image/inst/im2single.m 2012-04-11 18:30:27 UTC (rev 10197) @@ -0,0 +1,68 @@ +## Copyright (C) 2012 Carn\xEB Draug <car...@gm...> +## +## This program 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. +## +## This program 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 +## this program; if not, see <http://www.gnu.org/licenses/>. + +## -*- texinfo -*- +## @deftypefn {Function File} @var{im2} = im2single (@var{im1}) +## @deftypefnx {Function File} @var{im2} = im2single (@var{im1}, "indexed") +## Convert input image @var{im1} to single precision. +## +## The following images type are supported: double, single, uint8, uint16, int16, +## binary (logical), indexed. If @var{im1} is an indexed images, the second +## argument must be a string with the value `indexed'. +## +## Processing will depend on the class of the input image @var{im1}: +## @itemize @bullet +## @item uint8, uint16, int16 - output will be rescaled for the interval [0 1] +## with the limits of the class; +## @item single - output will be the same as input; +## @item double - output will have the same values as input but the class will +## single; +## @item indexed, logical - converted to single class. +## @end itemize +## +## @seealso{im2bw, im2uint16, im2uint8} +## @end deftypefn + +function im = im2single (im, indexed = false) + + ## Input checking (private function that is used for all im2class functions) + im_class = imconversion (nargin, "im2single", indexed, im); + + ## READ BEFORE MAKE CHANGES: + ## this function is pretty much the same as im2double. Any changes on this code + ## should most likely also be done there + + switch im_class + case "single" + ## do nothing, return the same + case {"logical", "double"} + im = single (im); + case {"uint8", "uint16"} + if (indexed) + im = single (im) + 1; + else + im = single (im) / single (intmax (im_class)); + endif + case "int16" + im = (single (im) + single (intmax (im_class)) + 1) / single (intmax ("uint16")); + otherwise + error ("unsupported image class %s", im_class); + endswitch +endfunction + +%!assert(im2single([1 2 3]), single([1 2 3])); # double returns the same +%!assert(im2single(uint8([0 255])), single([0 1])); # basic usage +%!assert(im2single(uint8([1 25]), "indexed"), single([2 26])); # test indexed +%!assert(im2single(int16([-32768 32768])), single([0 1])); # test signed integer This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <car...@us...> - 2012-04-11 18:23:15
|
Revision: 10196 http://octave.svn.sourceforge.net/octave/?rev=10196&view=rev Author: carandraug Date: 2012-04-11 18:23:09 +0000 (Wed, 11 Apr 2012) Log Message: ----------- im2uint8: matlab compatibility and support for indexed images Modified Paths: -------------- trunk/octave-forge/main/image/NEWS trunk/octave-forge/main/image/inst/im2uint16.m trunk/octave-forge/main/image/inst/im2uint8.m Modified: trunk/octave-forge/main/image/NEWS =================================================================== --- trunk/octave-forge/main/image/NEWS 2012-04-11 17:51:21 UTC (rev 10195) +++ trunk/octave-forge/main/image/NEWS 2012-04-11 18:23:09 UTC (rev 10196) @@ -44,6 +44,7 @@ imhist conndef im2double + im2uint8 im2uint16 isbw isgray Modified: trunk/octave-forge/main/image/inst/im2uint16.m =================================================================== --- trunk/octave-forge/main/image/inst/im2uint16.m 2012-04-11 17:51:21 UTC (rev 10195) +++ trunk/octave-forge/main/image/inst/im2uint16.m 2012-04-11 18:23:09 UTC (rev 10196) @@ -45,7 +45,7 @@ ## do nothing, return the same case {"single", "double"} if (indexed) - imax = max( im(:)); + imax = max (im(:)); if ( imax > intmax ("uint16")) error ("Too many colors '%d' for an indexed uint16 image", imax); endif Modified: trunk/octave-forge/main/image/inst/im2uint8.m =================================================================== --- trunk/octave-forge/main/image/inst/im2uint8.m 2012-04-11 17:51:21 UTC (rev 10195) +++ trunk/octave-forge/main/image/inst/im2uint8.m 2012-04-11 18:23:09 UTC (rev 10196) @@ -1,47 +1,83 @@ -## Copyright (C) 2007 S\xF8ren Hauberg -## -## This program 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 2, or (at your option) -## any later version. -## -## This program 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 this file. If not, see <http://www.gnu.org/licenses/>. +## Copyright (C) 2007 S\xF8ren Hauberg <so...@ha...> +## Copyright (C) 2012 Carn\xEB Draug <car...@gm...> +## +## This program 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. +## +## This program 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 +## this program; if not, see <http://www.gnu.org/licenses/>. ## -*- texinfo -*- -## @deftypefn {Function File} @var{im2} = im2uint8(@var{im1}) -## Converts the input image to an image of class uint8. +## @deftypefn {Function File} @var{im2} = im2uint8 (@var{im1}) +## @deftypefnx {Function File} @var{im2} = im2uint8 (@var{im1}, "indexed") +## Convert input image @var{im1} to uint16 precision. ## -## If the input image is of class uint8 the output is unchanged. -## If the input is of class double the result will be multiplied -## by 255 and converted to uint8, and if the input is of class uint16 the -## image will be divided by 257 and converted to uint8. +## The following images type are supported: double, single, uint8, uint16, int16, +## binary (logical), indexed. If @var{im1} is an indexed images, the second +## argument must be a string with the value `indexed'. +## +## Processing will depend on the class of the input image @var{im1}: +## @itemize @bullet +## @item uint8 - returns the same as input +## @item uint16, double, single, int16, logical - output will be rescaled for the +## interval of the uint8 class [0 255] +## @item indexed - depends on the input class. No value can be above the max of +## the uint8 class (255). +## @end itemize +## ## @seealso{im2bw, im2uint16, im2double} ## @end deftypefn -function im2 = im2uint8(im1) - ## Input checking - if (nargin < 1) - print_usage(); +function im = im2uint8 (im, indexed = false) + + ## Input checking (private function that is used for all im2class functions) + im_class = imconversion (nargin, "im2uint8", indexed, im); + + if (indexed) + imax = max (im(:)); + if (imax > intmax ("uint8")) + error ("Too many colors '%d' for an indexed uint8 image", imax); + endif endif - if (!isgray(im1) && !isrgb(im1)) - error("im2uint8: input must be an image"); - endif - - ## Take action depending on the class of the data - switch (class(im1)) - case "double" - im2 = uint8(255*im1); + + switch im_class case "uint8" - im2 = im1; + ## do nothing, return the same + case {"single", "double"} + if (indexed) + im = uint8 (im) - 1; + else + im = uint8 (im * double (intmax ("uint8"))); + endif + case "logical" + im = uint8 (im) * intmax ("uint8"); case "uint16" - im2 = uint8(im1/257); + if (indexed) + im = uint8 (im); + else + ## 257 is the ratio between the max of uint8 and uint16 + ## double (intmax ("uint16")) / double (intmax ("uint8")) == 257 + im = uint8 (im / 257); + endif + case "int16" + im = uint8 ((double (im) + double (intmax (im_class)) + 1) / 257); otherwise - error("im2uint8: unsupported image class"); + error ("unsupported image class %s", im_class); endswitch + endfunction + +%!assert(im2uint8(uint8([1 2 3])), uint8([1 2 3])); # uint16 returns the same +%!assert(im2uint8(uint16([0 65535])), uint8([0 255])); # basic usage with uint16 +%!assert(im2uint8([0 0.5 1]), uint8([0 128 255])); # basic usage with double +%!assert(im2uint8([1 2]), uint8([255 255])); # for double, above 1 is same as 1 +%!assert(im2uint8(uint16([3 25]), "indexed"), uint8([3 25])); # test indexed uint8 +%!assert(im2uint8([3 25], "indexed"), uint8([2 24])); # test indexed double +%!assert(im2uint8(int16([-32768 0 32768])), uint8([0 128 255])); # test signed integer This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <car...@us...> - 2012-04-11 17:51:28
|
Revision: 10195 http://octave.svn.sourceforge.net/octave/?rev=10195&view=rev Author: carandraug Date: 2012-04-11 17:51:21 +0000 (Wed, 11 Apr 2012) Log Message: ----------- im2uint16: matlab compatibility and support for indexed images Modified Paths: -------------- trunk/octave-forge/main/image/NEWS trunk/octave-forge/main/image/inst/im2double.m trunk/octave-forge/main/image/inst/im2uint16.m Modified: trunk/octave-forge/main/image/NEWS =================================================================== --- trunk/octave-forge/main/image/NEWS 2012-04-11 17:13:27 UTC (rev 10194) +++ trunk/octave-forge/main/image/NEWS 2012-04-11 17:51:21 UTC (rev 10195) @@ -44,6 +44,7 @@ imhist conndef im2double + im2uint16 isbw isgray isrgb Modified: trunk/octave-forge/main/image/inst/im2double.m =================================================================== --- trunk/octave-forge/main/image/inst/im2double.m 2012-04-11 17:13:27 UTC (rev 10194) +++ trunk/octave-forge/main/image/inst/im2double.m 2012-04-11 17:51:21 UTC (rev 10195) @@ -15,8 +15,8 @@ ## this program; if not, see <http://www.gnu.org/licenses/>. ## -*- texinfo -*- -## @deftypefn {Function File} @var{im2} = im2double(@var{im1}) -## @deftypefnx {Function File} @var{im2} = im2double(@var{im1}, "indexed") +## @deftypefn {Function File} @var{im2} = im2double (@var{im1}) +## @deftypefnx {Function File} @var{im2} = im2double (@var{im1}, "indexed") ## Convert input image @var{im1} to double precision. ## ## The following images type are supported: double, single, uint8, uint16, int16, Modified: trunk/octave-forge/main/image/inst/im2uint16.m =================================================================== --- trunk/octave-forge/main/image/inst/im2uint16.m 2012-04-11 17:13:27 UTC (rev 10194) +++ trunk/octave-forge/main/image/inst/im2uint16.m 2012-04-11 17:51:21 UTC (rev 10195) @@ -1,47 +1,80 @@ -## Copyright (C) 2007 S\xF8ren Hauberg -## -## This program 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 2, or (at your option) -## any later version. -## -## This program 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 this file. If not, see <http://www.gnu.org/licenses/>. +## Copyright (C) 2007 S\xF8ren Hauberg <so...@ha...> +## Copyright (C) 2012 Carn\xEB Draug <car...@gm...> +## +## This program 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. +## +## This program 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 +## this program; if not, see <http://www.gnu.org/licenses/>. ## -*- texinfo -*- -## @deftypefn {Function File} @var{im2} = im2uint16(@var{im1}) -## Converts the input image to an image of class uint16. +## @deftypefn {Function File} @var{im2} = im2uint16 (@var{im1}) +## @deftypefnx {Function File} @var{im2} = im2uint16 (@var{im1}, "indexed") +## Convert input image @var{im1} to uint16 precision. ## -## If the input image is of class uint16 the output is unchanged. -## If the input is of class uint8 the result will be converted to uint16 -## and multiplied by 257, and if the input is of class double the image will -## be multiplied by 65535 and converted to uint16. +## The following images type are supported: double, single, uint8, uint16, int16, +## binary (logical), indexed. If @var{im1} is an indexed images, the second +## argument must be a string with the value `indexed'. +## +## Processing will depend on the class of the input image @var{im1}: +## @itemize @bullet +## @item uint16 - returns the same as input +## @item uint8, double, single, int16, logical - output will be rescaled for the +## interval of the uint16 class [0 65535] +## @item indexed - depends on the input class. If double, no value can be above +## the max of the uint16 class (65535). +## @end itemize +## ## @seealso{im2bw, im2double, im2uint8} ## @end deftypefn -function im2 = im2uint16(im1) - ## Input checking - if (nargin < 1) - print_usage(); - endif - if (!isgray(im1) && !isrgb(im1)) - error("im2uint16: input must be an image"); - endif - - ## Take action depending on the class of the data - switch (class(im1)) - case "double" - im2 = uint16(65535*im1); +function im = im2uint16 (im, indexed = false) + + ## Input checking (private function that is used for all im2class functions) + im_class = imconversion (nargin, "im2uint16", indexed, im); + + switch im_class + case "uint16" + ## do nothing, return the same + case {"single", "double"} + if (indexed) + imax = max( im(:)); + if ( imax > intmax ("uint16")) + error ("Too many colors '%d' for an indexed uint16 image", imax); + endif + im = uint16 (im) - 1; + else + im = uint16 (im * double (intmax ("uint16"))); + endif + case "logical" + im = uint16 (im) * intmax ("uint16"); case "uint8" - im2 = 257*uint16(im1); - case "uint16" - im2 = im1; + if (indexed) + im = uint16 (im); + else + ## 257 is the ratio between the max of uint8 and uint16 + ## double (intmax ("uint16")) / double (intmax ("uint8")) == 257 + im = 257 * uint16 (im); + endif + case "int16" + im = uint16 (double (im) + double (intmax (im_class)) + 1); otherwise - error("im2uint16: unsupported image class"); + error ("unsupported image class %s", im_class); endswitch + endfunction + +%!assert(im2uint16(uint16([1 2 3])), uint16([1 2 3])); # uint16 returns the same +%!assert(im2uint16(uint8([0 255])), uint16([0 65535])); # basic usage with uint8 +%!assert(im2uint16([0 0.5 1]), uint16([0 32768 65535])); # basic usage with double +%!assert(im2uint16([1 2]), uint16([65535 65535])); # for double, above 1 is same as 1 +%!assert(im2uint16(uint8([3 25]), "indexed"), uint16([3 25])); # test indexed uint8 +%!assert(im2uint16([3 25], "indexed"), uint16([2 24])); # test indexed double +%!assert(im2uint16(int16([-32768 32768])), uint16([0 65535])); # test signed integer This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <car...@us...> - 2012-04-11 17:13:38
|
Revision: 10194 http://octave.svn.sourceforge.net/octave/?rev=10194&view=rev Author: carandraug Date: 2012-04-11 17:13:27 +0000 (Wed, 11 Apr 2012) Log Message: ----------- im2double: fix small bug where isind would be called wrongly Modified Paths: -------------- trunk/octave-forge/main/image/inst/im2double.m Modified: trunk/octave-forge/main/image/inst/im2double.m =================================================================== --- trunk/octave-forge/main/image/inst/im2double.m 2012-04-11 17:01:36 UTC (rev 10193) +++ trunk/octave-forge/main/image/inst/im2double.m 2012-04-11 17:13:27 UTC (rev 10194) @@ -36,10 +36,10 @@ ## @seealso{im2bw, im2uint16, im2uint8} ## @end deftypefn -function im = im2double (im, ind = false) +function im = im2double (im, indexed = false) ## Input checking (private function that is used for all im2class functions) - im_class = imconversion (nargin, "im2double", ind, im); + im_class = imconversion (nargin, "im2double", indexed, im); switch im_class case "double" @@ -47,9 +47,9 @@ case {"logical", "single"} im = double (im); case {"uint8", "uint16"} - if (ind) + if (indexed) im = double (im) + 1; - elseif (isind (im)) + else im = double (im) / double (intmax (im_class)); endif case "int16" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <car...@us...> - 2012-04-11 17:01:46
|
Revision: 10193 http://octave.svn.sourceforge.net/octave/?rev=10193&view=rev Author: carandraug Date: 2012-04-11 17:01:36 +0000 (Wed, 11 Apr 2012) Log Message: ----------- im2double: added new private function that will be used for input checking of all im2_class functions Modified Paths: -------------- trunk/octave-forge/main/image/inst/im2double.m Added Paths: ----------- trunk/octave-forge/main/image/inst/private/imconversion.m Modified: trunk/octave-forge/main/image/inst/im2double.m =================================================================== --- trunk/octave-forge/main/image/inst/im2double.m 2012-04-11 16:45:41 UTC (rev 10192) +++ trunk/octave-forge/main/image/inst/im2double.m 2012-04-11 17:01:36 UTC (rev 10193) @@ -36,35 +36,26 @@ ## @seealso{im2bw, im2uint16, im2uint8} ## @end deftypefn -function im2 = im2double (im1, ind = false) - ## Input checking - if (nargin < 1 || nargin > 2) - print_usage; - elseif (nargin == 2 && (!ischar (ind) || !strcmpi (ind, "indexed"))) - error ("second argument must be a string with the word `indexed'"); - endif +function im = im2double (im, ind = false) - if (ind && !isind (im1)) - error ("input should have been an indexed image but it is not"); - endif + ## Input checking (private function that is used for all im2class functions) + im_class = imconversion (nargin, "im2double", ind, im); - ## Take action depending on the class of the data - in_class = class (im1); - switch in_class + switch im_class case "double" - im2 = im1; + ## do nothing, return the same case {"logical", "single"} - im2 = double (im1); + im = double (im); case {"uint8", "uint16"} if (ind) - im2 = double (im1) + 1; - elseif (isind (im1)) - im2 = double (im1) / double (intmax (in_class)); + im = double (im) + 1; + elseif (isind (im)) + im = double (im) / double (intmax (im_class)); endif case "int16" - im2 = (double (im1) + double (intmax (in_class)) + 1) / double (intmax ("uint16")); + im = (double (im) + double (intmax (im_class)) + 1) / double (intmax ("uint16")); otherwise - error ("unsupported image class"); + error ("unsupported image class %s", im_class); endswitch endfunction Added: trunk/octave-forge/main/image/inst/private/imconversion.m =================================================================== --- trunk/octave-forge/main/image/inst/private/imconversion.m (rev 0) +++ trunk/octave-forge/main/image/inst/private/imconversion.m 2012-04-11 17:01:36 UTC (rev 10193) @@ -0,0 +1,34 @@ +## Copyright (C) 2012 Carnë Draug <car...@gm...> +## +## This program 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. +## +## This program 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 this program; if not, see <http://www.gnu.org/licenses/>. + +## This is a private fucntion for the common code between the functions that +## convert an input image into another class. Mostly does the input checking for +## all of them and returns the class of the input image + +function im_class = imconversion (nargs, fname, ind, im1) + ## Input checking + if (nargs < 1 || nargs > 2) + print_usage (fname); + elseif (nargs == 2 && (!ischar (ind) || !strcmpi (ind, "indexed"))) + error ("%s: second argument must be a string with the word `indexed'\n", fname); + endif + + if (ind && !isind (im1)) + error ("%s: input should have been an indexed image but it is not.\n", fname); + endif + + im_class = class (im1); + +endfunction This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <car...@us...> - 2012-04-11 16:45:52
|
Revision: 10192 http://octave.svn.sourceforge.net/octave/?rev=10192&view=rev Author: carandraug Date: 2012-04-11 16:45:41 +0000 (Wed, 11 Apr 2012) Log Message: ----------- im2double: added tests Modified Paths: -------------- trunk/octave-forge/main/image/inst/im2double.m Modified: trunk/octave-forge/main/image/inst/im2double.m =================================================================== --- trunk/octave-forge/main/image/inst/im2double.m 2012-04-11 15:22:19 UTC (rev 10191) +++ trunk/octave-forge/main/image/inst/im2double.m 2012-04-11 16:45:41 UTC (rev 10192) @@ -67,3 +67,8 @@ error ("unsupported image class"); endswitch endfunction + +%!assert(im2double([1 2 3]), [1 2 3]); # double returns the same +%!assert(im2double(uint8([0 255])), [0 1]); # basic usage +%!assert(im2double(uint8([1 25]), "indexed"), [2 26]); # test indexed +%!assert(im2double(int16([-32768 32768])), [0 1]); # test signed integer This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <car...@us...> - 2012-04-11 15:22:30
|
Revision: 10191 http://octave.svn.sourceforge.net/octave/?rev=10191&view=rev Author: carandraug Date: 2012-04-11 15:22:19 +0000 (Wed, 11 Apr 2012) Log Message: ----------- im2double: added support for indexed images and matlab compatibility Modified Paths: -------------- trunk/octave-forge/main/image/inst/im2double.m Modified: trunk/octave-forge/main/image/inst/im2double.m =================================================================== --- trunk/octave-forge/main/image/inst/im2double.m 2012-04-11 14:57:31 UTC (rev 10190) +++ trunk/octave-forge/main/image/inst/im2double.m 2012-04-11 15:22:19 UTC (rev 10191) @@ -1,48 +1,69 @@ -## Copyright (C) 2007 S\xF8ren Hauberg -## -## This program 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 2, or (at your option) -## any later version. -## -## This program 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 this file. If not, see <http://www.gnu.org/licenses/>. +## Copyright (C) 2007 S\xF8ren Hauberg <so...@ha...> +## Copyright (C) 2012 Carn\xEB Draug <car...@gm...> +## +## This program 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. +## +## This program 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 +## this program; if not, see <http://www.gnu.org/licenses/>. ## -*- texinfo -*- ## @deftypefn {Function File} @var{im2} = im2double(@var{im1}) -## Converts the input image to an image of class double. +## @deftypefnx {Function File} @var{im2} = im2double(@var{im1}, "indexed") +## Convert input image @var{im1} to double precision. ## -## If the input image is of class double the output is unchanged. -## If the input is of class uint8 the result will be converted to doubles -## and divided by 255, and if the input is of class uint16 the image will -## be converted to doubles and divided by 65535. +## The following images type are supported: double, single, uint8, uint16, int16, +## binary (logical), indexed. If @var{im1} is an indexed images, the second +## argument must be a string with the value `indexed'. +## +## Processing will depend on the class of the input image @var{im1}: +## @itemize @bullet +## @item uint8, uint16, int16 - output will be rescaled for the interval [0 1] +## with the limits of the class; +## @item double - output will be the same as input; +## @item single - output will have the same values as input but the class will +## double; +## @item indexed, logical - converted to double class. +## @end itemize +## ## @seealso{im2bw, im2uint16, im2uint8} ## @end deftypefn -function im2 = im2double(im1) +function im2 = im2double (im1, ind = false) ## Input checking - if (nargin < 1) - print_usage(); - elseif (!isgray(im1) && !isrgb(im1) && !isbw(im1)) - error("im2double: input must be an image"); + if (nargin < 1 || nargin > 2) + print_usage; + elseif (nargin == 2 && (!ischar (ind) || !strcmpi (ind, "indexed"))) + error ("second argument must be a string with the word `indexed'"); endif + if (ind && !isind (im1)) + error ("input should have been an indexed image but it is not"); + endif + ## Take action depending on the class of the data - switch (class(im1)) + in_class = class (im1); + switch in_class case "double" im2 = im1; - case "logical" - im2 = double(im1); - case "uint8" - im2 = double(im1) / 255; - case "uint16" - im2 = double(im1) / (pow2(16)-1); + case {"logical", "single"} + im2 = double (im1); + case {"uint8", "uint16"} + if (ind) + im2 = double (im1) + 1; + elseif (isind (im1)) + im2 = double (im1) / double (intmax (in_class)); + endif + case "int16" + im2 = (double (im1) + double (intmax (in_class)) + 1) / double (intmax ("uint16")); otherwise - error("im2double: unsupported image class"); + error ("unsupported image class"); endswitch endfunction This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <car...@us...> - 2012-04-11 14:57:41
|
Revision: 10190 http://octave.svn.sourceforge.net/octave/?rev=10190&view=rev Author: carandraug Date: 2012-04-11 14:57:31 +0000 (Wed, 11 Apr 2012) Log Message: ----------- isind: fix small mistake on help text Modified Paths: -------------- trunk/octave-forge/main/image/inst/isind.m Modified: trunk/octave-forge/main/image/inst/isind.m =================================================================== --- trunk/octave-forge/main/image/inst/isind.m 2012-04-11 14:08:27 UTC (rev 10189) +++ trunk/octave-forge/main/image/inst/isind.m 2012-04-11 14:57:31 UTC (rev 10190) @@ -16,7 +16,7 @@ ## -*- texinfo -*- ## @deftypefn {Function File} @var{bool} = isind (@var{img}) -## Return true if @var{img} is a RGB image. +## Return true if @var{img} is an indexed image. ## ## A variable is considereed to be an indexed image if it is 2-dimensional, ## non-sparse matrix and: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <car...@us...> - 2012-04-11 14:08:34
|
Revision: 10189 http://octave.svn.sourceforge.net/octave/?rev=10189&view=rev Author: carandraug Date: 2012-04-11 14:08:27 +0000 (Wed, 11 Apr 2012) Log Message: ----------- im2double: added support for binary images (patch by Martin Helm <ma...@mh...>) Modified Paths: -------------- trunk/octave-forge/main/image/NEWS trunk/octave-forge/main/image/inst/im2double.m Modified: trunk/octave-forge/main/image/NEWS =================================================================== --- trunk/octave-forge/main/image/NEWS 2012-04-11 13:34:25 UTC (rev 10188) +++ trunk/octave-forge/main/image/NEWS 2012-04-11 14:08:27 UTC (rev 10189) @@ -43,6 +43,7 @@ bweuler imhist conndef + im2double isbw isgray isrgb Modified: trunk/octave-forge/main/image/inst/im2double.m =================================================================== --- trunk/octave-forge/main/image/inst/im2double.m 2012-04-11 13:34:25 UTC (rev 10188) +++ trunk/octave-forge/main/image/inst/im2double.m 2012-04-11 14:08:27 UTC (rev 10189) @@ -28,15 +28,16 @@ ## Input checking if (nargin < 1) print_usage(); - endif - if (!isgray(im1) && !isrgb(im1)) + elseif (!isgray(im1) && !isrgb(im1) && !isbw(im1)) error("im2double: input must be an image"); endif - + ## Take action depending on the class of the data switch (class(im1)) case "double" im2 = im1; + case "logical" + im2 = double(im1); case "uint8" im2 = double(im1) / 255; case "uint16" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jpi...@us...> - 2012-04-11 13:34:36
|
Revision: 10188 http://octave.svn.sourceforge.net/octave/?rev=10188&view=rev Author: jpicarbajal Date: 2012-04-11 13:34:25 +0000 (Wed, 11 Apr 2012) Log Message: ----------- linear-algebra: nmf_bpas ready to deliver. Modified Paths: -------------- trunk/octave-forge/main/linear-algebra/devel/nmf_bpas.m Modified: trunk/octave-forge/main/linear-algebra/devel/nmf_bpas.m =================================================================== --- trunk/octave-forge/main/linear-algebra/devel/nmf_bpas.m 2012-04-11 10:02:51 UTC (rev 10187) +++ trunk/octave-forge/main/linear-algebra/devel/nmf_bpas.m 2012-04-11 13:34:25 UTC (rev 10188) @@ -1,98 +1,104 @@ -%% Copyright (c) 2012 by Jingu Kim and Haesun Park <ji...@cc...> -%% -%% This program 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 -%% any later version. -%% -%% This program 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 this program. If not, see <http://www.gnu.org/licenses/>. +## Copyright (c) 2012 by Jingu Kim and Haesun Park <ji...@cc...> +## +## This program 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 +## any later version. +## +## This program 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 this program. If not, see <http://www.gnu.org/licenses/>. -% Nonnegative Matrix Factorization by Alternating Nonnegativity Constrained Least Squares -% using Block Principal Pivoting/Active Set method -% -% This software solves one the following problems: given A and k, find W and H such that -% (1) minimize 1/2 * || A-WH ||_F^2 -% (2) minimize 1/2 * ( || A-WH ||_F^2 + alpha * || W ||_F^2 + beta * || H ||_F^2 ) -% (3) minimize 1/2 * ( || A-WH ||_F^2 + alpha * || W ||_F^2 + beta * (sum_(i=1)^n || H(:,i) ||_1^2 ) ) -% where W>=0 and H>=0 elementwise. -% -% Reference: -% [1] For using this software, please cite: -% Jingu Kim and Haesun Park, Toward Faster Nonnegative Matrix Factorization: A New Algorithm and Comparisons, -% In Proceedings of the 2008 Eighth IEEE International Conference on Data Mining (ICDM'08), 353-362, 2008 -% [2] If you use 'nnls_solver'='as' (see below), please cite: -% Hyunsoo Kim and Haesun Park, Nonnegative Matrix Factorization Based on Alternating Nonnegativity Constrained Least Squares and Active Set Method, -% SIAM Journal on Matrix Analysis and Applications, 2008, 30, 713-730 -% -% Written by Jingu Kim (ji...@cc...) -% Copyright 2008-2009 by Jingu Kim and Haesun Park, -% School of Computational Science and Engineering, -% Georgia Institute of Technology -% -% Check updated code at http://www.cc.gatech.edu/~jingu -% Please send bug reports, comments, or questions to Jingu Kim. -% This code comes with no guarantee or warranty of any kind. -% -% Last modified Feb-20-2010 -% -% <Inputs> -% A : Input data matrix (m x n) -% k : Target low-rank -% -% (Below are optional arguments: can be set by providing name-value pairs) -% TYPE : 'plain' to use formulation (1) -% 'regularized' to use formulation (2) -% 'sparse' to use formulation (3) -% Default is 'regularized', which is recommended for quick application testing unless 'sparse' or 'plain' is explicitly needed. -% If sparsity is needed for 'W' factor, then apply this function for the transpose of 'A' with formulation (3). -% Then, exchange 'W' and 'H' and obtain the transpose of them. -% Imposing sparsity for both factors is not recommended and thus not included in this software. -% NNLS_SOLVER : 'bp' to use the algorithm in [1] -% 'as' to use the algorithm in [2] -% Default is 'bp', which is in general faster. -% ALPHA : Parameter alpha in the formulation (2) or (3). -% Default is the average of all elements in A. No good justfication for this default value, and you might want to try other values. -% BETA : Parameter beta in the formulation (2) or (3). -% Default is the average of all elements in A. No good justfication for this default value, and you might want to try other values. -% MAX_ITER : Maximum number of iterations. Default is 100. -% MIN_ITER : Minimum number of iterations. Default is 20. -% MAX_TIME : Maximum amount of time in seconds. Default is 100,000. -% W_INIT : (m x k) initial value for W. -% H_INIT : (k x n) initial value for H. -% TOL : Stopping tolerance. Default is 1e-3. If you want to obtain a more accurate solution, decrease TOL and increase MAX_ITER at the same time. -% VERBOSE : 0 (default) - No debugging information is collected. -% 1 (debugging purpose) - History of computation is returned by 'HIS' variable. -% 2 (debugging purpose) - History of computation is additionally printed on screen. -% <Outputs> -% W : Obtained basis matrix (m x k) -% H : Obtained coefficients matrix (k x n) -% iter : Number of iterations -% HIS : (debugging purpose) History of computation -% <Usage Examples> -% nmf(A,10) -% nmf(A,20,'verbose',2) -% nmf(A,30,'verbose',2,'nnls_solver','as') -% nmf(A,5,'verbose',2,'type','sparse') -% nmf(A,60,'verbose',1,'type','plain','w_init',rand(m,k)) -% nmf(A,70,'verbose',2,'type','sparse','nnls_solver','bp','alpha',1.1,'beta',1.3) +## -*- texinfo -*- +## @deftypefn {Function File} {[@var{W}, @var{H}, @var{iter}, @var{HIS}] = } nmf_bpas (@var{A}, @var{k}) +## Nonnegative Matrix Factorization by Alternating Nonnegativity Constrained Least Squares +## using Block Principal Pivoting/Active Set method. +## +## This function solves one the following problems: given @var{A} and @var{k}, find @var{W} and @var{H} such that +## (1) minimize 1/2 * || @var{A}-@var{W}@var{H} ||_F^2 +## (2) minimize 1/2 * ( || @var{A}-@var{W}@var{H} ||_F^2 + alpha * || @var{W} ||_F^2 + beta * || @var{H} ||_F^2 ) +## (3) minimize 1/2 * ( || @var{A}-@var{W}@var{H} ||_F^2 + alpha * || @var{W} ||_F^2 + beta * (sum_(i=1)^n || @var{H}(:,i) ||_1^2 ) ) +## where @var{W}>=0 and @var{H}>=0 elementwise. +## The input arguments are @var{A} : Input data matrix (m x n) and @var{k} : Target low-rank. +## +## +## @strong{Optional Inputs} +## @table @samp +## @item Type : Default is 'regularized', which is recommended for quick application testing unless 'sparse' or 'plain' is explicitly needed. If sparsity is needed for 'W' factor, then apply this function for the transpose of 'A' with formulation (3). Then, exchange 'W' and 'H' and obtain the transpose of them. Imposing sparsity for both factors is not recommended and thus not included in this software. +## @table @asis +## @item 'plain' to use formulation (1) +## @item 'regularized' to use formulation (2) +## @item 'sparse' to use formulation (3) +## @end table +## +## @item NNLSSolver : Default is 'bp', which is in general faster. +## @table @asis +## item 'bp' to use the algorithm in [1] +## item 'as' to use the algorithm in [2] +## @end table +## +## @item Alpha : Parameter alpha in the formulation (2) or (3). Default is the average of all elements in A. No good justfication for this default value, and you might want to try other values. +## @item Beta : Parameter beta in the formulation (2) or (3). +## Default is the average of all elements in A. No good justfication for this default value, and you might want to try other values. +## @item MaxIter : Maximum number of iterations. Default is 100. +## @item MinIter : Minimum number of iterations. Default is 20. +## @item MaxTime : Maximum amount of time in seconds. Default is 100,000. +## @item Winit : (m x k) initial value for W. +## @item Hinit : (k x n) initial value for H. +## @item Tol : Stopping tolerance. Default is 1e-3. If you want to obtain a more accurate solution, decrease TOL and increase MAX_ITER at the same time. +## @item Verbose : +## @table @asis +## @item 0 (default) - No debugging information is collected.@* +## @item 1 (debugging purpose) - History of computation is returned by 'HIS' variable. +## @item 2 (debugging purpose) - History of computation is additionally printed on screen. +## @end table +## @end table +## +## @strong{Outputs} +## @table @samp +## @item W : Obtained basis matrix (m x k) +## @item H : Obtained coefficients matrix (k x n) +## @item iter : Number of iterations +## @item HIS : (debugging purpose) History of computation +## @end table +## +## Usage Examples: +## @example +## nmf(A,10) +## nmf(A,20,'verbose',2) +## nmf(A,30,'verbose',2,'nnls_solver','as') +## nmf(A,5,'verbose',2,'type','sparse') +## nmf(A,60,'verbose',1,'type','plain','w_init',rand(m,k)) +## nmf(A,70,'verbose',2,'type','sparse','nnls_solver','bp','alpha',1.1,'beta',1.3) +## @end example +## +## References: +## [1] For using this software, please cite:@* +## Jingu Kim and Haesun Park, Toward Faster Nonnegative Matrix Factorization: A New Algorithm and Comparisons,@* +## In Proceedings of the 2008 Eighth IEEE International Conference on Data Mining (ICDM'08), 353-362, 2008@* +## [2] If you use 'nnls_solver'='as' (see below), please cite:@* +## Hyunsoo Kim and Haesun Park, Nonnegative Matrix Factorization Based @* +## on Alternating Nonnegativity Constrained Least Squares and Active Set Method, @* +## SIAM Journal on Matrix Analysis and Applications, 2008, 30, 713-730 +## +## Check original code at @url{http://www.cc.gatech.edu/~jingu} +## +## @seealso{nmf_pg} +## @end deftypefn ## 2012 - Modified and adapted to Octave 3.6.1 by ## Juan Pablo Carbajal <car...@if...> # TODO -# - Use inputParser for options. -# - Write docstring. -# - Write demos using example files. # - Format code. # - Vectorize loops. function [W, H, iter, HIS] = nmf_bpas (A, k , varargin) + page_screen_output (0, "local"); [m,n] = size(A); ST_RULE = 1; @@ -109,10 +115,10 @@ parser = addParamValue (parser,'MaxTime', 1e3, @(x)x>0); parser = addParamValue (parser,'Verbose', false); - val_type = @(x,c) ischar(x) && any(strcmpi(x,c); + val_type = @(x,c) ischar (x) && any (strcmpi (x,c)); parser = addParamValue (parser,'Type', 'regularized', ... @(x)val_type (x,{'regularized', 'sparse','plain'})); - parser = addParamValue (parser,'NNLSSolver', 'bp', , ... + parser = addParamValue (parser,'NNLSSolver', 'bp', ... @(x)val_type (x,{'bp', 'as'})); parser = parse(parser,varargin{:}); @@ -178,13 +184,15 @@ HIS(1,[1:5])=0; ver.initGrNormW = initGrNormW; ver.initGrNormH = initGrNormH; - ver.initNorm = initNorm; HIS(1,6)=ver.initNorm; - ver.SC1 = initSCs(1); HIS(1,7)=ver.SC1; - ver.SC2 = initSCs(2); HIS(1,8)=ver.SC2; - ver.SC3 = initSCs(3); HIS(1,9)=ver.SC3; - ver.W_density = length(find(W>0))/(m*k); HIS(1,10)=ver.W_density; - ver.H_density = length(find(H>0))/(n*k); HIS(1,11)=ver.H_density; - if par.verbose == 2, display(ver);, end + ver.initNorm = initNorm; HIS(1,6) = ver.initNorm; + ver.SC1 = initSCs(1); HIS(1,7) = ver.SC1; + ver.SC2 = initSCs(2); HIS(1,8) = ver.SC2; + ver.SC3 = initSCs(3); HIS(1,9) = ver.SC3; + ver.W_density = length(find(W>0))/(m*k); HIS(1,10) = ver.W_density; + ver.H_density = length(find(H>0))/(n*k); HIS(1,11) = ver.H_density; + if par.verbose == 2 + disp (ver); + end tPrev = cputime; end @@ -214,7 +222,7 @@ if par.verbose % collect information for analysis/debugging elapsed = cputime-tPrev; tTotal = tTotal + elapsed; - ver = 0; + ver = []; idx = iter+1; %---(1)------(2)--------(3)--------(4)--------(5)---------(6)----------(7)------(8)-----(9)-------(10)--------------(11)------- % iter # | elapsed | totalTime | subIterW | subIterH | rel. obj.(%) | NM_GRAD | GRAD | DELTA | W density (%) | H density (%) @@ -240,7 +248,9 @@ break; elseif (SC/initSC <= par.tol) SCconv = SCconv + 1; - if (SCconv >= SC_COUNT), break;, end + if (SCconv >= SC_COUNT) + break; + end else SCconv = 0; end @@ -606,11 +616,11 @@ Z = zeros(size(AtB)); [n,k1] = size(PassSet); - %% Fixed on Aug-12-2009 + ## Fixed on Aug-12-2009 if k1==1 Z(PassSet)=AtA(PassSet,PassSet)\AtB(PassSet); else - %% Fixed on Aug-12-2009 + ## Fixed on Aug-12-2009 % The following bug was identified by investigating a bug report by Hanseung Lee. [sortedPassSet,sortIx] = sortrows(PassSet'); breaks = any(diff(sortedPassSet)'); @@ -629,3 +639,73 @@ end end endfunction + +%!shared m, n, k, A +%! m = 30; +%! n = 20; +%! k = 10; +%! A = rand(m,n); + +%!test +%! [W,H,iter,HIS]=nmf_bpas(A,k); + +%!test +%! [W,H,iter,HIS]=nmf_bpas(A,k,'verbose',2); + +%!test +%! [W,H,iter,HIS]=nmf_bpas(A,k,'verbose',1,'nnls_solver','as'); + +%!test +%! [W,H,iter,HIS]=nmf_bpas(A,k,'verbose',1,'type','sparse'); + +%!test +%! [W,H,iter,HIS]=nmf_bpas(A,k,'verbose',1,'type','sparse','nnls_solver','bp','alpha',1.1,'beta',1.3); + +%!test +%! [W,H,iter,HIS]=nmf_bpas(A,k,'verbose',2,'type','plain','w_init',rand(m,k)); + +%!demo +%! m = 300; +%! n = 200; +%! k = 10; +%! +%! W_org = rand(m,k);, W_org(rand(m,k)>0.5)=0; +%! H_org = rand(k,n);, H_org(rand(k,n)>0.5)=0; +%! +%! % normalize W, since 'nmf' normalizes W before return +%! norm2=sqrt(sum(W_org.^2,1)); +%! toNormalize = norm2>0; +%! W_org(:,toNormalize) = W_org(:,toNormalize)./repmat(norm2(toNormalize),m,1); +%! +%! A = W_org * H_org; +%! +%! [W,H,iter,HIS]=nmf_bpas (A,k,'type','plain','tol',1e-4); +%! +%! % -------------------- column reordering before computing difference +%! reorder = zeros(k,1); +%! selected = zeros(k,1); +%! for i=1:k +%! for j=1:k +%! if ~selected(j), break, end +%! end +%! minIx = j; +%! +%! for j=minIx+1:k +%! if ~selected(j) +%! d1 = norm(W(:,i)-W_org(:,minIx)); +%! d2 = norm(W(:,i)-W_org(:,j)); +%! if (d2<d1) +%! minIx = j; +%! end +%! end +%! end +%! reorder(i) = minIx; +%! selected(minIx) = 1; +%! end +%! +%! W_org = W_org(:,reorder); +%! H_org = H_org(reorder,:); +%! % --------------------------------------------------------------------- +%! +%! recovery_error_W = norm(W_org-W)/norm(W_org) +%! recovery_error_H = norm(H_org-H)/norm(H_org) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jpi...@us...> - 2012-04-11 10:27:05
|
Revision: 10186 http://octave.svn.sourceforge.net/octave/?rev=10186&view=rev Author: jpicarbajal Date: 2012-04-11 09:57:29 +0000 (Wed, 11 Apr 2012) Log Message: ----------- system-identitfication: Adding devel of timeseries class Added Paths: ----------- trunk/octave-forge/main/system-identification/devel/@timeseries/ trunk/octave-forge/main/system-identification/devel/@timeseries/get.m trunk/octave-forge/main/system-identification/devel/@timeseries/plot.m trunk/octave-forge/main/system-identification/devel/@timeseries/set.m trunk/octave-forge/main/system-identification/devel/@timeseries/timeseries.m Added: trunk/octave-forge/main/system-identification/devel/@timeseries/get.m =================================================================== --- trunk/octave-forge/main/system-identification/devel/@timeseries/get.m (rev 0) +++ trunk/octave-forge/main/system-identification/devel/@timeseries/get.m 2012-04-11 09:57:29 UTC (rev 10186) @@ -0,0 +1,47 @@ +%% Copyright (c) 2012 Juan Pablo Carbajal <car...@if...> +%% +%% This program 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 +%% any later version. +%% +%% This program 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 this program. If not, see <http://www.gnu.org/licenses/>. + +%% -*- texinfo -*- +%% @deftypefn {Function File} {@var{field} = } get (@var{obj}, @var{fieldname}) +%% Get the value of a field of the timeseries object. +%% +%% If @var{fieldname} is a cell, it returns a structure containing the fields +%% retrieved. +%% +%% @end deftypefn + +function field = get (obj, fieldname) + + if !iscell (fieldname) + fieldname = {fieldname}; + end + + tf = ismember (fieldname, fieldnames(obj)); + not_found = {fieldname{!tf}}; + + if !isempty (not_found) + msg = @(x) warning("Field '%s' not found in object timeseries.\n",x); + cellfun (msg, not_found); + end + + fieldname = {fieldname{tf}}; + func = @(x) getfield (struct (obj), x); + f = cellfun (func, fieldname, 'UniformOutput', false); + field = cell2struct (f, fieldname, 2); + + if numel(fieldname) == 1 + field = field.(fieldname{1}); + end +endfunction Added: trunk/octave-forge/main/system-identification/devel/@timeseries/plot.m =================================================================== --- trunk/octave-forge/main/system-identification/devel/@timeseries/plot.m (rev 0) +++ trunk/octave-forge/main/system-identification/devel/@timeseries/plot.m 2012-04-11 09:57:29 UTC (rev 10186) @@ -0,0 +1,40 @@ +%% Copyright (c) 2012 Juan Pablo Carbajal <car...@if...> +%% +%% This program 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 +%% any later version. +%% +%% This program 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 this program. If not, see <http://www.gnu.org/licenses/>. + +%% -*- texinfo -*- +%% @deftypefn {Function File} {@var{h} = } plot (@var{obj}) +%% Plots the timeseries object. +%% +%% @end deftypefn + +function varargout = plot (obj, varargin) +%% TODO this is a placeholder function + + t = obj.Time; + y = obj.Data; + names = obj.Name; + + hplot = plot (t, y); + axis tight + grid on + hleg = legend (hplot, names); + + h.plot = hplot; + h.legend = hleg; + if nargout == 1 + varargout{1} = h; + end + +endfunction Added: trunk/octave-forge/main/system-identification/devel/@timeseries/set.m =================================================================== --- trunk/octave-forge/main/system-identification/devel/@timeseries/set.m (rev 0) +++ trunk/octave-forge/main/system-identification/devel/@timeseries/set.m 2012-04-11 09:57:29 UTC (rev 10186) @@ -0,0 +1,94 @@ +%% Copyright (c) 2012 Juan Pablo Carbajal <car...@if...> +%% +%% This program 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 +%% any later version. +%% +%% This program 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 this program. If not, see <http://www.gnu.org/licenses/>. + +%% -*- texinfo -*- +%% @deftypefn {Function File} set (@var{obj}, @var{fieldname},@var{value}) +%% @deftypefnx {Function File} set (@var{obj}, @var{fieldname},@var{value},@dots) +%% Set the value of a field of the timeseries object. +%% +%% If @var{fieldname} is a cell so must be @var{value}, it sets the values of +%% all matching fields. +%% +%% The function also accepts property-value pairs. +%% +%% @end deftypefn + +function obj = set (obj, varargin) + + if numel (varargin) == 2 && iscell (varargin{1}) && iscell (varargin{2}) + %% The arguments are two cells, expecting fields and values. + fieldname = varargin{1}; + value = varargin{2}; + else + fieldname = {varargin{1:2:end}}; + value = {varargin{2:2:end}}; + end + + + if numel (fieldname) != numel (value) + error ('timeseries:set:InvalidArgument', ... + 'FIELDS and VALUES must have the same number of elements.'); + end + + tf = ismember (fieldname, fieldnames(obj)); + not_found = {fieldname{!tf}}; + + if !isempty (not_found) + msg = @(x) warning("Field '%s' not found in object timeseries.\n",x); + cellfun (msg, not_found); + end + + fieldname = {fieldname{tf}}; + value = {value{tf}}; + + %% Check data consistency + [tf idx] = ismember ({'Time','Data'},fieldname); + if tf(1) && !tf(2) + if length(value{idx(1)}) != size(obj.Data , 1) + error ('timeseries:set:InvalidArgument', ... + ["Time vector must have lenght equal to the first dimension" ... + "of Data (%d)\n"], ... + size(obj.Data , 1)); + end + elseif !tf(1) && tf(2) + if length(obj.Time) != size(value{idx(2)}, 1) + warning ('timeseries:set:InvalidArgument', ... + ["Data vector of different size as Time vector (%d)." ... + " Time vector will be reseted."], length(obj.Time)); + fieldname{end+1} = 'Time'; + value{end+1} = 0:1:(size(value{idx(2)}, 1)-1); + end + elseif tf(1) && tf(2) + if length(value{idx(1)}) != size(value{idx(2)}, 1) + error ('timeseries:set:InvalidArgument', ... + ["Time vector must have lenght equal to the first dimension" ... + "of Data (%d)\n"], ... + size(value{idx(2)}, 1)); + end + end + + if tf(1) + fieldname{end+1} = 'Length'; + value{end+1} = length(value{idx(1)}); + end + + %% Set values + % Can't avoid the loop with cellfun, cause the handle to cellfun is treated as + % a external function. + for i = 1:numel(fieldname) + obj.(fieldname{i}) = value{i}; + end + +endfunction Added: trunk/octave-forge/main/system-identification/devel/@timeseries/timeseries.m =================================================================== --- trunk/octave-forge/main/system-identification/devel/@timeseries/timeseries.m (rev 0) +++ trunk/octave-forge/main/system-identification/devel/@timeseries/timeseries.m 2012-04-11 09:57:29 UTC (rev 10186) @@ -0,0 +1,119 @@ +## Copyright (c) 2012 Juan Pablo Carbajal <car...@if...> +## +## This program 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. +## +## This program 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 this program; if not, see <http://www.gnu.org/licenses/>. + + +## -*- texinfo -*- +## @deftypefn {Function File} {@var{obj} =} timeseries () +## @deftypefnx {Function File} {@var{obj} =} timeseries (@var{data}) +## @deftypefnx {Function File} {@var{obj} =} timeseries (@var{data},@var{time}) +## @deftypefnx {Function File} {@var{obj} =} timeseries (@dots,@var{Property},@var{Value}) +## Create object of the timeseries class. +## +## If no input argument is provided the object is empty. +## If the @var{data} argument is present, creates the timeseries object using the specified data. +## If @var{data} and @var{time} are provided, creates the timeseries object using the specified data and time. +## Property-value pairs can be specified to set several properties of the object. +## +## @end deftypefn + +function timeseries = timeseries(Data=[],Time=[],varargin) + + timeseries = struct (); + + # --- Parse arguments --- # + parser = inputParser (); + parser.FunctionName = "timeseries"; + parser = addParamValue (parser,'Data', Data, @ismatrix); + parser = addParamValue (parser,'DataInfo', ... + struct ('Unit', '', 'UserData','',... + 'Interpolation', ... + struct ('Fhandle', [], 'Name', 'linear')), ... + @isstruct); + func = @(x) arrayfun ( ... + @(x)sprintf('Series %d',x), 1:size(Data,2), 'UniformOutput', false); + parser = addParamValue (parser,'Name', func(), @iscell); + parser = addParamValue (parser,'Time', Time, @ismatrix); + parser = parse(parser,varargin{:}); + + %% Data + %% Timeseries data, where each data sample corresponds to a specific time + %% The data can be a scalar, a vector, or a multidimensional array. The first + %% dimension of the data must align with Time (this is less general than MATLAB implementation). + %% By default, NA represent missing or unspecified data. + %% Though it is not handled properly yet. + timeseries.Data = parser.Results.Data; + + %% Length + %% Length of the time vector in the timeseries object. Internal use. + timeseries.Length = size (timeseries.Data, 1); + + %% DataInfo + %% Contains fields for storing contextual information about Data: + %% Unit — String that specifies data units + %% Interpolation — A struct that specifies the interpolation method for this + %% timeseries object. + %% Fields of the struct include: + %% Fhandle — Function handle to a user-defined interpolation function. + %% Name — String that specifies the name of the interpolation method. + %% 'linear' is the default. + %% UserData — Any user-defined information entered as a string + timeseries.DataInfo = parser.Results.DataInfo; + + %% Name + %% The timeseries object name entered as a string. This name can differ from + %% the name of the timeseries variable in the workspace. + timeseries.Name = parser.Results.Name; + + %% Time + %% Array of time values. The lenght must coincide with the length of the first + %% dimension of the data. + timeseries.Time = parser.Results.Time; + if isempty (timeseries.Time) + timeseries.Time = 0:1:(timeseries.Length-1); + end + + %% Events + %% Not used. + timeseries.Events = []; + + %% IsTimeFirst + %% Not used + timeseries.IsTimeFirst = []; + + %% Quality + %% Not used + timeseries.Quality = []; + + %% QualityInfo + %% Not used + timeseries.QualityInfo = []; + + %% TimeInfo + %% Not used. + timeseries.TimeInfo = []; + + %% TreatNaNasMissing + %% Not implemented. Logical value that specifies how to treat NA values in Data. + timeseries.TreatNaNasMissing = []; + + %% UserData + %% Not used. + timeseries.UserData = []; + + timeseries = class (timeseries, 'timeseries'); + +endfunction + +%!test This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jpi...@us...> - 2012-04-11 10:03:01
|
Revision: 10187 http://octave.svn.sourceforge.net/octave/?rev=10187&view=rev Author: jpicarbajal Date: 2012-04-11 10:02:51 +0000 (Wed, 11 Apr 2012) Log Message: ----------- system-identification: Adding TODO to devel Added Paths: ----------- trunk/octave-forge/main/system-identification/devel/@timeseries/TODO Added: trunk/octave-forge/main/system-identification/devel/@timeseries/TODO =================================================================== --- trunk/octave-forge/main/system-identification/devel/@timeseries/TODO (rev 0) +++ trunk/octave-forge/main/system-identification/devel/@timeseries/TODO 2012-04-11 10:02:51 UTC (rev 10187) @@ -0,0 +1,48 @@ +synchronize +Synchronize and resample two timeseries objects using a common time vector. + +getinterpmethod +Get the interpolation method for a timeseries object. + +resample +Select or interpolate data in a timeseries object using a new time vector. + +setinterpmethod +Set interpolation method for a timeseries object. + +addsample +Add a data sample to a timeseries object. + +delsample +Delete a sample from a timeseries object. + +append +Concatenate timeseries objects in the time dimension. + +detrend +Subtract the mean or best-fit line and remove all NaNs from time-series data. + +filter +Shape frequency content of time-series data using a 1-D digital filter. + +getdatasamples +Extract a subset of data samples from an existing timeseries object into an array using a subscripted indexed array. + +getsamples +Extract a subset of data samples from an existing timeseries object into a new timeseries object using a subscript indexed array. + +getsampleusingtime +Extract data samples from an existing timeseries object into a new timeseries object based on specified start and end time values. + +idealfilter +Apply an ideal pass or notch (noncausal) filter to a timeseries object. + +setuniformtime +Assign uniform time vector to timeseries object. + +transpose +Transpose a timeseries object. + +ctranspose +Transpose a timeseries object. + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2012-04-11 08:48:01
|
Revision: 10185 http://octave.svn.sourceforge.net/octave/?rev=10185&view=rev Author: paramaniac Date: 2012-04-11 08:47:55 +0000 (Wed, 11 Apr 2012) Log Message: ----------- control-devel: fix corner case in diff method (experiments with only 1 sample) Modified Paths: -------------- trunk/octave-forge/extra/control-devel/inst/@iddata/diff.m Modified: trunk/octave-forge/extra/control-devel/inst/@iddata/diff.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/@iddata/diff.m 2012-04-11 07:20:44 UTC (rev 10184) +++ trunk/octave-forge/extra/control-devel/inst/@iddata/diff.m 2012-04-11 08:47:55 UTC (rev 10185) @@ -32,7 +32,7 @@ print_usage (); endif - dat.y = cellfun (@(y) diff (y, k), dat.y, "uniformoutput", false); - dat.u = cellfun (@(u) diff (u, k), dat.u, "uniformoutput", false); + dat.y = cellfun (@(y) diff (y, k, 1), dat.y, "uniformoutput", false); + dat.u = cellfun (@(u) diff (u, k, 1), dat.u, "uniformoutput", false); -endfunction \ No newline at end of file +endfunction This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2012-04-11 07:20:55
|
Revision: 10184 http://octave.svn.sourceforge.net/octave/?rev=10184&view=rev Author: paramaniac Date: 2012-04-11 07:20:44 +0000 (Wed, 11 Apr 2012) Log Message: ----------- control-devel: fix corner case in detrend method (set experiments with only 1 sample to zero) Modified Paths: -------------- trunk/octave-forge/extra/control-devel/inst/@iddata/detrend.m Added Paths: ----------- trunk/octave-forge/extra/control-devel/devel/test_frd2iddata.m Added: trunk/octave-forge/extra/control-devel/devel/test_frd2iddata.m =================================================================== --- trunk/octave-forge/extra/control-devel/devel/test_frd2iddata.m (rev 0) +++ trunk/octave-forge/extra/control-devel/devel/test_frd2iddata.m 2012-04-11 07:20:44 UTC (rev 10184) @@ -0,0 +1,15 @@ +sys = ss (-2,3,4,5) + +H = idfrd (sys) + +H.frequency +H.responsedata + + +dat = iddata (H) +dat.y +H.responsedata + +dat.u % alles 1! +dat.frequency +H.frequency \ No newline at end of file Modified: trunk/octave-forge/extra/control-devel/inst/@iddata/detrend.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/@iddata/detrend.m 2012-04-11 05:23:52 UTC (rev 10183) +++ trunk/octave-forge/extra/control-devel/inst/@iddata/detrend.m 2012-04-11 07:20:44 UTC (rev 10184) @@ -38,9 +38,18 @@ error ("iddata: detrend: second argument must be a positve integer"); endif + [n, p, m] = size (dat); + dat.y = cellfun (@(y) detrend (y, ord), dat.y, "uniformoutput", false); dat.u = cellfun (@(u) detrend (u, ord), dat.u, "uniformoutput", false); + ## if a MIMO experiment has only 1 sample, detrend works + ## row-wisely instead of column-wisely + ## therefore we set these experiments to zero + idx = (n == 1); + dat.y(idx) = zeros (1, p); + dat.u(idx) = zeros (1, m); + endfunction This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2012-04-11 05:23:58
|
Revision: 10183 http://octave.svn.sourceforge.net/octave/?rev=10183&view=rev Author: paramaniac Date: 2012-04-11 05:23:52 +0000 (Wed, 11 Apr 2012) Log Message: ----------- control-devel: fix borderline case in fft method, add test Modified Paths: -------------- trunk/octave-forge/extra/control-devel/inst/@iddata/fft.m trunk/octave-forge/extra/control-devel/inst/test_devel.m Modified: trunk/octave-forge/extra/control-devel/inst/@iddata/fft.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/@iddata/fft.m 2012-04-09 20:16:48 UTC (rev 10182) +++ trunk/octave-forge/extra/control-devel/inst/@iddata/fft.m 2012-04-11 05:23:52 UTC (rev 10183) @@ -46,20 +46,21 @@ error ("iddata: fft: second argument invalid"); endif - dat.y = cellfun (@(y, n) fft (y, n)(1:fix(n/2)+1, :) / sqrt (n), dat.y, n, "uniformoutput", false); - dat.u = cellfun (@(u, n) fft (u, n)(1:fix(n/2)+1, :) / sqrt (n), dat.u, n, "uniformoutput", false); + dat.y = cellfun (@(y, n) fft (y, n, 1)(1:fix(n/2)+1, :) / sqrt (n), dat.y, n, "uniformoutput", false); + dat.u = cellfun (@(u, n) fft (u, n, 1)(1:fix(n/2)+1, :) / sqrt (n), dat.u, n, "uniformoutput", false); + ## fft (x, n, dim=1) because x could be a row vector (n=1) - dat.w = cellfun (@(n, tsam) (0:fix(n/2)).' * (2*pi/tsam/n), n, dat.tsam, "uniformoutput", false); + dat.w = cellfun (@(n, tsam) (0:fix(n/2)).' * (2*pi/abs(tsam)/n), n, dat.tsam, "uniformoutput", false); + ## abs(tsam) because of -1 for undefined sampling times dat.timedomain = false; endfunction -%!shared DATD, Z -%! DAT = iddata ({[(1:10).', (1:2:20).'], [(10:-1:1).', (20:-2:1).']}, {[(41:50).', (46:55).'], [(61:70).', (-66:-1:-75).']}); -%! DATD = detrend (DAT, "linear"); -%! Z = zeros (10, 2); -%!assert (DATD.y{1}, Z, 1e-10); -%!assert (DATD.y{2}, Z, 1e-10); -%!assert (DATD.u{1}, Z, 1e-10); -%!assert (DATD.u{2}, Z, 1e-10); +%!shared DATD, Y, U +%! Y = 1:10; +%! U = 20:-2:1; +%! DAT = iddata (Y, U); +%! DATD = fft (DAT); +%!assert (DATD.y{1}, Y, 1e-10); +%!assert (DATD.u{1}, U, 1e-10); Modified: trunk/octave-forge/extra/control-devel/inst/test_devel.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/test_devel.m 2012-04-09 20:16:48 UTC (rev 10182) +++ trunk/octave-forge/extra/control-devel/inst/test_devel.m 2012-04-11 05:23:52 UTC (rev 10183) @@ -2,3 +2,4 @@ test @iddata/iddata test @iddata/cat test @iddata/detrend +test @iddata/fft This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <prn...@us...> - 2012-04-09 20:16:54
|
Revision: 10182 http://octave.svn.sourceforge.net/octave/?rev=10182&view=rev Author: prnienhuis Date: 2012-04-09 20:16:48 +0000 (Mon, 09 Apr 2012) Log Message: ----------- Updated to latest status Modified Paths: -------------- trunk/octave-forge/main/io/NEWS Modified: trunk/octave-forge/main/io/NEWS =================================================================== --- trunk/octave-forge/main/io/NEWS 2012-04-09 19:57:08 UTC (rev 10181) +++ trunk/octave-forge/main/io/NEWS 2012-04-09 20:16:48 UTC (rev 10182) @@ -1,5 +1,16 @@ Summary of important user-visible changes for releases of the io package +post-1.0.18 (in SVN only) + +** Bug fixes: +--- getusedrange subfunc getusedrange_jod: str2num applied to indices rather + than the substring. Must have been there for > 2 years, only surfaced + with jopendocument v 1.3b1 + +** Compatible with jOpenDocument version 1.3b1 + +** Compatible with Apache POI 3.8 final + =============================================================================== io-1.0.18 Release Date: 2012-03-22 Release Manager: Philip Nienhuis =============================================================================== @@ -30,7 +41,7 @@ have worked properly for two years (!) ** Fixed support for odfdom v.0.8.7 (ODS). Note: the OTK interface only works - well with xercesImpl.jar 2.9.1 (Sep 14, 2009) + well with xercesImpl.jar 2.9.1 (Sep 14, 2009) ** Many small bug fixes & documentation updated to actual functionality. @@ -103,3 +114,5 @@ for older Octave versions (< 3.4.0) you can install io-1.0.15 using the -nodeps flag. You'll then loose the old and buggy textread and csv/dlm-read/write functions but I'd consider that as no big loss. + + <please scroll up/back to see rest of io NEWS> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <prn...@us...> - 2012-04-09 19:57:14
|
Revision: 10181 http://octave.svn.sourceforge.net/octave/?rev=10181&view=rev Author: prnienhuis Date: 2012-04-09 19:57:08 +0000 (Mon, 09 Apr 2012) Log Message: ----------- Update - jOpenDocument 1.3b1 also supported Modified Paths: -------------- trunk/octave-forge/main/io/doc/READ-ODS.html Modified: trunk/octave-forge/main/io/doc/READ-ODS.html =================================================================== --- trunk/octave-forge/main/io/doc/READ-ODS.html 2012-04-09 19:54:16 UTC (rev 10180) +++ trunk/octave-forge/main/io/doc/READ-ODS.html 2012-04-09 19:57:08 UTC (rev 10181) @@ -18,7 +18,7 @@ Copyright \xA9 2009 - 2012 Philip Nienhuis <prnienhuis at users.sf.net></font></font> </p> <p align="center"><font face="Arial, sans-serif"><font size="2"> - This version February 26, 2012</font></font> + This version April 09, 2012</font></font> </p> <p><font face="Arial, sans-serif"><font size="2"> <i>(ODS = Open Document Format spreadsheet data format, used by e.g., OpenOffice.org.)</i></font></font> @@ -296,7 +296,7 @@ capacity) but that doesn't help).</font></font></p></li></ul> <dl> <dt><p><font face="Arial, sans-serif"><font size="2">NOT fixed in - version 1.2 final:</font></font></p></dt></dl> + version 1.2 final nor 1.3b1:</font></font></p></dt></dl> <ul> <li><p align="left"> <font face="Arial, sans-serif"><font size="2">jOpenDocument doesn't @@ -550,7 +550,7 @@ <font face="Arial, sans-serif"><font size="2">oct2ods.m (revision 7159)</font></font></li></ul> <p><font face="Arial, sans-serif"><font size="2">Enjoy!</font></font></p><p align="center"><font face="Arial, sans-serif"><font size="2">Philip - Nienhuis, February 26, 2012</font></font></p><dl><dd><p align="center"> + Nienhuis, April 09, 2012</font></font></p><dl><dd><p align="center"> <br> </p></dd></dl> </body></html> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <prn...@us...> - 2012-04-09 19:54:22
|
Revision: 10180 http://octave.svn.sourceforge.net/octave/?rev=10180&view=rev Author: prnienhuis Date: 2012-04-09 19:54:16 +0000 (Mon, 09 Apr 2012) Log Message: ----------- Bugfix in JOD section (rowrepcnt - str2num error) Modified Paths: -------------- trunk/octave-forge/main/io/inst/getusedrange.m Modified: trunk/octave-forge/main/io/inst/getusedrange.m =================================================================== --- trunk/octave-forge/main/io/inst/getusedrange.m 2012-04-09 12:56:37 UTC (rev 10179) +++ trunk/octave-forge/main/io/inst/getusedrange.m 2012-04-09 19:54:16 UTC (rev 10180) @@ -1,4 +1,4 @@ -## Copyright (C) 2010,2011 Philip Nienhuis <pr....@us...> +## Copyright (C) 2010,2011,2012 Philip Nienhuis <pr....@us...> ## ## This program 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 @@ -67,7 +67,7 @@ ## 2011-09-08 Style & layout updates ## 2012-01-26 Fixed "seealso" help string ## -## Last subfunc update: 2012-03-02 (UNO) +## Last subfunc update: 2012-04-09 (JOD) function [ trow, lrow, lcol, rcol ] = getusedrange (spptr, ii) @@ -95,7 +95,7 @@ endfunction -## Copyright (C) 2010,2011 Philip Nienhuis, pr.nienhuis -at- users.sf.net +## Copyright (C) 2010,2011,2012 Philip Nienhuis, pr.nienhuis -at- users.sf.net ## ## This program 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 @@ -118,7 +118,7 @@ ## 2010-08-24 Support for odfdom (ODF Toolkit) 0.8.6 checked; we still need ## => TableTable API because 0.8.6 is fooled by empty lowermost ## filler rows comprising number-rows-repeated table attribute :-( -## " Indentation changed from tab to double space +## '' Indentation changed from tab to double space ## 2010-11-13 Catched jOpenDocument bug (1.2bx) where string cells have no office:value-type ## attrib set (by JOD). Somehow OTK is more robust as it catches these cells; ## Currently this fix is just commented. @@ -211,7 +211,7 @@ endfunction -## Copyright (C) 2010 Philip Nienhuis <prnienhuis -aT- users.sf.net> +## Copyright (C) 2010,2011,2012 Philip Nienhuis <prnienhuis -aT- users.sf.net> ## ## This program 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 @@ -236,6 +236,7 @@ ## 2010-08-12 Little textual adaptations ## 2010-11-13 Catched jOpenDocument bug (1.2bx) where string cells have no office:value-type ## '' attrb set (by JOD). Somehow OTK is more robust as it catches these cells +## 2012-04-09 Fixed rowrepcnt (str2num not applied to tablerow) function [ trow, brow, lcol, rcol ] = getusedrange_jod (ods, wsh) @@ -275,7 +276,7 @@ rowrept = strfind (tablerow(1:rowend), 'number-rows-repeated'); if (~isempty (rowrept)) [st, en] = regexp (tablerow(rowrept:min (rowend, rowrept+30)), '\d+'); - rowrepcnt += str2num (rowrept+st-1:min (rowend, rowrept+en-1)) - 1; + rowrepcnt += str2num (tablerow(rowrept+st-1:min (rowend, rowrept+en-1))) - 1; endif # Search table-cells. table-c is a table-covered-cell that is considered empty @@ -352,7 +353,7 @@ endfunction -## Copyright (C) 2011 Philip Nienhuis +## Copyright (C) 2011,2012 Philip Nienhuis ## ## This program 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 @@ -432,7 +433,7 @@ endfunction -## Copyright (C) 2010 Philip Nienhuis +## Copyright (C) 2010,2011,2012 Philip Nienhuis ## ## This program 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 @@ -482,7 +483,7 @@ endfunction -## Copyright (C) 2010 Philip Nienhuis, prnienhuis at users.sf.net +## Copyright (C) 2010,2011,2012 Philip Nienhuis, prnienhuis at users.sf.net ## ## This program 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 @@ -537,7 +538,7 @@ endfunction -## Copyright (C) 2010 Philip Nienhuis, prnienhuis at users.sf.net +## Copyright (C) 2010,2011,2012 Philip Nienhuis, prnienhuis at users.sf.net ## ## This program 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 @@ -591,7 +592,7 @@ endfunction -## Copyright (C) 2010 Philip Nienhuis, <prnienhuis at users.sf.net> +## Copyright (C) 2010,2011,2012 Philip Nienhuis, <prnienhuis at users.sf.net> ## ## This program 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 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mma...@us...> - 2012-04-09 12:56:46
|
Revision: 10179 http://octave.svn.sourceforge.net/octave/?rev=10179&view=rev Author: mmarzolla Date: 2012-04-09 12:56:37 +0000 (Mon, 09 Apr 2012) Log Message: ----------- fixed documentation Modified Paths: -------------- trunk/octave-forge/main/queueing/doc/queueingnetworks.txi Modified: trunk/octave-forge/main/queueing/doc/queueingnetworks.txi =================================================================== --- trunk/octave-forge/main/queueing/doc/queueingnetworks.txi 2012-04-09 12:55:37 UTC (rev 10178) +++ trunk/octave-forge/main/queueing/doc/queueingnetworks.txi 2012-04-09 12:56:37 UTC (rev 10179) @@ -1118,11 +1118,10 @@ The @code{queueing} package provides a high-level function @code{qnsolve} for analyzing QN models. @code{qnsolve} takes as input a high-level description of the queueing model, and delegates the -actual solution of the model to one of the lower-level function -described in the previous section. @code{qnsolve} supports single or -multiclass models, but at the moment only product-form networks can be -analyzed. For non product-form networks @xref{Algorithms for non -Product-Form QNs}. +actual solution of the model to one of the lower-level +function. @code{qnsolve} supports single or multiclass models, but at +the moment only product-form networks can be analyzed. For non +product-form networks @xref{Algorithms for non Product-Form QNs}. @code{qnsolve} accepts two input parameters. The first one is the list of nodes, encoded as an Octave @emph{cell array}. The second parameter @@ -1174,7 +1173,6 @@ @GETDEMO{qnsolve,1} @end example - @c @c @c This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mma...@us...> - 2012-04-09 12:55:47
|
Revision: 10178 http://octave.svn.sourceforge.net/octave/?rev=10178&view=rev Author: mmarzolla Date: 2012-04-09 12:55:37 +0000 (Mon, 09 Apr 2012) Log Message: ----------- modifications Removed Paths: ------------- trunk/octave-forge/main/queueing/doc/queueing.html trunk/octave-forge/main/queueing/doc/queueing.pdf Deleted: trunk/octave-forge/main/queueing/doc/queueing.html =================================================================== --- trunk/octave-forge/main/queueing/doc/queueing.html 2012-04-09 12:50:58 UTC (rev 10177) +++ trunk/octave-forge/main/queueing/doc/queueing.html 2012-04-09 12:55:37 UTC (rev 10178) @@ -1,6038 +0,0 @@ -<html lang="en"> -<head> -<title>queueing</title> -<meta http-equiv="Content-Type" content="text/html"> -<meta name="description" content="User manual for the queueing toolbox, a GNU Octave package for queueing networks and Markov chains analysis. This package supports single-station queueing systems, queueing networks and Markov chains. The queueing toolbox implements, among others, the Mean Value Analysis (MVA) and convolution algorithms for product-form queueing networks. Transient and steady-state analysis of Markov chains is also implemented."> -<meta name="generator" content="makeinfo 4.13"> -<link title="Top" rel="top" href="#Top"> -<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> -<meta http-equiv="Content-Style-Type" content="text/css"> -<style type="text/css"><!-- - pre.display { font-family:inherit } - pre.format { font-family:inherit } - pre.smalldisplay { font-family:inherit; font-size:smaller } - pre.smallformat { font-family:inherit; font-size:smaller } - pre.smallexample { font-size:smaller } - pre.smalllisp { font-size:smaller } - span.sc { font-variant:small-caps } - span.roman { font-family:serif; font-weight:normal; } - span.sansserif { font-family:sans-serif; font-weight:normal; } ---></style> -</head> -<body> -Copyright © 2008, 2009, 2010, 2011, 2012 Moreno Marzolla. - - <p>Permission is granted to make and distribute verbatim copies of -this manual provided the copyright notice and this permission notice -are preserved on all copies. - - <p>Permission is granted to copy and distribute modified versions of -this manual under the conditions for verbatim copying, provided that -the entire resulting derived work is distributed under the terms of -a permission notice identical to this one. - - <p>Permission is granted to copy and distribute translations of this -manual into another language, under the above conditions for -modified versions. - -<div class="contents"> -<h2>Table of Contents</h2> -<ul> -<li><a name="toc_Top" href="#Top">queueing</a> -<li><a name="toc_Summary" href="#Summary">1 Summary</a> -<ul> -<li><a href="#About-the-Queueing-Toolbox">1.1 About the Queueing Toolbox</a> -<li><a href="#Contributing-Guidelines">1.2 Contributing Guidelines</a> -<li><a href="#Acknowledgements">1.3 Acknowledgements</a> -</li></ul> -<li><a name="toc_Installation" href="#Installation">2 Installing the queueing toolbox</a> -<ul> -<li><a href="#Installation-through-Octave-package-management-system">2.1 Installation through Octave package management system</a> -<li><a href="#Manual-installation">2.2 Manual installation</a> -<li><a href="#Development-sources">2.3 Development sources</a> -<li><a href="#Using-the-queueing-toolbox">2.4 Using the queueing toolbox</a> -</li></ul> -<li><a name="toc_Markov-Chains" href="#Markov-Chains">3 Markov Chains</a> -<ul> -<li><a href="#Discrete_002dTime-Markov-Chains">3.1 Discrete-Time Markov Chains</a> -<ul> -<li><a href="#State-occupancy-probabilities-_0028DTMC_0029">3.1.1 State occupancy probabilities</a> -<li><a href="#Birth_002ddeath-process-_0028DTMC_0029">3.1.2 Birth-death process</a> -<li><a href="#Expected-number-of-visits-_0028DTMC_0029">3.1.3 Expected Number of Visits</a> -<li><a href="#Time_002daveraged-expected-sojourn-times-_0028DTMC_0029">3.1.4 Time-averaged expected sojourn times</a> -<li><a href="#Mean-time-to-absorption-_0028DTMC_0029">3.1.5 Mean Time to Absorption</a> -<li><a href="#First-passage-times-_0028DTMC_0029">3.1.6 First Passage Times</a> -</li></ul> -<li><a href="#Continuous_002dTime-Markov-Chains">3.2 Continuous-Time Markov Chains</a> -<ul> -<li><a href="#State-occupancy-probabilities-_0028CTMC_0029">3.2.1 State occupancy probabilities</a> -<li><a href="#Birth_002ddeath-process-_0028CTMC_0029">3.2.2 Birth-Death Process</a> -<li><a href="#Expected-sojourn-times-_0028CTMC_0029">3.2.3 Expected Sojourn Times</a> -<li><a href="#Time_002daveraged-expected-sojourn-times-_0028CTMC_0029">3.2.4 Time-Averaged Expected Sojourn Times</a> -<li><a href="#Mean-time-to-absorption-_0028CTMC_0029">3.2.5 Mean Time to Absorption</a> -<li><a href="#First-passage-times-_0028CTMC_0029">3.2.6 First Passage Times</a> -</li></ul> -</li></ul> -<li><a name="toc_Single-Station-Queueing-Systems" href="#Single-Station-Queueing-Systems">4 Single Station Queueing Systems</a> -<ul> -<li><a href="#The-M_002fM_002f1-System">4.1 The M/M/1 System</a> -<li><a href="#The-M_002fM_002fm-System">4.2 The M/M/m System</a> -<li><a href="#The-M_002fM_002finf-System">4.3 The M/M/inf System</a> -<li><a href="#The-M_002fM_002f1_002fK-System">4.4 The M/M/1/K System</a> -<li><a href="#The-M_002fM_002fm_002fK-System">4.5 The M/M/m/K System</a> -<li><a href="#The-Asymmetric-M_002fM_002fm-System">4.6 The Asymmetric M/M/m System</a> -<li><a href="#The-M_002fG_002f1-System">4.7 The M/G/1 System</a> -<li><a href="#The-M_002fHm_002f1-System">4.8 The M/H_m/1 System</a> -</li></ul> -<li><a name="toc_Queueing-Networks" href="#Queueing-Networks">5 Queueing Networks</a> -<ul> -<li><a href="#Introduction-to-QNs">5.1 Introduction to QNs</a> -<ul> -<li><a href="#Introduction-to-QNs">5.1.1 Single class models</a> -<li><a href="#Introduction-to-QNs">5.1.2 Multiple class models</a> -<li><a href="#Introduction-to-QNs">5.1.3 Closed Network Example</a> -<li><a href="#Introduction-to-QNs">5.1.4 Open Network Example</a> -</li></ul> -<li><a href="#Algorithms-for-Product_002dForm-QNs">5.2 Algorithms for Product-Form QNs</a> -<ul> -<li><a href="#Algorithms-for-Product_002dForm-QNs">5.2.1 Jackson Networks</a> -<li><a href="#Algorithms-for-Product_002dForm-QNs">5.2.2 The Convolution Algorithm</a> -<li><a href="#Algorithms-for-Product_002dForm-QNs">5.2.3 Open networks</a> -<li><a href="#Algorithms-for-Product_002dForm-QNs">5.2.4 Closed Networks</a> -<li><a href="#Algorithms-for-Product_002dForm-QNs">5.2.5 Mixed Networks</a> -</li></ul> -<li><a href="#Algorithms-for-non-Product_002dForm-QNs">5.3 Algorithms for non Product-Form QNs</a> -<li><a href="#Generic-Algorithms">5.4 Generic Algorithms</a> -<li><a href="#Bounds-on-performance">5.5 Bounds on performance</a> -<li><a href="#Utility-functions">5.6 Utility functions</a> -<ul> -<li><a href="#Utility-functions">5.6.1 Open or closed networks</a> -<li><a href="#Utility-functions">5.6.2 Computation of the visit counts</a> -<li><a href="#Utility-functions">5.6.3 Other utility functions</a> -</li></ul> -</li></ul> -<li><a name="toc_References" href="#References">6 References</a> -<li><a name="toc_Copying" href="#Copying">Appendix A GNU GENERAL PUBLIC LICENSE</a> -<li><a name="toc_Concept-Index" href="#Concept-Index">Concept Index</a> -<li><a name="toc_Function-Index" href="#Function-Index">Function Index</a> -<li><a name="toc_Author-Index" href="#Author-Index">Author Index</a> -</li></ul> -</div> - -<div class="node"> -<a name="Top"></a> -<p><hr> -Next: <a rel="next" accesskey="n" href="#Summary">Summary</a>, -Up: <a rel="up" accesskey="u" href="#dir">(dir)</a> - -</div> - -<h2 class="unnumbered">queueing</h2> - -<p>This manual documents how to install and run the Queueing Toolbox. -It corresponds to version 1.1.0 of the package. - -<!-- --> -<ul class="menu"> -<li><a accesskey="1" href="#Summary">Summary</a> -<li><a accesskey="2" href="#Installation">Installation</a>: Installation of the queueing toolbox. -<li><a accesskey="3" href="#Markov-Chains">Markov Chains</a>: Functions for Markov Chains. -<li><a accesskey="4" href="#Single-Station-Queueing-Systems">Single Station Queueing Systems</a>: Functions for single-station queueing systems. -<li><a accesskey="5" href="#Queueing-Networks">Queueing Networks</a>: Functions for queueing networks. -<li><a accesskey="6" href="#References">References</a>: References -<li><a accesskey="7" href="#Copying">Copying</a>: The GNU General Public License. -<li><a accesskey="8" href="#Concept-Index">Concept Index</a>: An item for each concept. -<li><a accesskey="9" href="#Function-Index">Function Index</a>: An item for each function. -<li><a href="#Author-Index">Author Index</a>: An item for each author. -</ul> - -<!-- --> -<!-- This file has been automatically generated from summary.txi --> -<!-- by proc.m. Do not edit this file, all changes will be lost --> -<!-- *- texinfo -*- --> -<!-- Copyright (C) 2008, 2009, 2010, 2011, 2012 Moreno Marzolla --> -<!-- This file is part of the queueing toolbox, a Queueing Networks --> -<!-- analysis package for GNU Octave. --> -<!-- 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; see the file COPYING. If not, see --> -<!-- <http://www.gnu.org/licenses/>. --> -<div class="node"> -<a name="Summary"></a> -<p><hr> -Next: <a rel="next" accesskey="n" href="#Installation">Installation</a>, -Previous: <a rel="previous" accesskey="p" href="#Top">Top</a>, -Up: <a rel="up" accesskey="u" href="#Top">Top</a> - -</div> - -<h2 class="chapter">1 Summary</h2> - -<ul class="menu"> -<li><a accesskey="1" href="#About-the-Queueing-Toolbox">About the Queueing Toolbox</a>: What is the Queueing Toolbox -<li><a accesskey="2" href="#Contributing-Guidelines">Contributing Guidelines</a>: How to contribute -<li><a accesskey="3" href="#Acknowledgements">Acknowledgements</a> -</ul> - -<div class="node"> -<a name="About-the-Queueing-Toolbox"></a> -<p><hr> -Next: <a rel="next" accesskey="n" href="#Contributing-Guidelines">Contributing Guidelines</a>, -Up: <a rel="up" accesskey="u" href="#Summary">Summary</a> - -</div> - -<h3 class="section">1.1 About the Queueing Toolbox</h3> - -<p>This document describes the <code>queueing</code> toolbox for GNU Octave -(<code>queueing</code> in short). The <code>queueing</code> toolbox, previously -known as <code>qnetworks</code>, is a collection of functions written in GNU -Octave for analyzing queueing networks and Markov -chains. Specifically, <code>queueing</code> contains functions for analyzing -Jackson networks, open, closed or mixed product-form BCMP networks, -and computation of performance bounds. The following algorithms have -been implemented - - <ul> -<li>Convolution for closed, single-class product-form networks -with load-dependent service centers; - - <li>Exact and approximate Mean Value Analysis (MVA) for single and -multiple class product-form closed networks; - - <li>MVA for mixed, multiple class product-form networks -with load-independent service centers; - - <li>Approximate MVA for closed, single-class networks with blocking -(MVABLO algorithm by F. Akyildiz); - - <li>Asymptotic Bounds, Balanced System Bounds and Geometric Bounds; - - </ul> - -<p class="noindent"><code>queueing</code> -provides functions for analyzing the following kind of single-station -queueing systems: - - <ul> -<li>M/M/1 -<li>M/M/m -<li>M/M/\infty -<li>M/M/1/k single-server, finite capacity system -<li>M/M/m/k multiple-server, finite capacity system -<li>Asymmetric M/M/m -<li>M/G/1 (general service time distribution) -<li>M/H_m/1 (Hyperexponential service time distribution) -</ul> - - <p>Functions for Markov chain analysis are also provided: - - <ul> -<li>Birth-death process; -<li>Transient and steady-state occupancy probabilities; -<li>Mean times to absorption; -<li>Expected sojourn times and time-averaged sojourn times; -<li>Mean first passage times; - - </ul> - - <p>The <code>queueing</code> toolbox is distributed under the terms of the GNU -General Public License (GPL), version 3 or later -(see <a href="#Copying">Copying</a>). You are encouraged to share this software with -others, and make this package more useful by contributing additional -functions and reporting problems. See <a href="#Contributing-Guidelines">Contributing Guidelines</a>. - - <p>If you use the <code>queueing</code> toolbox in a technical paper, please -cite it as: - - <blockquote> -Moreno Marzolla, <em>The qnetworks Toolbox: A Software Package for -Queueing Networks Analysis</em>. Khalid Al-Begain, Dieter Fiems and -William J. Knottenbelt, Editors, Proceedings 17th International -Conference on Analytical and Stochastic Modeling Techniques and -Applications (ASMTA 2010) Cardiff, UK, June 14–16, 2010, volume 6148 -of Lecture Notes in Computer Science, Springer, pp. 102–116, ISBN -978-3-642-13567-5 -</blockquote> - - <p>If you use BibTeX, this is the citation block: - -<pre class="verbatim">@inproceedings{queueing, - author = {Moreno Marzolla}, - title = {The qnetworks Toolbox: A Software Package for Queueing - Networks Analysis}, - booktitle = {Analytical and Stochastic Modeling Techniques and - Applications, 17th International Conference, - ASMTA 2010, Cardiff, UK, June 14-16, 2010. Proceedings}, - editor = {Khalid Al-Begain and Dieter Fiems and William J. Knottenbelt}, - year = {2010}, - publisher = {Springer}, - series = {Lecture Notes in Computer Science}, - volume = {6148}, - pages = {102--116}, - ee = {http://dx.doi.org/10.1007/978-3-642-13568-2_8}, - isbn = {978-3-642-13567-5} -} -</pre> - - <p>An early draft of the paper above is available as Technical Report -<a href="http://www.informatica.unibo.it/ricerca/ublcs/2010/UBLCS-2010-04">UBLCS-2010-04</a>, February 2010, Department of Computer Science, -University of Bologna, Italy. - -<div class="node"> -<a name="Contributing-Guidelines"></a> -<p><hr> -Next: <a rel="next" accesskey="n" href="#Acknowledgements">Acknowledgements</a>, -Previous: <a rel="previous" accesskey="p" href="#About-the-Queueing-Toolbox">About the Queueing Toolbox</a>, -Up: <a rel="up" accesskey="u" href="#Summary">Summary</a> - -</div> - -<h3 class="section">1.2 Contributing Guidelines</h3> - -<p>Contributions and bug reports are <em>always</em> welcome. If you want -to contribute to the <code>queueing</code> package, here are some -guidelines: - - <ul> -<li>If you are contributing a new function, please embed proper -documentation within the function itself. The documentation must be in -<code>texinfo</code> format, so that it can be extracted and formatted into -the printable manual. See the existing functions of the -<code>queueing</code> package for the documentation style. - - <li>Make sure that each new function -properly checks the validity of its input parameters. For example, -each function accepting vectors should check whether the dimensions -match. - - <li>Provide bibliographic references for each new algorithm you -contribute. If your implementation differs in some way from the -reference you give, please describe how and why your implementation -differs. Add references to the <samp><span class="file">doc/references.txi</span></samp> file. - - <li>Include test and demo blocks with your code. -Test blocks are particularly important, since most algorithms tend to -be quite tricky to implement correctly. If appropriate, test blocks -should also verify that the function fails on incorrect input -parameters. - - </ul> - - <p>Send your contribution to Moreno Marzolla -(<a href="mailto:mar...@cs...">mar...@cs...</a>). If you are just a user of this -package and find it useful, let me know by dropping me a line. Thanks. - -<div class="node"> -<a name="Acknowledgements"></a> -<p><hr> -Previous: <a rel="previous" accesskey="p" href="#Contributing-Guidelines">Contributing Guidelines</a>, -Up: <a rel="up" accesskey="u" href="#Summary">Summary</a> - -</div> - -<h3 class="section">1.3 Acknowledgements</h3> - -<p>The following people (listed in alphabetical order) contributed to the -<code>queueing</code> package, either by providing feedback, reporting bugs -or contributing code: Philip Carinhas, Phil Colbourn, Yves Durand, -Marco Guazzone, Dmitry Kolesnikov. - -<!-- This file has been automatically generated from installation.txi --> -<!-- by proc.m. Do not edit this file, all changes will be lost --> -<!-- *- texinfo -*- --> -<!-- Copyright (C) 2008, 2009, 2010, 2011, 2012 Moreno Marzolla --> -<!-- This file is part of the queueing toolbox, a Queueing Networks --> -<!-- analysis package for GNU Octave. --> -<!-- 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; see the file COPYING. If not, see --> -<!-- <http://www.gnu.org/licenses/>. --> -<div class="node"> -<a name="Installation"></a> -<p><hr> -Next: <a rel="next" accesskey="n" href="#Markov-Chains">Markov Chains</a>, -Previous: <a rel="previous" accesskey="p" href="#Summary">Summary</a>, -Up: <a rel="up" accesskey="u" href="#Top">Top</a> - -</div> - -<h2 class="chapter">2 Installing the queueing toolbox</h2> - -<ul class="menu"> -<li><a accesskey="1" href="#Installation-through-Octave-package-management-system">Installation through Octave package management system</a> -<li><a accesskey="2" href="#Manual-installation">Manual installation</a> -<li><a accesskey="3" href="#Development-sources">Development sources</a> -<li><a accesskey="4" href="#Using-the-queueing-toolbox">Using the queueing toolbox</a> -</ul> - -<div class="node"> -<a name="Installation-through-Octave-package-management-system"></a> -<p><hr> -Next: <a rel="next" accesskey="n" href="#Manual-installation">Manual installation</a>, -Up: <a rel="up" accesskey="u" href="#Installation">Installation</a> - -</div> - -<h3 class="section">2.1 Installation through Octave package management system</h3> - -<p>The most recent version of <code>queueing</code> is 1.1.0 and can -be downloaded from Octave-Forge - - <p><a href="http://octave.sourceforge.net/queueing/">http://octave.sourceforge.net/queueing/</a> - - <p>Additional information can be found at - - <p><a href="http://www.moreno.marzolla.name/software/queueing/">http://www.moreno.marzolla.name/software/queueing/</a> - - <p>If you have a recent version of GNU Octave and a network connection, -you can install <code>queueing</code> directly from Octave command prompt -using this command: - -<pre class="example"> octave:1> <kbd>pkg install -forge queueing</kbd> -</pre> - <p>The command above will automaticall download and install the latest -version of the queueing toolbox from Octave Forge, and install it on -your machine. You can verify that the package is indeed installed: - -<pre class="example"> octave:1><kbd>pkg list queueing</kbd> - Package Name | Version | Installation directory - --------------+---------+----------------------- - queueing *| 1.1.0 | /home/moreno/octave/queueing-1.1.0 -</pre> - <p>Alternatively, you can first download <code>queueing</code> from -Octave-Forge; then, to install the package in the system-wide -location issue this command at the Octave prompt: - -<pre class="example"> octave:1> <kbd>pkg install </kbd><em>queueing-1.1.0.tar.gz</em> -</pre> - <p class="noindent">(you may need to start Octave as root in order to allow the -installation to copy the files to the target locations). After this, -all functions will be readily available each time Octave starts, -without the need to tweak the search path. - - <p>If you do not have root access, you can do a local install using: - -<pre class="example"> octave:1> <kbd>pkg install -local queueing-1.1.0.tar.gz</kbd> -</pre> - <p>This will install <code>queueing</code> within your home directory, and the -package will be available to your user only. - - <blockquote> -<b>Note:</b> Octave version 3.2.3 as shipped with Ubuntu 10.04 seems to ignore -<code>-local</code> and always tries to install the package on the system -directory. -</blockquote> - - <p>To remove <code>queueing</code> simply use - -<pre class="example"> octave:1> <kbd>pkg uninstall queueing</kbd> -</pre> - <div class="node"> -<a name="Manual-installation"></a> -<p><hr> -Next: <a rel="next" accesskey="n" href="#Development-sources">Development sources</a>, -Previous: <a rel="previous" accesskey="p" href="#Installation-through-Octave-package-management-system">Installation through Octave package management system</a>, -Up: <a rel="up" accesskey="u" href="#Installation">Installation</a> - -</div> - -<h3 class="section">2.2 Manual installation</h3> - -<p>If you want to manually install <code>queueing</code> in a custom location, -you can download the tarball and unpack it somewhere: - -<pre class="example"> <kbd>tar xvfz queueing-1.1.0.tar.gz</kbd> - <kbd>cd queueing-1.1.0/queueing/</kbd> -</pre> - <p>Copy all <code>.m</code> files from the <samp><span class="file">inst/</span></samp> directory to some -target location. Then, start Octave with the <samp><span class="option">-p</span></samp> option to add -the target location to the search path, so that Octave will find all -<code>queueing</code> functions automatically: - -<pre class="example"> <kbd>octave -p </kbd><em>/path/to/queueing</em> -</pre> - <p>For example, if all <code>queueing</code> m-files are in -<samp><span class="file">/usr/local/queueing</span></samp>, you can start Octave as follows: - -<pre class="example"> <kbd>octave -p </kbd><em>/usr/local/queueing</em> -</pre> - <p>If you want, you can add the following line to <samp><span class="file">~/.octaverc</span></samp>: - -<pre class="example"> <kbd>addpath("</kbd><em>/path/to/queueing</em><kbd>");</kbd> -</pre> - <p class="noindent">so that the path <samp><span class="file">/usr/local/queueing</span></samp> is automatically -added to the search path each time Octave is started, and you no -longer need to specify the <samp><span class="option">-p</span></samp> option on the command line. - -<div class="node"> -<a name="Development-sources"></a> -<p><hr> -Next: <a rel="next" accesskey="n" href="#Using-the-queueing-toolbox">Using the queueing toolbox</a>, -Previous: <a rel="previous" accesskey="p" href="#Manual-installation">Manual installation</a>, -Up: <a rel="up" accesskey="u" href="#Installation">Installation</a> - -</div> - -<h3 class="section">2.3 Development sources</h3> - -<p>The source code of the <code>queueing</code> package can be found in the -Subversion repository at the URL: - - <p><a href="http://octave.svn.sourceforge.net/viewvc/octave/trunk/octave-forge/main/queueing/">http://octave.svn.sourceforge.net/viewvc/octave/trunk/octave-forge/main/queueing/</a> - - <p>The source distribution contains additional development files which -are not present in the installation tarball. This section briefly -describes the content of the source tree. This is only relevant for -developers who want to modify the code or documentation; normal users -of the <code>queueing</code> package don't need - - <p>The source distribution contains the following directories: - - <dl> -<dt><samp><span class="file">doc/</span></samp><dd>Documentation source. Most of the documentation is extracted from the -comment blocks of individual function files from the <samp><span class="file">inst/</span></samp> -directory. - - <br><dt><samp><span class="file">inst/</span></samp><dd>This directory contains the <tt>m</tt>-files which implement the -various Queueing Network algorithms provided by <code>queueing</code>. As a -notational convention, the names of source files containing functions -for Queueing Networks start with the ‘<samp><span class="samp">qn</span></samp>’ prefix; the name of -source files containing functions for Continuous-Time Markov Chains -(CTMSs) start with the ‘<samp><span class="samp">ctmc</span></samp>’ prefix, and the names of files -containing functions for Discrete-Time Markov Chains (DTMCs) start -with the ‘<samp><span class="samp">dtmc</span></samp>’ prefix. - - <br><dt><samp><span class="file">test/</span></samp><dd>This directory contains the test functions used to invoke all tests on -all function files. - - <br><dt><samp><span class="file">scripts/</span></samp><dd>This directory contains some utility scripts mostly from GNU Octave, -which extract the documentation from the specially-formatted comments -in the <tt>m</tt>-files. - - <br><dt><samp><span class="file">examples/</span></samp><dd>This directory contains examples which are automatically extracted -from the ‘<samp><span class="samp">demo</span></samp>’ blocks of the function files. - - <br><dt><samp><span class="file">devel/</span></samp><dd>This directory contains function files which are either not working -properly, or need additional testing before they are moved to the -<samp><span class="file">inst/</span></samp> directory. - - </dl> - - <p>The <code>queueing</code> package ships with a Makefile which can be used -to produce the documentation (in PDF and HTML format), and -automatically execute all function tests. Specifically, the following -targets are defined: - - <dl> -<dt><code>all</code><dd>Running ‘<samp><span class="samp">make</span></samp>’ (or ‘<samp><span class="samp">make all</span></samp>’) on the top-level directory -builds the programs used to extract the documentation from the -comments embedded in the <tt>m</tt>-files, and then produce the -documentation in PDF and HTML format (<samp><span class="file">doc/queueing.pdf</span></samp> and -<samp><span class="file">doc/queueing.html</span></samp>, respectively). - - <br><dt><code>check</code><dd>Running ‘<samp><span class="samp">make check</span></samp>’ will execute all tests contained in the -<tt>m</tt>-files. If you modify the code of any function in the -<samp><span class="file">inst/</span></samp> directory, you should run the tests to ensure that no -errors have been introduced. You are also encouraged to contribute new -tests, especially for functions which are not adequately validated. - - <br><dt><code>clean</code><dt><code>distclean</code><dt><code>dist</code><dd>The ‘<samp><span class="samp">make clean</span></samp>’, ‘<samp><span class="samp">make distclean</span></samp>’ and ‘<samp><span class="samp">make dist</span></samp>’ -commands are used to clean up the source directory and prepare the -distribution archive in compressed tar format. - - </dl> - -<div class="node"> -<a name="Using-the-queueing-toolbox"></a> -<p><hr> -Previous: <a rel="previous" accesskey="p" href="#Development-sources">Development sources</a>, -Up: <a rel="up" accesskey="u" href="#Installation">Installation</a> - -</div> - -<h3 class="section">2.4 Using the queueing toolbox</h3> - -<p>You can use all functions by simply invoking their name with the -appropriate parameters; the <code>queueing</code> package should display an -error message in case of missing/wrong parameters. You can display the -help text for any function using the <samp><span class="command">help</span></samp> command. For -example: - -<pre class="example"> octave:2> <kbd>help qnmvablo</kbd> -</pre> - <p>prints the documentation for the <samp><span class="command">qnmvablo</span></samp> function. -Additional information can be found in the <code>queueing</code> manual, -which is available in PDF format in <samp><span class="file">doc/queueing.pdf</span></samp> and in -HTML format in <samp><span class="file">doc/queueing.html</span></samp>. - - <p>Within GNU Octave, you can also run the test and demo blocks -associated to the functions, using the <samp><span class="command">test</span></samp> and -<samp><span class="command">demo</span></samp> commands respectively. To run all the tests of, say, -the <samp><span class="command">qnmvablo</span></samp> function: - -<pre class="example"> octave:3> <kbd>test qnmvablo</kbd> - -| PASSES 4 out of 4 tests -</pre> - <p>To execute the demos of the <samp><span class="command">qnclosed</span></samp> function, use the -following: - -<pre class="example"> octave:4> <kbd>demo qnclosed</kbd> -</pre> - <!-- This file has been automatically generated from markovchains.txi --> -<!-- by proc.m. Do not edit this file, all changes will be lost --> -<!-- *- texinfo -*- --> -<!-- Copyright (C) 2008, 2009, 2010, 2011, 2012 Moreno Marzolla --> -<!-- This file is part of the queueing toolbox, a Queueing Networks --> -<!-- analysis package for GNU Octave. --> -<!-- 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; see the file COPYING. If not, see --> -<!-- <http://www.gnu.org/licenses/>. --> -<div class="node"> -<a name="Markov-Chains"></a> -<p><hr> -Next: <a rel="next" accesskey="n" href="#Single-Station-Queueing-Systems">Single Station Queueing Systems</a>, -Previous: <a rel="previous" accesskey="p" href="#Installation">Installation</a>, -Up: <a rel="up" accesskey="u" href="#Top">Top</a> - -</div> - -<h2 class="chapter">3 Markov Chains</h2> - -<ul class="menu"> -<li><a accesskey="1" href="#Discrete_002dTime-Markov-Chains">Discrete-Time Markov Chains</a> -<li><a accesskey="2" href="#Continuous_002dTime-Markov-Chains">Continuous-Time Markov Chains</a> -</ul> - -<div class="node"> -<a name="Discrete-Time-Markov-Chains"></a> -<a name="Discrete_002dTime-Markov-Chains"></a> -<p><hr> -Next: <a rel="next" accesskey="n" href="#Continuous_002dTime-Markov-Chains">Continuous-Time Markov Chains</a>, -Up: <a rel="up" accesskey="u" href="#Markov-Chains">Markov Chains</a> - -</div> - -<h3 class="section">3.1 Discrete-Time Markov Chains</h3> - -<p>Let X_0, X_1, <small class="dots">...</small>, X_n, <small class="dots">...</small> be a sequence of random -variables defined over a discete state space 0, 1, 2, -<small class="dots">...</small>. The sequence X_0, X_1, <small class="dots">...</small>, X_n, <small class="dots">...</small> is a -<em>stochastic process</em> with discrete time 0, 1, 2, -<small class="dots">...</small>. A <em>Markov chain</em> is a stochastic process {X_n, -n=0, 1, 2, <small class="dots">...</small>} which satisfies the following Markov property: - - <p>P(X_n+1 = x_n+1 | X_n = x_n, X_n-1 = x_n-1, ..., X_0 = x_0) = P(X_n+1 = x_n+1 | X_n = x_n) - -<p class="noindent">which basically means that the probability that the system is in -a particular state at time n+1 only depends on the state the -system was at time n. - - <p>The evolution of a Markov chain with finite state space {1, 2, -<small class="dots">...</small>, N} can be fully described by a stochastic matrix \bf -P(n) = [ P_i,j(n) ] such that P_i, j(n) = P( X_n+1 = j\ -|\ X_n = i ). If the Markov chain is homogeneous (that is, the -transition probability matrix \bf P(n) is time-independent), -we can write \bf P = [P_i, j], where P_i, j = P( -X_n+1 = j\ |\ X_n = i ) for all n=0, 1, <small class="dots">...</small>. - - <p>The transition probability matrix \bf P must satisfy the -following two properties: (1) P_i, j ≥ 0 for all -i, j, and (2) \sum_j=1^N P_i,j = 1 for all i - - <p><a name="doc_002ddtmc_005fcheck_005fP"></a> - -<div class="defun"> -— Function File: [<var>r</var> <var>err</var>] = <b>dtmc_check_P</b> (<var>P</var>)<var><a name="index-dtmc_005fcheck_005fP-1"></a></var><br> -<blockquote> - <p><a name="index-Markov-chain_002c-discrete-time-2"></a> -Check if <var>P</var> is a valid transition probability matrix. If <var>P</var> -is valid, <var>r</var> is the size (number of rows or columns) of <var>P</var>. -If <var>P</var> is not a transition probability matrix, <var>r</var> is set to -zero, and <var>err</var> to an appropriate error string. - - </blockquote></div> - -<ul class="menu"> -<li><a accesskey="1" href="#State-occupancy-probabilities-_0028DTMC_0029">State occupancy probabilities (DTMC)</a> -<li><a accesskey="2" href="#Birth_002ddeath-process-_0028DTMC_0029">Birth-death process (DTMC)</a> -<li><a accesskey="3" href="#Expected-number-of-visits-_0028DTMC_0029">Expected number of visits (DTMC)</a> -<li><a accesskey="4" href="#Time_002daveraged-expected-sojourn-times-_0028DTMC_0029">Time-averaged expected sojourn times (DTMC)</a> -<li><a accesskey="5" href="#Mean-time-to-absorption-_0028DTMC_0029">Mean time to absorption (DTMC)</a> -<li><a accesskey="6" href="#First-passage-times-_0028DTMC_0029">First passage times (DTMC)</a> -</ul> - -<div class="node"> -<a name="State-occupancy-probabilities-(DTMC)"></a> -<a name="State-occupancy-probabilities-_0028DTMC_0029"></a> -<p><hr> -Next: <a rel="next" accesskey="n" href="#Birth_002ddeath-process-_0028DTMC_0029">Birth-death process (DTMC)</a>, -Up: <a rel="up" accesskey="u" href="#Discrete_002dTime-Markov-Chains">Discrete-Time Markov Chains</a> - -</div> - -<h4 class="subsection">3.1.1 State occupancy probabilities</h4> - -<p>We denote with \bf \pi(n) = \left(\pi_1(n), \pi_2(n), <small class="dots">...</small>, -\pi_N(n) \right) the <em>state occupancy probability vector</em> at -step n. \pi_i(n) denotes the probability that the system -is in state i after n transitions. - - <p>Given the transition probability matrix \bf P and the initial -state occupancy probability vector \bf \pi(0) = -\left(\pi_1(0), \pi_2(0), <small class="dots">...</small>, \pi_N(0)\right), \bf -\pi(n) can be computed as: - -<pre class="example"> \pi(n) = \pi(0) P^n -</pre> - <p>Under certain conditions, there exists a <em>stationary state -occupancy probability</em> \bf \pi = \lim_n \rightarrow +\infty -\bf \pi(n), which is independent from \bf \pi(0). The -stationary vector \bf \pi is the solution of the following -linear system: - -<pre class="example"> / - | \pi P = \pi - | \pi 1^T = 1 - \ -</pre> - <p class="noindent">where \bf 1 is the row vector of ones, and ( \cdot )^T -the transpose operator. - - <p><a name="doc_002ddtmc"></a> - -<div class="defun"> -— Function File: <var>p</var> = <b>dtmc</b> (<var>P</var>)<var><a name="index-dtmc-3"></a></var><br> -— Function File: <var>p</var> = <b>dtmc</b> (<var>P, n, p0</var>)<var><a name="index-dtmc-4"></a></var><br> -<blockquote> - <p><a name="index-Markov-chain_002c-discrete-time-5"></a><a name="index-Discrete-time-Markov-chain-6"></a><a name="index-Markov-chain_002c-stationary-probabilities-7"></a><a name="index-Stationary-probabilities-8"></a><a name="index-Markov-chain_002c-transient-probabilities-9"></a><a name="index-Transient-probabilities-10"></a> -Compute steady-state or transient state occupancy probabilities for a -Discrete-Time Markov Chain. With a single argument, compute the -steady-state occupancy probability vector <var>p</var><code>(1), ..., -</code><var>p</var><code>(N)</code> given the N \times N transition probability matrix -<var>P</var>. With three arguments, compute the state occupancy -probabilities <var>p</var><code>(1), ..., </code><var>p</var><code>(N)</code> after <var>n</var> -steps, given initial occupancy probability vector <var>p0</var>. - - <p><strong>INPUTS</strong> - - <dl> -<dt><var>P</var><dd><var>P</var><code>(i,j)</code> is the transition probability from state i -to state j. <var>P</var> must be an irreducible stochastic matrix, -which means that the sum of each row must be 1 (\sum_j=1^N P_i, j = 1), and the rank of -<var>P</var> must be equal to its dimension. - - <br><dt><var>n</var><dd>Number of transitions after which compute the state occupancy probabilities -(n=0, 1, <small class="enddots">...</small>) - - <br><dt><var>p0</var><dd><var>p0</var><code>(i)</code> is the probability that at step 0 the system -is in state i. - - </dl> - - <p><strong>OUTPUTS</strong> - - <dl> -<dt><var>p</var><dd>If this function is invoked with a single argument, -<var>p</var><code>(i)</code> is the steady-state probability that the system is -in state i. <var>p</var> satisfies the equations p = p\bf P and \sum_i=1^N p_i = 1. If this function is invoked -with three arguments, <var>p</var><code>(i)</code> is the marginal probability -that the system is in state i after <var>n</var> transitions, -given the initial probabilities <var>p0</var><code>(i)</code> that the initial state is -i. - - </dl> - - </blockquote></div> - -<p class="noindent"><strong>EXAMPLE</strong> - - <p>This example is from <a href="#GrSn97">GrSn97</a>. Let us consider a maze with nine -rooms, as shown in the following figure - -<pre class="example"> +-----+-----+-----+ - | | | | - | 1 2 3 | - | | | | - +- -+- -+- -+ - | | | | - | 4 5 6 | - | | | | - +- -+- -+- -+ - | | | | - | 7 8 9 | - | | | | - +-----+-----+-----+ -</pre> - <p>A mouse is placed in one of the rooms and can wander around. At each -step, the mouse moves from the current room to a neighboring one with -equal probability: if it is in room 1, it can move to room 2 and 4 -with probability 1/2, respectively. If the mouse is in room 8, it can -move to either 7, 5 or 9 with probability 1/3. - - <p>The transition probability \bf P from room i to room -j is the following: - -<pre class="example"> / 0 1/2 0 1/2 0 0 0 0 0 \ - | 1/3 0 1/3 0 1/3 0 0 0 0 | - | 0 1/2 0 0 0 1/2 0 0 0 | - | 1/3 0 0 0 1/3 0 1/3 0 0 | - P = | 0 1/4 0 1/4 0 1/4 0 1/4 0 | - | 0 0 1/3 0 1/3 0 0 0 1/3 | - | 0 0 0 1/2 0 0 0 1/2 0 | - | 0 0 0 0 1/3 0 1/3 0 1/3 | - \ 0 0 0 0 0 1/2 0 1/2 0 / -</pre> - <p>The stationary state occupancy probability vector can be computed -using the following code: - -<pre class="example"><pre class="verbatim"> P = zeros(9,9); - P(1,[2 4] ) = 1/2; - P(2,[1 5 3] ) = 1/3; - P(3,[2 6] ) = 1/2; - P(4,[1 5 7] ) = 1/3; - P(5,[2 4 6 8]) = 1/4; - P(6,[3 5 9] ) = 1/3; - P(7,[4 8] ) = 1/2; - P(8,[7 5 9] ) = 1/3; - P(9,[6 8] ) = 1/2; - p = dtmc(P); - disp(p) -</pre> - ⇒ 0.083333 0.125000 0.083333 0.125000 - 0.166667 0.125000 0.083333 0.125000 - 0.083333 -</pre> - <div class="node"> -<a name="Birth-death-process-(DTMC)"></a> -<a name="Birth_002ddeath-process-_0028DTMC_0029"></a> -<p><hr> -Next: <a rel="next" accesskey="n" href="#Expected-number-of-visits-_0028DTMC_0029">Expected number of visits (DTMC)</a>, -Previous: <a rel="previous" accesskey="p" href="#State-occupancy-probabilities-_0028DTMC_0029">State occupancy probabilities (DTMC)</a>, -Up: <a rel="up" accesskey="u" href="#Discrete_002dTime-Markov-Chains">Discrete-Time Markov Chains</a> - -</div> - -<h4 class="subsection">3.1.2 Birth-death process</h4> - -<p><a name="doc_002ddtmc_005fbd"></a> - -<div class="defun"> -— Function File: <var>P</var> = <b>dtmc_bd</b> (<var>b, d</var>)<var><a name="index-dtmc_005fbd-11"></a></var><br> -<blockquote> - <p><a name="index-Markov-chain_002c-discrete-time-12"></a><a name="index-Birth_002ddeath-process-13"></a> -Returns the transition probability matrix P for a discrete -birth-death process over state space 1, 2, <small class="dots">...</small>, N. -<var>b</var><code>(i)</code> is the transition probability from state -i to i+1, and <var>d</var><code>(i)</code> is the transition -probability from state i+1 to state i, i=1, 2, -<small class="dots">...</small>, N-1. - - <p>Matrix \bf P is therefore defined as: - - <pre class="example"> / \ - | 1-b(1) b(1) | - | d(1) (1-d(1)-b(2)) b(2) | - | d(2) (1-d(2)-b(3)) b(3) | - | | - | ... ... ... | - | | - | d(N-2) (1-d(N-2)-b(N-1)) b(N-1) | - | d(N-1) 1-d(N-1) | - \ / -</pre> - </blockquote></div> - -<div class="node"> -<a name="Expected-number-of-visits-(DTMC)"></a> -<a name="Expected-number-of-visits-_0028DTMC_0029"></a> -<p><hr> -Next: <a rel="next" accesskey="n" href="#Time_002daveraged-expected-sojourn-times-_0028DTMC_0029">Time-averaged expected sojourn times (DTMC)</a>, -Previous: <a rel="previous" accesskey="p" href="#Birth_002ddeath-process-_0028DTMC_0029">Birth-death process (DTMC)</a>, -Up: <a rel="up" accesskey="u" href="#Discrete_002dTime-Markov-Chains">Discrete-Time Markov Chains</a> - -</div> - -<h4 class="subsection">3.1.3 Expected Number of Visits</h4> - -<p>Given a N state discrete-time Markov chain with transition -matrix \bf P and an integer n ≥ 0, we let -L_i(n) be the the expected number of visits to state i -during the first n transitions. The vector \bf L(n) = -( L_1(n), L_2(n), <small class="dots">...</small>, L_N(n) ) is defined as - -<pre class="example"> n n - ___ ___ - \ \ i - L(n) = > pi(i) = > pi(0) P - /___ /___ - i=0 i=0 -</pre> - <p class="noindent">where \bf \pi(i) = \bf \pi(0)\bf P^i is the state -occupancy probability after i transitions. - - <p>If \bf P is absorbing, i.e., the stochastic process eventually -reaches a state with no outgoing transitions with probability 1, then -we can compute the expected number of visits until absorption -\bf L. To do so, we first rearrange the states to rewrite -matrix \bf P as: - -<pre class="example"> / Q | R \ - P = |---+---| - \ 0 | I / -</pre> - <p class="noindent">where the first t states are transient -and the last r states are absorbing (t+r = N). The -matrix \bf N = (\bf I - \bf Q)^-1 is called the -<em>fundamental matrix</em>; N_i,j is the expected number of -times that the process is in the j-th transient state if it -started in the i-th transient state. If we reshape \bf N -to the size of \bf P (filling missing entries with zeros), we -have that, for absorbing chains \bf L = \bf \pi(0)\bf N. - - <p><a name="doc_002ddtmc_005fexps"></a> - -<div class="defun"> -— Function File: <var>L</var> = <b>dtmc_exps</b> (<var>P, n, p0</var>)<var><a name="index-dtmc_005fexps-14"></a></var><br> -— Function File: <var>L</var> = <b>dtmc_exps</b> (<var>P, p0</var>)<var><a name="index-dtmc_005fexps-15"></a></var><br> -<blockquote> - <p><a name="index-Expected-sojourn-times-16"></a> -Compute the expected number of visits to each state during the first -<var>n</var> transitions, or until abrosption. - - <p><strong>INPUTS</strong> - - <dl> -<dt><var>P</var><dd>N \times N transition probability matrix. - - <br><dt><var>n</var><dd>Number of steps during which the expected number of visits are -computed (<var>n</var> ≥ 0). If <var>n</var><code>=0</code>, returns -<var>p0</var>. If <var>n</var><code> > 0</code>, returns the expected number of -visits after exactly <var>n</var> transitions. - - <br><dt><var>p0</var><dd>Initial state occupancy probability. - - </dl> - - <p><strong>OUTPUTS</strong> - - <dl> -<dt><var>L</var><dd>When called with two arguments, <var>L</var><code>(i)</code> is the expected -number of visits to transient state i before absorption. When -called with three arguments, <var>L</var><code>(i)</code> is the expected number -of visits to state i during the first <var>n</var> transitions, -given initial occupancy probability <var>p0</var>. - - </dl> - - <pre class="sp"> - - </pre> - <strong>See also:</strong> ctmc_exps. - - </blockquote></div> - -<div class="node"> -<a name="Time-averaged-expected-sojourn-times-(DTMC)"></a> -<a name="Time_002daveraged-expected-sojourn-times-_0028DTMC_0029"></a> -<p><hr> -Next: <a rel="next" accesskey="n" href="#Mean-time-to-absorption-_0028DTMC_0029">Mean time to absorption (DTMC)</a>, -Previous: <a rel="previous" accesskey="p" href="#Expected-number-of-visits-_0028DTMC_0029">Expected number of visits (DTMC)</a>, -Up: <a rel="up" accesskey="u" href="#Discrete_002dTime-Markov-Chains">Discrete-Time Markov Chains</a> - -</div> - -<h4 class="subsection">3.1.4 Time-averaged expected sojourn times</h4> - -<p><a name="doc_002ddtmc_005ftaexps"></a> - -<div class="defun"> -— Function File: <var>L</var> = <b>dtmc_exps</b> (<var>P, n, p0</var>)<var><a name="index-dtmc_005fexps-17"></a></var><br> -— Function File: <var>L</var> = <b>dtmc_exps</b> (<var>P, p0</var>)<var><a name="index-dtmc_005fexps-18"></a></var><br> -<blockquote> - <p><a name="index-Time_002dalveraged-sojourn-time-19"></a> -Compute the <em>time-averaged sojourn time</em> <var>M</var><code>(i)</code>, -defined as the fraction of time steps {0, 1, <small class="dots">...</small>, n} (or -until absorption) spent in state i, assuming that the state -occupancy probabilities at time 0 are <var>p0</var>. - - <p><strong>INPUTS</strong> - - <dl> -<dt><var>Q</var><dd>Infinitesimal generator matrix. <var>Q</var><code>(i,j)</code> is the transition -rate from state i to state j, -1 ≤ i \neq j ≤ N. The -matrix <var>Q</var> must also satisfy the condition \sum_j=1^N Q_i, j = 0 - - <br><dt><var>t</var><dd>Time. If omitted, the results are computed until absorption. - - <br><dt><var>p</var><dd><var>p</var><code>(i)</code> is the probability that, at time 0, the system was in -state i, for all i = 1, <small class="dots">...</small>, N - - </dl> - - <p><strong>OUTPUTS</strong> - - <dl> -<dt><var>M</var><dd>If this function is called with three arguments, <var>M</var><code>(i)</code> -is the expected fraction of the interval [0,t] spent in state -i assuming that the state occupancy probability at time zero -is <var>p</var>. If this function is called with two arguments, -<var>M</var><code>(i)</code> is the expected fraction of time until absorption -spent in state i. - - </dl> - - </blockquote></div> - -<div class="node"> -<a name="Mean-time-to-absorption-(DTMC)"></a> -<a name="Mean-time-to-absorption-_0028DTMC_0029"></a> -<p><hr> -Next: <a rel="next" accesskey="n" href="#First-passage-times-_0028DTMC_0029">First passage times (DTMC)</a>, -Previous: <a rel="previous" accesskey="p" href="#Time_002daveraged-expected-sojourn-times-_0028DTMC_0029">Time-averaged expected sojourn times (DTMC)</a>, -Up: <a rel="up" accesskey="u" href="#Discrete_002dTime-Markov-Chains">Discrete-Time Markov Chains</a> - -</div> - -<h4 class="subsection">3.1.5 Mean Time to Absorption</h4> - -<p>The <em>mean time to absorption</em> is defined as the average number of -transitions which are required to reach an absorbing state, starting -from a transient state (or given an initial state occupancy -probability vector \bf \pi(0)). - - <p>Let \bf t_i be the expected number of transitions before -being absorbed in any absorbing state, starting from state i. -Vector \bf t can be computed from the fundamental matrix -\bf N (see <a href="#Expected-number-of-visits-_0028DTMC_0029">Expected number of visits (DTMC)</a>) as - -<pre class="example"> t = 1 N -</pre> - <p>Let \bf B = [ B_i, j ] be a matrix where B_i, j is -the probability of being absorbed in state j, starting from -transient state i. Again, using matrices \bf N and -\bf R (see <a href="#Expected-number-of-visits-_0028DTMC_0029">Expected number of visits (DTMC)</a>) we can write - -<pre class="example"> B = N R -</pre> - <p><a name="doc_002ddtmc_005fmtta"></a> - -<div class="defun"> -— Function File: [<var>t</var> <var>N</var> <var>B</var>] = <b>dtmc_mtta</b> (<var>P</var>)<var><a name="index-dtmc_005fmtta-20"></a></var><br> -— Function File: [<var>t</var> <var>N</var> <var>B</var>] = <b>dtmc_mtta</b> (<var>P, p0</var>)<var><a name="index-dtmc_005fmtta-21"></a></var><br> -<blockquote> - <p><a name="index-Mean-time-to-absorption-22"></a><a name="index-Absorption-probabilities-23"></a><a name="index-Fundamental-matrix-24"></a> -Compute the expected number of steps before absorption for a -DTMC with N \times N transition probability matrix <var>P</var>; -compute also the fundamental matrix <var>N</var> for <var>P</var>. - - <p><strong>INPUTS</strong> - - <dl> -<dt><var>P</var><dd>N \times N transition probability matrix. - - </dl> - - <p><strong>OUTPUTS</strong> - - <dl> -<dt><var>t</var><dd>When called with a single argument, <var>t</var> is a vector of size -N such that <var>t</var><code>(i)</code> is the expected number of steps -before being absorbed in any absorbing state, starting from state -i; if i is absorbing, <var>t</var><code>(i) = 0</code>. When -called with two arguments, <var>t</var> is a scalar, and represents the -expected number of steps before absorption, starting from the initial -state occupancy probability <var>p0</var>. - - <br><dt><var>N</var><dd>When called with a single argument, <var>N</var> is the N \times N -fundamental matrix for <var>P</var>. <var>N</var><code>(i,j)</code> is the expected -number of visits to transient state <var>j</var> before absorption, if it -is started in transient state <var>i</var>. The initial state is counted -if i = j. When called with two arguments, <var>N</var> is a vector -of size N such that <var>N</var><code>(j)</code> is the expected number -of visits to transient state <var>j</var> before absorption, given initial -state occupancy probability <var>P0</var>. - - <br><dt><var>B</var><dd>When called with a single argument, <var>B</var> is a N \times N -matrix where <var>B</var><code>(i,j)</code> is the probability of being absorbed -in state j, starting from transient state i; if -j is not absorbing, <var>B</var><code>(i,j) = 0</code>; if i -is absorbing, <var>B</var><code>(i,i) = 1</code> and -<var>B</var><code>(i,j) = 0</code> for all j \neq j. When called with -two arguments, <var>B</var> is a vector of size N where -<var>B</var><code>(j)</code> is the probability of being absorbed in state -<var>j</var>, given initial state occupancy probabilities <var>p0</var>. - - </dl> - - <pre class="sp"> - - </pre> - <strong>See also:</strong> ctmc_mtta. - - </blockquote></div> - -<div class="node"> -<a name="First-passage-times-(DTMC)"></a> -<a name="First-passage-times-_0028DTMC_0029"></a> -<p><hr> -Previous: <a rel="previous" accesskey="p" href="#Mean-time-to-absorption-_0028DTMC_0029">Mean time to absorption (DTMC)</a>, -Up: <a rel="up" accesskey="u" href="#Discrete_002dTime-Markov-Chains">Discrete-Time Markov Chains</a> - -</div> - -<h4 class="subsection">3.1.6 First Passage Times</h4> - -<p>The First Passage Time M_i, j is the average number of -transitions needed to visit state j for the first time, -starting from state i. Matrix \bf M satisfies the -property that - -<pre class="example"> ___ - \ - M_ij = 1 + > P_ij * M_kj - /___ - k!=j -</pre> - <p>To compute \bf M = [ M_i, j] a different formulation is -used. Let \bf W be the N \times N matrix having each -row equal to the steady-state probability vector \bf \pi for -\bf P; let \bf I be the N \times N identity -matrix. Define \bf Z as follows: - -<pre class="example"> -1 - Z = (I - P + W) -</pre> - <p class="noindent">Then, we have that - -<pre class="example"> Z_jj - Z_ij - M_ij = ----------- - \pi_j -</pre> - <p>According to the definition above, M_i,i = 0. We arbitrarily -let M_i,i to be the <em>mean recurrence time</em> r_i -for state i, that is the average number of transitions needed -to return to state i starting from it. r_i is: - -<pre class="example"> 1 - r_i = ----- - \pi_i -</pre> - <p><a name="doc_002ddtmc_005ffpt"></a> - -<div class="defun"> -— Function File: <var>M</var> = <b>dtmc_fpt</b> (<var>P</var>)<var><a name="index-dtmc_005ffpt-25"></a></var><br> -<blockquote> - <p><a name="index-First-passage-times-26"></a><a name="index-Mean-recurrence-times-27"></a> -Compute mean first passage times and mean recurrence times -for an irreducible discrete-time Markov chain. - - <p><strong>INPUTS</strong> - - <dl> -<dt><var>P</var><dd><var>P</var><code>(i,j)</code> is the transition probability from state i -to state j. <var>P</var> must be an irreducible stochastic matrix, -which means that the sum of each row must be 1 (\sum_j=1^N -P_i j = 1), and the rank of <var>P</var> must be equal to its -dimension. - - </dl> - - <p><strong>OUTPUTS</strong> - - <dl> -<dt><var>M</var><dd>For all i \neq j, <var>M</var><code>(i,j)</code> is the average number of -transitions before state <var>j</var> is reached for the first time, -starting from state <var>i</var>. <var>M</var><code>(i,i)</code> is the <em>mean -recurrence time</em> of state i, and represents the average time -needed to return to state <var>i</var>. - - </dl> - - <pre class="sp"> - - </pre> - <strong>See also:</strong> ctmc_fpt. - - </blockquote></div> - -<div class="node"> -<a name="Continuous-Time-Markov-Chains"></a> -<a name="Continuous_002dTime-Markov-Chains"></a> -<p><hr> -Previous: <a rel="previous" accesskey="p" href="#Discrete_002dTime-Markov-Chains">Discrete-Time Markov Chains</a>, -Up: <a rel="up" accesskey="u" href="#Markov-Chains">Markov Chains</a> - -</div> - -<h3 class="section">3.2 Continuous-Time Markov Chains</h3> - -<p>A stochastic process {X(t), t ≥ 0} is a continuous-time -Markov chain if, for all integers n, and for any sequence -t_0, t_1 , \ldots, t_n, t_n+1 such that t_0 < t_1 < -\ldots < t_n < t_n+1, we have - - <p>P(X_n+1 = x_n+1 | X_n = x_n, X_n-1 = x_n-1, ..., X_0 = x_0) = P(X_n+1 = x_n+1 | X_n = x_n) - - <p>A continuous-time Markov chain is defined according to an -<em>infinitesimal generator matrix</em> \bf Q = [Q_i,j], -where for each i \neq j, Q_i, j is the transition rate -from state i to state j. The matrix \bf Q must -satisfy the property that, for all i, \sum_j=1^N Q_i, -j = 0. - - <p><a name="doc_002dctmc_005fcheck_005fQ"></a> - -<div class="defun"> -— Function File: [<var>result</var> <var>err</var>] = <b>ctmc_check_Q</b> (<var>Q</var>)<var><a name="index-ctmc_005fcheck_005fQ-28"></a></var><br> -<blockquote> - <p><a name="index-Markov-chain_002c-continuous-time-29"></a> -If <var>Q</var> is a valid infinitesimal generator matrix, return -the size (number of rows or columns) of <var>Q</var>. If <var>Q</var> is not -an infinitesimal generator matrix, set <var>result</var> to zero, and -<var>err</var> to an appropriate error string. - - </blockquote></div> - -<ul class="menu"> -<li><a accesskey="1" href="#State-occupancy-probabilities-_0028CTMC_0029">State occupancy probabilities (CTMC)</a> -<li><a accesskey="2" href="#Birth_002ddeath-process-_0028CTMC_0029">Birth-death process (CTMC)</a> -<li><a accesskey="3" href="#Expected-sojourn-times-_0028CTMC_0029">Expected sojourn times (CTMC)</a> -<li><a accesskey="4" href="#Time_002daveraged-expected-sojourn-times-_0028CTMC_0029">Time-averaged expected sojourn times (CTMC)</a> -<li><a accesskey="5" href="#Mean-time-to-absorption-_0028CTMC_0029">Mean time to absorption (CTMC)</a> -<li><a accesskey="6" href="#First-passage-times-_0028CTMC_0029">First passage times (CTMC)</a> -</ul> - -<div class="node"> -<a name="State-occupancy-probabilities-(CTMC)"></a> -<a name="State-occupancy-probabilities-_0028CTMC_0029"></a> -<p><hr> -Next: <a rel="next" accesskey="n" href="#Birth_002ddeath-process-_0028CTMC_0029">Birth-death process (CTMC)</a>, -Up: <a rel="up" accesskey="u" href="#Continuous_002dTime-Markov-Chains">Continuous-Time Markov Chains</a> - -</div> - -<h4 class="subsection">3.2.1 State occupancy probabilities</h4> - -<p>Similarly to the discrete case, we denote with \bf \pi(t) = -(\pi_1(t), \pi_2(t), <small class="dots">...</small>, \pi_N(t) ) the <em>state occupancy -probability vector</em> at time t. \pi_i(t) is the -probability that the system is in state i at time t -≥ 0. - - <p>Given the infinitesimal generator matrix \bf Q and the initial -state occupancy probabilities \bf \pi(0) = (\pi_1(0), -\pi_2(0), <small class="dots">...</small>, \pi_N(0)), the state occupancy probabilities -\bf \pi(t) at time t can be computed as: - -<pre class="example"> \pi(t) = \pi(0) exp(Qt) -</pre> - <p class="noindent">where \exp( \bf Q t ) is the matrix exponential -of \bf Q t. Under certain conditions, there exists a -<em>stationary state occupancy probability</em> \bf \pi = -\lim_t \rightarrow +\infty \bf \pi(t), which is independent from -\bf \pi(0). \bf \pi is the solution of the following -linear system: - -<pre class="example"> / - | \pi Q = 0 - | \pi 1^T = 1 - \ -</pre> - <p><a name="doc_002dctmc"></a> - -<div class="defun"> -— Function File: <var>p</var> = <b>ctmc</b> (<var>Q</var>)<var><a name="index-ctmc-30"></a></var><br> -— Function File: <var>p</var> = <b>ctmc</b> (<var>Q, t. p0</var>)<var><a name="index-ctmc-31"></a></var><br> -<blockquote> - <p><a name="index-Markov-chain_002c-continuous-time-32"></a><a name="index-Continuous-time-Markov-chain-33"></a><a name="index-Markov-chain_002c-state-occupancy-probabilities-34"></a><a name="index-Stationary-probabilities-35"></a> -Compute stationary or transient state occupancy probabilities -for a continuous-time Markov chain. - - <p>With a single argument, compute the stat... [truncated message content] |
From: <mma...@us...> - 2012-04-09 12:51:08
|
Revision: 10177 http://octave.svn.sourceforge.net/octave/?rev=10177&view=rev Author: mmarzolla Date: 2012-04-09 12:50:58 +0000 (Mon, 09 Apr 2012) Log Message: ----------- improved documentation Modified Paths: -------------- trunk/octave-forge/main/queueing/doc/markovchains.txi trunk/octave-forge/main/queueing/doc/munge-texi.m trunk/octave-forge/main/queueing/doc/queueing.html trunk/octave-forge/main/queueing/doc/queueing.pdf trunk/octave-forge/main/queueing/doc/queueing.texi trunk/octave-forge/main/queueing/doc/queueingnetworks.txi trunk/octave-forge/main/queueing/doc/references.txi Removed Paths: ------------- trunk/octave-forge/main/queueing/doc/gettingstarted.txi Deleted: trunk/octave-forge/main/queueing/doc/gettingstarted.txi =================================================================== --- trunk/octave-forge/main/queueing/doc/gettingstarted.txi 2012-04-08 20:54:02 UTC (rev 10176) +++ trunk/octave-forge/main/queueing/doc/gettingstarted.txi 2012-04-09 12:50:58 UTC (rev 10177) @@ -1,316 +0,0 @@ -@c -*- texinfo -*- - -@c Copyright (C) 2008, 2009, 2010, 2011, 2012 Moreno Marzolla -@c -@c This file is part of the queueing toolbox, a Queueing Networks -@c analysis package for GNU Octave. -@c -@c The queueing toolbox is free software; you can redistribute it -@c and/or modify it under the terms of the GNU General Public License -@c as published by the Free Software Foundation; either version 3 of -@c the License, or (at your option) any later version. -@c -@c The queueing toolbox is distributed in the hope that it will be -@c useful, but WITHOUT ANY WARRANTY; without even the implied warranty -@c of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -@c GNU General Public License for more details. -@c -@c You should have received a copy of the GNU General Public License -@c along with the queueing toolbox; see the file COPYING. If not, see -@c <http://www.gnu.org/licenses/>. - -@node Getting Started -@chapter Introduction and Getting Started - -@menu -* Analysis of Closed Networks:: -* Analysis of Open Networks:: -@end menu - -In this chapter we give some usage examples of the @code{queueing} -package. The reader is assumed to be familiar with Queueing Networks -(although some basic terminology and notation will be given -here). Additional usage examples are embedded in most of the function -files; to display and execute the demos associated with function -@emph{fname} you can type @command{demo @emph{fname}} at the Octave -prompt. For example - -@example -@kbd{demo qnclosed} -@end example - -@noindent executes all demos (if any) for the @command{qnclosed} function. - -@node Analysis of Closed Networks -@section Analysis of Closed Networks - -Let us consider a simple closed network with @math{K=3} service -centers. Each center is of type @math{M/M/1}--FCFS. We denote with -@math{S_i} the average service time at center @math{i}, @math{i=1, 2, -3}. Let @math{S_1 = 1.0}, @math{S_2 = 2.0} and @math{S_3 = 0.8}. The -routing of jobs within the network is described with a @emph{routing -probability matrix} @math{P}. Specifically, a request completing -service at center @math{i} is enqueued at center @math{j} with -probability @math{P_{i, j}}. Let us assume the following routing -probability matrix: - -@iftex -@tex -$$ -P = \pmatrix{ 0 & 0.3 & 0.7 \cr - 1 & 0 & 0 \cr - 1 & 0 & 0 } -$$ -@end tex -@end iftex -@ifnottex -@example - [ 0 0.3 0.7 ] -P = [ 1 0 0 ] - [ 1 0 0 ] -@end example -@end ifnottex - -For example, according to matric @math{P} a job completing service at -center 1 is routed to center 2 with probability 0.3, and is routed to -center 3 with probability 0.7. - -The network above can be analyzed with the @command{qnclosed} -function; if there is just a single class of requests, as in the -example above, @command{qnclosed} calls @command{qnclosedsinglemva} -which implements the Mean Value Analysys (MVA) algorithm for -single-class, product-form network. - -@command{qnclosed} requires the following parameters: - -@table @var - -@item N -Number of requests in the network (since we are considering a closed -network, the number of requests is fixed) - -@item S -Array of average service times at the centers: @code{@var{S}(k)} is -the average service time at center @math{k}. - -@item V -Array of visit ratios: @code{@var{V}(k)} is the average number of -visits to center @math{k}. - -@end table - -As can be seen, we must compute the @emph{visit ratios} (or visit -counts) @math{V_k} for each center @math{k}. The visit counts satisfy -the following equations: - -@iftex -@tex -$$ -V_j = \sum_{i=1}^K V_i P_{i, j} -$$ -@end tex -@end iftex -@ifnottex -@example -V_j = sum_i V_i P_ij -@end example -@end ifnottex - -We can compute @math{V_k} from the routing probability matrix -@math{P_{i, j}} using the @command{qnvisits} function: - -@example -@group -@kbd{P = [0 0.3 0.7; 1 0 0; 1 0 0];} -@kbd{V = qnvisits(P)} - @result{} V = 1.00000 0.30000 0.70000 -@end group -@end example - -We can check that the computed values satisfy the above equation by -evaluating the following expression: - -@example -@kbd{V*P} - @result{} ans = 1.00000 0.30000 0.70000 -@end example - -@noindent which is equal to @math{V}. -Hence, we can analyze the network for a given population size @math{N} -(for example, @math{N=10}) as follows: - -@example -@group -@kbd{N = 10;} -@kbd{S = [1 2 0.8];} -@kbd{P = [0 0.3 0.7; 1 0 0; 1 0 0];} -@kbd{V = qnvisits(P);} -@kbd{[U R Q X] = qnclosed( N, S, V )} - @result{} U = 0.99139 0.59483 0.55518 - @result{} R = 7.4360 4.7531 1.7500 - @result{} Q = 7.3719 1.4136 1.2144 - @result{} X = 0.99139 0.29742 0.69397 -@end group -@end example - -The output of @command{qnclosed} includes the vector of utilizations -@math{U_k} at center @math{k}, response time @math{R_k}, average -number of customers @math{Q_k} and throughput @math{X_k}. In our -example, the throughput of center 1 is @math{X_1 = 0.99139}, and the -average number of requests in center 3 is @math{Q_3 = 1.2144}. The -utilization of center 1 is @math{U_1 = 0.99139}, which is the higher -value among the service centers. Tus, center 1 is the @emph{bottleneck -device}. - -This network can also be analyzed with the @command{qnsolve} -function. @command{qnsolve} can handle open, closed or mixed networks, -and allows the network to be described in a very flexible way. First, -let @var{Q1}, @var{Q2} and @var{Q3} be the variables describing the -service centers. Each variable is instantiated with the -@command{qnmknode} function. - -@example -@group -@kbd{Q1 = qnmknode( "m/m/m-fcfs", 1 );} -@kbd{Q2 = qnmknode( "m/m/m-fcfs", 2 );} -@kbd{Q3 = qnmknode( "m/m/m-fcfs", 0.8 );} -@end group -@end example - -The first parameter of @command{qnmknode} is a string describing the -type of the node. Here we use @code{"m/m/m-fcfs"} to denote a -@math{M/M/m}--FCFS center. The second parameter gives the average -service time. An optional third parameter can be used to specify the -number @math{m} of service centers. If omitted, it is assumed -@math{m=1} (single-server node). - -Now, the network can be analyzed as follows: - -@example -@group -@kbd{N = 10;} -@kbd{V = [1 0.3 0.7];} -@kbd{[U R Q X] = qnsolve( "closed", N, @{ Q1, Q2, Q3 @}, V )} - @result{} U = 0.99139 0.59483 0.55518 - @result{} R = 7.4360 4.7531 1.7500 - @result{} Q = 7.3719 1.4136 1.2144 - @result{} X = 0.99139 0.29742 0.69397 -@end group -@end example - -Of course, we get exactly the same results. Other functions can be used -for closed networks, @pxref{Algorithms for Product-Form QNs}. - -@node Analysis of Open Networks -@section Analysis of Open Networks - -Open networks can be analyzed in a similar way. Let us consider -an open network with @math{K=3} service centers, and routing -probability matrix as follows: - -@iftex -@tex -$$ -P = \pmatrix{ 0 & 0.3 & 0.5 \cr - 1 & 0 & 0 \cr - 1 & 0 & 0 } -$$ -@end tex -@end iftex -@ifnottex -@example - [ 0 0.3 0.5 ] -P = [ 1 0 0 ] - [ 1 0 0 ] -@end example -@end ifnottex - -In this network, requests can leave the system from center 1 with -probability @math{(1-(0.3+0.5) = 0.2}. We suppose that external jobs -arrive at center 1 with rate @math{\lambda_1 = 0.15}; there are no -arrivals at centers 2 and 3. - -Similarly to closed networks, we first need to compute the visit -counts @math{V_k} to center @math{k}. Again, we use the -@command{qnvisits} function as follows: - -@example -@group -@kbd{P = [0 0.3 0.5; 1 0 0; 1 0 0];} -@kbd{lambda = [0.15 0 0];} -@kbd{V = qnvisits(P, lambda)} - @result{} V = 5.00000 1.50000 2.50000 -@end group -@end example - -@noindent where @code{@var{lambda}(k)} is the arrival rate at center @math{k}, -and @var{P} is the routing matrix. The visit counts @math{V_k} for -open networks satisfy the following equation: - -@iftex -@tex -$$ -V_j = P_{0, j} + \sum_{i=1}^K V_i P_{i, j} -$$ -@end tex -@end iftex -@ifnottex -@example -V_j = sum_i V_i P_ij -@end example -@end ifnottex - -where @math{P_{0, j}} is the probability of an external arrival to -center @math{j}. This can be computed as: - -@tex -$$ -P_{0, j} = {\lambda_j \over \sum_{i=1}^K \lambda_i } -$$ -@end tex - -Assuming the same service times as in the previous example, the -network can be analyzed with the @command{qnopen} function, as -follows: - -@example -@group -@kbd{S = [1 2 0.8];} -@kbd{[U R Q X] = qnopen( sum(lambda), S, V )} - @result{} U = 0.75000 0.45000 0.30000 - @result{} R = 4.0000 3.6364 1.1429 - @result{} Q = 3.00000 0.81818 0.42857 - @result{} X = 0.75000 0.22500 0.37500 -@end group -@end example - -The first parameter of the @command{qnopen} function is the (scalar) -aggregate arrival rate. - -Again, it is possible to use the @command{qnsolve} high-level function: - -@example -@group -@kbd{Q1 = qnmknode( "m/m/m-fcfs", 1 );} -@kbd{Q2 = qnmknode( "m/m/m-fcfs", 2 );} -@kbd{Q3 = qnmknode( "m/m/m-fcfs", 0.8 );} -@kbd{lambda = [0.15 0 0];} -@kbd{[U R Q X] = qnsolve( "open", sum(lambda), @{ Q1, Q2, Q3 @}, V )} - @result{} U = 0.75000 0.45000 0.30000 - @result{} R = 4.0000 3.6364 1.1429 - @result{} Q = 3.00000 0.81818 0.42857 - @result{} X = 0.75000 0.22500 0.37500 -@end group -@end example - -@c @node Markov Chains Analysis -@c @section Markov Chains Analysis - -@c @subsection Discrete-Time Markov Chains - -@c (TODO) - -@c @subsection Continuous-Time Markov Chains - -@c (TODO) - Modified: trunk/octave-forge/main/queueing/doc/markovchains.txi =================================================================== --- trunk/octave-forge/main/queueing/doc/markovchains.txi 2012-04-08 20:54:02 UTC (rev 10176) +++ trunk/octave-forge/main/queueing/doc/markovchains.txi 2012-04-09 12:50:58 UTC (rev 10177) @@ -139,8 +139,8 @@ @noindent @strong{EXAMPLE} -This example is from [GrSn97]. Let us consider a maze with nine rooms, -as shown in the following figure +This example is from @ref{GrSn97}. Let us consider a maze with nine +rooms, as shown in the following figure @example @group Modified: trunk/octave-forge/main/queueing/doc/munge-texi.m =================================================================== --- trunk/octave-forge/main/queueing/doc/munge-texi.m 2012-04-08 20:54:02 UTC (rev 10176) +++ trunk/octave-forge/main/queueing/doc/munge-texi.m 2012-04-09 12:50:58 UTC (rev 10177) @@ -40,7 +40,7 @@ ## Texinfo crashes if @end tex does not appear first on the line. text = regexprep (text, '^ +@end tex', '@end tex', 'lineanchors'); - printf("%s\n", text); + printf("@anchor{doc-%s}\n%s\n", func, text); endfunction ############################################################################## Modified: trunk/octave-forge/main/queueing/doc/queueing.html =================================================================== --- trunk/octave-forge/main/queueing/doc/queueing.html 2012-04-08 20:54:02 UTC (rev 10176) +++ trunk/octave-forge/main/queueing/doc/queueing.html 2012-04-09 12:50:58 UTC (rev 10177) @@ -52,69 +52,66 @@ <li><a href="#Development-sources">2.3 Development sources</a> <li><a href="#Using-the-queueing-toolbox">2.4 Using the queueing toolbox</a> </li></ul> -<li><a name="toc_Getting-Started" href="#Getting-Started">3 Introduction and Getting Started</a> +<li><a name="toc_Markov-Chains" href="#Markov-Chains">3 Markov Chains</a> <ul> -<li><a href="#Analysis-of-Closed-Networks">3.1 Analysis of Closed Networks</a> -<li><a href="#Analysis-of-Open-Networks">3.2 Analysis of Open Networks</a> -</li></ul> -<li><a name="toc_Markov-Chains" href="#Markov-Chains">4 Markov Chains</a> +<li><a href="#Discrete_002dTime-Markov-Chains">3.1 Discrete-Time Markov Chains</a> <ul> -<li><a href="#Discrete_002dTime-Markov-Chains">4.1 Discrete-Time Markov Chains</a> -<ul> -<li><a href="#State-occupancy-probabilities-_0028DTMC_0029">4.1.1 State occupancy probabilities</a> -<li><a href="#Birth_002ddeath-process-_0028DTMC_0029">4.1.2 Birth-death process</a> -<li><a href="#Expected-number-of-visits-_0028DTMC_0029">4.1.3 Expected Number of Visits</a> -<li><a href="#Time_002daveraged-expected-sojourn-times-_0028DTMC_0029">4.1.4 Time-averaged expected sojourn times</a> -<li><a href="#Mean-time-to-absorption-_0028DTMC_0029">4.1.5 Mean Time to Absorption</a> -<li><a href="#First-passage-times-_0028DTMC_0029">4.1.6 First Passage Times</a> +<li><a href="#State-occupancy-probabilities-_0028DTMC_0029">3.1.1 State occupancy probabilities</a> +<li><a href="#Birth_002ddeath-process-_0028DTMC_0029">3.1.2 Birth-death process</a> +<li><a href="#Expected-number-of-visits-_0028DTMC_0029">3.1.3 Expected Number of Visits</a> +<li><a href="#Time_002daveraged-expected-sojourn-times-_0028DTMC_0029">3.1.4 Time-averaged expected sojourn times</a> +<li><a href="#Mean-time-to-absorption-_0028DTMC_0029">3.1.5 Mean Time to Absorption</a> +<li><a href="#First-passage-times-_0028DTMC_0029">3.1.6 First Passage Times</a> </li></ul> -<li><a href="#Continuous_002dTime-Markov-Chains">4.2 Continuous-Time Markov Chains</a> +<li><a href="#Continuous_002dTime-Markov-Chains">3.2 Continuous-Time Markov Chains</a> <ul> -<li><a href="#State-occupancy-probabilities-_0028CTMC_0029">4.2.1 State occupancy probabilities</a> -<li><a href="#Birth_002ddeath-process-_0028CTMC_0029">4.2.2 Birth-Death Process</a> -<li><a href="#Expected-sojourn-times-_0028CTMC_0029">4.2.3 Expected Sojourn Times</a> -<li><a href="#Time_002daveraged-expected-sojourn-times-_0028CTMC_0029">4.2.4 Time-Averaged Expected Sojourn Times</a> -<li><a href="#Mean-time-to-absorption-_0028CTMC_0029">4.2.5 Mean Time to Absorption</a> -<li><a href="#First-passage-times-_0028CTMC_0029">4.2.6 First Passage Times</a> +<li><a href="#State-occupancy-probabilities-_0028CTMC_0029">3.2.1 State occupancy probabilities</a> +<li><a href="#Birth_002ddeath-process-_0028CTMC_0029">3.2.2 Birth-Death Process</a> +<li><a href="#Expected-sojourn-times-_0028CTMC_0029">3.2.3 Expected Sojourn Times</a> +<li><a href="#Time_002daveraged-expected-sojourn-times-_0028CTMC_0029">3.2.4 Time-Averaged Expected Sojourn Times</a> +<li><a href="#Mean-time-to-absorption-_0028CTMC_0029">3.2.5 Mean Time to Absorption</a> +<li><a href="#First-passage-times-_0028CTMC_0029">3.2.6 First Passage Times</a> </li></ul> </li></ul> -<li><a name="toc_Single-Station-Queueing-Systems" href="#Single-Station-Queueing-Systems">5 Single Station Queueing Systems</a> +<li><a name="toc_Single-Station-Queueing-Systems" href="#Single-Station-Queueing-Systems">4 Single Station Queueing Systems</a> <ul> -<li><a href="#The-M_002fM_002f1-System">5.1 The M/M/1 System</a> -<li><a href="#The-M_002fM_002fm-System">5.2 The M/M/m System</a> -<li><a href="#The-M_002fM_002finf-System">5.3 The M/M/inf System</a> -<li><a href="#The-M_002fM_002f1_002fK-System">5.4 The M/M/1/K System</a> -<li><a href="#The-M_002fM_002fm_002fK-System">5.5 The M/M/m/K System</a> -<li><a href="#The-Asymmetric-M_002fM_002fm-System">5.6 The Asymmetric M/M/m System</a> -<li><a href="#The-M_002fG_002f1-System">5.7 The M/G/1 System</a> -<li><a href="#The-M_002fHm_002f1-System">5.8 The M/H_m/1 System</a> +<li><a href="#The-M_002fM_002f1-System">4.1 The M/M/1 System</a> +<li><a href="#The-M_002fM_002fm-System">4.2 The M/M/m System</a> +<li><a href="#The-M_002fM_002finf-System">4.3 The M/M/inf System</a> +<li><a href="#The-M_002fM_002f1_002fK-System">4.4 The M/M/1/K System</a> +<li><a href="#The-M_002fM_002fm_002fK-System">4.5 The M/M/m/K System</a> +<li><a href="#The-Asymmetric-M_002fM_002fm-System">4.6 The Asymmetric M/M/m System</a> +<li><a href="#The-M_002fG_002f1-System">4.7 The M/G/1 System</a> +<li><a href="#The-M_002fHm_002f1-System">4.8 The M/H_m/1 System</a> </li></ul> -<li><a name="toc_Queueing-Networks" href="#Queueing-Networks">6 Queueing Networks</a> +<li><a name="toc_Queueing-Networks" href="#Queueing-Networks">5 Queueing Networks</a> <ul> -<li><a href="#Introduction-to-QNs">6.1 Introduction to QNs</a> +<li><a href="#Introduction-to-QNs">5.1 Introduction to QNs</a> <ul> -<li><a href="#Introduction-to-QNs">6.1.1 Single class models</a> -<li><a href="#Introduction-to-QNs">6.1.2 Multiple class models</a> +<li><a href="#Introduction-to-QNs">5.1.1 Single class models</a> +<li><a href="#Introduction-to-QNs">5.1.2 Multiple class models</a> +<li><a href="#Introduction-to-QNs">5.1.3 Closed Network Example</a> +<li><a href="#Introduction-to-QNs">5.1.4 Open Network Example</a> </li></ul> -<li><a href="#Generic-Algorithms">6.2 Generic Algorithms</a> -<li><a href="#Algorithms-for-Product_002dForm-QNs">6.3 Algorithms for Product-Form QNs</a> +<li><a href="#Algorithms-for-Product_002dForm-QNs">5.2 Algorithms for Product-Form QNs</a> <ul> -<li><a href="#Algorithms-for-Product_002dForm-QNs">6.3.1 Jackson Networks</a> -<li><a href="#Algorithms-for-Product_002dForm-QNs">6.3.2 The Convolution Algorithm</a> -<li><a href="#Algorithms-for-Product_002dForm-QNs">6.3.3 Open networks</a> -<li><a href="#Algorithms-for-Product_002dForm-QNs">6.3.4 Closed Networks</a> -<li><a href="#Algorithms-for-Product_002dForm-QNs">6.3.5 Mixed Networks</a> +<li><a href="#Algorithms-for-Product_002dForm-QNs">5.2.1 Jackson Networks</a> +<li><a href="#Algorithms-for-Product_002dForm-QNs">5.2.2 The Convolution Algorithm</a> +<li><a href="#Algorithms-for-Product_002dForm-QNs">5.2.3 Open networks</a> +<li><a href="#Algorithms-for-Product_002dForm-QNs">5.2.4 Closed Networks</a> +<li><a href="#Algorithms-for-Product_002dForm-QNs">5.2.5 Mixed Networks</a> </li></ul> -<li><a href="#Algorithms-for-non-Product_002dform-QNs">6.4 Algorithms for non Product-Form QNs</a> -<li><a href="#Bounds-on-performance">6.5 Bounds on performance</a> -<li><a href="#Utility-functions">6.6 Utility functions</a> +<li><a href="#Algorithms-for-non-Product_002dForm-QNs">5.3 Algorithms for non Product-Form QNs</a> +<li><a href="#Generic-Algorithms">5.4 Generic Algorithms</a> +<li><a href="#Bounds-on-performance">5.5 Bounds on performance</a> +<li><a href="#Utility-functions">5.6 Utility functions</a> <ul> -<li><a href="#Utility-functions">6.6.1 Open or closed networks</a> -<li><a href="#Utility-functions">6.6.2 Computation of the visit counts</a> -<li><a href="#Utility-functions">6.6.3 Other utility functions</a> +<li><a href="#Utility-functions">5.6.1 Open or closed networks</a> +<li><a href="#Utility-functions">5.6.2 Computation of the visit counts</a> +<li><a href="#Utility-functions">5.6.3 Other utility functions</a> </li></ul> </li></ul> -<li><a name="toc_References" href="#References">7 References</a> +<li><a name="toc_References" href="#References">6 References</a> <li><a name="toc_Copying" href="#Copying">Appendix A GNU GENERAL PUBLIC LICENSE</a> <li><a name="toc_Concept-Index" href="#Concept-Index">Concept Index</a> <li><a name="toc_Function-Index" href="#Function-Index">Function Index</a> @@ -139,14 +136,13 @@ <ul class="menu"> <li><a accesskey="1" href="#Summary">Summary</a> <li><a accesskey="2" href="#Installation">Installation</a>: Installation of the queueing toolbox. -<li><a accesskey="3" href="#Getting-Started">Getting Started</a>: Getting started with the queueing toolbox. -<li><a accesskey="4" href="#Markov-Chains">Markov Chains</a>: Functions for Markov Chains. -<li><a accesskey="5" href="#Single-Station-Queueing-Systems">Single Station Queueing Systems</a>: Functions for single-station queueing systems. -<li><a accesskey="6" href="#Queueing-Networks">Queueing Networks</a>: Functions for queueing networks. -<li><a accesskey="7" href="#References">References</a>: References -<li><a accesskey="8" href="#Copying">Copying</a>: The GNU General Public License. -<li><a accesskey="9" href="#Concept-Index">Concept Index</a>: An item for each concept. -<li><a href="#Function-Index">Function Index</a>: An item for each function. +<li><a accesskey="3" href="#Markov-Chains">Markov Chains</a>: Functions for Markov Chains. +<li><a accesskey="4" href="#Single-Station-Queueing-Systems">Single Station Queueing Systems</a>: Functions for single-station queueing systems. +<li><a accesskey="5" href="#Queueing-Networks">Queueing Networks</a>: Functions for queueing networks. +<li><a accesskey="6" href="#References">References</a>: References +<li><a accesskey="7" href="#Copying">Copying</a>: The GNU General Public License. +<li><a accesskey="8" href="#Concept-Index">Concept Index</a>: An item for each concept. +<li><a accesskey="9" href="#Function-Index">Function Index</a>: An item for each function. <li><a href="#Author-Index">Author Index</a>: An item for each author. </ul> @@ -369,7 +365,7 @@ <div class="node"> <a name="Installation"></a> <p><hr> -Next: <a rel="next" accesskey="n" href="#Getting-Started">Getting Started</a>, +Next: <a rel="next" accesskey="n" href="#Markov-Chains">Markov Chains</a>, Previous: <a rel="previous" accesskey="p" href="#Summary">Summary</a>, Up: <a rel="up" accesskey="u" href="#Top">Top</a> @@ -597,7 +593,7 @@ <pre class="example"> octave:4> <kbd>demo qnclosed</kbd> </pre> - <!-- This file has been automatically generated from gettingstarted.txi --> + <!-- This file has been automatically generated from markovchains.txi --> <!-- by proc.m. Do not edit this file, all changes will be lost --> <!-- *- texinfo -*- --> <!-- Copyright (C) 2008, 2009, 2010, 2011, 2012 Moreno Marzolla --> @@ -615,254 +611,15 @@ <!-- along with the queueing toolbox; see the file COPYING. If not, see --> <!-- <http://www.gnu.org/licenses/>. --> <div class="node"> -<a name="Getting-Started"></a> -<p><hr> -Next: <a rel="next" accesskey="n" href="#Markov-Chains">Markov Chains</a>, -Previous: <a rel="previous" accesskey="p" href="#Installation">Installation</a>, -Up: <a rel="up" accesskey="u" href="#Top">Top</a> - -</div> - -<h2 class="chapter">3 Introduction and Getting Started</h2> - -<ul class="menu"> -<li><a accesskey="1" href="#Analysis-of-Closed-Networks">Analysis of Closed Networks</a> -<li><a accesskey="2" href="#Analysis-of-Open-Networks">Analysis of Open Networks</a> -</ul> - -<p>In this chapter we give some usage examples of the <code>queueing</code> -package. The reader is assumed to be familiar with Queueing Networks -(although some basic terminology and notation will be given -here). Additional usage examples are embedded in most of the function -files; to display and execute the demos associated with function -<em>fname</em> you can type <samp><span class="command">demo </span><em>fname</em></samp> at the Octave -prompt. For example - -<pre class="example"> <kbd>demo qnclosed</kbd> -</pre> - <p class="noindent">executes all demos (if any) for the <samp><span class="command">qnclosed</span></samp> function. - -<div class="node"> -<a name="Analysis-of-Closed-Networks"></a> -<p><hr> -Next: <a rel="next" accesskey="n" href="#Analysis-of-Open-Networks">Analysis of Open Networks</a>, -Up: <a rel="up" accesskey="u" href="#Getting-Started">Getting Started</a> - -</div> - -<h3 class="section">3.1 Analysis of Closed Networks</h3> - -<p>Let us consider a simple closed network with K=3 service -centers. Each center is of type M/M/1–FCFS. We denote with -S_i the average service time at center i, i=1, 2, -3. Let S_1 = 1.0, S_2 = 2.0 and S_3 = 0.8. The -routing of jobs within the network is described with a <em>routing -probability matrix</em> P. Specifically, a request completing -service at center i is enqueued at center j with -probability P_i, j. Let us assume the following routing -probability matrix: - -<pre class="example"> [ 0 0.3 0.7 ] - P = [ 1 0 0 ] - [ 1 0 0 ] -</pre> - <p>For example, according to matric P a job completing service at -center 1 is routed to center 2 with probability 0.3, and is routed to -center 3 with probability 0.7. - - <p>The network above can be analyzed with the <samp><span class="command">qnclosed</span></samp> -function; if there is just a single class of requests, as in the -example above, <samp><span class="command">qnclosed</span></samp> calls <samp><span class="command">qnclosedsinglemva</span></samp> -which implements the Mean Value Analysys (MVA) algorithm for -single-class, product-form network. - - <p><samp><span class="command">qnclosed</span></samp> requires the following parameters: - - <dl> -<dt><var>N</var><dd>Number of requests in the network (since we are considering a closed -network, the number of requests is fixed) - - <br><dt><var>S</var><dd>Array of average service times at the centers: <var>S</var><code>(k)</code> is -the average service time at center k. - - <br><dt><var>V</var><dd>Array of visit ratios: <var>V</var><code>(k)</code> is the average number of -visits to center k. - - </dl> - - <p>As can be seen, we must compute the <em>visit ratios</em> (or visit -counts) V_k for each center k. The visit counts satisfy -the following equations: - -<pre class="example"> V_j = sum_i V_i P_ij -</pre> - <p>We can compute V_k from the routing probability matrix -P_i, j using the <samp><span class="command">qnvisits</span></samp> function: - -<pre class="example"> <kbd>P = [0 0.3 0.7; 1 0 0; 1 0 0];</kbd> - <kbd>V = qnvisits(P)</kbd> - ⇒ V = 1.00000 0.30000 0.70000 -</pre> - <p>We can check that the computed values satisfy the above equation by -evaluating the following expression: - -<pre class="example"> <kbd>V*P</kbd> - ⇒ ans = 1.00000 0.30000 0.70000 -</pre> - <p class="noindent">which is equal to V. -Hence, we can analyze the network for a given population size N -(for example, N=10) as follows: - -<pre class="example"> <kbd>N = 10;</kbd> - <kbd>S = [1 2 0.8];</kbd> - <kbd>P = [0 0.3 0.7; 1 0 0; 1 0 0];</kbd> - <kbd>V = qnvisits(P);</kbd> - <kbd>[U R Q X] = qnclosed( N, S, V )</kbd> - ⇒ U = 0.99139 0.59483 0.55518 - ⇒ R = 7.4360 4.7531 1.7500 - ⇒ Q = 7.3719 1.4136 1.2144 - ⇒ X = 0.99139 0.29742 0.69397 -</pre> - <p>The output of <samp><span class="command">qnclosed</span></samp> includes the vector of utilizations -U_k at center k, response time R_k, average -number of customers Q_k and throughput X_k. In our -example, the throughput of center 1 is X_1 = 0.99139, and the -average number of requests in center 3 is Q_3 = 1.2144. The -utilization of center 1 is U_1 = 0.99139, which is the higher -value among the service centers. Tus, center 1 is the <em>bottleneck -device</em>. - - <p>This network can also be analyzed with the <samp><span class="command">qnsolve</span></samp> -function. <samp><span class="command">qnsolve</span></samp> can handle open, closed or mixed networks, -and allows the network to be described in a very flexible way. First, -let <var>Q1</var>, <var>Q2</var> and <var>Q3</var> be the variables describing the -service centers. Each variable is instantiated with the -<samp><span class="command">qnmknode</span></samp> function. - -<pre class="example"> <kbd>Q1 = qnmknode( "m/m/m-fcfs", 1 );</kbd> - <kbd>Q2 = qnmknode( "m/m/m-fcfs", 2 );</kbd> - <kbd>Q3 = qnmknode( "m/m/m-fcfs", 0.8 );</kbd> -</pre> - <p>The first parameter of <samp><span class="command">qnmknode</span></samp> is a string describing the -type of the node. Here we use <code>"m/m/m-fcfs"</code> to denote a -M/M/m–FCFS center. The second parameter gives the average -service time. An optional third parameter can be used to specify the -number m of service centers. If omitted, it is assumed -m=1 (single-server node). - - <p>Now, the network can be analyzed as follows: - -<pre class="example"> <kbd>N = 10;</kbd> - <kbd>V = [1 0.3 0.7];</kbd> - <kbd>[U R Q X] = qnsolve( "closed", N, { Q1, Q2, Q3 }, V )</kbd> - ⇒ U = 0.99139 0.59483 0.55518 - ⇒ R = 7.4360 4.7531 1.7500 - ⇒ Q = 7.3719 1.4136 1.2144 - ⇒ X = 0.99139 0.29742 0.69397 -</pre> - <p>Of course, we get exactly the same results. Other functions can be used -for closed networks, see <a href="#Algorithms-for-Product_002dForm-QNs">Algorithms for Product-Form QNs</a>. - -<div class="node"> -<a name="Analysis-of-Open-Networks"></a> -<p><hr> -Previous: <a rel="previous" accesskey="p" href="#Analysis-of-Closed-Networks">Analysis of Closed Networks</a>, -Up: <a rel="up" accesskey="u" href="#Getting-Started">Getting Started</a> - -</div> - -<h3 class="section">3.2 Analysis of Open Networks</h3> - -<p>Open networks can be analyzed in a similar way. Let us consider -an open network with K=3 service centers, and routing -probability matrix as follows: - -<pre class="example"> [ 0 0.3 0.5 ] - P = [ 1 0 0 ] - [ 1 0 0 ] -</pre> - <p>In this network, requests can leave the system from center 1 with -probability (1-(0.3+0.5) = 0.2. We suppose that external jobs -arrive at center 1 with rate \lambda_1 = 0.15; there are no -arrivals at centers 2 and 3. - - <p>Similarly to closed networks, we first need to compute the visit -counts V_k to center k. Again, we use the -<samp><span class="command">qnvisits</span></samp> function as follows: - -<pre class="example"> <kbd>P = [0 0.3 0.5; 1 0 0; 1 0 0];</kbd> - <kbd>lambda = [0.15 0 0];</kbd> - <kbd>V = qnvisits(P, lambda)</kbd> - ⇒ V = 5.00000 1.50000 2.50000 -</pre> - <p class="noindent">where <var>lambda</var><code>(k)</code> is the arrival rate at center k, -and <var>P</var> is the routing matrix. The visit counts V_k for -open networks satisfy the following equation: - -<pre class="example"> V_j = sum_i V_i P_ij -</pre> - <p>where P_0, j is the probability of an external arrival to -center j. This can be computed as: - - <p>Assuming the same service times as in the previous example, the -network can be analyzed with the <samp><span class="command">qnopen</span></samp> function, as -follows: - -<pre class="example"> <kbd>S = [1 2 0.8];</kbd> - <kbd>[U R Q X] = qnopen( sum(lambda), S, V )</kbd> - ⇒ U = 0.75000 0.45000 0.30000 - ⇒ R = 4.0000 3.6364 1.1429 - ⇒ Q = 3.00000 0.81818 0.42857 - ⇒ X = 0.75000 0.22500 0.37500 -</pre> - <p>The first parameter of the <samp><span class="command">qnopen</span></samp> function is the (scalar) -aggregate arrival rate. - - <p>Again, it is possible to use the <samp><span class="command">qnsolve</span></samp> high-level function: - -<pre class="example"> <kbd>Q1 = qnmknode( "m/m/m-fcfs", 1 );</kbd> - <kbd>Q2 = qnmknode( "m/m/m-fcfs", 2 );</kbd> - <kbd>Q3 = qnmknode( "m/m/m-fcfs", 0.8 );</kbd> - <kbd>lambda = [0.15 0 0];</kbd> - <kbd>[U R Q X] = qnsolve( "open", sum(lambda), { Q1, Q2, Q3 }, V )</kbd> - ⇒ U = 0.75000 0.45000 0.30000 - ⇒ R = 4.0000 3.6364 1.1429 - ⇒ Q = 3.00000 0.81818 0.42857 - ⇒ X = 0.75000 0.22500 0.37500 -</pre> - <!-- @node Markov Chains Analysis --> -<!-- @section Markov Chains Analysis --> -<!-- @subsection Discrete-Time Markov Chains --> -<!-- (TODO) --> -<!-- @subsection Continuous-Time Markov Chains --> -<!-- (TODO) --> -<!-- This file has been automatically generated from markovchains.txi --> -<!-- by proc.m. Do not edit this file, all changes will be lost --> -<!-- *- texinfo -*- --> -<!-- Copyright (C) 2008, 2009, 2010, 2011, 2012 Moreno Marzolla --> -<!-- This file is part of the queueing toolbox, a Queueing Networks --> -<!-- analysis package for GNU Octave. --> -<!-- 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; see the file COPYING. If not, see --> -<!-- <http://www.gnu.org/licenses/>. --> -<div class="node"> <a name="Markov-Chains"></a> <p><hr> Next: <a rel="next" accesskey="n" href="#Single-Station-Queueing-Systems">Single Station Queueing Systems</a>, -Previous: <a rel="previous" accesskey="p" href="#Getting-Started">Getting Started</a>, +Previous: <a rel="previous" accesskey="p" href="#Installation">Installation</a>, Up: <a rel="up" accesskey="u" href="#Top">Top</a> </div> -<h2 class="chapter">4 Markov Chains</h2> +<h2 class="chapter">3 Markov Chains</h2> <ul class="menu"> <li><a accesskey="1" href="#Discrete_002dTime-Markov-Chains">Discrete-Time Markov Chains</a> @@ -878,7 +635,7 @@ </div> -<h3 class="section">4.1 Discrete-Time Markov Chains</h3> +<h3 class="section">3.1 Discrete-Time Markov Chains</h3> <p>Let X_0, X_1, <small class="dots">...</small>, X_n, <small class="dots">...</small> be a sequence of random variables defined over a discete state space 0, 1, 2, @@ -905,6 +662,8 @@ following two properties: (1) P_i, j ≥ 0 for all i, j, and (2) \sum_j=1^N P_i,j = 1 for all i + <p><a name="doc_002ddtmc_005fcheck_005fP"></a> + <div class="defun"> — Function File: [<var>r</var> <var>err</var>] = <b>dtmc_check_P</b> (<var>P</var>)<var><a name="index-dtmc_005fcheck_005fP-1"></a></var><br> <blockquote> @@ -934,7 +693,7 @@ </div> -<h4 class="subsection">4.1.1 State occupancy probabilities</h4> +<h4 class="subsection">3.1.1 State occupancy probabilities</h4> <p>We denote with \bf \pi(n) = \left(\pi_1(n), \pi_2(n), <small class="dots">...</small>, \pi_N(n) \right) the <em>state occupancy probability vector</em> at @@ -962,6 +721,8 @@ <p class="noindent">where \bf 1 is the row vector of ones, and ( \cdot )^T the transpose operator. + <p><a name="doc_002ddtmc"></a> + <div class="defun"> — Function File: <var>p</var> = <b>dtmc</b> (<var>P</var>)<var><a name="index-dtmc-3"></a></var><br> — Function File: <var>p</var> = <b>dtmc</b> (<var>P, n, p0</var>)<var><a name="index-dtmc-4"></a></var><br> @@ -1008,8 +769,8 @@ <p class="noindent"><strong>EXAMPLE</strong> - <p>This example is from [GrSn97]. Let us consider a maze with nine rooms, -as shown in the following figure + <p>This example is from <a href="#GrSn97">GrSn97</a>. Let us consider a maze with nine +rooms, as shown in the following figure <pre class="example"> +-----+-----+-----+ | | | | @@ -1074,8 +835,10 @@ </div> -<h4 class="subsection">4.1.2 Birth-death process</h4> +<h4 class="subsection">3.1.2 Birth-death process</h4> +<p><a name="doc_002ddtmc_005fbd"></a> + <div class="defun"> — Function File: <var>P</var> = <b>dtmc_bd</b> (<var>b, d</var>)<var><a name="index-dtmc_005fbd-11"></a></var><br> <blockquote> @@ -1112,7 +875,7 @@ </div> -<h4 class="subsection">4.1.3 Expected Number of Visits</h4> +<h4 class="subsection">3.1.3 Expected Number of Visits</h4> <p>Given a N state discrete-time Markov chain with transition matrix \bf P and an integer n ≥ 0, we let @@ -1149,6 +912,8 @@ to the size of \bf P (filling missing entries with zeros), we have that, for absorbing chains \bf L = \bf \pi(0)\bf N. + <p><a name="doc_002ddtmc_005fexps"></a> + <div class="defun"> — Function File: <var>L</var> = <b>dtmc_exps</b> (<var>P, n, p0</var>)<var><a name="index-dtmc_005fexps-14"></a></var><br> — Function File: <var>L</var> = <b>dtmc_exps</b> (<var>P, p0</var>)<var><a name="index-dtmc_005fexps-15"></a></var><br> @@ -1199,8 +964,10 @@ </div> -<h4 class="subsection">4.1.4 Time-averaged expected sojourn times</h4> +<h4 class="subsection">3.1.4 Time-averaged expected sojourn times</h4> +<p><a name="doc_002ddtmc_005ftaexps"></a> + <div class="defun"> — Function File: <var>L</var> = <b>dtmc_exps</b> (<var>P, n, p0</var>)<var><a name="index-dtmc_005fexps-17"></a></var><br> — Function File: <var>L</var> = <b>dtmc_exps</b> (<var>P, p0</var>)<var><a name="index-dtmc_005fexps-18"></a></var><br> @@ -1238,7 +1005,7 @@ </dl> - </blockquote></div> + </blockquote></div> <div class="node"> <a name="Mean-time-to-absorption-(DTMC)"></a> @@ -1250,7 +1017,7 @@ </div> -<h4 class="subsection">4.1.5 Mean Time to Absorption</h4> +<h4 class="subsection">3.1.5 Mean Time to Absorption</h4> <p>The <em>mean time to absorption</em> is defined as the average number of transitions which are required to reach an absorbing state, starting @@ -1271,7 +1038,9 @@ <pre class="example"> B = N R </pre> - <div class="defun"> + <p><a name="doc_002ddtmc_005fmtta"></a> + +<div class="defun"> — Function File: [<var>t</var> <var>N</var> <var>B</var>] = <b>dtmc_mtta</b> (<var>P</var>)<var><a name="index-dtmc_005fmtta-20"></a></var><br> — Function File: [<var>t</var> <var>N</var> <var>B</var>] = <b>dtmc_mtta</b> (<var>P, p0</var>)<var><a name="index-dtmc_005fmtta-21"></a></var><br> <blockquote> @@ -1335,7 +1104,7 @@ </div> -<h4 class="subsection">4.1.6 First Passage Times</h4> +<h4 class="subsection">3.1.6 First Passage Times</h4> <p>The First Passage Time M_i, j is the average number of transitions needed to visit state j for the first time, @@ -1372,7 +1141,9 @@ r_i = ----- \pi_i </pre> - <div class="defun"> + <p><a name="doc_002ddtmc_005ffpt"></a> + +<div class="defun"> — Function File: <var>M</var> = <b>dtmc_fpt</b> (<var>P</var>)<var><a name="index-dtmc_005ffpt-25"></a></var><br> <blockquote> <p><a name="index-First-passage-times-26"></a><a name="index-Mean-recurrence-times-27"></a> @@ -1417,7 +1188,7 @@ </div> -<h3 class="section">4.2 Continuous-Time Markov Chains</h3> +<h3 class="section">3.2 Continuous-Time Markov Chains</h3> <p>A stochastic process {X(t), t ≥ 0} is a continuous-time Markov chain if, for all integers n, and for any sequence @@ -1433,6 +1204,8 @@ satisfy the property that, for all i, \sum_j=1^N Q_i, j = 0. + <p><a name="doc_002dctmc_005fcheck_005fQ"></a> + <div class="defun"> — Function File: [<var>result</var> <var>err</var>] = <b>ctmc_check_Q</b> (<var>Q</var>)<var><a name="index-ctmc_005fcheck_005fQ-28"></a></var><br> <blockquote> @@ -1462,7 +1235,7 @@ </div> -<h4 class="subsection">4.2.1 State occupancy probabilities</h4> +<h4 class="subsection">3.2.1 State occupancy probabilities</h4> <p>Similarly to the discrete case, we denote with \bf \pi(t) = (\pi_1(t), \pi_2(t), <small class="dots">...</small>, \pi_N(t) ) the <em>state occupancy @@ -1489,7 +1262,9 @@ | \pi 1^T = 1 \ </pre> - <div class="defun"> + <p><a name="doc_002dctmc"></a> + +<div class="defun"> — Function File: <var>p</var> = <b>ctmc</b> (<var>Q</var>)<var><a name="index-ctmc-30"></a></var><br> — Function File: <var>p</var> = <b>ctmc</b> (<var>Q, t. p0</var>)<var><a name="index-ctmc-31"></a></var><br> <blockquote> @@ -1556,8 +1331,10 @@ </div> -<h4 class="subsection">4.2.2 Birth-Death Process</h4> +<h4 class="subsection">3.2.2 Birth-Death Process</h4> +<p><a name="doc_002dctmc_005fbd"></a> + <div class="defun"> — Function File: <var>Q</var> = <b>ctmc_bd</b> (<var>b, d</var>)<var><a name="index-ctmc_005fbd-36"></a></var><br> <blockquote> @@ -1593,7 +1370,7 @@ </div> -<h4 class="subsection">4.2.3 Expected Sojourn Times</h4> +<h4 class="subsection">3.2.3 Expected Sojourn Times</h4> <p>Given a N state continuous-time Markov Chain with infinitesimal generator matrix \bf Q, we define the vector \bf L(t) = @@ -1618,6 +1395,8 @@ the state occupancy probability at time t; \exp(\bf Qt) is the matrix exponential of \bf Qt. + <p><a name="doc_002dctmc_005fexps"></a> + <div class="defun"> — Function File: <var>L</var> = <b>ctmc_exps</b> (<var>Q, t, p </var>)<var><a name="index-ctmc_005fexps-39"></a></var><br> — Function File: <var>L</var> = <b>ctmc_exps</b> (<var>Q, p</var>)<var><a name="index-ctmc_005fexps-40"></a></var><br> @@ -1697,8 +1476,10 @@ </div> -<h4 class="subsection">4.2.4 Time-Averaged Expected Sojourn Times</h4> +<h4 class="subsection">3.2.4 Time-Averaged Expected Sojourn Times</h4> +<p><a name="doc_002dctmc_005ftaexps"></a> + <div class="defun"> — Function File: <var>M</var> = <b>ctmc_taexps</b> (<var>Q, t, p</var>)<var><a name="index-ctmc_005ftaexps-43"></a></var><br> — Function File: <var>M</var> = <b>ctmc_taexps</b> (<var>Q, p</var>)<var><a name="index-ctmc_005ftaexps-44"></a></var><br> @@ -1736,7 +1517,7 @@ </dl> - </blockquote></div> + </blockquote></div> <p class="noindent"><strong>EXAMPLE</strong> @@ -1772,7 +1553,7 @@ </div> -<h4 class="subsection">4.2.5 Mean Time to Absorption</h4> +<h4 class="subsection">3.2.5 Mean Time to Absorption</h4> <p>If we consider a Markov Chain with absorbing states, it is possible to define the <em>expected time to absorption</em> as the expected time @@ -1789,6 +1570,8 @@ state occupancy probability at time 0, restricted to states in A. + <p><a name="doc_002dctmc_005fmtta"></a> + <div class="defun"> — Function File: <var>t</var> = <b>ctmc_mtta</b> (<var>Q, p</var>)<var><a name="index-ctmc_005fmtta-47"></a></var><br> <blockquote> @@ -1870,8 +1653,10 @@ </div> -<h4 class="subsection">4.2.6 First Passage Times</h4> +<h4 class="subsection">3.2.6 First Passage Times</h4> +<p><a name="doc_002dctmc_005ffpt"></a> + <div class="defun"> — Function File: <var>M</var> = <b>ctmc_fpt</b> (<var>Q</var>)<var><a name="index-ctmc_005ffpt-54"></a></var><br> — Function File: <var>m</var> = <b>ctmc_fpt</b> (<var>Q, i, j</var>)<var><a name="index-ctmc_005ffpt-55"></a></var><br> @@ -1911,7 +1696,7 @@ </pre> <strong>See also:</strong> dtmc_fpt. - </blockquote></div> + </blockquote></div> <!-- This file has been automatically generated from singlestation.txi --> <!-- by proc.m. Do not edit this file, all changes will be lost --> @@ -1939,7 +1724,7 @@ </div> -<h2 class="chapter">5 Single Station Queueing Systems</h2> +<h2 class="chapter">4 Single Station Queueing Systems</h2> <p>Single Station Queueing Systems contain a single station, and are thus quite easy to analyze. The <code>queueing</code> package contains functions @@ -1972,7 +1757,7 @@ </div> -<h3 class="section">5.1 The M/M/1 System</h3> +<h3 class="section">4.1 The M/M/1 System</h3> <p>The M/M/1 system is made of a single server connected to an unlimited FCFS queue. The mean arrival rate is Poisson with arrival @@ -2040,7 +1825,7 @@ </div> -<h3 class="section">5.2 The M/M/m System</h3> +<h3 class="section">4.2 The M/M/m System</h3> <p>The M/M/m system is similar to the M/M/1 system, except that there are m \geq 1 identical servers connected to a single @@ -2119,7 +1904,7 @@ </div> -<h3 class="section">5.3 The M/M/inf System</h3> +<h3 class="section">4.3 The M/M/inf System</h3> <p>The M/M/\infty system is similar to the M/M/m system, except that there are infinitely many identical servers (that is, @@ -2194,7 +1979,7 @@ </div> -<h3 class="section">5.4 The M/M/1/K System</h3> +<h3 class="section">4.4 The M/M/1/K System</h3> <p>In a M/M/1/K finite capacity system there can be at most k jobs at any time. If a new request tries to join the system @@ -2263,7 +2048,7 @@ </div> -<h3 class="section">5.5 The M/M/m/K System</h3> +<h3 class="section">4.5 The M/M/m/K System</h3> <p>The M/M/m/K finite capacity system is similar to the M/M/1/k system except that the number of servers is m, @@ -2343,7 +2128,7 @@ </div> -<h3 class="section">5.6 The Asymmetric M/M/m System</h3> +<h3 class="section">4.6 The Asymmetric M/M/m System</h3> <p>The Asymmetric M/M/m system contains m servers connected to a single queue. Differently from the M/M/m system, in the @@ -2410,7 +2195,7 @@ </div> -<h3 class="section">5.7 The M/G/1 System</h3> +<h3 class="section">4.7 The M/G/1 System</h3> <div class="defun"> — Function File: [<var>U</var>, <var>R</var>, <var>Q</var>, <var>X</var>, <var>p0</var>] = <b>qnmg1</b> (<var>lambda, xavg, x2nd</var>)<var><a name="index-qnmg1-91"></a></var><br> @@ -2467,7 +2252,7 @@ </div> -<h3 class="section">5.8 The M/H_m/1 System</h3> +<h3 class="section">4.8 The M/H_m/1 System</h3> <div class="defun"> — Function File: [<var>U</var>, <var>R</var>, <var>Q</var>, <var>X</var>, <var>p0</var>] = <b>qnmh1</b> (<var>lambda, mu, alpha</var>)<var><a name="index-qnmh1-93"></a></var><br> @@ -2544,13 +2329,13 @@ </div> -<h2 class="chapter">6 Queueing Networks</h2> +<h2 class="chapter">5 Queueing Networks</h2> <ul class="menu"> <li><a accesskey="1" href="#Introduction-to-QNs">Introduction to QNs</a>: A brief introduction to Queueing Networks. -<li><a accesskey="2" href="#Generic-Algorithms">Generic Algorithms</a>: High-level functions for QN analysis -<li><a accesskey="3" href="#Algorithms-for-Product_002dForm-QNs">Algorithms for Product-Form QNs</a>: Functions to analyze product-form QNs -<li><a accesskey="4" href="#Algorithms-for-non-Product_002dform-QNs">Algorithms for non Product-form QNs</a>: Functions to analyze non product-form QNs +<li><a accesskey="2" href="#Algorithms-for-Product_002dForm-QNs">Algorithms for Product-Form QNs</a>: Functions to analyze product-form QNs +<li><a accesskey="3" href="#Algorithms-for-non-Product_002dForm-QNs">Algorithms for non Product-Form QNs</a>: Functions to analyze non product-form QNs +<li><a accesskey="4" href="#Generic-Algorithms">Generic Algorithms</a>: High-level functions for QN analysis <li><a accesskey="5" href="#Bounds-on-performance">Bounds on performance</a>: Functions to compute performance bounds <li><a accesskey="6" href="#Utility-functions">Utility functions</a>: Utility functions to compute miscellaneous quantities </ul> @@ -2560,26 +2345,25 @@ <div class="node"> <a name="Introduction-to-QNs"></a> <p><hr> -Next: <a rel="next" accesskey="n" href="#Generic-Algorithms">Generic Algorithms</a>, +Next: <a rel="next" accesskey="n" href="#Algorithms-for-Product_002dForm-QNs">Algorithms for Product-Form QNs</a>, Up: <a rel="up" accesskey="u" href="#Queueing-Networks">Queueing Networks</a> </div> -<h3 class="section">6.1 Introduction to QNs</h3> +<h3 class="section">5.1 Introduction to QNs</h3> <p>Queueing Networks (QN) are a very simple yet powerful modeling tool -which is used to analyze many kind of systems. In its simplest form, a -QN is made of K service centers. Each service center i -has a queue, which is connected to m_i (generally identical) -<em>servers</em>. Customers (or requests) arrive at the service center, -and join the queue if there is a slot available. Then, requests are -served according to a (de)queueing policy. After service completes, -the requests leave the service center. +which can be used to analyze many kind of systems. In its simplest +form, a QN is made of K service centers. Each center k +has a queue, which is connected to m_k (generally identical) +<em>servers</em>. Arriving customers (requests) join the queue if there +is a slot available. Then, requests are served according to a +(de)queueing policy (e.g., FIFO). After service completes, requests +leave the server and can join another queue or exit from the system. - <p>The service centers for which m_i = \infty are called -<em>delay centers</em> or <em>infinite servers</em>. If a service center -has infinite servers, of course each new request will find one server -available, so there will never be queueing. + <p>Service centers for which m_k = \infty are called <em>delay +centers</em> or <em>infinite servers</em>. In this kind of centers, every +request always finds one available server, so queueing never occurs. <p>Requests join the queue according to a <em>queueing policy</em>, such as: @@ -2590,74 +2374,72 @@ <br><dt><strong>PS</strong><dd>Processor Sharing - <br><dt><strong>IS</strong><dd>Infinite Server, there is an infinite number of identical servers so -that each request always finds a server available, and there is no -queueing + <br><dt><strong>IS</strong><dd>Infinite Server (for which m_k = \infty). </dl> - <p>A population of <em>requests</em> or <em>customers</em> arrives to the -system system, requesting service to the service centers. The request -population may be <em>open</em> or <em>closed</em>. In open systems there -is an infinite population of requests. New customers arrive from -outside the system, and eventually leave the system. In closed systems -there is a fixed population of request which continuously interacts -with the system. + <p>Queueing models can be <em>open</em> or <em>closed</em>. In open models +there is an infinite population of requests; new customers are +generated outside the system, and eventually leave the system. In +closed systems there is a fixed population of request. - <p>There might be a single class of requests, meaning that all requests -behave in the same way (e.g., they spend the same average time on each -particular server), or there might be multiple classes of requests. + <p>Queueing models can have a single request class, meaning that all +requests behave in the same way (e.g., they spend the same average +time on each particular server). In multiclass models there are +multiple request classes, each one with its own +parameters. Furthermore, in multiclass models there can be open and +closed classes of requests within the same system. -<h4 class="subsection">6.1.1 Single class models</h4> +<h4 class="subsection">5.1.1 Single class models</h4> -<p>In single class models, all requests are indistinguishable and belong to -the same class. This means that every request has the same average +<p>In single class models, all requests are indistinguishable and belong +to the same class. This means that every request has the same average service time, and all requests move through the system with the same routing probabilities. <p class="noindent"><strong>Model Inputs</strong> <dl> -<dt>\lambda_i<dd>External arrival rate to service center i. +<dt>\lambda_k<dd>External arrival rate to service center k. <br><dt>\lambda<dd>Overall external arrival rate to the whole system: \lambda = -\sum_i \lambda_i. +\sum_k \lambda_k. - <br><dt>S_i<dd>Average service time. S_i is the average service time on service -center i. In other words, S_i is the average time from the + <br><dt>S_k<dd>Average service time. S_k is the average service time on service +center k. In other words, S_k is the average time from the instant in which a request is extracted from the queue and starts being service, and the instant at which service finishes and the request moves to another queue (or exits the system). - <br><dt>P_i, j<dd>Routing probability matrix. \bf P = P_i, j is a K + <br><dt>P_i, j<dd>Routing probability matrix. \bf P = [P_i, j] is a K \times K matrix such that P_i, j is the probability that a request completing service at server i will move directly to server j, The probability that a request leaves the system after service at service center i is 1-\sum_j=1^K P_i, j. - <br><dt>V_i<dd>Average number of visits. V_i is the average number of visits to -the service center i. This quantity will be described shortly. + <br><dt>V_k<dd>Average number of visits. V_k is the average number of visits to +the service center k. This quantity will be described shortly. </dl> <p class="noindent"><strong>Model Outputs</strong> <dl> -<dt>U_i<dd>Service center utilization. U_i is the utilization of service -center i. The utilization is defined as the fraction of time in +<dt>U_k<dd>Service center utilization. U_k is the utilization of service +center k. The utilization is defined as the fraction of time in which the resource is busy (i.e., the server is processing requests). - <br><dt>R_i<dd>Average response time. R_i is the average response time of -service center i. The average response time is defined as the + <br><dt>R_k<dd>Average response time. R_k is the average response time of +service center k. The average response time is defined as the average time between the arrival of a customer in the queue, and the completion of service. - <br><dt>Q_i<dd>Average number of customers. Q_i is the average number of -requests in service center i. This includes both the requests in + <br><dt>Q_k<dd>Average number of customers. Q_k is the average number of +requests in service center k. This includes both the requests in the queue, and the request being served. - <br><dt>X_i<dd>Throughput. X_i is the throughput of service center i. + <br><dt>X_k<dd>Throughput. X_k is the throughput of service center k. The throughput is defined as the ratio of job completions (i.e., average number of jobs completed over a fixed interval of time). @@ -2705,7 +2487,7 @@ i=1 </pre> - <h4 class="subsection">6.1.2 Multiple class models</h4> + <h4 class="subsection">5.1.2 Multiple class models</h4> <p>In multiple class QN models, we assume that there exist C different classes of requests. Each request from class c spends @@ -2718,7 +2500,7 @@ class c requests in the system. <p>The transition probability matrix for these kind of networks will be a -C \times K \times C \times K matrix \bf P = P_r, i, s, j +C \times K \times C \times K matrix \bf P = [P_r, i, s, j] such that P_r, i, s, j is the probability that a class r request which completes service at center i will join server j as a class s request. @@ -2729,41 +2511,41 @@ <p class="noindent"><strong>Model Inputs</strong> <dl> -<dt>\lambda_c, i<dd>External arrival rate of class-c requests to service center i +<dt>\lambda_c, k<dd>External arrival rate of class-c requests to service center k - <br><dt>\lambda<dd>Overall external arrival rate to the whole system: \lambda = \sum_c \sum_i \lambda_c, i + <br><dt>\lambda<dd>Overall external arrival rate to the whole system: \lambda = \sum_c \sum_k \lambda_c, k - <br><dt>S_c, i<dd>Average service time. S_c, i is the average service time on -service center i for class c requests. + <br><dt>S_c, k<dd>Average service time. S_c, k is the average service time on +service center k for class c requests. - <br><dt>P_r, i, s, j<dd>Routing probability matrix. \bf P = P_r, i, s, j is a C + <br><dt>P_r, i, s, j<dd>Routing probability matrix. \bf P = [P_r, i, s, j] is a C \times K \times C \times K matrix such that P_r, i, s, j is the probability that a class r request which completes service at server i will move to server j as a class s request. - <br><dt>V_c, i<dd>Average number of visits. V_c, i is the average number of visits -of class c requests to the service center i. + <br><dt>V_c, k<dd>Average number of visits. V_c, k is the average number of visits +of class c requests to center k. </dl> <p class="noindent"><strong>Model Outputs</strong> <dl> -<dt>U_c, i<dd>Utilization of service center i by class c requests. The +<dt>U_c, k<dd>Utilization of service center k by class c requests. The utilization is defined as the fraction of time in which the resource is busy (i.e., the server is processing requests). - <br><dt>R_c, i<dd>Average response time experienced by class c requests on service -center i. The average response time is defined as the average + <br><dt>R_c, k<dd>Average response time experienced by class c requests on service +center k. The average response time is defined as the average time between the arrival of a customer in the queue, and the completion of service. - <br><dt>Q_c, i<dd>Average number of class c requests on service center -i. This includes both the requests in the queue, and the request + <br><dt>Q_c, k<dd>Average number of class c requests on service center +k. This includes both the requests in the queue, and the request being served. - <br><dt>X_c, i<dd>Throughput of service center i for class c requests. The + <br><dt>X_c, k<dd>Throughput of service center k for class c requests. The throughput is defined as the rate of completion of class c requests. @@ -2772,8 +2554,8 @@ <p class="noindent">It is possible to define aggregate performance measures as follows: <dl> -<dt>U_i<dd>Utilization of service center i: -<code>Ui = sum(U,1);</code> +<dt>U_k<dd>Utilization of service center k: +<code>Uk = sum(U,k);</code> <br><dt>R_c<dd>System response time for class c requests: <code>Rc = sum( V.*R, 1 );</code> @@ -2802,224 +2584,155 @@ \sum_s \sum_j \lambda_s, j is the overall external arrival rate to the whole system, then P_0, s, j = \lambda_s, j / \lambda. -<div class="node"> -<a name="Generic-Algorithms"></a> -<p><hr> -Next: <a rel="next" accesskey="n" href="#Algorithms-for-Product_002dForm-QNs">Algorithms for Product-Form QNs</a>, -Previous: <a rel="previous" accesskey="p" href="#Introduction-to-QNs">Introduction to QNs</a>, -Up: <a rel="up" accesskey="u" href="#Queueing-Networks">Queueing Networks</a> +<h4 class="subsection">5.1.3 Closed Network Example</h4> -</div> +<p>We now give a simple example on how the queueing toolbox can be used +to analyze a closed network. Let us consider a simple closed network +with K=3 M/M/1–FCFS centers. We denote with S_k +the average service time at center k, k=1, 2, 3. We use +S_1 = 1.0, S_2 = 2.0 and S_3 = 0.8. The routing +of jobs within the network is described with a <em>routing +probability matrix</em> \bf P. Specifically, a request completing +service at center i is enqueued at center j with +probability P_i, j. We use the following routing matrix: -<h3 class="section">6.2 Generic Algorithms</h3> +<pre class="example"> / 0 0.3 0.7 \ + P = | 1 0 0 | + \ 1 0 0 / +</pre> + <p>The network above can be analyzed with the <samp><span class="command">qnclosed</span></samp> function +see <a href="#doc_002dqnclosed">doc-qnclosed</a>. <samp><span class="command">qnclosed</span></samp> requires the following +parameters: -<p>The <code>queueing</code> package provides a couple of high-level functions -for defining and solving QN models. These functions can be used to -define a open or closed QN model (with single or multiple job -classes), with arbitrary configuration and queueing disciplines. At -the moment only product-form networks can be solved, See <a href="#Algorithms-for-Product_002dForm-QNs">Algorithms for Product-Form QNs</a>. + <dl> +<dt><var>N</var><dd>Number of requests in the network (since we are considering a closed +network, the number of requests is fixed) - <p>The network is defined by two parameters. The first one is the list of -nodes, encoded as an Octave <em>cell array</em>. The second parameter is -the visit ration <var>V</var>, which can be either a vector (for -single-class models) or a two-dimensional matrix (for multiple-class -models).... [truncated message content] |
From: <mma...@us...> - 2012-04-08 20:54:09
|
Revision: 10176 http://octave.svn.sourceforge.net/octave/?rev=10176&view=rev Author: mmarzolla Date: 2012-04-08 20:54:02 +0000 (Sun, 08 Apr 2012) Log Message: ----------- Fixed makefile Modified Paths: -------------- trunk/octave-forge/main/queueing/doc/Makefile Modified: trunk/octave-forge/main/queueing/doc/Makefile =================================================================== --- trunk/octave-forge/main/queueing/doc/Makefile 2012-04-08 20:08:53 UTC (rev 10175) +++ trunk/octave-forge/main/queueing/doc/Makefile 2012-04-08 20:54:02 UTC (rev 10176) @@ -28,7 +28,7 @@ %.texi: %.txi octave -p../inst/ -q munge-texi.m $< ../inst/ > $@ -dist: +dist: $(DISTFILES) ln $(DISTFILES) ../`cat ../fname`/doc/ clean: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mma...@us...> - 2012-04-08 20:08:59
|
Revision: 10175 http://octave.svn.sourceforge.net/octave/?rev=10175&view=rev Author: mmarzolla Date: 2012-04-08 20:08:53 +0000 (Sun, 08 Apr 2012) Log Message: ----------- updated documentation scripts Modified Paths: -------------- trunk/octave-forge/main/queueing/Makefile Modified: trunk/octave-forge/main/queueing/Makefile =================================================================== --- trunk/octave-forge/main/queueing/Makefile 2012-04-08 20:05:13 UTC (rev 10174) +++ trunk/octave-forge/main/queueing/Makefile 2012-04-08 20:08:53 UTC (rev 10175) @@ -5,7 +5,7 @@ DISTNAME=$(PROGNAME)-$(VERSIONNUM) SUBDIRS=inst doc test devel DISTFILES=COPYING NEWS DESCRIPTION -DISTSUBDIRS=inst doc doc/demos doc/help +DISTSUBDIRS=inst doc .PHONY: clean check This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mma...@us...> - 2012-04-08 20:05:19
|
Revision: 10174 http://octave.svn.sourceforge.net/octave/?rev=10174&view=rev Author: mmarzolla Date: 2012-04-08 20:05:13 +0000 (Sun, 08 Apr 2012) Log Message: ----------- removed unused directories Removed Paths: ------------- trunk/octave-forge/main/queueing/doc/demos/ trunk/octave-forge/main/queueing/doc/help/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |