proxtoolbox.algorithms package

This package contains the different algorithms that can be used when running the various experiments contained in the proxtoolbox. It contains the abstract Algorithm class and various concrete classes.

Submodules

proxtoolbox.algorithms.ADMM module

class proxtoolbox.algorithms.ADMM.ADMM(experiment, iterateMonitor, accelerator)[source]

Bases: proxtoolbox.algorithms.algorithm.Algorithm

Alternating directions method of multipliers for solving problems of the form : minimize f(x) + g(y), subject to Ax=y

Based on Matlab code written by Russell Luke (Inst. Fuer Numerische und Angewandte Mathematik, Universitaet Gottingen) on October 2, 2017.

evaluate(u)[source]

Update of the ADMM algorithm

Parameters:
u : a 3-dimensional cell

The current iterate. 3 blocks of variables, primal (x), auxilliary (y) and dual variables corresponding to Lagrange multipliers for the constraint Ax=y

Returns:
u_new : a 3-dimensional cell

The new iterate (same type as input parameter u).

getDescription()[source]

Function returning a string giving the algorithm name and optionally a list of parameters that characterize this algorithm (i.e., lambda_0, and lambda_max constants). This string is used for graphical output. The default implementation only returns the name of the class implementing this algorithm. Derived classes may overrride this method to add meaningful parameters.

Returns:
desc : string

short description of the algorithm

proxtoolbox.algorithms.ADMM_IterateMonitor module

class proxtoolbox.algorithms.ADMM_IterateMonitor.ADMM_IterateMonitor(experiment)[source]

Bases: proxtoolbox.algorithms.iterateMonitor.IterateMonitor

Algorithm analyzer for monitoring iterates of projection algorithms for the ADMM algorithm. Specialization of the IterateMonitor class.

preprocess(alg)[source]

Allocate data structures needed to collect statistics. Called before running the algorithm.

Parameters:
alg : instance of Algorithm class

Algorithm to be monitored.

updateStatistics(alg)[source]

Update statistics. Called at each iteration while the algorithm is running.

Parameters:
alg : instance of Algorithm class

Algorithm being monitored.

postprocess(alg, output)[source]

Called after the algorithm stops. Store statistics in the given ‘output’ dictionary

Parameters:
alg : instance of Algorithm class

Algorithm that was monitored.

output : dictionary

Contains the last iterate and various statistics that were collected while the algorithm was running.

Returns:
output : dictionary into which the following entries are added

(when diagnostics are required)

gaps : ndarray

Squared gap distance normalized by the magnitude constraint

shadows : ndarray

??? TODO

proxtoolbox.algorithms.ADMM_PhaseLagrangeUpdate module

class proxtoolbox.algorithms.ADMM_PhaseLagrangeUpdate.ADMM_PhaseLagrangeUpdate(experiment)[source]

Bases: proxtoolbox.proxoperators.ADMM_prox.ADMM_Context

Explicit step with respect to the Lagrange multipliers in the ADMM algorithm.

Based on Matlab code written by Russell Luke (Inst. Fuer Numerische und Angewandte Mathematik, Universitaet Gottingen) on Oct 1, 2017.

eval(u)[source]

Explicit step with respect to the Lagrange multipliers in the ADMM algorithm

Parameters:
u : cell

Input data

Returns:
xprime : cell

The resulting step

proxtoolbox.algorithms.ADMM_phase_indicator_objective module

class proxtoolbox.algorithms.ADMM_phase_indicator_objective.ADMM_phase_indicator_objective(experiment)[source]

Bases: proxtoolbox.proxoperators.ADMM_prox.ADMM_Context

Augmented Lagrangian for the ADMM algorithm applied to the phase retrieval problem with an indicator function for the primal objective: Lagrangian(u{1}, u{2}, u{3})= iota_0(u{1}) + … sum_{j=1}^m iota_j(u{2}(j) + <u{3}(j), (F_ju{1}(j))-u{2}(j))>

  • 1/2||F_ju{1}(j))-u{2}(j)||^2

We assume that the point u is feasible, so the indicator functions will be zero and all that need be computed is:

Lagrangian(u{1}, u{2}, u{3}) = sum_{j=1}^m <u{3}(j),
(F_ju{1}(j))-u{2}(j)> + 1/2||F_ju{1}(j))-u{2}(j)||^2

Based on Matlab code written by Russell Luke (Inst. Fuer Numerische und Angewandte Mathematik, Universitaet Gottingen) on Oct 3, 2017.

calculateObjective(alg)[source]

Evaluate ADMM objective function

Parameters:
alg : algorithm instance

The algorithm that is running

Returns:
lagrangian : real

The value of the objective function which will in this case measure the gap

proxtoolbox.algorithms.AP module

class proxtoolbox.algorithms.AP.AP(experiment, iterateMonitor, accelerator=None)[source]

Bases: proxtoolbox.algorithms.algorithm.Algorithm

Alternating Projection algorithm

evaluate(u)[source]

Update for Alternating projection algorithm.

Parameters:
u : ndarray or a list of ndarray objects

The current iterate.

Returns:
u_new : ndarray or a list of ndarray objects

The new iterate (same type as input parameter u).

proxtoolbox.algorithms.AvP module

class proxtoolbox.algorithms.AvP.AvP(experiment, iterateMonitor, accelerator)[source]

Bases: proxtoolbox.algorithms.algorithm.Algorithm

Averaged Projections algorithm

Based on Matlab code written by Russell Luke (Inst. Fuer Numerische und Angewandte Mathematik, Universitaet Gottingen) on Aug.18, 2017.

evaluate(u)[source]

Update of the Averaged Projections algorithm

Parameters:
u : ndarray or a list of ndarray objects

The current iterate.

Returns:
u_new : ndarray or a list of ndarray objects

The new iterate (same type as input parameter u).

Notes

We try to figure out how the user is calling this. Either (1) the user knows that averaged projections is alternating projectons on the product space with one of the sets being the diagonal, or (2) the user hasn’t preprocessed this and has just passed the list of prox mappings and left it to us to rearrange and average. If it is case (1) one of the prox mappings will be P_Diag, otherwise we will assume that we are in case (2)

proxtoolbox.algorithms.AvP2 module

class proxtoolbox.algorithms.AvP2.AvP2(experiment, iterateMonitor, accelerator)[source]

Bases: proxtoolbox.algorithms.algorithm.Algorithm

Alternating prox with modification as described in Luke,Sabach&Teboulle “Optimization on Spheres: Models and Proximal Algorithms with Computational Performance Comparisons” D. R. Luke, S. Sabach and M. Teboulle. 2019. This is an averaged projections algorithm with a 2-step recursion (x^{k-1}, x^{k}, u^{k})

Based on Matlab code written by Russell Luke (Inst. Fuer Numerische und Angewandte Mathematik, Universitaet Gottingen) on September 08, 2016.

evaluate(u)[source]

Update of the AvP2 algorithm

Parameters:
u : ndarray or a cell of ndarray objects

The current iterate.

Returns:
u_new : ndarray or a cell of ndarray objects

The new iterate (same type as input parameter u).

proxtoolbox.algorithms.AvP2_IterateMonitor module

class proxtoolbox.algorithms.AvP2_IterateMonitor.AvP2_IterateMonitor(experiment)[source]

Bases: proxtoolbox.algorithms.iterateMonitor.IterateMonitor

Algorithm analyzer for monitoring iterates of projection algorithms for the PHeBIE algorithm. Specialization of the IterateMonitor class.

preprocess(alg)[source]

Allocate data structures needed to collect statistics. Called before running the algorithm.

Parameters:
alg : instance of Algorithm class

Algorithm to be monitored.

updateStatistics(alg)[source]

Update statistics. Called at each iteration while the algorithm is running.

Parameters:
alg : instance of Algorithm class

Algorithm being monitored.

calculateObjective(alg)[source]

Calculate objective value. The dafault implementation uses the optimality monitor if it exists

Parameters:
alg : instance of Algorithm class

Algorithm that was monitored.

Returns:
objValue : real

objective value

postprocess(alg, output)[source]

Called after the algorithm stops. Store statistics in the given ‘output’ dictionary

Parameters:
alg : instance of Algorithm class

Algorithm that was monitored.

output : dictionary

Contains the last iterate and various statistics that were collected while the algorithm was running.

Returns:
output : dictionary into which the following entries are added

(when diagnostics are required)

gaps : ndarray

Squared gap distance normalized by the magnitude constraint

proxtoolbox.algorithms.CADRl module

class proxtoolbox.algorithms.CADRl.CADRl(experiment, iterateMonitor, accelerator=None)[source]

Bases: proxtoolbox.algorithms.algorithm.Algorithm

Relaxed version of a cyclic averaged alternating reflections method (CAAR) proposed by Borwein and Tam, Journal of Nonlinear and Convex Analysis Volume 16, Number 4. The relaxation is the relaxed Douglas Rachford algorithm proposed and analysed by Luke, Inverse Problems, 2005 and SIAM J. on Optimization, 2008)

For more on the CDRl algorithm in the convex setting see: D. R. Luke, A. Martins and M. K. Tam. “Relaxed Cyclic Douglas-Rachford Algorithms for Nonconvex Optimization.” ICML 2018 Workshop: Modern Trends in Nonconvex Optimization for Machine Learning, Stockholm, July 2018. https://sites.google.com/view/icml2018nonconvex/papers

Based on Matlab code written by Russell Luke (Inst. Fuer Numerische und Angewandte Mathematik, Universitaet Gottingen) on Aug 18, 2017.

evaluate(u)[source]

Update for the relaxed version of a cyclic averaged alternating reflections algorithm

Parameters:
u : ndarray

The current iterate.

Returns:
u_new : ndarray

The new iterate (same type as input parameter u).

getDescription()[source]

Function returning a string giving the algorithm name and optionally a list of parameters that characterize this algorithm (i.e., lambda_0, and lambda_max constants). This string is used for graphical output. The default implementation only returns the name of the class implementing this algorithm. Derived classes may overrride this method to add meaningful parameters.

Returns:
desc : string

short description of the algorithm

proxtoolbox.algorithms.CDRl module

class proxtoolbox.algorithms.CDRl.CDRl(experiment, iterateMonitor, accelerator=None)[source]

Bases: proxtoolbox.algorithms.algorithm.Algorithm

Relaxed version of a cyclic averaged alternating reflections method (CAAR) proposed by Borwein and Tam, Journal of Nonlinear and Convex Analysis Volume 16, Number 4. The relaxation is the relaxed Douglas Rachford algorithm proposed and analysed by Luke, Inverse Problems, 2005 and SIAM J. on Optimization, 2008)

For more on the CDRl algorithm in the convex setting see: D. R. Luke, A. Martins and M. K. Tam. “Relaxed Cyclic Douglas-Rachford Algorithms for Nonconvex Optimization.” ICML 2018 Workshop: Modern Trends in Nonconvex Optimization for Machine Learning, Stockholm, July 2018. https://sites.google.com/view/icml2018nonconvex/papers

Based on Matlab code written by Russell Luke (Inst. Fuer Numerische und Angewandte Mathematik, Universitaet Gottingen) on Aug 18, 2017.

evaluate(u)[source]

Update for the relaxed version of a cyclic averaged alternating reflections algorithm

Parameters:
u : ndarray

The current iterate.

Returns:
u_new : ndarray

The new iterate (same type as input parameter u).

getDescription()[source]

Function returning a string giving the algorithm name and optionally a list of parameters that characterize this algorithm (i.e., lambda_0, and lambda_max constants). This string is used for graphical output. The default implementation only returns the name of the class implementing this algorithm. Derived classes may overrride this method to add meaningful parameters.

Returns:
desc : string

short description of the algorithm

proxtoolbox.algorithms.CP module

class proxtoolbox.algorithms.CP.CP(experiment, iterateMonitor, accelerator=None)[source]

Bases: proxtoolbox.algorithms.algorithm.Algorithm

Cyclic Projections algorithm

evaluate(u)[source]

Update for Cyclic Projections algorithm.

Parameters:
u : ndarray

The current iterate.

Returns
——-
u_new : ndarray

The new iterate.

proxtoolbox.algorithms.CT_IterateMonitor module

class proxtoolbox.algorithms.CT_IterateMonitor.CT_IterateMonitor(experiment)[source]

Bases: proxtoolbox.algorithms.iterateMonitor.IterateMonitor

Algorithm analyzer for monitoring iterates of projection algorithms for CT (ART) experiments Specialization of the IterateMonitor class.

It would be more appropriate to derive from FeasibilityIterateMonitor, but this would result in too many calculations

Was used for plotting. Now does nothing, but this could change…

proxtoolbox.algorithms.DRAP module

class proxtoolbox.algorithms.DRAP.DRAP(experiment, iterateMonitor, accelerator=None)[source]

Bases: proxtoolbox.algorithms.algorithm.Algorithm

A type of hybrid Douglas-Rachford and Alternating projections proposed by Nguyen H. Thao, “A convergent relaxation of the Douglas–Rachford algorithm”, Comput. Optim. Appl., 70 (2018), pp. 841–863.

Based on Matlab code written by Russell Luke (Inst. Fuer Numerische und Angewandte Mathematik, Universitaet Gottingen) on Aug 18, 2017.

evaluate(u)[source]

Update of the Relaxed Averaged Alternating Reflection algorithm.

Parameters:
u : ndarray or a list of ndarray objects

The current iterate.

Returns:
u_new : ndarray or a list of ndarray objects

The new iterate (same type as input parameter u).

getDescription()[source]

Function returning a string giving the algorithm name and optionally a list of parameters that characterize this algorithm (i.e., lambda_0, and lambda_max constants). This string is used for graphical output. The default implementation only returns the name of the class implementing this algorithm. Derived classes may overrride this method to add meaningful parameters.

Returns:
desc : string

short description of the algorithm

proxtoolbox.algorithms.DRl module

class proxtoolbox.algorithms.DRl.DRl(experiment, iterateMonitor, accelerator=None)[source]

Bases: proxtoolbox.algorithms.RAAR.RAAR

Relaxed Averaged Alternating Reflection algorithm.

For background see: D.R.Luke, Inverse Problems 21:37-50(2005) D.R. Luke, SIAM J. Opt. 19(2): 714–739 (2008). D. R. Luke and A.-L. Martins, “Convergence Analysis of the Relaxed Douglas Rachford Algorithm” , SIAM J. on Optimization, 30(1):542–584(2020). https://epubs.siam.org/doi/abs/10.1137/18M1229638

Based on Matlab code written by Russell Luke (Inst. Fuer Numerische und Angewandte Mathematik, Universitaet Gottingen) on Aug 18, 2017.

proxtoolbox.algorithms.DyRePr module

class proxtoolbox.algorithms.DyRePr.DyRePr(experiment, iterateMonitor, accelerator)[source]

Bases: proxtoolbox.algorithms.AvP.AvP

Dynamically Reweighted Prox mappings as presented in Luke,Burke,Lyon “OPTICAL WAVEFRONT RECONSTRUCTION: THEORY AND NUMERICAL METHODS”, SIAM Review, 2002, where it is described as extended least squares: a gradient descent method for minimizing the log likelihood objective of the sum of squared distances to sets.

Based on Matlab code written by Russell Luke (Inst. Fuer Numerische und Angewandte Mathematik, Universitaet Gottingen) on Aug.18, 2017.

evaluate(u)[source]

Update of the Averaged Projections algorithm

Parameters:
u : ndarray or a list of ndarray objects

The current iterate.

Returns:
u_new : ndarray or a list of ndarray objects

The new iterate (same type as input parameter u).

Notes

We try to figure out how the user is calling this. Either (1) the user knows that averaged projections is alternating projectons on the product space with one of the sets being the diagonal, or (2) the user hasn’t preprocessed this and has just passed the list of prox mappings and left it to us to rearrange and average. If it is case (1) one of the prox mappings will be P_Diag, otherwise we will assume that we are in case (2)

proxtoolbox.algorithms.GenericAccelerator module

class proxtoolbox.algorithms.GenericAccelerator.GenericAccelerator(experiment)[source]

Bases: object

Generic Nesterov-type accelerator for first-order methods

Based on Matlab code written by Russell Luke (Inst. Fuer Numerische und Angewandte Mathematik, Universitaet Gottingen) on April 5, 2018.

evaluate(u, alg)[source]

Evaluation of generic Nesterov-type accelerator for first-order methods

Parameters:
u : ndarray or a cell of ndarray objects

The point to be accelerated.

alg : Algorithm object

The algorithm that uses this accelerator

Returns:
u_new : ndarray or a cell of ndarray objects

(same type as input parameter u) The step generated by this acceleration method (same type as input parameter u).

proxtoolbox.algorithms.HPR module

class proxtoolbox.algorithms.HPR.HPR(experiment, iterateMonitor, accelerator=None)[source]

Bases: proxtoolbox.algorithms.algorithm.Algorithm

User-friendly version of the Heinz-Patrick-Russell algorithm. See Bauschke,Combettes&Luke, Journal of the Optical Society of America A, 20(6):1025-1034 (2003).

Based on Matlab code written by Russell Luke (Inst. Fuer Numerische und Angewandte Mathematik, Universitaet Gottingen) on May 23, 2002, revised Jan.17, 2005.

evaluate(u)[source]

Update for the Heinz-Patrick-Russell algorithm

Parameters:
u : ndarray or a list of ndarray objects

The current iterate.

Returns:
u_new : ndarray or a list of ndarray objects

The new iterate (same type as input parameter u).

getDescription()[source]

Function returning a string giving the algorithm name and optionally a list of parameters that characterize this algorithm (i.e., lambda_0, and lambda_max constants). This string is used for graphical output. The default implementation only returns the name of the class implementing this algorithm. Derived classes may overrride this method to add meaningful parameters.

Returns:
desc : string

short description of the algorithm

proxtoolbox.algorithms.PHeBIE module

class proxtoolbox.algorithms.PHeBIE.PHeBIE(experiment, iterateMonitor, accelerator)[source]

Bases: proxtoolbox.algorithms.algorithm.Algorithm

Proximal Heterogenious Block Implicit-Explicit (PHeBIE) minimzation algorithm as proposed in the paper “Proximal Heterogeneous Block Implicit-Explicit Method and Application to Blind Ptychographic Diffraction Imaging”, R. Hesse, D. R. Luke, S. Sabach and M. K. Tam, SIAM J. on Imaging Sciences, 8(1):426–457 (2015).

Based on Matlab code written by Russell Luke (Inst. Fuer Numerische und Angewandte Mathematik, Universitaet Gottingen) on Aug. 31, 2017.

evaluate(u)[source]

Update for the PHeBIE algorithm

Parameters:
u : a cell whose cell elements are the blocks

The current iterate.

Returns:
u_new : type ???

The new iterate.

proxtoolbox.algorithms.PHeBIE_IterateMonitor module

class proxtoolbox.algorithms.PHeBIE_IterateMonitor.PHeBIE_IterateMonitor(experiment)[source]

Bases: proxtoolbox.algorithms.iterateMonitor.IterateMonitor

Algorithm analyzer for monitoring iterates of projection algorithms for the PHeBIE algorithm. Specialization of the IterateMonitor class.

preprocess(alg)[source]

Allocate data structures needed to collect statistics. Called before running the algorithm.

Parameters:
alg : instance of Algorithm class

Algorithm to be monitored.

updateStatistics(alg)[source]

Update statistics. Called at each iteration while the algorithm is running.

Parameters:
alg : instance of Algorithm class

Algorithm being monitored.

calculateObjective(alg)[source]

Calculate objective value. The dafault implementation uses the optimality monitor if it exists

Parameters:
alg : instance of Algorithm class

Algorithm that was monitored.

Returns:
objValue : real

objective value

postprocess(alg, output)[source]

Called after the algorithm stops. Store statistics in the given ‘output’ dictionary

Parameters:
alg : instance of Algorithm class

Algorithm that was monitored.

output : dictionary

Contains the last iterate and various statistics that were collected while the algorithm was running.

Returns:
output : dictionary into which the following entries are added

(when diagnostics are required)

gaps : ndarray

Squared gap distance normalized by the magnitude constraint

proxtoolbox.algorithms.QNAccelerator module

class proxtoolbox.algorithms.QNAccelerator.QNAccelerator(experiment)[source]

Bases: object

Quasi-Newton acceleration of fixed point iterations based on Samsara, a reverse communication nonlinear optimization package. Samsara must be installed in the folder proxtoolbox/algorithms/samsara.

Based on Matlab code written by Russell Luke (Inst. Fuer Numerische und Angewandte Mathematik, Universitaet Gottingen) on Feb 23, 2018.

evaluate(u, alg)[source]

Quasi-Newton acceleration evaluation

Parameters:
u : ndarray or a list of ndarray objects

The point to be accelerated.

alg : Algorithm object

The algorithm that uses this accelerator

Returns:
u_new : ndarray or a list of ndarray objects

(same type as input parameter u) The step generated by the quasi-Newton routine (same type as input parameter u).

proxtoolbox.algorithms.QNAvP module

class proxtoolbox.algorithms.QNAvP.QNAvP(experiment, iterateMonitor, accelerator)[source]

Bases: proxtoolbox.algorithms.AvP.AvP

Quasi-Newton Accelerated averaged projections algorithm

Based on Matlab code written by Russell Luke (Inst. Fuer Numerische und Angewandte Mathematik, Universitaet Gottingen) on Feb.18, 2018.

evaluate(u)[source]

Update of the Quasi-Newton Accelerated averaged projections algorithm

Parameters:
u : ndarray or a list of ndarray objects

The current iterate.

Returns:
u_new : ndarray or a list of ndarray objects

The new iterate (same type as input parameter u).

Notes

We try to figure out how the user is calling this. Either (1) the user knows that averaged projections is alternating projectons on the product space with one of the sets being the diagonal, or (2) the user hasn’t preprocessed this and has just passed the list of prox mappings and left it to us to rearrange and average. If it is case (1) one of the prox mappings will be P_Diag, otherwise we will assume that we are in case (2)

Code is similar to the AvP algorithm, but for some reason the use of the accelerator is a bit different. So for now we don’t reuse the AvP code, except in the constructor.

proxtoolbox.algorithms.RAAR module

class proxtoolbox.algorithms.RAAR.RAAR(experiment, iterateMonitor, accelerator=None)[source]

Bases: proxtoolbox.algorithms.algorithm.Algorithm

User-friendly version of the Relaxed Averaged Alternating Reflection algorithm. For background and analysis see: D.R.Luke, Inverse Problems 21:37-50(2005) D.R. Luke, SIAM J. Opt. 19(2): 714–739 (2008). D. R. Luke and A.-L. Martins, “Convergence Analysis of the Relaxed Douglas Rachford Algorithm” , SIAM J. on Optimization, 30(1):542–584(2020). https://epubs.siam.org/doi/abs/10.1137/18M1229638

Based on Matlab code written by Russell Luke (Inst. Fuer Numerische und Angewandte Mathematik, Universitaet Gottingen) on Aug 18, 2017.

evaluate(u)[source]

Update for the Relaxed Averaged Alternating Reflection algorithm.

Parameters:
u : ndarray or a list of ndarray objects

The current iterate.

Returns:
u_new : ndarray or a list of ndarray objects

(same type as input parameter u) The new iterate.

getDescription()[source]

Function returning a string giving the algorithm name and optionally a list of parameters that characterize this algorithm (i.e., lambda_0, and lambda_max constants). This string is used for graphical output. The default implementation only returns the name of the class implementing this algorithm. Derived classes may overrride this method to add meaningful parameters.

Returns:
desc : string

short description of the algorithm

proxtoolbox.algorithms.algorithm module

class proxtoolbox.algorithms.algorithm.Algorithm(experiment, iterateMonitor, accelerator=None)[source]

Bases: object

Base class for ProxToolbox algorithms. Derived classes need to implement the evaluate() method which computes the next iterate. The algorithm object is created when the Experiment object is initialized.

preprocess()[source]

The default implementation calls the iterate monitor’s preprocess() method which initializes the arrays that will be used to collect statistics.

stoppingCondition()[source]

Evaluate stopping condition. The default stopping condition checks if the maximum number of iteration is reached or if the given tolerance is attained. Can be overriden by derived classes.

Returns:
bool

Returns False when the algorithm must stop (the stopping condition is satisfied). Returns True otherwise.

evaluate(u)[source]

Compute the algorithm update. Take the current iterate and returns the next iterate. Must be overriden by derived class.

Parameters:
u: ndarray or a list of ndarray objects

Current iterate.

Returns:
u: ndarray or a list of ndarray objects

Next iterate.

updateStatistics()[source]

Update statistics for the current iteration. Delegate the work to the iterate monitor.

displayProgress()[source]

Display progress. Delegate the work to the iterate monitor.

postprocess()[source]

Prepare the data that will be returned by the run() method. Call the iterate monitor postprocess() method to retrieve the various statistics.

Returns:
output: dictionary with the following entries:
u: ndarray or a list of ndarray objects

The last iterate.

iter: int

The number of iterations the algorithm performed

additional entries are given by the iterate monitor

run(u)[source]

Run the algorithm given an initial iterate u. The algorithm runs until the stopping condition is satisfied. Statistics are collected at each iteration by the iterate monitor.

Parameters:
u: ndarray or a list of ndarray objects

Initial iterate.

Returns:
dictionary with the following entries:
u: ndarray or a list of ndarray objects

The last iterate.

iter: natural number

The last iteration count

additional entries are given by the iterate monitor

getDescription()[source]

Function returning a string giving the algorithm name and optionally a list of parameters that characterize this algorithm (i.e., lambda_0, and lambda_max constants). This string is used for graphical output. The default implementation only returns the name of the class implementing this algorithm. Derived classes may overrride this method to add meaningful parameters.

Returns:
desc : string

short description of the algorithm

getDescriptionHelper(param_name=None, param_0=None, param_max=None)[source]

Generate a string giving a short description of the algorithm (the name of its class name and optionally, the relaxation parameter used).

Returns:
desc: string

description string genarated from the name of the algorithm’s class and the given parameters param_0 and param_max.

computeRelaxation()[source]

Compute the relaxation parameter based on the current iteration count.

Returns:
lmbda: Float64

Relaxation parameter.

static phase_offset_compensated_norm(arr1, arr2, norm_factor=1, norm_type='fro')[source]

proxtoolbox.algorithms.feasibilityIterateMonitor module

class proxtoolbox.algorithms.feasibilityIterateMonitor.FeasibilityIterateMonitor(experiment)[source]

Bases: proxtoolbox.algorithms.iterateMonitor.IterateMonitor

Algorithm analyzer for monitoring iterates of projection algorithms for feasibility problems. Specialization of the IterateMonitor class.

preprocess(alg)[source]

Allocate data structures needed to collect statistics. Called before running the algorithm.

Parameters:
alg : instance of Algorithm class

Algorithm to be monitored.

updateStatistics(alg)[source]

Update statistics. Called at each iteration while the algorithm is running.

Parameters:
alg : instance of Algorithm class

Algorithm being monitored.

Notes

The call to the Numpy norm function should not specify ‘fro’ since this is the default. This would not be an issue except for the fact that this norm function throws an exception when we apply it to a vector, that is ‘fro’ is not considered a valid option for a vector.

postprocess(alg, output)[source]

Called after the algorithm stops. Store statistics in the given ‘output’ dictionary

Parameters:
alg : instance of Algorithm class

Algorithm that was monitored.

output : dictionary

Contains the last iterate and various statistics that were collected while the algorithm was running.

Returns:
output : dictionary into which the following entries are added

(when diagnostics are required)

gaps : ndarray

Squared gap distance normalized by the magnitude constraint

shadow_changes : ndarray

Euclidean norm of the gap to the unregularized set. To monitor the Euclidean norm of the gap to the regularized set is expensive to calculate, so we use this surrogate.

proxtoolbox.algorithms.iterateMonitor module

class proxtoolbox.algorithms.iterateMonitor.IterateMonitor(experiment)[source]

Bases: object

Base class for iterate monitors. This is the default algorithm analyzer for monitoring iterates of fixed point algorithms.

preprocess(alg)[source]

Allocate data structures needed to collect statistics. Called before running the algorithm.

Parameters:
alg : instance of Algorithm class

Algorithm to be monitored.

updateStatistics(alg)[source]

Update statistics. Called at each iteration while the algorithm is running.

Parameters:
alg : instance of Algorithm class

Algorithm being monitored.

displayProgress(alg)[source]

Display progress. This method is called after UpdateStatistics(). Default implementation does nothing. May be overriden in derived classes

Parameters:
alg : instance of Algorithm class

Algorithm being monitored.

postprocess(alg, output)[source]

Called after the algorithm stops. Store statistics in the given ‘output’ dictionary

Parameters:
alg : instance of Algorithm class

Algorithm that was monitored.

output : dictionary

Contains the last iterate and various statistics that were collected while the algorithm was running.

Returns:
output : dictionary into which the following entries are added
u_monitor : ndarray or list of ndarrays.

Part of the sequence that is being monitored. Default is to monitor the entire variable ‘u’.

u1 : ndarray

Part of ‘u_monitor’. Used for display.

u2 : ndarray

Part of ‘u_monitor’. Used for display.

changes: ndarray

normalized change in successive iterates

static phase_offset_compensated_norm(arr1, arr2, norm_factor=1, norm_type='fro')[source]
getIterateSize(u)[source]

Given an iterate, determine p and q parameters :param u: :return: p,q (ints)

evaluateChange(u, u_new)[source]

Given an old and new iterate calculate the total absolute squared difference, normalized to self.norm_data :param u: iterate :param u_new: new iterate :return: sum of abs squared differences = frobenius norm squared

calculateObjective(alg)[source]

Calculate objective value. The dafault implementation uses the optimality monitor if it exists

Parameters:
alg : instance of Algorithm class

Algorithm that was monitored.

Returns:
objValue : real

objective value