-
-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #727 from SciML/lbfgsb
Try augmented-lagrangian with lbfgsb
- Loading branch information
Showing
7 changed files
with
207 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Manopt.jl | ||
|
||
[Manopt.jl](https://github.com/JuliaManifolds/Manopt.jl) is a package with implementations of a variety of optimziation solvers on manifolds supported by | ||
[Manifolds](https://github.com/JuliaManifolds/Manifolds.jl). | ||
|
||
## Installation: OptimizationManopt.jl | ||
|
||
To use the Optimization.jl interface to Manopt, install the OptimizationManopt package: | ||
|
||
```julia | ||
import Pkg; | ||
Pkg.add("OptimizationManopt"); | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,21 @@ | ||
using Optimization | ||
using ForwardDiff, Zygote, ReverseDiff, FiniteDiff, Tracker | ||
using ModelingToolkit, Enzyme, Random | ||
using ForwardDiff, Zygote, ReverseDiff, FiniteDiff | ||
using Test | ||
|
||
x0 = zeros(2) | ||
rosenbrock(x, p = nothing) = (1 - x[1])^2 + 100 * (x[2] - x[1]^2)^2 | ||
l1 = rosenbrock(x0) | ||
|
||
optf = OptimizationFunction(rosenbrock, AutoForwardDiff()) | ||
optf = OptimizationFunction(rosenbrock, AutoEnzyme()) | ||
prob = OptimizationProblem(optf, x0) | ||
res = solve(prob, Optimization.LBFGS(), maxiters = 100) | ||
@time res = solve(prob, Optimization.LBFGS(), maxiters = 100) | ||
|
||
@test res.u≈[1.0, 1.0] atol=1e-3 | ||
function con2_c(res, x, p) | ||
res .= [x[1]^2 + x[2]^2, (x[2] * sin(x[1]) + x[1])-5] | ||
end | ||
|
||
optf = OptimizationFunction(rosenbrock, AutoZygote()) | ||
prob = OptimizationProblem(optf, x0, lb = [0.0, 0.0], ub = [0.3, 0.3]) | ||
res = solve(prob, Optimization.LBFGS(), maxiters = 100) | ||
|
||
@test res.u≈[0.3, 0.09] atol=1e-3 | ||
optf = OptimizationFunction(rosenbrock, AutoZygote(), cons = con2_c) | ||
prob = OptimizationProblem(optf, x0, lcons = [1.0, -Inf], | ||
ucons = [1.0, 0.0], lb = [-1.0, -1.0], | ||
ub = [1.0, 1.0]) | ||
@time res = solve(prob, Optimization.LBFGS(), maxiters = 100) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters