Institut de Robòtica i Informàtica Industrial

CSpace

PURPOSE ^

CSpace constructor.

SYNOPSIS ^

function CS=CSpace(varargin)

DESCRIPTION ^

   CSpace constructor.

   Defines a continuous space.
   Actually we define an axis aligned box in a continuous space.
   
   Parameters:
     min: column vector with lower bound for each one of the dimension of
          the state space.
     max: column vector with upper bound for each one of the dimension of
          the state space.

CROSS-REFERENCE INFORMATION ^

This function calls:
  • size Returns the size of a policy.
This function is called by:

SOURCE CODE ^

0001 function CS=CSpace(varargin)
0002 %   CSpace constructor.
0003 %
0004 %   Defines a continuous space.
0005 %   Actually we define an axis aligned box in a continuous space.
0006 %
0007 %   Parameters:
0008 %     min: column vector with lower bound for each one of the dimension of
0009 %          the state space.
0010 %     max: column vector with upper bound for each one of the dimension of
0011 %          the state space.
0012 
0013   switch nargin
0014     case 1
0015       if isa(varargin{1},'CSpace')
0016         CS=varargin{1};
0017       else
0018         error('Wrong type of parameters in CSpace constructor');
0019       end
0020     case 2
0021       if isa(varargin{1},'double')
0022         CS.min=varargin{1};
0023       else
0024         error('Wrong type of parameters in CSpace constructor');
0025       end
0026       if isa(varargin{2},'double')
0027         CS.max=varargin{2};
0028       else
0029         error('Wrong type of parameters in CSpace constructor');
0030       end
0031       CS.dim=size(CS.min,1);
0032       CS.range=CS.max-CS.min;
0033       if sum(CS.range>0)~=CS.dim
0034         error('Wrong bounds in CSpace constructor');
0035       end
0036       if CS.dim~=size(CS.max,1) || size(CS.min,2)~=1 || size(CS.max,2)~=1
0037         error('Size missmatch in CSpace constructor');
0038       end
0039       CS=class(CS,'CSpace');
0040     otherwise
0041       error('Wrong number of parameters in CSpace constructor');
0042   end


Institut de Robòtica i Informàtica Industrial

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