SLimOptim.jl documentation
- SLimOptim.jl documentation
- Denoising
- Packages setup
- Use a standard reference image
- Measurment operator
- Setup transform domain operator
- Measurements
- Linearized bregman
- Plot result and convergence
- Constrained Inversion, basics
- Problem definition
- Define in place objective and gradient functions
- Inversion
- Plot solutions
- Constrained FWI with
- 1. Prepare models
- Visualize
- 2. Setup Constraints with SetIntersectionProjection
- 3. Build a small local compute cluster (2 workers)
- 4. Create source and receivers geometries
- 5. Build
F
, the JUDI modeling operator - 6. Use
F
to create the data in both models - 7. Visualize data
- 8. Assess if data is cycle skipped at the farthest offsets
- 9. Build the
objective
functions - 10. Perform the FWI using
minConf_PQN
- 11. Visualize velocity models and objective function
- 12. Visualize data match
- 14. Remove workers
Line searches
Line search utuility function that calls LineSearches.jl, this function is used for the line search at each iteration in spg
and pqn
and can be used by itslef as weel. For convenience the linesearches are all exported and available.
SlimOptim.linesearch
— Functionlinesearch(ls, sol, d, f, g!, fg!, t, funRef, gtd, gvec)
Line search interface to LineSearches.jl
Arguments
ls
: Line search structure (see LineSearches.jl documentation)f
: Objective function, x -> f(x)g!
`: Gradient in place function, x-> (g.= gradient(x))fg!
`: Objective and in place gradient function, x-> (f = f(x); g.= gradient(x))t
: Initial steplength gessfunRef
: Reference objective function valuegtd
: Reference direction inner product dot(g0, d0)gvec
: prealocated array for thhe gradient
SPG
Spectral Projected gradient algorithm adapted from min_Conf for constrained optimization.
SlimOptim.spg
— Functionspg(funObj, x, funProj, options; ls=nothing, callback=nothing)
Function for using Spectral Projected Gradient to solve problems of the form min funObj(x) s.t. x in C
Arguments
funObj(x)
:function to minimize (returns gradient as second argument)funProj(x)
: function that returns projection of x onto Cx
: Initial guessoptions
: spg_options structure
Optional Arguments
ls
`: User provided linesearch functioncallback
: Callback function. Must take as input aresult
callback(x::result)
Notes:
if the projection is expensive to compute, you can reduce the number of projections by setting testOpt to 0 in the options
Adapted fromt he matlab implementation of minConf_SPG
spg(f, g!, fg!, x, funProj, options; ls=nothing, callback=nothing)
Function for using Spectral Projected Gradient to solve problems of the form min funObj(x) s.t. x in C
Arguments
f(x)
: function to minimize (returns objective only)g!(g, x)
: gradient of function (in place)fg!(g, x)
: objective and gradient (in place)funProj(x)
: function that returns projection of x onto Cx
: Initial guessoptions
: spg_options structure
Optional Arguments
ls
`: User provided linesearch functioncallback
: Callback function. Must take as input aresult
callback(x::result)
Notes:
if the projection is expensive to compute, you can reduce the number of projections by setting testOpt to 0 in the options
Adapted fromt he matlab implementation of minConf_SPG
The algorithms uses the following options:
SlimOptim.spg_options
— Functionspg_options(;verbose=3,optTol=1f-5,progTol=1f-7,
maxIter=20,suffDec=1f-4,memory=2,
useSpectral=true,curvilinear=false,
feasibleInit=false,testOpt=true,
bbType=true,testInit=false, store_trace=false,
optNorm=Inf,iniStep=1f0, maxLinesearchIter=10)
Options structure for Spectral Project Gradient algorithm.
Arguments
verbose
: level of verbosity (0: no output, 1: iter (default))optTol
: tolerance used to check for optimality (default: 1e-5)progTol
: tolerance used to check for lack of progress (default: 1e-9)maxIter
: maximum number of iterations (default: 20)suffDec
: sufficient decrease parameter in Armijo condition (default: 1e-4)memory
: number of steps to look back in non-monotone Armijo conditionuseSpectral
: use spectral scaling of gradient direction (default: 1)curvilinear
: backtrack along projection Arc (default: 0)testOpt
: test optimality condition (default: 1)feasibleInit
: if 1, then the initial point is assumed to be feasiblebbType
: type of Barzilai Borwein step (default: 1)testInit
: Whether to test the initial estimate for optimality (default: false)store_trace
: Whether to store the trace/history of x (default: false)optNorm
: First-Order Optimality Conditions norm (default: Inf)iniStep
: Initial step length estimate (default: 1)maxLinesearchIter
: Maximum number of line search iteration (default: 20)
PQN
Projected Quasi-Newton algorithm adapted from min_Conf for constrained optimization.
SlimOptim.pqn
— Functionpqn(objective, x, projection, options; ls=nothing, callback=nothing)
Function for using a limited-memory projected quasi-Newton to solve problems of the form min objective(x) s.t. x in C
The projected quasi-Newton sub-problems are solved the spectral projected gradient algorithm
Arguments
funObj(x)
: function to minimize (returns gradient as second argument)funProj(x)
: function that returns projection of x onto Cx
: Initial guessoptions
: pqn_options structure
Optional Arguments
ls
`: User provided linesearch functioncallback
: Callback function. Must take as input aresult
callback(x::result)
Notes:
Adapted fromt he matlab implementation of minConf_PQN
pqn(f, g!, fg!, x, projection, options; ls=nothing, callback=nothing)
Function for using a limited-memory projected quasi-Newton to solve problems of the form min objective(x) s.t. x in C
The projected quasi-Newton sub-problems are solved the spectral projected gradient algorithm.
Arguments
f(x)
: function to minimize (returns objective only)g!(g, x)
: gradient of function (in place)fg!(g, x)
: objective and gradient (in place)funProj(x)
: function that returns projection of x onto Cx
: Initial guessoptions
: pqn_options structure
Optional Arguments
ls
`: User provided linesearch functioncallback
: Callback function. Must take as input aresult
callback(x::result)
Notes:
Adapted fromt he matlab implementation of minConf_PQN
The algorithms uses the following options:
SlimOptim.pqn_options
— Functionpqn_options(;verbose=2, optTol=1f-5, progTol=1f-7,
maxIter=20, suffDec=1f-4, corrections=10, adjustStep=false,
bbInit=false, store_trace=false, SPGoptTol=1f-6, SPGprogTol=1f-7,
SPGiters=10, SPGtestOpt=false, maxLinesearchIter=20)
Options structure for Spectral Project Gradient algorithm.
Arguments
verbose
: level of verbosity (0: no output, 1: iter (default))optTol
: tolerance used to check for optimality (default: 1e-5)progTol
: tolerance used to check for progress (default: 1e-9)maxIter
: maximum number of iterations (default: 20)suffDec
: sufficient decrease parameter in Armijo condition (default: 1e-4)corrections
: number of lbfgs corrections to store (default: 10)adjustStep
: use quadratic initialization of line search (default: 0)bbInit
: initialize sub-problem with Barzilai-Borwein step (default: 1)store_trace
: Whether to store the trace/history of x (default: false)SPGoptTol
: optimality tolerance for SPG direction finding (default: 1e-6)SPGprogTol
: SPG tolerance used to check for progress (default: 1e-7)SPGiters
: maximum number of iterations for SPG direction finding (default:10)SPGtestOpt
: Whether to check for optimality in SPG (default: false)maxLinesearchIter
: Maximum number of line search iteration (default: 20)memory
: Number of steps for the non-monotone functional decrease condition.iniStep
: Initial step length estimate (default: 1). Ignored with adjustStep.
Linearized bregman
Linearized bregman iteration for split feasability problems.
SlimOptim.bregman_options
— Functionbregman_options(;verbose=1, optTol=1e-6, progTol=1e-8, maxIter=20,
store_trace=false, quantile=.5, alpha=.25, spg=false)
Options structure for the bregman iteration algorithm
Arguments
verbose
: level of verbosity (0: no output, 1: final, 2: iter (default), 3: debug)progTol
: tolerance used to check for lack of progress (default: 1e-9)maxIter
: maximum number of iterations (default: 20)store_trace
: Whether to store the trace/history of x (default: false)antichatter
: Whether to use anti-chatter step length correctionalpha
: Strong convexity modulus. (step length is $α \frac{||r||_2^2}{||g||_2^2}$)spg
: whether to use spg, default is falseTD
: sparsifying transform (e.g. curvelet), default is identity (LinearAlgebra.I)λfunc
: a function to calculate threshold value, default is nothingλ
: a pre-set threshold, will only be used ifλfunc
is not defined, default is nothingquantile
: a percentage to calculate the threshold by quantile of the dual variable in 1st iteration, will only be used if neitherλfunc
norλ
are defined, default is .95 i.e thresholds 95% of the vectorw
: a weight vector that is applied on the threshold element-wise according to relaxation of weighted l1, default is 1 (no weighting)reset_lambda
: How often should lambda be updated. Defaults tonothing
i.e lambda is nerver updated and estimated at the first iteration.
SlimOptim.bregman
— Functionbregman(A, x, b, options)
Linearized bregman iteration for the system
$\frac{1}{2} ||TD \ x||_2^2 + λ ||TD \ x||_{1,w} \ \ \ s.t Ax = b$
For example, for sparsity promoting denoising (i.e LSRTM)
Required arguments
A
: Forward operator (e.g. J or preconditioned J for LSRTM)x
: Initial guessb
: observed data
Optional Arguments
callback
: Callback function. Must take as input aresult
callback(x::result)
Non-required arguments
options
: bregman options, default is bregman_options(); options.TD provides the sparsifying transform (e.g. curvelet), options.w provides the weight vector for the weighted l1
bregman(funobj, x, options)
Linearized bregman iteration for the system
$\frac{1}{2} ||TD \ x||_2^2 + λ ||TD \ x||_{1,w} \ \ \ s.t Ax = b$
Required arguments
funobj
: a function that calculates the objective value (0.5 * norm(Ax-b)^2
) and the gradient (A'(Ax-b)
)x
: Initial guess
Optional Arguments
callback
: Callback function. Must take as input aresult
callback(x::result)
Non-required arguments
options
: bregman options, default is bregman_options(); options.TD provides the sparsifying transform (e.g. curvelet), options.w provides the weight vector for the weighted l1