pystop.solver.SLPG
X, output_dict = SLPG(obj_fun, manifold, Xinit = None, maxit= 100, prox = lambda X, eta: X, gtol = 1e-5, post_process = True, verbosity = 2, **kwargs)
Minimize fun
over the Stiefel manifold by starting from Xinit
and applying penalty-free infeasible first-order method. Here the fun
can be expressed as
is easy to compute. The word ''penalty-free'' means SLPG does not need the penalty parameter
Input arguments
obj_fun : callable
The function that is to be minimized.
fval, grad = obj_fun(X)
It should have two returns: fval
denotes the function value at grad
is a matrix in
manifold : STOP manifold class The specified Stiefel manifold
21from pystop.manifold import Stiefel
2manifold = Stiefel(1000,10)
Xinit : ndarray, shape (n, p)
Initial guess. Array of real elements of size Xinit
is not specified, the SLPG_smooth
solver uses the manifold.Init_point()
instead.
prox: callable
The proximal mapping of the nonsmooth term Y = prox(X_input, eta)
, which returns the solution of
maxit : int Maximum number of iterations to perform.
gtol : float
SLPG_smooth
terminates when post_process : bool
Post-processing for infeasible methods to achieve a feasible solution by orthonormalization. It is implemented by the manifold.Post_process()
provided by STOP manifold class.
verbosity : int Level of information logged by the solver while it operates, 0 is silent, 2 is most information.
Output results
X : ndarray, shape (n, p)
The final results returned by the SLPG_smooth
solver
output_dict : dict
A dictionary of information. One can see which attributes are available using the keys()
method.
iter
fval
kkt
fea
fvals
kkts
feas
In these examples, we solve the following
The following example introduces how to apply SLPG to solve this problem.
x
1# Importing packages
2import numpy as np
3import scipy as sp
4import matplotlib.pyplot as plt
5
6# Adding essential materials
7from pystop.manifold import Stiefel
8from pystop.solver.SLPG import SLPG_smooth, SLPG
9
10# Set parameters
11n = 100
12m = 100
13p = 2
14M = Stiefel(n,p)
15
16# Defining objective function
17
18A = np.random.randn(n,m)
19A = A/ np.linalg.norm(A,2)
20def obj_fun(X):
21 AX = A.T @ X
22 fval = np.sum(AX * AX)
23 return fval, - A @ AX
24
25# Set the proximal function
26# We provides the proximal mapping for l21 and l1 regularization term
27# One can use
28# from utilies import prox_l1
29# def my_prox(X, eta):
30# return prox_l1(X, eta, gamma)
31
32gamma = 0.001
33def prox_l1(X_input, eta):
34 # np.max(X_input, 0)
35 return np.maximum(X_input - gamma * eta, 0 ) + np.minimum(X_input + gamma * eta, 0 )
36
37
38# Execute the solver
39UA, SA, VA = np.linalg.svd(A, full_matrices= False)
40X_init = UA[:,0:p] # Set initial point
41X, out_dict = SLPG(obj_fun, M,Xinit=X_init, prox= prox_l1, gtol=1e-7 ,verbosity=2, maxit = 3000)