Skip to content

Commit a3aab8f

Browse files
committed
documenting
1 parent 8dfe442 commit a3aab8f

File tree

11 files changed

+168
-71
lines changed

11 files changed

+168
-71
lines changed

docs/make.jl

+5-5
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ makedocs(
66
sitename = "StructuredOptimization",
77
authors = "Niccolò Antonello and Lorenzo Stella",
88
pages = Any[
9-
"Home" => "index.md",
10-
"Guide" => "tutorial.md",
11-
"Expressions" => "expressions.md",
12-
"Functions" => "functions.md",
13-
"Solvers" => "solvers.md",
9+
"Home" => "index.md",
10+
"Quick Tutorial Guide" => "tutorial.md",
11+
"Expressions" => "expressions.md",
12+
"Functions" => "functions.md",
13+
"Solvers" => "solvers.md",
1414
],
1515
)
1616

docs/src/expressions.md

+24-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
11
# Expressions
22

3+
With `StructuredOptimization.jl` you can easily create mathematical expressions.
4+
5+
Firstly, [Variables](@ref) must be defined: various [Mappings](@ref) can then be applied
6+
following the application of [Functions and constraints](@ref) to create the `Term`s that define the optimization problem.
7+
38
## Variables
49

510
### Creating Variables
611

712
```@docs
813
Variable
914
```
15+
!!! note
16+
17+
`StructuredOptimization.jl` supports complex variables. It is possible to create them by specifying the type
18+
`Variable(Complex{Float64}, 10)` or by initializing them with a complex array `Variable(randn(10)+im*randn(10))`.
1019

1120
### Utilities
1221

@@ -28,15 +37,22 @@ eltype
2837
*
2938
```
3039

31-
## Operators
40+
## Mappings
3241

33-
### Basic
42+
As shown in the [Quick tutorial guide](@ref) it is possible to apply different mappings to the variables
43+
using a simple syntax.
44+
45+
Alternatively, as shown in [Multiplying expressions](@ref), it is possible to define the mappings using
46+
[`AbstractOperators.jl`](https://github.com/kul-forbes/ProximalAlgorithms.jl) and to apply them
47+
to the variable (or expression) through multiplication.
48+
49+
### Basic mappings
3450
```@docs
3551
getindex
3652
reshape
3753
```
3854

39-
### DSP
55+
### DSP mappings
4056
```@docs
4157
fft
4258
ifft
@@ -51,19 +67,22 @@ mimofilt
5167
zeropad
5268
```
5369

54-
### Finite differences
70+
### Finite differences mappings
5571
```@docs
5672
finitediff
5773
variation
5874
```
5975

60-
### Nonlinear
76+
### Nonlinear mappings
6177
```@docs
6278
sigmoid
6379
```
6480

6581
## Utilities
6682

83+
It is possible to access the variables, mappings and displacement of an expression.
84+
Notice that these commands work also for the `Term`s described in [Functions and constraints](@ref).
85+
6786
```@docs
6887
variables
6988
operator

docs/src/functions.md

+14-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Functions and constraints
22

3+
Once an expression is created it is possible to create the `Term`s defining the optimization problem.
4+
5+
These can consists of either [Smooth functions](@ref), [Nonsmooth functions](@ref), [Inequality constraints](@ref)
6+
or [Equality constraints](@ref).
7+
38
## Smooth functions
49

510
```@docs
@@ -20,7 +25,7 @@ sumpositive
2025
hingeloss
2126
```
2227

23-
## Inequalities constraints
28+
## Inequality constraints
2429

2530
```@docs
2631
<=
@@ -34,12 +39,20 @@ hingeloss
3439

3540
## Smoothing
3641

42+
Sometimes the optimization problem might involve only non-smooth terms which do not lead to efficient proximal mappings. It is possible to *smooth* this terms by means of the *Moreau envelope*.
43+
3744
```@docs
3845
smooth
3946
```
4047

4148
## Duality
4249

50+
In some cases it is more convenient to solve the *dual problem* instead of the primal problem.
51+
52+
It is possible to convert the primal problem into its dual form by means of the *convex conjugate*.
53+
54+
See the Total Variation demo for an example of such procedure.
55+
4356
```@docs
4457
conj
4558
```

docs/src/index.md

+7-4
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,17 @@ three different packages:
1414

1515
* [`ProximalAlgorithms.jl`](https://github.com/kul-forbes/ProximalAlgorithms.jl) is a library of proximal algorithms (aka splitting algorithms) solvers.
1616

17-
`StructuredOptimization.jl` can handle large-scale convex and nonconvex problems with nonsmooth cost functions: see ? for a set of demos.
17+
`StructuredOptimization.jl` can handle large-scale convex and nonconvex problems with nonsmooth cost functions. It supports complex variables as well. See the demos and the [Quick tutorial guide](@ref).
18+
19+
## Citing
20+
21+
If you use `StructuredOptimization.jl` for published work, we encourage you to cite:
22+
23+
* N. Antonello, L. Stella, P. Patrinos, T. van Waterschoot, “Proximal Gradient Algorithms: Applications in Signal Processing,” [arXiv:1803.01621](https://arxiv.org/abs/1803.01621) (2018).
1824

1925
# Credits
2026

2127
`StructuredOptimization.jl` is developed by
2228
[Lorenzo Stella](https://lostella.github.io) and
2329
[Niccolò Antonello](https://nantonel.github.io)
2430
at [KU Leuven, ESAT/Stadius](https://www.esat.kuleuven.be/stadius/).
25-
26-
## Citing
27-

docs/src/solvers.md

+50-1
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,69 @@
66
@minimize
77
```
88

9+
!!! note "Problem warm-starting"
10+
11+
By default *warm-starting* is always enabled.
12+
13+
For example, if two problems that utilize the same variables are solved consecutively,
14+
the second one will be automatically warm-started by the solution of the first one.
15+
16+
That is because the variables are always linked to their respective data vectors.
17+
18+
If one wants to avoid this, the optimization variables needs to be manually re-initialized
19+
before solving the second problem e.g. to a vector of zeros: `~x .= 0.0`.
20+
21+
922
## Specifying solver and options
1023

24+
As shown above it is possible to choose the type of algorithm and specify its options by creating a `Solver` object.
25+
26+
Currently, the following algorithms are supported:
27+
28+
* *Proximal Gradient (PG)* [[1]](http://www.mit.edu/~dimitrib/PTseng/papers/apgm.pdf), [[2]](http://epubs.siam.org/doi/abs/10.1137/080716542)
29+
* *Fast Proximal Gradient (FPG)* [[1]](http://www.mit.edu/~dimitrib/PTseng/papers/apgm.pdf), [[2]](http://epubs.siam.org/doi/abs/10.1137/080716542)
30+
* *ZeroFPR* [[3]](https://arxiv.org/abs/1606.06256)
31+
* *PANOC* [[4]](https://doi.org/10.1109/CDC.2017.8263933)
32+
1133
```@docs
1234
PG
1335
FPG
14-
PANOC
1536
ZeroFPR
37+
PANOC
1638
```
1739

1840
## Build and solve
1941

42+
The macro [`@minimize`](@ref) automatically parse and solve the problem.
43+
44+
An alternative syntax is given by the function [`problem`](@ref) and [`solve`](@ref).
45+
2046
```@docs
2147
problem
2248
solve
49+
```
50+
51+
It is important to stress out that the `Solver` objects created using
52+
the functions above ([`PG`](@ref), [`FPG`](@ref), etc.)
53+
specify only the type of algorithm to be used together with its options.
54+
55+
The actual solver
56+
(namely the one of [`ProximalAlgorithms.jl`](https://github.com/kul-forbes/ProximalAlgorithms.jl))
57+
is constructed altogether with the problem formulation.
58+
59+
The problem parsing procedure can be separated from the solver application using the functions [`build`](@ref) and [`solve!`](@ref).
60+
61+
```@docs
2362
build
2463
solve!
2564
```
65+
66+
## Citations
67+
68+
[[1]](http://www.mit.edu/~dimitrib/PTseng/papers/apgm.pdf) Tseng, *On Accelerated Proximal Gradient Methods for Convex-Concave Optimization* (2008).
69+
70+
[[2]](http://epubs.siam.org/doi/abs/10.1137/080716542) Beck, Teboulle, *A Fast Iterative Shrinkage-Thresholding Algorithm for Linear Inverse Problems*, SIAM Journal on Imaging Sciences, vol. 2, no. 1, pp. 183-202 (2009).
71+
72+
[[3]](https://arxiv.org/abs/1606.06256) Themelis, Stella, Patrinos, *Forward-backward envelope for the sum of two nonconvex functions: Further properties and nonmonotone line-search algorithms*, arXiv:1606.06256 (2016).
73+
74+
[[4]](https://doi.org/10.1109/CDC.2017.8263933) Stella, Themelis, Sopasakis, Patrinos, *A simple and efficient algorithm for nonlinear model predictive control*, 56th IEEE Conference on Decision and Control (2017).

docs/src/tutorial.md

+21-13
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Quick Tutorial
1+
# Quick tutorial guide
22

33
## Standard problem formulation
44

@@ -18,9 +18,9 @@ The *least absolute shrinkage and selection operator* (LASSO) belongs to this cl
1818
\underset{ \mathbf{x} }{\text{minimize}} \ \tfrac{1}{2} \| \mathbf{A} \mathbf{x} - \mathbf{y} \|^2+ \lambda \| \mathbf{x} \|_1.
1919
```
2020

21-
Here the squared norm $\tfrac{1}{2} \| \mathbf{A} \mathbf{x} - \mathbf{y} \|^2$ is a *smooth* function while the $l_1$-norm is a *nonsmooth* function.
21+
Here the squared norm $\tfrac{1}{2} \| \mathbf{A} \mathbf{x} - \mathbf{y} \|^2$ is a *smooth* function $f$ wherelse the $l_1$-norm is a *nonsmooth* function $g$.
2222

23-
This can be solved using `StructuredOptimization.jl` using only few lines of code:
23+
This problem can be solved using `StructuredOptimization.jl` using only few lines of code:
2424

2525
```julia
2626
julia> using StructuredOptimization
@@ -46,11 +46,11 @@ It is possible to access to the solution by typing `~x`.
4646

4747
By default variables are initialized by `Array`s of zeros.
4848

49-
It is possible to set different initializations during construction `x = Variable( [1.; 0.; ...] )` or by assignement `~x .= [1.; 0.; ...]`.
49+
Different initializations can be set during construction `x = Variable( [1.; 0.; ...] )` or by assignement `~x .= [1.; 0.; ...]`.
5050

5151
## Constraint optimization
5252

53-
Constraint optimization is also ecompassed by [Standard problem formulation](@ref):
53+
Constraint optimization is also ecompassed by the [Standard problem formulation](@ref):
5454

5555
for a nonempty set $\mathcal{S}$ the constraint of
5656

@@ -61,7 +61,7 @@ for a nonempty set $\mathcal{S}$ the constraint of
6161
\end{align*}
6262
```
6363

64-
can be converted into an indicator function
64+
can be converted into an *indicator function*
6565

6666
```math
6767
g(\mathbf{x}) = \delta_{\mathcal{S}} (\mathbf{x}) = \begin{cases}
@@ -78,17 +78,16 @@ For example, the non-negative deconvolution problem:
7878

7979
```math
8080
\begin{align*}
81-
\underset{ \mathbf{x} }{\text{minimize}} \ & \tfrac{1}{2} \| \mathbf{x} * \mathbf{h} - \mathbf{y} \| \\
81+
\underset{ \mathbf{x} }{\text{minimize}} \ & \tfrac{1}{2} \| \mathbf{x} * \mathbf{h} - \mathbf{y} \|^2 \\
8282
\text{subject to} \ & \mathbf{x} \geq 0
8383
\end{align*}
8484
```
8585

86-
where $*$ stands fof convoluton and $\mathbf{h}$ contains the taps of a finite impluse response.
87-
88-
This problem be solved using the following line of code:
86+
where $*$ stands fof convoluton and $\mathbf{h}$ contains the taps of a finite impluse response,
87+
can be solved using the following lines of code:
8988

9089
```julia
91-
julia> n = 10;
90+
julia> n = 10; # define problem size
9291

9392
julia> x = Variable(n); # define variable
9493

@@ -105,7 +104,11 @@ julia> @minimize ls(conv(x,h)-y) st x >= 0.
105104
`StructuredOptimization.jl` provides a set of functions that can be used to apply
106105
specific operators to variables and create mathematical expression.
107106

108-
The available functions can be found in [Operators](@ref).
107+
The available functions can be found in [Mappings](@ref).
108+
109+
In general it is more convenient to use these functions instead of matrices,
110+
as these functions apply efficient algorithms for the forward and adjoint mappings leading to
111+
*matrix free optimization*.
109112

110113
## Using multiple variables
111114

@@ -135,13 +138,15 @@ julia> @minimize ls(X1*X2-Y) st X1 >= 0., X2 >= 0.
135138

136139
Currently `StructuredOptimization.jl` supports only *Proximal Gradient (aka Forward Backward) algorithms*, which require specific properties of the nonsmooth functions and costraint to be applicable.
137140

141+
In particular, the nonsmooth functions must lead to an *efficiently computable proximal mapping*.
142+
138143
If we express the nonsmooth function $g$ as the composition of
139144
a function $\tilde{g}$ with a linear operator $A$:
140145
```math
141146
g(\mathbf{x}) =
142147
\tilde{g}(A \mathbf{x})
143148
```
144-
than the problem can be solved when $g$ satisifies the following properties:
149+
then a proximal mapping of $g$ is efficiently computable if it satisifies the following properties:
145150

146151
1. the mapping $A$ must be a *tight frame* namely it must satisfy $A A^* = \mu Id$, where $\mu \geq 0$ and $A^*$ is the adjoint of $A$ and $Id$ is the identity operator.
147152

@@ -184,3 +189,6 @@ julia> @minimize ls( A*x - y ) + λ*norm(x[1:div(n,2)], 1) st x[div(n,2)+1:n] >=
184189
```
185190
as not the optimization variables $\mathbf{x}$ are partitioned into non-overlapping groups.
186191

192+
!!! note
193+
194+
When the problem is not accepted it might be still possible to solve it: see [Smoothing](@ref) and [Duality](@ref).

src/solvers/solvers_options.jl

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export PG, FPG
1212
1313
Creates an object `PG` containing the options of the Proximal Gradient solvers:
1414
15-
* `gamma`, stepsize (default: unspecified, determine automatically)
15+
* `gamma`, stepsize (default: unspecified, determined automatically)
1616
* `maxit`, maximum number of iteration (default: `10000`)
1717
* `tol`, halting tolerance on the fixed-point residual (default: `1e-4`)
1818
* `adaptive`, adaptively adjust `gamma` (default: `false` if `gamma` is provided)
@@ -50,7 +50,7 @@ export ZeroFPR
5050
5151
Creates an object `ZeroFPR` containing the options of the ZeroFPR solver:
5252
53-
* `gamma`, stepsize (default: unspecified, determine automatically)
53+
* `gamma`, stepsize (default: unspecified, determined automatically)
5454
* `maxit`, maximum number of iteration (default: `10000`)
5555
* `tol`, halting tolerance on the fixed-point residual (default: `1e-4`)
5656
* `adaptive`, adaptively adjust `gamma` (default: `false` if `gamma` is provided)
@@ -79,7 +79,7 @@ export PANOC
7979
8080
Creates an object `PANOC` containing the options of the PANOC solver:
8181
82-
* `gamma`, stepsize (default: unspecified, determine automatically)
82+
* `gamma`, stepsize (default: unspecified, determined automatically)
8383
* `maxit`, maximum number of iteration (default: `10000`)
8484
* `tol`, halting tolerance on the fixed-point residual (default: `1e-4`)
8585
* `adaptive`, adaptively adjust `gamma` (default: `false` if `gamma` is provided)

src/syntax/expressions/addition.jl

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import Base: +, -
22

33
"""
4-
`+(A::AbstractOperator, ex::AbstractExpression)`
4+
`+(ex1::AbstractExpression, ex2::AbstractExpression)`
55
66
Add two expressions.
77
@@ -20,7 +20,7 @@ julia> ex2 = randn(5,2)*z
2020
2121
```
2222
23-
Notice that in order for two expressions to be added toghether their associate `AbstractOperator`
23+
Notice that in order for two expressions to be added toghether their associated `AbstractOperator`
2424
must have the same codomain:
2525
2626
```julia
@@ -173,8 +173,8 @@ julia> ex = x+4
173173
174174
```
175175
176-
Notice that in order to add an array to `ex`, `b` must belong to
177-
of the associate `AbstractOperator` of `ex`.
176+
Notice that in order to add an array to `ex`, `b` must belong to the codomain
177+
of the associated `AbstractOperator` of `ex`.
178178
179179
```julia
180180
julia> b = randn(10);

0 commit comments

Comments
 (0)