Save history: Save the progress at the current iteration % % runhist = TEBD_SaveHistory(obj,runhist,iter,residuals,secs,lambda_ratio,theta) % % input: % - obj : contains the values of the objective function(s) % - runhist : (struct) contains the accumulated running history % - iter : current iteration % - resduals : (struct) contains the specific residuals of the problem at the current iteration % - secs : time at the current iteration % - lambda_ratio : ratio between a the adaptive and the non-adaptive stepsizes (lambda) % - theta : value of the dynamic scaling parameter at the current iteration % % output: % - runhist : (struct) contains the accumulated running history, including the info from the current iteration (iter) % - runhist.obj : accumulated running history of the objective function(s) % - runhist.theta : accumulated running history of the dynamic scaling parameter % - runhist.gap : accumulated running history of the duality gap (if it applies for the given problem) % - runhist.resnorm : accumulated running history of the problem specific norms of the residuals % - runhist.lambda_ratio : accumulated running history of the ratio between a the adaptive and the non-adaptive stepsizes (lambda) % - runhist.residual : accumulated running history of the specific residuals of the problem at the current iteration % - runhist.cputime : accumulated running history of the time at every iteration % - runhist.finalbestresnorm : the current minimum norm of the residuals % - runhist.objbest : the objective function(s) at the iteration with minimum norm of the residuals % - runhist.bestiteration : the iteration with minimum norm of the residuals %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % 2EBD-HPE: % Modified by C.Ortiz % Last Modified: 6/15/2012
0001 %Save history: Save the progress at the current iteration 0002 %% 0003 %% runhist = TEBD_SaveHistory(obj,runhist,iter,residuals,secs,lambda_ratio,theta) 0004 %% 0005 %% input: 0006 %% - obj : contains the values of the objective function(s) 0007 %% - runhist : (struct) contains the accumulated running history 0008 %% - iter : current iteration 0009 %% - resduals : (struct) contains the specific residuals of the problem at the current iteration 0010 %% - secs : time at the current iteration 0011 %% - lambda_ratio : ratio between a the adaptive and the non-adaptive stepsizes (lambda) 0012 %% - theta : value of the dynamic scaling parameter at the current iteration 0013 %% 0014 %% output: 0015 %% - runhist : (struct) contains the accumulated running history, including the info from the current iteration (iter) 0016 %% - runhist.obj : accumulated running history of the objective function(s) 0017 %% - runhist.theta : accumulated running history of the dynamic scaling parameter 0018 %% - runhist.gap : accumulated running history of the duality gap (if it applies for the given problem) 0019 %% - runhist.resnorm : accumulated running history of the problem specific norms of the residuals 0020 %% - runhist.lambda_ratio : accumulated running history of the ratio between a the adaptive and the non-adaptive stepsizes (lambda) 0021 %% - runhist.residual : accumulated running history of the specific residuals of the problem at the current iteration 0022 %% - runhist.cputime : accumulated running history of the time at every iteration 0023 %% - runhist.finalbestresnorm : the current minimum norm of the residuals 0024 %% - runhist.objbest : the objective function(s) at the iteration with minimum norm of the residuals 0025 %% - runhist.bestiteration : the iteration with minimum norm of the residuals 0026 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0027 %% 2EBD-HPE: 0028 %% Modified by C.Ortiz 0029 %% Last Modified: 6/15/2012 0030 function runhist = TEBD_SaveHistory(obj,runhist,iter,residuals,secs,lambda_ratio,theta) 0031 0032 runhist.obj{iter}= obj; 0033 0034 runhist.theta(iter)= theta; 0035 0036 runhist.gap(iter)= residuals.gap; 0037 0038 runhist.resnorm(iter) = residuals.resnorm; 0039 0040 runhist.lambda_ratio(iter) = lambda_ratio; 0041 0042 runhist.residual(iter) = residuals; 0043 0044 runhist.cputime(iter) = secs; 0045 0046 if iter == 1 || runhist.finalbestresnorm >= residuals.resnorm 0047 runhist.finalbestresnorm = residuals.resnorm; 0048 runhist.objbest(1)=runhist.obj(iter); 0049 runhist.bestiteration = iter; 0050 end 0051 0052