Institut de Robòtica i Informàtica Industrial

SampleBeliefs

PURPOSE ^

Samples a set of beliefs from a POMDP.

SYNOPSIS ^

function SB=SampleBeliefs(P,start,nBeliefs,minBeliefDist,stepsXtrial,minR,maxR)

DESCRIPTION ^

   Samples a set of beliefs from a POMDP.

   Defines a set of 'nBeliefs' beliefs randomly simulating a POMDP.
   This function corresponds to that in line 2 of Table 2 in section 6 of
   the paper.

   The sampling of beliefs is organized in trials. Each trial starts from
   the given 'start' belief and evolves selecting actions and observations
   at radom. Actions are selected with uniform probability and
   observations from the corresponding observation model.
   Each trial is stopped after executing 'stepsXtrial' steps of when the
   received reward is outside the interval [minR, maxR].

   Only beliefs that are further away more than 'minBelifDist' from any
   other already stored beliefs are considered.
   
   The sampling of beliefs can be quite slow and some information is
   printed while it proceeds.
      '.' Means a new belief has been added to the output.
      '*' Means a trial has ended.

   See also SimulationStep, @DBelief/distance, @GMixture/Distance,
   @PBelief/Distance.

CROSS-REFERENCE INFORMATION ^

This function calls:
  • Distance Distance between beliefs.
  • rand Random state from a discrete belief.
  • get Get for GBeliefs.
  • Distance Distance between beliefs.
  • rand Random state from a belief.
  • Crop Limits all means to be inside the given space.
  • Distance Approximated Kullback-Leibler distance between Gaussian mixture.
  • get Get function for the GMixture object.
  • rand Generates random points on a GMixture.
  • Crop Forces the Gaussian mean to be in a given space.
  • get Gaussian object get function.
  • rand Generates random ponts on a Gaussian.
  • get Get function for CS_CO_CA_POMDPs.
  • get Get function for CS_CO_DA_POMDPs.
  • get Get function for CS_CO_POMDPs.
  • get Get function for CS_DO_CA_POMDPs.
  • get Get function for CS_DO_DA_POMDPs.
  • get Get function for CS_POMDPs.
  • get Get function for DS_CO_CA_POMDPs.
  • get Get function for DS_CO_DA_POMDPs.
  • get Get function for DS_DO_CA_POMDPs.
  • get Get function for DS_DO_DA_POMDPs.
  • SimulationStep Executes one step of a POMDP simulation.
  • get Get functio for POMDPs.
  • Crop Forces a state to be in a given continuous sub-space.
  • min Lower bound of a CSpace
  • rand Random state from a continuous space.
  • Crop Forces a state to be in a given discrete space.
  • rand Random state from a discrete space.
This function is called by:

SOURCE CODE ^

0001 function SB=SampleBeliefs(P,start,nBeliefs,minBeliefDist,stepsXtrial,minR,maxR)
0002 %   Samples a set of beliefs from a POMDP.
0003 %
0004 %   Defines a set of 'nBeliefs' beliefs randomly simulating a POMDP.
0005 %   This function corresponds to that in line 2 of Table 2 in section 6 of
0006 %   the paper.
0007 %
0008 %   The sampling of beliefs is organized in trials. Each trial starts from
0009 %   the given 'start' belief and evolves selecting actions and observations
0010 %   at radom. Actions are selected with uniform probability and
0011 %   observations from the corresponding observation model.
0012 %   Each trial is stopped after executing 'stepsXtrial' steps of when the
0013 %   received reward is outside the interval [minR, maxR].
0014 %
0015 %   Only beliefs that are further away more than 'minBelifDist' from any
0016 %   other already stored beliefs are considered.
0017 %
0018 %   The sampling of beliefs can be quite slow and some information is
0019 %   printed while it proceeds.
0020 %      '.' Means a new belief has been added to the output.
0021 %      '*' Means a trial has ended.
0022 %
0023 %   See also SimulationStep, @DBelief/distance, @GMixture/Distance,
0024 %   @PBelief/Distance.
0025 
0026   rand('state',sum(100*clock));
0027   
0028   A=get(P,'ActionSpace');
0029   S=get(P,'StateSpace');
0030   
0031   md=minBeliefDist+1;
0032   SB=cell(1,nBeliefs);
0033   k=0;
0034   r=maxR-1;
0035   while k<nBeliefs
0036     if (mod(k,stepsXtrial)==0) || (r>maxR) || (r<minR)
0037       b=start;
0038       s=Crop(S,rand(b));
0039       
0040       fprintf('*\n');
0041     end
0042     a=rand(A);
0043     [s b o r]=SimulationStep(P,b,s,a);
0044     
0045     if (k>1) && (minBeliefDist>0)
0046       md=min(cellfun(@(b1)(Distance(b,b1)),SB(1,k)));
0047     end
0048     if md>minBeliefDist
0049       k=k+1;
0050       SB{k}=b;
0051       
0052       fprintf('.');
0053       if mod(k,80)==0
0054         fprintf('\n');
0055       end
0056     end
0057   end
0058   fprintf('\n');
0059


Institut de Robòtica i Informàtica Industrial

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