Home > manopt > solvers > linesearch > linesearch_constant.m

linesearch_constant

PURPOSE ^

Forces a constant multiplier on the descent direction chosen by the algorithm.

SYNOPSIS ^

function [stepsize, newx, newkey, lsstats] =linesearch_constant(problem, x, d, ~, ~, ~, storedb, ~)

DESCRIPTION ^

 Forces a constant multiplier on the descent direction chosen by the algorithm.
 
 This is meant to be used by the steepestdescent or conjugategradients solvers.
 To use this method, specify linesearch_constant as an option, and your chosen
 constant alpha > 0 in the problem structure, as follows:

  problem.linesearch = @(x, d) 1.0;     % choose any positive real number
  options.linesearch = @linesearch_constant;
  x = steepestdescent(problem, [], options);

 The effective step (that is, the vector the optimization algorithm retracts)
 is constructed as alpha*d, and the step size is the norm of that vector.
 Thus: stepsize = alpha*norm_d.
 For steepestdescent, we have d = -grad f(x).
 The step is executed by retracting the vector alpha*d from the current
 point x, which gives newx (the returned point).
 This line-search method does not require any cost function evaluations,
 as there is effectively no search involved.

 Inputs

  problem : structure holding the description of the optimization problem
  x : current point on the manifold problem.M
  d : tangent vector at x (descent direction)
  storedb : StoreDB object (handle class: passed by reference) for caching

  storedb is optional.

 Outputs

  stepsize : norm of the vector retracted to reach newx from x.
  newx : next iterate using the constant stepsize, such that
         the retraction at x of the vector alpha*d reaches newx.
  newkey : key associated to newx in storedb
  lsstats : statistics about the line-search procedure
            (costevals, stepsize, alpha).

 See also: steepestdescent conjugategradients linesearch

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [stepsize, newx, newkey, lsstats] = ...
0002                   linesearch_constant(problem, x, d, ~, ~, ~, storedb, ~)
0003 % Forces a constant multiplier on the descent direction chosen by the algorithm.
0004 %
0005 % This is meant to be used by the steepestdescent or conjugategradients solvers.
0006 % To use this method, specify linesearch_constant as an option, and your chosen
0007 % constant alpha > 0 in the problem structure, as follows:
0008 %
0009 %  problem.linesearch = @(x, d) 1.0;     % choose any positive real number
0010 %  options.linesearch = @linesearch_constant;
0011 %  x = steepestdescent(problem, [], options);
0012 %
0013 % The effective step (that is, the vector the optimization algorithm retracts)
0014 % is constructed as alpha*d, and the step size is the norm of that vector.
0015 % Thus: stepsize = alpha*norm_d.
0016 % For steepestdescent, we have d = -grad f(x).
0017 % The step is executed by retracting the vector alpha*d from the current
0018 % point x, which gives newx (the returned point).
0019 % This line-search method does not require any cost function evaluations,
0020 % as there is effectively no search involved.
0021 %
0022 % Inputs
0023 %
0024 %  problem : structure holding the description of the optimization problem
0025 %  x : current point on the manifold problem.M
0026 %  d : tangent vector at x (descent direction)
0027 %  storedb : StoreDB object (handle class: passed by reference) for caching
0028 %
0029 %  storedb is optional.
0030 %
0031 % Outputs
0032 %
0033 %  stepsize : norm of the vector retracted to reach newx from x.
0034 %  newx : next iterate using the constant stepsize, such that
0035 %         the retraction at x of the vector alpha*d reaches newx.
0036 %  newkey : key associated to newx in storedb
0037 %  lsstats : statistics about the line-search procedure
0038 %            (costevals, stepsize, alpha).
0039 %
0040 % See also: steepestdescent conjugategradients linesearch
0041 
0042 % This file is part of Manopt: www.manopt.org.
0043 % Original author: Victor Liao, June 13, 2022.
0044 % Contributors:
0045 % Change log:
0046 
0047     % Allow omission of storedb.
0048     if ~exist('storedb', 'var')
0049         storedb = StoreDB();
0050     end
0051 
0052     % Obtain user-specified alpha if it exists.
0053     % User should specify their intended alpha by:
0054     % problem.linesearch = @(x,d) alpha;
0055     if canGetLinesearch(problem)
0056         alpha = getLinesearch(problem, x, d);
0057     else
0058         alpha = 1; % default alpha value.
0059     end
0060 
0061     % Make the chosen step and compute the cost there.
0062     newx = problem.M.retr(x, d, alpha);
0063     newkey = storedb.getNewKey();
0064     
0065     % As seen outside this function, stepsize is the size of the vector we
0066     % retract to make the step from x to newx. Since the step is alpha*d:
0067     norm_d = problem.M.norm(x, d);
0068     stepsize = alpha * norm_d;
0069     
0070     % Return some statistics also, for possible analysis.
0071     % Return some statistics also, for possible analysis.
0072     lsstats.costevals = 0;
0073     lsstats.stepsize = stepsize;
0074     lsstats.alpha = alpha;
0075 end

Generated on Fri 30-Sep-2022 13:18:25 by m2html © 2005