Institut de Robòtica i Informàtica Industrial

plot

PURPOSE ^

Plots the CS_CA_RewardModel

SYNOPSIS ^

function h=plot(RM)

DESCRIPTION ^

 Plots the CS_CA_RewardModel

 Plot a 3d surface representing the reward function in the continous state
 and action spaces.
 It only works for one-dimensional spaces.

CROSS-REFERENCE INFORMATION ^

This function calls:
  • size Returns the size of a policy.
  • Value Evaluates a GMixture.
  • Value Evaluation of a Gaussian.
  • dim Dimensionality of a continuous space.
  • max Upper bound of a CSpace
  • min Lower bound of a CSpace
  • dim Dimensionality of a discrete space.
This function is called by:

SOURCE CODE ^

0001 function h=plot(RM)
0002 % Plots the CS_CA_RewardModel
0003 %
0004 % Plot a 3d surface representing the reward function in the continous state
0005 % and action spaces.
0006 % It only works for one-dimensional spaces.
0007    
0008    if dim(RM.S)==1 && dim(RM.A)==1
0009      
0010      s=min(RM.S):max(RM.S);
0011      a=min(RM.A):max(RM.A);
0012      ns=size(s,2);
0013      na=size(a,2);
0014      sr=zeros(ns,na);
0015      for i=1:ns
0016        for j=1:na
0017          sr(i,j)=sum(RM.w.*cellfun(@(g)(Value(g,s(i))),RM.gS).*cellfun(@(g)(Value(g,a(j))),RM.gA));
0018        end
0019      end
0020      h=surf(s,a,sr');
0021    else
0022      error('CS_CA_RewardModel plot only implemented for one-dimensional S/A spaces');
0023    end


Institut de Robòtica i Informàtica Industrial

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