Skip to content

Commit 3f5e3c9

Browse files
authored
Cleanup (#2)
* Clean up utils. * Better docstrings and RST files. * Better latex formatting.
1 parent 40028c5 commit 3f5e3c9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+478
-1249
lines changed

docs/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
2121
author = 'Weiwei Kong'
2222

2323
# The full version, including alpha/beta/rc tags
24-
release = '0.1a1'
24+
release = '0.2.1'
2525
# The short version
26-
version = '0.1a1'
26+
version = '0.2.1'
2727

2828

2929
# -- General configuration ---------------------------------------------------

docs/pages/examples.rst

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Unconstrained Problems
3838

3939
This subsection considers unconstrained composite optimization problems.
4040

41-
:scpt:`src.examples.unconstrained.basic_convex_qp`
41+
:scpt:`examples/unconstrained/basic_convex_qp.m`
4242

4343
This example solves the convex univariate optimization problem
4444

@@ -47,7 +47,7 @@ This example solves the convex univariate optimization problem
4747
\underset{x}{\text{minimize}}\quad & \frac{1}{2}x^{2}-x+\frac{1}{2} \\
4848
\text{subject to}\quad & x\in\mathbb{R}.
4949
50-
:scpt:`src.examples.unconstrained.nonconvex_qp`
50+
:scpt:`examples/unconstrained/nonconvex_qp`
5151

5252
This example solves the nonconvex quadratic programming problem
5353

@@ -62,7 +62,7 @@ where $\Delta^n$ is the unit simplex given by
6262
6363
\Delta^{n}:=\left\{ x\in\mathbb{R}^{n}:\sum_{i=1}^{n}x_{i}=1,0\leq x\leq1\right\}.
6464
65-
:scpt:`src.examples.unconstrained.nonconvex_qsdp`
65+
:scpt:`examples/unconstrained/nonconvex_qsdp.m`
6666

6767
This example solves the nonconvex quadratic semidefinite programming problem
6868

@@ -77,7 +77,7 @@ where $\mathbb{S}^{n}_{+}$ is the collection of positive semidefinite matrices a
7777
7878
P^{n}:=\left\{ X\in\mathbb{S}^{n}_{+}: {\rm tr}\, X = 1\right\}.
7979
80-
:scpt:`src.examples.unconstrained.nonconvex_svm`
80+
:scpt:`examples/unconstrained/nonconvex_svm.m`
8181

8282
This example solves the nonconvex support vector machine problem
8383

@@ -111,7 +111,7 @@ under a saddle-point termination criterion based on the one given in **[3]**. Mo
111111
\partial\left[-\Phi(x,\cdot)\right](y)
112112
\end{array}\right),\quad\|v\|\leq\rho_{x},\quad\|w\|\leq\rho_{y}.
113113
114-
:scpt:`src.examples.minmax.nonconvex_minmax_qp`
114+
:scpt:`examples/minmax/nonconvex_minmax_qp.m`
115115

116116
This example solves the nonconvex minmax quadratic programming problem
117117

@@ -131,7 +131,7 @@ where $\Delta^n$ is the unit simplex given by
131131
132132
\Delta^{n}:=\left\{ x\in\mathbb{R}^{n}:\sum_{i=1}^{n}x_{i}=1,0\leq x\leq1\right\}.
133133
134-
:scpt:`src.examples.minmax.nonconvex_power_control`
134+
:scpt:`examples/minmax/nonconvex_power_control.m`
135135

136136
This example solves the nonconvex power control problem
137137

@@ -149,7 +149,7 @@ where $f_{k,n}$, $B_x$, and $B_y$ are given by
149149
B_x & := \left\{X\in \mathbb{R}^{K\times N} : 0 \leq X \leq R \right\}, \\
150150
B_y & := \left\{y\in \mathbb{R}^{N} : 0 \leq y \leq \frac{N}{2} \right\}.
151151
152-
:scpt:`src.examples.minmax.nonconvex_robust_regression`
152+
:scpt:`examples/minmax/nonconvex_robust_regression.m`
153153

154154
This example solves the robust regression problem
155155

@@ -173,7 +173,7 @@ Spectral Problems
173173
-----------------
174174
This subsection considers spectral optimization problems where $f_s = f_{1,s} + f_{2,s}^{\cal V} \circ \sigma$ and $f_n = f_{n}^{\cal V} \circ \sigma$ for absolutely symmetric functions $f_{2,s}^{\cal V}$ and $f_{n}^{\cal V}$.
175175

176-
:scpt:`src.examples.spectral.nonconvex_spectral_mc`
176+
:scpt:`examples/spectral/nonconvex_spectral_mc.m`
177177

178178
This example solves the spectral matrix completion problem
179179

@@ -184,7 +184,7 @@ This example solves the spectral matrix completion problem
184184
185185
where ${\cal R}_{\mu}$ is an absolutely symmetric regularization function, $\sigma(\cdot)$ is the function that maps a matrix to its vector of singular values, and $B_R$ is the Euclidean ball of radius $R$, i.e., $B_R := \{X \in \mathbb{R}^{p\times q} : \|X\|_F \leq R\}$.
186186

187-
:scpt:`src.examples.spectral.nonconvex_spectral_bmc`
187+
:scpt:`examples/spectral/nonconvex_spectral_bmc.m`
188188

189189
This example solves the spectral blockwise matrix completion problem
190190

@@ -200,7 +200,7 @@ Linearly-Set Constrained Problems
200200

201201
This subsection considers linearly-set constrained composite optimization problems where $g(x)=Ax$ for a linear operator $A$ and $S$ is a closed convex set.
202202

203-
:scpt:`src.examples.constrained.lin_constr_nonconvex_qp`
203+
:scpt:`examples/constrained/lin_constr_nonconvex_qp.m`
204204

205205
This example solves the linearly-constrained nonconvex quadratic programming problem
206206

@@ -215,7 +215,7 @@ where $\Delta^n$ is the unit simplex given by
215215
216216
\Delta^{n}:=\left\{ x\in\mathbb{R}^{n}:\sum_{i=1}^{n}x_{i}=1,0\leq x\leq1\right\}.
217217
218-
:scpt:`src.examples.constrained.nonconvex_lin_constr_qsdp`
218+
:scpt:`examples/constrained/nonconvex_lin_constr_qsdp.m`
219219

220220
This example solves the linearly-constrained nonconvex quadratic semidefinite programming problem
221221

@@ -230,7 +230,7 @@ where $\mathbb{S}^{n}_{+}$ is the collection of positive semidefinite matrices a
230230
231231
P^{n}:=\left\{ X\in\mathbb{S}^{n}_{+}: {\rm tr}\, X = 1\right\}.
232232
233-
:scpt:`src.examples.constrained.nonconvex_sparse_pca`
233+
:scpt:`examples/constrained/nonconvex_sparse_pca.m`
234234

235235
This example solves the nonconvex sparse principal component analysis problem
236236

@@ -246,7 +246,7 @@ where ${\cal F}^k$ is the $k$-Fantope given by
246246
247247
{\cal F}^k:=\left\{ X\in\mathbb{S}^{n}_{+}: 0 \preceq X \preceq I, {\rm tr}\, X = k\right\}.
248248
249-
:scpt:`src.examples.constrained.nonconvex_bounded_mc`
249+
:scpt:`examples/constrained.nonconvex_bounded_mc.m`
250250

251251
This example solves the nonconvex bounded matrix completion problem
252252

docs/pages/frameworks.rst

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,12 @@ For simplicity, we only list the parameter inputs that affect the behavior of th
1111

1212
.. automodule:: src.frameworks
1313

14-
.. autofunction:: penalty(solver, oracle, params)
14+
.. autofunction:: AIDAL(~, oracle, params)
1515

16-
.. autofunction:: IAPIAL(~, oracle, params)
16+
.. autofunction:: IAIPAL(~, oracle, params)
1717

1818
.. autofunction:: iALM(~, oracle, params)
19+
20+
.. autofunction:: penalty(solver, oracle, params)
21+
22+
.. autofunction:: sProxALM(~, oracle, params)

docs/pages/introduction.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,20 @@ Currently, the following problems classes are supported:
1111
- Linearly Set Constrained Composite Optimization
1212
- Nonconvex-Concave Min-Max Optimization
1313
- Spectral Composite Optimization
14-
- Convex Cone Constrained Composite Optimization (WIP)
14+
- Convex Cone Constrained Composite Optimization
1515

1616
Instances of the above classes include *semidefinite programming*, *convex programming*, *cone programming*, *linear and quadratic programmin*, and *nonconvex programming*.
1717

1818
The components of NC-OPT can be split into the following categories.
1919

20-
:mod:`src.oracles`
21-
A class that abstracts the idea of a first-order oracle at a point. It contains any one of the following oracles: *function value*, *function gradient*, and *proximal oracle*.
20+
:mod:`oracles`
21+
Classes that abstract the idea of a first-order oracle at a point. It contains one or more of the following oracles: *function value*, *function gradient*, and *proximal oracle*.
2222

23-
:mod:`src.solvers`
23+
:mod:`solvers`
2424
A collection of composite optimzation solvers that solve the problem associated with a particular first-order oracle. Some examples include: *the composite gradient method*, *the accelerated composite gradient method*, and *the accelerated inexact proximal point method*.
2525

26-
:mod:`src.frameworks`
26+
:mod:`frameworks`
2727
A collection of constrained composite optimization frameworks that use a solver to solve a constrained composite optimization model. Some examples include: *the quadratic penalty framework*, *the augmented Lagrangian framework*, and *the dampened augmented Lagrangian framework*.
2828

29-
:mod:`src.models`
29+
:mod:`models`
3030
A class that abstracts the idea of a composite optimization model. It contains properties that describe various aspects of the model, including: *objective function*, *constraints*, *solver*, *framework*, *tolerances*, and *logging*.

docs/pages/solvers.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,6 @@ Spectral NCO Solvers
4141

4242
These solvers are used for spectral nonconvex composite optimization problems.
4343

44-
.. autofunction:: IA_ICG(spectral_oracle, params)
44+
.. autofunction:: DA_ICG(spectral_oracle, params)
4545

46-
.. autofunction:: DA_ICG(spectral_oracle, params)
46+
.. autofunction:: IA_ICG(spectral_oracle, params)

src/frameworks/AIDAL.m

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,26 @@
22
% Copyright © 2021 Weiwei "William" Kong
33

44
function [model, history] = AIDAL(~, oracle, params)
5-
% An accelerated inexact dampened augmeneted Lagrangian (AIDAL) framework for solving a nonconvex composite optimization problem
6-
% with linear constraints
7-
%
8-
% Note:
9-
%
10-
% Based on the paper:
11-
%
12-
% ?????
13-
%
14-
% Arguments:
15-
%
16-
% oracle (Oracle): The oracle underlying the optimization problem.
17-
%
18-
% params (struct): Contains instructions on how to call the framework.
19-
%
20-
% ??? add defaults here ???
21-
%
22-
% Returns:
23-
%
24-
% A pair of structs containing model and history related outputs of the solved problem associated with the oracle and input
25-
% parameters.
26-
%
27-
28-
% Global constants.
29-
MIN_PENALTY_CONST = 1;
5+
% An accelerated inexact dampened augmeneted Lagrangian (AIDAL) framework for solving a nonconvex composite optimization problem
6+
% with linear constraints
7+
%
8+
% Note:
9+
%
10+
% Based on the paper:
11+
%
12+
% **TBD**
13+
%
14+
% Arguments:
15+
%
16+
% oracle (Oracle): The oracle underlying the optimization problem.
17+
%
18+
% params (struct): Contains instructions on how to call the framework.
19+
%
20+
% Returns:
21+
%
22+
% A pair of structs containing model and history related outputs of the solved problem associated with the oracle and input
23+
% parameters.
24+
%
3025

3126
% Timer start.
3227
t_start = tic;
@@ -107,7 +102,7 @@
107102
z0 = params.x0;
108103
p0 = zeros(size(params.constr_fn(z0)));
109104
p00 = p0;
110-
c = max([MIN_PENALTY_CONST, L / K_constr ^ 2]);
105+
c = params.c0;
111106
c0 = c;
112107
params_acg = params;
113108
params_acg.mu = 1 - lambda * m;
@@ -215,6 +210,9 @@
215210
% Fills in parameters that were not set as input.
216211
function params = set_default_params(params)
217212

213+
% Global constants.
214+
MIN_PENALTY_CONST = 1;
215+
218216
% Overwrite if necessary.
219217
if (~isfield(params, 'i_logging'))
220218
params.i_logging = false;
@@ -234,6 +232,9 @@
234232
if (~isfield(params, 'theta'))
235233
params.theta = 0.01;
236234
end
235+
if (~isfield(params, 'c0'))
236+
params.c0 = max([MIN_PENALTY_CONST, L / K_constr ^ 2]);
237+
end
237238
if (~isfield(params, 'chi'))
238239
theta = params.theta;
239240
params.chi = theta ^ 2 / (2 * (2 - theta) * (1 - theta));

src/frameworks/IAIPAL.m

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,18 @@
22
% Copyright © 2021 Weiwei "William" Kong
33

44
function [model, history] = IAIPAL(~, oracle, params)
5-
% An inexact accelerated proximal augmeneted Lagrangian (IAPIAL) framework for solving a nonconvex composite optimization problem
6-
% with convex cone constraints.
5+
% An inner accelerated proximal inexact augmeneted Lagrangian (IAPIAL) framework for solving a nonconvex composite optimization
6+
% problem with convex (linear or nonliner) cone constraints.
77
%
88
% Note:
99
%
10-
% Based on the paper:
10+
% Based on the papers:
1111
%
12-
% Kong, W., Melo, J. G., & Monteiro, R. D. (2020). Iteration-complexity of a proximal augmented Lagrangian method for solving
13-
% nonconvex composite optimization problems with nonlinear convex constraints. *arXiv preprint arXiv:2008.07080*\.
12+
% **[1]** Melo, J. G., & Monteiro, R. D. (2020). Iteration-complexity of an inner accelerated inexact proximal augmented Lagrangian
13+
% method based on the classical Lagrangian function and a full Lagrange multiplier update. *arXiv preprint arXiv:2008.00562*\.
14+
%
15+
% **[2]** Kong, W., Melo, J. G., & Monteiro, R. D. (2020). Iteration-complexity of a proximal augmented Lagrangian method for
16+
% solving nonconvex composite optimization problems with nonlinear convex constraints. *arXiv preprint arXiv:2008.07080*\.
1417
%
1518
% Arguments:
1619
%
@@ -22,6 +25,7 @@
2225
%
2326
% A pair of structs containing model and history related outputs of the solved problem associated with the oracle and input
2427
% parameters.
28+
%
2529

2630
% Timer start.
2731
t_start = tic;

src/frameworks/iALM.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
function [model, history] = iALM(~, oracle, params)
55
% An inexact augmented Lagrangian method (iALM) for solving a nonconvex composite optimization model with nonlinear equality
6-
% constraints, i.e. g(x) = 0.
6+
% constraints, i.e. $g(x) = 0$.
77
%
88
% Note:
99
%

src/models/CompModel.m

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,29 @@
99
% The following properties are necessary before the ``optimize()`` method can be called to solve the model: either {``f_s``,
1010
% ``grad_f_s``} or ``oracle``, ``L``, ``x0``, and ``solver``.
1111
%
12-
% Key Attributes:
12+
% Attributes:
1313
%
1414
% f_s (function handle): A one argument function that, when evaluated at a point $x$, outputs $f_s(x)$. Defaults to ``None``.
1515
%
1616
% grad_f_s (function handle): A one argument function that, when evaluated at a point $x$, outputs $\nabla f_s(x)$. Defaults
1717
% to ``None``.
1818
%
19-
% f_n (function handle): A one argument function that, when evaluated at a point $x$, outputs $f_n(x)$. Defaults to ``@(x)
20-
% zeros(size(x))``.
19+
% f_n (function handle): A one argument function that, when evaluated at a point $x$, outputs $f_n(x)$. Defaults to
20+
% ``@(x) zeros(size(x))``.
2121
%
22-
% prox_f_n (function handle): A two argument function that, when evaluated at $\{x,\lambda\}$, outputs $${\rm prox}_{\lambda
23-
% f_n}(x) := {\rm argmin}_u \left\{\lambda f_n(u) + \frac{1}{2}\|u-x\|^2\right\}.$$ Defaults to ``@(x, lam) x``.
22+
% prox_f_n (function handle): A two argument function that, when evaluated at $\{x,\lambda\}$, outputs
23+
% $${\rm prox}_{\lambda f_n}(x) := {\rm argmin}_u \left\{\lambda f_n(u) + \frac{1}{2}\|u-x\|^2\right\}.$$
24+
% Defaults to ``@(x, lam) x``.
2425
%
2526
% L (double): A **required** Lipschitz constant of $\nabla f_s$. Defaults to ``None``.
2627
%
27-
% M (double): An **optional** upper curvature constant of $\nabla f_s$, i.e., a constant satisfying $$f_s(z) - f_s(u) - \langle
28-
% \nabla f_s(u), z - u \rangle \leq \frac{M}{2}\|u-z\|^2 \quad \forall u,z \in {\rm dom}\, f_n.$$ Defaults to ``None``.
28+
% M (double): An **optional** upper curvature constant of $\nabla f_s$, i.e., a constant satisfying
29+
% $$f_s(z) - f_s(u) - \langle\nabla f_s(u), z - u \rangle \leq \frac{M}{2}\|u-z\|^2 \quad \forall u,z \in {\rm dom}\, f_n.$$
30+
% Defaults to ``None``.
2931
%
30-
% m (double): An **optional** lower curvature constant of $\nabla f_s$, i.e. a constant satisfying $$f_s(z) - f_s(u) - \langle
31-
% \nabla f_s(u), z - u \rangle \geq -\frac{m}{2}\|u-z\|^2 \quad \forall u,z \in {\rm dom}\, f_n.$$ Defaults to ``None``.
32+
% m (double): An **optional** lower curvature constant of $\nabla f_s$, i.e. a constant satisfying
33+
% $$f_s(z) - f_s(u) - \langle\nabla f_s(u), z - u \rangle \geq -\frac{m}{2}\|u-z\|^2 \quad \forall u,z \in {\rm dom}\, f_n.$$
34+
% Defaults to ``None``.
3235
%
3336
% x0 (double vector): A **required** starting point of the solver. Defaults to ``None``.
3437
%
@@ -70,7 +73,7 @@
7073
% x (double vector): The stationary point returned by the solver. Defaults to ``None``. Cannot be set by the user.
7174
%
7275
% v (double vector): The stationary residual returned by the solver. Defaults to ``None``. Cannot be set by the user.
73-
76+
%
7477
%% CONSTRUCTORS
7578
methods
7679
function obj = CompModel(varargin)

src/models/ConstrCompModel.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
% The following (non-inherited) properties are necessary before the ``optimize()`` method can be called to solve the model:
1010
% ``framework``, ``constr_fn``, ``grad_constr_fn``, ``set_projector``, and ``K_constr``.
1111
%
12-
% Key Attributes:
12+
% Attributes:
1313
%
1414
% framework (function handle): A **required** function handle to a framework that solves constrained composite optimization
1515
% problems (see src/frameworks). Defaults to ``None``.

0 commit comments

Comments
 (0)