Skip to content

Commit 2357c79

Browse files
Merge pull request #52 from SciML/diffeqbase
use DiffEqBase problem definition
2 parents ad9a73c + 631171e commit 2357c79

File tree

9 files changed

+332
-312
lines changed

9 files changed

+332
-312
lines changed

Project.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ authors = ["Vaibhavdixit02 <[email protected]>"]
44
version = "0.2.2"
55

66
[deps]
7+
ArrayInterface = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9"
78
ConsoleProgressMonitor = "88cd18e8-d9cc-4ea6-8889-5259c0d15c8b"
89
DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e"
910
DiffResults = "163ba53b-c6d8-5494-b064-1a9d43ac40c5"
@@ -15,6 +16,7 @@ LoggingExtras = "e6f89c97-d47a-5376-807f-9c37f3926c36"
1516
Optim = "429524aa-4258-5aef-a3af-852621145aeb"
1617
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
1718
ProgressLogging = "33c8b6b6-d38a-422a-b730-caa89a2f386c"
19+
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
1820
Requires = "ae029012-a4dd-5104-9daa-d747884805df"
1921
ReverseDiff = "37e2e3b7-166d-5795-8a7a-e32c996b4267"
2022
TerminalLoggers = "5d786b92-1e48-4d6f-9151-6b4477ca9bed"

README.md

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,20 @@ unified interface.
2020
x0 = zeros(2)
2121
p = [1.0,100.0]
2222

23-
prob = OptimizationProblem(rosenbrock,x0,p=p)
23+
prob = OptimizationProblem(rosenbrock,x0,p)
2424
sol = solve(prob,NelderMead())
2525

2626

2727
using BlackBoxOptim
28-
prob = OptimizationProblem(rosenbrock, x0, p = p, lb = [-1.0,-1.0], ub = [1.0,1.0])
28+
prob = OptimizationProblem(rosenbrock, x0, p, lb = [-1.0,-1.0], ub = [1.0,1.0])
2929
sol = solve(prob,BBO())
3030
```
3131

3232
```julia
33-
f = OptimizationFunction(rosenbrock, x0, GalacticOptim.AutoForwardDiff(), p=p)
34-
prob = OptimizationProblem(f, x0, p = p)
33+
f = OptimizationFunction(rosenbrock, x0, GalacticOptim.AutoForwardDiff(), p)
34+
prob = OptimizationProblem(f, x0, p)
3535
sol = solve(prob,BFGS())
36-
```
36+
```
3737

3838
```julia
3939
prob = OptimizationProblem(f, x0, p = p, lb = [-1.0,-1.0], ub = [1.0,1.0])
@@ -58,17 +58,15 @@ choice.
5858
### API Documentation
5959

6060
```julia
61-
OptimizationFunction(f, x, AutoForwardDiff();
62-
p = DiffEqBase.NullParameters(),
61+
OptimizationFunction(f, x, AutoForwardDiff(), p = DiffEqBase.NullParameters();
6362
grad = nothing,
6463
hes = nothing,
6564
hv = nothing,
6665
chunksize = 1)
6766
```
6867

6968
```julia
70-
OptimizationProblem(f, x;
71-
p = DiffEqBase.NullParameters(),
69+
OptimizationProblem(f, x, p = DiffEqBase.NullParameters(),;
7270
lb = nothing,
7371
ub = nothing)
7472
```

src/GalacticOptim.jl

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
module GalacticOptim
22

3-
using DiffEqBase, Requires
3+
using Reexport
4+
@reexport using DiffEqBase
5+
using Requires
46
using DiffResults, ForwardDiff, Zygote, ReverseDiff, Tracker, FiniteDiff
57
using Optim, Flux
68
using Logging, ProgressLogging, Printf, ConsoleProgressMonitor, TerminalLoggers, LoggingExtras
9+
using ArrayInterface
10+
11+
using ForwardDiff: DEFAULT_CHUNK_THRESHOLD
12+
import DiffEqBase: OptimizationProblem, OptimizationFunction, AbstractADType
713

8-
include("problem.jl")
914
include("solve.jl")
1015
include("function.jl")
1116

12-
export OptimizationProblem, OptimizationFunction
1317
export solve
1418

1519
export BBO, CMAEvolutionStrategyOpt

0 commit comments

Comments
 (0)