pystop.solver.SLPG_l21
X, output_dict = SLPG_l21( obj_fun, manifold, Xinit = None, maxit= 100, gamma = 0, 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
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
1from 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.
gamma: float
The parameter of the
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
where SLPG_l21
to solve this problem.
x1# 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 import SLPG_l21
9
10# Set parameters
11n = 1000
12m = 100
13p = 5
14M = Stiefel(n,p)
15
16# Defining objective function
17
18
19A = np.random.randn(n,m)
20
21A = A/ np.linalg.norm(A,2)
22
23def obj_fun(X):
24 AX = A.T @ X
25 fval = np.sum(AX * AX)
26 return -fval, - A @ AX
27
28
29# Execute the solver
30UA, SA, VA = np.linalg.svd(A, full_matrices= False)
31X_init = UA[:,0:p] # Set initial point
32X, out_dict = SLPG_l21( obj_fun, M,Xinit=X_init, gamma = 4e-2, gtol=1e-7 ,verbosity=2, maxit = 300)
33