Home > solver > TEBD_GetFinalValues_1.m

TEBD_GetFinalValues_1

PURPOSE ^

Save final values: save the info after running 2EBD-HPE

SYNOPSIS ^

function results = TEBD_GetFinalValues_1(runhist,iter,par,prob,x,u,u_tilde,x_tilde,y_tilde,Z_tilde,secs)

DESCRIPTION ^

 Save final values: save the info after running 2EBD-HPE
%
% results = results = TEBD_GetFinalValues_1(runhist,iter,par,prob,x,u,u_tilde,x_tilde,y_tilde,Z_tilde,residuals_d,secs)
%
% input:
%        - obj                : contains the values of the objective function(s)
%        - runhist            : (struct) contains the accumulated running history
%        - iter               : current  iteration
%        - par                : (struct) parameters of the algorithm
%        - prob               : (struct) problem definition
%      - x                  : the current point x (1st block variable)
%      - u                  : the current point u (2nd block variable)
%      - u_tilde            : the current itermediate point u_tilde (2nd block variable)
%      - x_tilde            : the current itermediate point x_tilde (1st block variable)
%      - Z_tilde            : (struct) the current dual variable Z_tilde (1st block dual variable)
%      - y_tilde            : (struct) the current dual variable y_tilde (2nd block dual variable)
%      - residuals_d        : (struct) the current residuals (primal-dual feasibilities and duality gap) obtained directly from the dual variables
%        - secs               : time at the current iteration
%        
% output:
%        - results                       : (struct) contains all the results after running 2EBD
%        - results.x                     : resulting point x (1st block variable)  measured for convergence (x_tilde) at the las iteration
%        - results.u                     : resulting point u (2nd block variable)  measured for convergence (u_tilde) at the las iteration
%        - results.obj                   : objective function(s) at the last iteration
%        - results.par                   : (struct) parameters of the algorithm
%        - results.prob                  : (struct) problem definition
%        - results.finalresiduals        : (struct) the residuals (primal-dual feasibilities and duality gap) obtained at the last iteration
%        - results.runhist.x_tilde       : itermediate point u_tilde (2nd block variable) at the last iteration
%        - results.runhist.obj           : accumulated running history of the objective function(s)
%        - results.runhist               : (struct) contains the accumulated running history, including the info from the current iteration (iter)
%        - results.runhist.x             : point x (1st block variable) at the las iteration
%        - results.runhist.u             : point u (2nd block variable) at the las iteration
%        - results.runhist.Z             : (struct) dual variable Z (1st block dual variable) at the last iteration
%        - results.runhist.y             : (struct) dual variable Z (2nd block dual variable) at the last iteration
%        - results.runhist.finalobj      : objective function(s) at the last iteration
%        - results.runhist.x_tilde       : itermediate point x_tilde (1st block variable) at the last iteration
%        - results.runhist.u_tilde       : itermediate point u_tilde (2nd block variable) at the last iteration
%        - results.runhist.Z_tilde       : (struct) dual variable Z_tilde (1st block dual variable) at the last iteration
%        - results.runhist.y_tilde       : (struct) dual variable y_tilde (2nd block dual variable) at the last iteration
%        - results.runhist.processtime   : total running time of the method without including preprocessing time 
%        - results.runhist.numiterations : total number of iterations taken
%        - results.runhist.eachiteration : average time per itertion of the method
%        - results.runhist.totaltime     : total running time of the method including preprocessing time
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 2EBD-HPE:
% Modified by C.Ortiz
% Last Modified: 5/31/2013

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 % Save final values: save the info after running 2EBD-HPE
0002 %%
0003 %% results = results = TEBD_GetFinalValues_1(runhist,iter,par,prob,x,u,u_tilde,x_tilde,y_tilde,Z_tilde,residuals_d,secs)
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 %%        - par                : (struct) parameters of the algorithm
0010 %%        - prob               : (struct) problem definition
0011 %%      - x                  : the current point x (1st block variable)
0012 %%      - u                  : the current point u (2nd block variable)
0013 %%      - u_tilde            : the current itermediate point u_tilde (2nd block variable)
0014 %%      - x_tilde            : the current itermediate point x_tilde (1st block variable)
0015 %%      - Z_tilde            : (struct) the current dual variable Z_tilde (1st block dual variable)
0016 %%      - y_tilde            : (struct) the current dual variable y_tilde (2nd block dual variable)
0017 %%      - residuals_d        : (struct) the current residuals (primal-dual feasibilities and duality gap) obtained directly from the dual variables
0018 %%        - secs               : time at the current iteration
0019 %%
0020 %% output:
0021 %%        - results                       : (struct) contains all the results after running 2EBD
0022 %%        - results.x                     : resulting point x (1st block variable)  measured for convergence (x_tilde) at the las iteration
0023 %%        - results.u                     : resulting point u (2nd block variable)  measured for convergence (u_tilde) at the las iteration
0024 %%        - results.obj                   : objective function(s) at the last iteration
0025 %%        - results.par                   : (struct) parameters of the algorithm
0026 %%        - results.prob                  : (struct) problem definition
0027 %%        - results.finalresiduals        : (struct) the residuals (primal-dual feasibilities and duality gap) obtained at the last iteration
0028 %%        - results.runhist.x_tilde       : itermediate point u_tilde (2nd block variable) at the last iteration
0029 %%        - results.runhist.obj           : accumulated running history of the objective function(s)
0030 %%        - results.runhist               : (struct) contains the accumulated running history, including the info from the current iteration (iter)
0031 %%        - results.runhist.x             : point x (1st block variable) at the las iteration
0032 %%        - results.runhist.u             : point u (2nd block variable) at the las iteration
0033 %%        - results.runhist.Z             : (struct) dual variable Z (1st block dual variable) at the last iteration
0034 %%        - results.runhist.y             : (struct) dual variable Z (2nd block dual variable) at the last iteration
0035 %%        - results.runhist.finalobj      : objective function(s) at the last iteration
0036 %%        - results.runhist.x_tilde       : itermediate point x_tilde (1st block variable) at the last iteration
0037 %%        - results.runhist.u_tilde       : itermediate point u_tilde (2nd block variable) at the last iteration
0038 %%        - results.runhist.Z_tilde       : (struct) dual variable Z_tilde (1st block dual variable) at the last iteration
0039 %%        - results.runhist.y_tilde       : (struct) dual variable y_tilde (2nd block dual variable) at the last iteration
0040 %%        - results.runhist.processtime   : total running time of the method without including preprocessing time
0041 %%        - results.runhist.numiterations : total number of iterations taken
0042 %%        - results.runhist.eachiteration : average time per itertion of the method
0043 %%        - results.runhist.totaltime     : total running time of the method including preprocessing time
0044 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0045 %% 2EBD-HPE:
0046 %% Modified by C.Ortiz
0047 %% Last Modified: 5/31/2013
0048 function results = TEBD_GetFinalValues_1(runhist,iter,par,prob,x,u,u_tilde,x_tilde,y_tilde,Z_tilde,secs)
0049 runhist.maxitreached = 0;
0050 if (iter>=par.maxit);
0051     fprintf('max iterations reached. \n');
0052     runhist.maxitreached = 1;
0053 end
0054 obj = runhist.obj{iter};
0055 
0056 runhist.x = x;
0057 runhist.u = u;
0058 runhist.finalobj = obj;
0059 runhist.u_tilde = u_tilde;
0060 runhist.x_tilde = x_tilde;
0061 
0062 
0063 runhist.processtime = secs;
0064 runhist.numiterations = iter;
0065 runhist.eachiteration = secs/iter;
0066 runhist.totaltime = secs+runhist.preprocesstime;
0067 
0068 if ~isfield(runhist,'finalresnorm2'); runhist.finalresnorm2 = runhist.finalbestresnorm; end;
0069 if ~isfield(runhist,'numiterations2'); runhist.numiterations2 = runhist.numiterations; end;
0070 if ~isfield(runhist,'finalresnorm3'); runhist.finalresnorm3 = runhist.finalresnorm2; end;
0071 if ~isfield(runhist,'numiterations3'); runhist.numiterations3 = runhist.numiterations2; end;
0072 
0073 results.runhist = runhist;
0074 results.x = x_tilde;
0075 results.u = u_tilde;
0076 results.y = y_tilde;
0077 results.Z = Z_tilde;
0078 results.obj = obj;
0079 results.par = par;
0080 results.prob = prob;
0081 
0082 residuals_d = runhist.residual(iter);
0083 results.finalresiduals = residuals_d;
0084 
0085 
0086 fprintf('preprocess time: %10.3f \n',runhist.preprocesstime);
0087 fprintf('# iterations: %d \n',runhist.numiterations);
0088 fprintf('iterations time: %10.3f \n',runhist.processtime);
0089 fprintf('each iteration time: %f \n',runhist.eachiteration);
0090 fprintf('Final norm of residual: %e \n',runhist.finalbestresnorm);
0091 fprintf('pfeas=%8.3e, dfeas=%8.3e, gap=%8.3e \n', residuals_d.pfeas,residuals_d.dfeas,residuals_d.gap);
0092 fprintf('total time: %10.3f \n',runhist.totaltime);
0093 end

Generated on Tue 06-Aug-2013 17:07:59 by m2html © 2005