Skip to content

Commit

Permalink
Merge pull request #681 from SciML/stateonly
Browse files Browse the repository at this point in the history
Moved optstats to SciMLBase
  • Loading branch information
Vaibhavdixit02 authored Jan 19, 2024
2 parents 24e9a11 + 54f11bd commit 5cc47d0
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 61 deletions.
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "Optimization"
uuid = "7f7a1694-90dd-40f0-9382-eb1efda571ba"
version = "3.21.1"
version = "3.21.2"

[deps]
ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b"
Expand Down Expand Up @@ -57,7 +57,7 @@ Printf = "1.10"
ProgressLogging = "0.1"
Reexport = "1.2"
ReverseDiff = "1.14"
SciMLBase = "2.16.3"
SciMLBase = "2.20.0"
SparseArrays = "1.10"
SparseDiffTools = "2.14"
SymbolicIndexingInterface = "0.3.2"
Expand Down
1 change: 1 addition & 0 deletions docs/src/optimization_packages/mathoptinterface.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Pkg.add("OptimizationMOI");
```

## Details

As of now, the `Optimization` interface to `MathOptInterface` implements only
the `maxtime` common keyword argument.

Expand Down
7 changes: 4 additions & 3 deletions src/Optimization.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,16 @@ using ArrayInterface, Base.Iterators, SparseArrays, LinearAlgebra
using SymbolicIndexingInterface
using Pkg

import SciMLBase: OptimizationProblem, OptimizationFunction, ObjSense,
MaxSense, MinSense
import SciMLBase: OptimizationProblem,
OptimizationFunction, ObjSense,
MaxSense, MinSense, OptimizationStats
export ObjSense, MaxSense, MinSense

include("utils.jl")
include("function.jl")
include("adtypes.jl")
include("cache.jl")
include("stats_state.jl")
include("state.jl")

export solve, OptimizationCache

Expand Down
27 changes: 27 additions & 0 deletions src/state.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
"""
$(TYPEDEF)
Stores the optimization run's state at the current iteration
and is passed to the callback function as the first argument.
## Fields
- `iter`: current iteration
- `u`: current solution
- `objective`: current objective value
- `gradient`: current gradient
- `hessian`: current hessian
- `original`: if the solver has its own state object then it is stored here
"""
struct OptimizationState{X, O, G, H, S}
iter::Int
u::X
objective::O
grad::G
hess::H
original::S
end

function OptimizationState(; iter = 0, u = nothing, objective = nothing,
grad = nothing, hess = nothing, original = nothing)
OptimizationState(iter, u, objective, grad, hess, original)
end
56 changes: 0 additions & 56 deletions src/stats_state.jl

This file was deleted.

0 comments on commit 5cc47d0

Please sign in to comment.