Institut de Robòtica i Informàtica Industrial

DS_DA_RewardModel

PURPOSE ^

DS_DA_RewardModel constructor.

SYNOPSIS ^

function RM=DS_DA_RewardModel(varargin)

DESCRIPTION ^

   DS_DA_RewardModel constructor.

   Defines a reward function on discrete state and 
   action spaces, r(s,a).
   This is the type of reward functions used in the usual POMDPs.

   Parameters
      S: Discrete state space.
      A: Discrete action space.
      r: A cell array iwth one column vector (of the dimension of the 
         state space) for each action.

CROSS-REFERENCE INFORMATION ^

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

SOURCE CODE ^

0001 function RM=DS_DA_RewardModel(varargin)
0002 %   DS_DA_RewardModel constructor.
0003 %
0004 %   Defines a reward function on discrete state and
0005 %   action spaces, r(s,a).
0006 %   This is the type of reward functions used in the usual POMDPs.
0007 %
0008 %   Parameters
0009 %      S: Discrete state space.
0010 %      A: Discrete action space.
0011 %      r: A cell array iwth one column vector (of the dimension of the
0012 %         state space) for each action.
0013 
0014 
0015   switch nargin
0016     case 1
0017       if isa(varargin{1},'DS_DA_RewardModel')
0018         RM=varargin{1};
0019       else
0020         error('Wrong parameter type in DS_DA_RewardModel constructor');
0021       end
0022     case 3
0023       if isa(varargin{1},'DSpace')
0024         RM.S=varargin{1};
0025       else
0026         error('Wrong parameter type in DS_DA_RewardModel constructor');
0027       end
0028       if isa(varargin{2},'DSpace')
0029         RM.A=varargin{2};
0030       else
0031         error('Wrong parameter type in DS_DA_RewardModel constructor');
0032       end
0033       if isa(varargin{3},'cell')
0034         RM.r=varargin{3};
0035       end
0036       
0037       if dim(RM.S)~=size(RM.r{1},1)
0038         error('Size missmatch in DS_DA_RewardModel constructor');
0039       end
0040       
0041       if dim(RM.A)~=size(RM.r,2)
0042         error('Size missmatch in DS_DA_RewardModel constructor');
0043       end
0044       
0045       RM=class(RM,'DS_DA_RewardModel');
0046     otherwise
0047       error('Wrong number of parameters in DS_DA_RewardModel constructor');
0048   end


Institut de Robòtica i Informàtica Industrial

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