Institut de Robòtica i Informàtica Industrial

DS_DO_ObsModel

PURPOSE ^

DS_DO_ObsModel constructor.

SYNOPSIS ^

function OM=DS_DO_ObsModel(varargin)

DESCRIPTION ^

   DS_DO_ObsModel constructor.

   Defines an observation model (p(o|s)) on discrete state and 
   observation spaces.

   Parameters
    S: Discrete state space.
    O: Discrete observation space.
    p: A cell array with one vector (of size of the number of states) for 
       each obs.

CROSS-REFERENCE INFORMATION ^

This function calls:
  • size Returns the size of a policy.
  • ObsModel ObsModel constructor.
  • dim Dimensionality of a continuous space.
  • dim Dimensionality of a discrete space.
This function is called by:

SOURCE CODE ^

0001 function OM=DS_DO_ObsModel(varargin)
0002 %   DS_DO_ObsModel constructor.
0003 %
0004 %   Defines an observation model (p(o|s)) on discrete state and
0005 %   observation spaces.
0006 %
0007 %   Parameters
0008 %    S: Discrete state space.
0009 %    O: Discrete observation space.
0010 %    p: A cell array with one vector (of size of the number of states) for
0011 %       each obs.
0012 
0013   switch nargin
0014     case 1
0015       if isa(varargin{1},'DS_DO_ObsModel')
0016         OM=varargin{1};
0017       else
0018         error('Wrong parameter type in DS_DO_ObsModel constructor');
0019       end
0020     case 3
0021       if isa(varargin{1},'DSpace')
0022         OM.S=varargin{1};
0023       else
0024         error('Wrong parameter type in DS_DO_ObsModel constructor');
0025       end
0026       if isa(varargin{2},'DSpace')
0027         OM.O=varargin{2};
0028       else
0029         error('Wrong parameter type in DS_DO_ObsModel constructor');
0030       end
0031       
0032       if isa(varargin{3},'cell')
0033         OM.p=varargin{3}; % one vector (of size numStates) for each obs
0034         no=dim(OM.O);
0035         for i=1:no
0036           if nnz(OM.p{i})/numel(OM.p{i})<0.5
0037             OM.p{i}=sparse(OM.p{i});
0038           end
0039         end
0040       else
0041         error('Wrong parameter type in DS_DO_ObsModel constructor');
0042       end
0043       
0044       if dim(OM.O)~=size(OM.p,2) || dim(OM.S)~=size(OM.p{1},1) 
0045         error('Size missmatch in DS_DO_ObsModel constructor');
0046       end
0047       
0048       OMBase=ObsModel();
0049       
0050       OM=class(OM,'DS_DO_ObsModel',OMBase);
0051     otherwise
0052       error('Wrong number of parameters in DS_DO_ObsModel constructor');
0053   end


Institut de Robòtica i Informàtica Industrial

Generated on Wed 05-Aug-2009 15:05:21 by m2html © 2003