Skip to content

Commit 5cc47d0

Browse files
Merge pull request #681 from SciML/stateonly
Moved optstats to SciMLBase
2 parents 24e9a11 + 54f11bd commit 5cc47d0

File tree

5 files changed

+34
-61
lines changed

5 files changed

+34
-61
lines changed

Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "Optimization"
22
uuid = "7f7a1694-90dd-40f0-9382-eb1efda571ba"
3-
version = "3.21.1"
3+
version = "3.21.2"
44

55
[deps]
66
ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b"
@@ -57,7 +57,7 @@ Printf = "1.10"
5757
ProgressLogging = "0.1"
5858
Reexport = "1.2"
5959
ReverseDiff = "1.14"
60-
SciMLBase = "2.16.3"
60+
SciMLBase = "2.20.0"
6161
SparseArrays = "1.10"
6262
SparseDiffTools = "2.14"
6363
SymbolicIndexingInterface = "0.3.2"

docs/src/optimization_packages/mathoptinterface.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Pkg.add("OptimizationMOI");
1313
```
1414

1515
## Details
16+
1617
As of now, the `Optimization` interface to `MathOptInterface` implements only
1718
the `maxtime` common keyword argument.
1819

src/Optimization.jl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,16 @@ using ArrayInterface, Base.Iterators, SparseArrays, LinearAlgebra
1616
using SymbolicIndexingInterface
1717
using Pkg
1818

19-
import SciMLBase: OptimizationProblem, OptimizationFunction, ObjSense,
20-
MaxSense, MinSense
19+
import SciMLBase: OptimizationProblem,
20+
OptimizationFunction, ObjSense,
21+
MaxSense, MinSense, OptimizationStats
2122
export ObjSense, MaxSense, MinSense
2223

2324
include("utils.jl")
2425
include("function.jl")
2526
include("adtypes.jl")
2627
include("cache.jl")
27-
include("stats_state.jl")
28+
include("state.jl")
2829

2930
export solve, OptimizationCache
3031

src/state.jl

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
"""
2+
$(TYPEDEF)
3+
4+
Stores the optimization run's state at the current iteration
5+
and is passed to the callback function as the first argument.
6+
7+
## Fields
8+
- `iter`: current iteration
9+
- `u`: current solution
10+
- `objective`: current objective value
11+
- `gradient`: current gradient
12+
- `hessian`: current hessian
13+
- `original`: if the solver has its own state object then it is stored here
14+
"""
15+
struct OptimizationState{X, O, G, H, S}
16+
iter::Int
17+
u::X
18+
objective::O
19+
grad::G
20+
hess::H
21+
original::S
22+
end
23+
24+
function OptimizationState(; iter = 0, u = nothing, objective = nothing,
25+
grad = nothing, hess = nothing, original = nothing)
26+
OptimizationState(iter, u, objective, grad, hess, original)
27+
end

src/stats_state.jl

Lines changed: 0 additions & 56 deletions
This file was deleted.

0 commit comments

Comments
 (0)