![]() |
ContinueSimulationPURPOSE
Continues a previous partial simulation.
SYNOPSIS
function R=ContinueSimulation(Result,varargin)
DESCRIPTION
Continues a previous partial simulation. Continues a simulation from a previous run. The input is the Result structure out of a experiment. See also Experiment1a, Experiment1b, Experiment1c. CROSS-REFERENCE INFORMATION
This function calls:
SOURCE CODE
0001 function R=ContinueSimulation(Result,varargin) 0002 % Continues a previous partial simulation. 0003 % 0004 % Continues a simulation from a previous run. 0005 % The input is the Result structure out of a experiment. 0006 % 0007 % See also Experiment1a, Experiment1b, Experiment1c. 0008 0009 F=Result.Filter; 0010 R=Result.Robot; 0011 Parameters=Result.Parameters; 0012 0013 if nargin>1 0014 Parameters.maxSteps=get(F,'nSteps')+varargin{1}+1; 0015 else 0016 Parameters.maxSteps=0; 0017 end 0018 0019 R=Simulation(F,R,Parameters); 0020 0021 allFields=true; 0022 0023 if isfield(R,'timeS') 0024 n=size(Result.timeS,2); 0025 R.timeS(1:n)=Result.timeS; 0026 end 0027 0028 if isfield(R,'timeT') 0029 n=size(Result.timeT,2); 0030 R.timeT(1:n)=Result.timeT; 0031 end 0032 0033 if isfield(R,'timeSA') 0034 n=size(Result.timeSA,2); 0035 R.timeSA(1:n)=Result.timeSA; 0036 else 0037 allFields=false; 0038 end 0039 0040 if isfield(R,'timeLC') 0041 n=size(Result.timeLC,2); 0042 R.timeLC(1:n)=Result.timeLC; 0043 else 0044 allFields=false; 0045 end 0046 0047 if isfield(R,'timeF') 0048 R.timeF=Result.timeF+R.timeF; 0049 else 0050 allFields=false; 0051 end 0052 0053 if isfield(R,'time') 0054 R.time=Result.time+R.time; 0055 else 0056 allFields=false; 0057 end 0058 0059 if isfield(R,'totalIG') 0060 R.totalIG=Result.totalIG+R.totalIG; 0061 end 0062 0063 if isfield(R,'numProposedLoops') 0064 R.numProposedLoops=Result.numProposedLoops+R.numProposedLoops; 0065 end 0066 0067 if isfield(R,'numClosedLoops') 0068 R.numClosedLoops=Result.numClosedLoops+R.numClosedLoops; 0069 end 0070 0071 if isfield(R,'NEES') 0072 n=size(Result.NEES,2); 0073 R.NEES(1:n)=Result.NEES; 0074 end 0075 0076 if allFields && (~Parameters.quiet) 0077 step=get(R.Filter,'nSteps'); 0078 fprintf('\n\nAccumulated statistics:\n'); 0079 if isfield(R,'timeS') && isfield(R,'timeT') 0080 fprintf(' Execution time: %f sec (%f sec per step. Search time: %f Tree time: %f)\n',R.time,R.time/step,sum(R.timeS),sum(R.timeT)); 0081 else 0082 fprintf(' Execution time: %f sec (%f sec per step)\n',R.time,R.time/step); 0083 end 0084 fprintf(' State Augmenation time: %f\n',sum(R.timeSA)); 0085 fprintf(' Loop Closure time : %f\n',sum(R.timeLC)); 0086 if isfield(R,'numProposedLoops') && isfield(R,'numClosedLoops') 0087 if Result.numProposedLoops>0 0088 fprintf(' Loop ratio: %u/%u=%f\n',Result.numClosedLoops,Result.numProposedLoops,Result.numClosedLoops/Result.numProposedLoops*100); 0089 else 0090 fprintf(' No loop closure was proposed\n'); 0091 end 0092 end 0093 end 0094 0095 |