• 大小: 2KB
    文件类型: .zip
    金币: 2
    下载: 1 次
    发布日期: 2021-04-17
  • 语言: Matlab
  • 标签: 乘子法  MATLAB  增广  

资源简介

增广拉格朗日乘子法matlab源码

资源截图

代码片段和文件信息

% Copyright ?010. The Regents of the University of California (Regents). 
% All Rights Reserved. Contact The Office of Technology Licensing 
% UC Berkeley 2150 Shattuck Avenue Suite 510 Berkeley CA 94720-1620 
% (510) 643-7201 for commercial licensing opportunities.

% Authors: Arvind Ganesh Allen Y. Yang Zihan Zhou.
% Contact: Allen Y. Yang Department of EECS University of California
% Berkeley. 

% IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT INDIRECT 
% SPECIAL INCIDENTAL OR CONSEQUENTIAL DAMAGES INCLUDING LOST PROFITS 
% ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION EVEN IF 
% REGENTS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

% REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES INCLUDING BUT NOT LIMITED
% TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 
% PARTICULAR PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION IF ANY 
% PROVIDED HEREUNDER IS PROVIDED “AS IS“. REGENTS HAS NO OBLIGATION TO 
% PROVIDE MAINTENANCE SUPPORT UPDATES ENHANCEMENTS OR MODIFICATIONS.

%% This function is modified from Matlab code proximal_gradient_bp

function [x nIter timeSteps errorSteps] = SolvePALM(A b varargin)

t0 = tic;
DEBUG = 0 ;
DISPLAY = 0 ;

STOPPING_TIME = -2;
STOPPING_GROUND_TRUTH = -1;
STOPPING_DUALITY_GAP = 1;
STOPPING_SPARSE_SUPPORT = 2;
STOPPING_objectIVE_VALUE = 3;
STOPPING_SUBGRADIENT = 4;
STOPPING_INCREMENTS = 5 ;
STOPPING_DEFAULT = STOPPING_INCREMENTS;

stoppingCriterion = STOPPING_DEFAULT;

% Initialize parameters
[mn] = size(A) ;

tol = 1e-6 ;
tol_apg = 1e-6 ;


At = A‘;
G = At*A ;
opts.disp = 0;
tau = eigs(G1‘lm‘opts);
tauInv = 1/tau;

nIter = 0 ;

mu = 20 *m / norm(b1);
muInv = 1/mu ;

lambda = ones(m1) ;
x = zeros(n1) ;

converged_main = 0 ;

maxIter = 200 ;
maxIter_apg = 50 ;

nz_x = (abs(x)>eps*10);

% Parse the optional inputs.
if (mod(length(varargin) 2) ~= 0 )
    error([‘Extra Parameters passed to the function ‘‘‘ mfilename ‘‘‘ lambdast be passed in pairs.‘]);
end
parameterCount = length(varargin)/2;

for parameterIndex = 1:parameterCount
    parameterName = varargin{parameterIndex*2 - 1};
    parameterValue = varargin{parameterIndex*2};
    switch lower(parameterName)
        case ‘stoppingcriterion‘
            stoppingCriterion = parameterValue;
        case ‘groundtruth‘
            xG = parameterValue;
        case ‘tolerance‘
            tol = parameterValue;
        case ‘maxiteration‘
            maxIter = parameterValue;
        case ‘maxtime‘
            maxTime = parameterValue;
        case ‘lambda‘
            warning(‘The parameter LAMBDA is ignored.‘);
        otherwise
            error([‘The parameter ‘‘‘ parameterName ‘‘‘ is not recognized by the function ‘‘‘ mfilename ‘‘‘.‘]);
    end
end
clear varargin

timeSteps = nan(1maxIter) ;
errorSteps = nan(1maxIter) ;

f = norm(x1);
while ~converged_ma

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       6192  2012-11-08 18:30  SolvePALM.m

----------- ---------  ---------- -----  ----

                 6192                    1


评论

共有 条评论