-
-
Notifications
You must be signed in to change notification settings - Fork 83
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 #612 from SciML/prima
[WIP] Add PRIMA wrapper
- Loading branch information
Showing
20 changed files
with
621 additions
and
163 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
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,5 +1,5 @@ | ||
.DS_Store | ||
/Manifest.toml | ||
Manifest.toml | ||
/dev/ | ||
/docs/build/ | ||
.vscode |
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 was deleted.
Oops, something went wrong.
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,49 @@ | ||
# PRIMA.jl | ||
|
||
[PRIMA.jl](https://github.com/libprima/PRIMA.jl) is a julia wrapper for the fortran library [prima](https://github.com/libprima/prima) which implements Powell's derivative free optimization methods. | ||
|
||
## Installation: OptimizationPRIMA | ||
|
||
To use this package, install the OptimizationPRIMA package: | ||
|
||
```julia | ||
import Pkg; | ||
Pkg.add("OptimizationPRIMA"); | ||
``` | ||
|
||
## Local Optimizer | ||
|
||
The five Powell's algorithms of the prima library are provided by the PRIMA.jl package: | ||
|
||
`UOBYQA`: (Unconstrained Optimization BY Quadratic Approximations) is for unconstrained optimization, that is Ω = ℝⁿ. | ||
|
||
`NEWUOA`: is also for unconstrained optimization. According to M.J.D. Powell, newuoa is superior to uobyqa. | ||
|
||
`BOBYQA`: (Bounded Optimization BY Quadratic Approximations) is for simple bound constrained problems, that is Ω = { x ∈ ℝⁿ | xl ≤ x ≤ xu }. | ||
|
||
`LINCOA`: (LINearly Constrained Optimization) is for constrained optimization problems with bound constraints, linear equality constraints, and linear inequality constraints. | ||
|
||
`COBYLA`: (Constrained Optimization BY Linear Approximations) is for general constrained problems with bound constraints, non-linear constraints, linear equality constraints, and linear inequality constraints. | ||
|
||
```@example PRIMA | ||
rosenbrock(x, p) = (p[1] - x[1])^2 + p[2] * (x[2] - x[1]^2)^2 | ||
x0 = zeros(2) | ||
_p = [1.0, 100.0] | ||
prob = OptimizationProblem(rosenbrock, x0, _p) | ||
sol = Optimization.solve(prob, UOBYQA(), maxiters = 1000) | ||
sol = Optimization.solve(prob, NEWUOA(), maxiters = 1000) | ||
sol = Optimization.solve(prob, BOBYQA(), maxiters = 1000) | ||
sol = Optimization.solve(prob, LINCOA(), maxiters = 1000) | ||
function con2_c(res, x, p) | ||
res .= [x[1] + x[2], x[2] * sin(x[1]) - x[1]] | ||
end | ||
optprob = OptimizationFunction(rosenbrock, AutoForwardDiff(), cons = con2_c) | ||
prob = OptimizationProblem(optprob, x0, _p, lcons = [1, -100], ucons = [1, 100]) | ||
sol = Optimization.solve(prob, COBYLA(), maxiters = 1000) | ||
``` |
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
Oops, something went wrong.