Solver class hierarchy¶
Solver object interface¶

class
pyunlocbox.solvers.
solver
(gamma=1, post_gamma=None, post_sol=None)[source]¶ Bases:
object
Defines the solver object interface.
This class defines the interface of a solver object intended to be passed to the
pyunlocbox.solvers.solve()
solving function. It is intended to be a base class for standard solvers which will implement the required methods. It can also be instantiated by user code and dynamically modified for rapid testing. This class also defines the generic attributes of all solver objects.Parameters: gamma : float
The step size. This parameter is upper bounded by \(\frac{1}{\beta}\) where the second convex function (gradient ?) is \(\beta\) Lipschitz continuous. Default is 1.
post_gamma : function
User defined function to postprocess the step size. This function is called every iteration and permits the user to alter the solver algorithm. The user may start with a high step size and progressively lower it while the algorithm runs to accelerate the convergence. The function parameters are the following : gamma (current step size), sol (current problem solution), objective (list of successive evaluations of the objective function), niter (current iteration number). The function should return a new value for gamma. Default is to return an unchanged value.
post_sol : function
User defined function to postprocess the problem solution. This function is called every iteration and permits the user to alter the solver algorithm. Same parameter as
post_gamma()
. Default is to return an unchanged value.
algo
(objective, niter)[source]¶ Call the solver iterative algorithm while allowing the user to alter it. This makes it possible to dynamically change the gamma step size while the algorithm is running. See parameters documentation in
pyunlocbox.solvers.solve()
documentation.

post
(verbosity)[source]¶ Solver specific postprocessing. See parameters documentation in
pyunlocbox.solvers.solve()
documentation.

pre
(functions, x0, verbosity)[source]¶ Solver specific initialization. See parameters documentation in
pyunlocbox.solvers.solve()
documentation.

Forwardbackward proximal splitting algorithm¶

class
pyunlocbox.solvers.
forward_backward
(method='FISTA', lambda_=1, *args, **kwargs)[source]¶ Bases:
pyunlocbox.solvers.solver
Forwardbackward splitting algorithm.
This algorithm solves convex optimization problems composed of the sum of two objective functions.
See generic attributes descriptions of the
pyunlocbox.solvers.solver
base class.Parameters: method : {‘FISTA’, ‘ISTA’}, optional
the method used to solve the problem. It can be ‘FISTA’ or ‘ISTA’. Default is ‘FISTA’.
lambda_ : float, optional
the update term weight for ISTA. It should be between 0 and 1. Default is 1.
Notes
This algorithm requires one function to implement the
pyunlocbox.functions.func.prox()
method and the other one to implement thepyunlocbox.functions.func.grad()
method.Examples
>>> from pyunlocbox import functions, solvers >>> import numpy as np >>> y = [4, 5, 6, 7] >>> x0 = np.zeros(len(y)) >>> f1 = functions.norm_l2(y=y) >>> f2 = functions.dummy() >>> solver = solvers.forward_backward(method='FISTA', lambda_=1, gamma=1) >>> ret = solvers.solve([f1, f2], x0, solver, absTol=1e5) Solution found after 10 iterations : objective function f(sol) = 7.460428e09 last relative objective improvement : 1.624424e+03 stopping criterion : ABS_TOL >>> ret['sol'] array([ 3.99996922, 4.99996153, 5.99995383, 6.99994614])