TestRepPURPOSEExecutes many times of Perseus on a given problem.
SYNOPSISfunction TestRep(varargin)
DESCRIPTIONExecutes many times of Perseus on a given problem. Executes a sequence of experiments on a given problem and stores the results in a file. The aim of this is to obtain statistically significant data to generate the plots in the paper. Parameters can be - POMDP, P, range: The POMDP, the set of parameters, and the range for the repetitions. - name, range: The name is used to obtain the POMDP and the parameters P calling a function with name 'Get'+name+'Parameters' The execution of each repetition is extremely computationally demanding. The range is typically used to execute different repetitions in different computers, in parallel. Finally note that, before executing anything, we check whether the file to generat is already available. If so nothing is executed. Examples of use: Get the experiment parameters [POMDP P]=GetHallwayParameters; [POMDP P]=GetTest1Parameters; and execute TestRep(POMDP,P,infix,1:10); or directly use TestRep('Hallway',infix,1:10); TestRep('Test1',infix,1:10); After each experiment statistics are obtained using GetPOMDPSolutionStatistics At the end of the execution, a file with the results and the statistics is generated. This file is named as Results/POMDPname-infix-n.mat where - POMDPname is the output of get(POMDP,'name'). - infix is the parameter given when calling this function. - n is the repetition number (in the given range). See also SampleBeliefs, iPerseus, GetPOMDPSolutionStatistics. CROSS-REFERENCE INFORMATIONThis function calls:
SOURCE CODE0001 function TestRep(varargin) 0002 % Executes many times of Perseus on a given problem. 0003 % 0004 % Executes a sequence of experiments on a given problem and stores the 0005 % results in a file. 0006 % The aim of this is to obtain statistically significant data to generate 0007 % the plots in the paper. 0008 % 0009 % Parameters can be 0010 % - POMDP, P, range: The POMDP, the set of parameters, and the range 0011 % for the repetitions. 0012 % - name, range: The name is used to obtain the POMDP and the 0013 % parameters P calling a function with name 'Get'+name+'Parameters' 0014 % 0015 % The execution of each repetition is extremely computationally 0016 % demanding. The range is typically used to execute different repetitions 0017 % in different computers, in parallel. 0018 % 0019 % Finally note that, before executing anything, we check whether the file 0020 % to generat is already available. If so nothing is executed. 0021 % 0022 % Examples of use: 0023 % Get the experiment parameters 0024 % [POMDP P]=GetHallwayParameters; 0025 % [POMDP P]=GetTest1Parameters; 0026 % and execute 0027 % TestRep(POMDP,P,infix,1:10); 0028 % 0029 % or directly use 0030 % TestRep('Hallway',infix,1:10); 0031 % TestRep('Test1',infix,1:10); 0032 % 0033 % After each experiment statistics are obtained using GetPOMDPSolutionStatistics 0034 % At the end of the execution, a file with the results and the statistics is 0035 % generated. 0036 % This file is named as 0037 % Results/POMDPname-infix-n.mat 0038 % 0039 % where - POMDPname is the output of get(POMDP,'name'). 0040 % - infix is the parameter given when calling this function. 0041 % - n is the repetition number (in the given range). 0042 % 0043 % See also SampleBeliefs, iPerseus, GetPOMDPSolutionStatistics. 0044 0045 switch nargin 0046 case 3 0047 if isa(varargin{1},'char') 0048 [POMDP P]=eval(['Get' varargin{1} 'Parameters']); 0049 else 0050 error('Wrong type of parameters in TestOne'); 0051 end 0052 infix=varargin{2}; 0053 rep=varargin{3}; 0054 0055 case 4 0056 POMDP=varargin{1}; 0057 P=varargin{2}; 0058 infix=varargin{3}; 0059 rep=varargin{4}; 0060 0061 otherwise 0062 error('Wrong number of parameters in TestRep'); 0063 end 0064 0065 % Tag for the output files 0066 prefix=sprintf('Results/%s-%s',get(POMDP,'name'),infix); 0067 0068 for i=rep 0069 name=sprintf('%s-%u.mat',prefix,i); 0070 0071 f=fopen(name); 0072 if f<0 0073 fprintf('Repetition %u\n',i); 0074 0075 % Sample a set of beliefs 0076 fprintf(' Sampling Beliefs\n'); 0077 B=SampleBeliefs(POMDP,P.start,P.nBeliefs,P.dBelief,P.stepsXtrial,P.rMin,P.rMax); 0078 0079 % Solve the problem 0080 fprintf(' Solving\n'); 0081 [V Val Alpha time]=iPerseus(POMDP,B,P.stopCriteria); 0082 0083 % Collect statistics on the resulting set of plans 0084 [tics aV aR nA nC]=GetPOMDPSolutionStatistics(POMDP,P,B,V,Alpha,time,P.maxTime,P.stTime); 0085 0086 % Save results for this repetition 0087 save(name,'POMDP','P','B','V','Val','Alpha','time','tics','aV','aR','nA','nC'); 0088 else 0089 fprintf('Repetition %u is already generated\n',i); 0090 fclose(f); 0091 end 0092 0093 end |