Skip to content

Commit cd0da39

Browse files
Merge branch 'master' into patch-1
2 parents 71b6c9d + a52b97d commit cd0da39

File tree

62 files changed

+1010
-454
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+1010
-454
lines changed

.github/workflows/CI.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ jobs:
4141
- OptimizationNLPModels
4242
version:
4343
- '1'
44+
- 'lts'
45+
- 'pre'
4446
steps:
4547
- uses: actions/checkout@v4
4648
- uses: julia-actions/setup-julia@v2

.github/workflows/Downgrade.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Downgrade
2+
on:
3+
pull_request:
4+
branches:
5+
- master
6+
paths-ignore:
7+
- 'docs/**'
8+
push:
9+
branches:
10+
- master
11+
paths-ignore:
12+
- 'docs/**'
13+
jobs:
14+
test:
15+
runs-on: ubuntu-latest
16+
strategy:
17+
matrix:
18+
downgrade_mode: ['alldeps']
19+
julia-version: ['1.10']
20+
group: ['Core']
21+
steps:
22+
- uses: actions/checkout@v4
23+
- uses: julia-actions/setup-julia@v2
24+
with:
25+
version: ${{ matrix.julia-version }}
26+
- uses: julia-actions/julia-downgrade-compat@v2
27+
with:
28+
skip: Pkg,TOML
29+
- uses: julia-actions/julia-buildpkg@v1
30+
- uses: julia-actions/julia-runtest@v1
31+
with:
32+
ALLOW_RERESOLVE: false
33+
env:
34+
GROUP: ${{ matrix.group }}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Downgrade Sublibraries
2+
on:
3+
pull_request:
4+
branches:
5+
- master
6+
paths-ignore:
7+
- 'docs/**'
8+
push:
9+
branches:
10+
- master
11+
paths-ignore:
12+
- 'docs/**'
13+
jobs:
14+
test:
15+
runs-on: ubuntu-latest
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
downgrade_mode: ['alldeps']
20+
julia-version: ['1.10']
21+
project:
22+
- 'lib/OptimizationBBO'
23+
- 'lib/OptimizationCMAEvolutionStrategy'
24+
- 'lib/OptimizationEvolutionary'
25+
- 'lib/OptimizationGCMAES'
26+
- 'lib/OptimizationMOI'
27+
- 'lib/OptimizationManopt'
28+
- 'lib/OptimizationMetaheuristics'
29+
- 'lib/OptimizationMultistartOptimization'
30+
- 'lib/OptimizationNLPModels'
31+
- 'lib/OptimizationNLopt'
32+
- 'lib/OptimizationNOMAD'
33+
- 'lib/OptimizationODE'
34+
- 'lib/OptimizationOptimJL'
35+
- 'lib/OptimizationOptimisers'
36+
- 'lib/OptimizationPRIMA'
37+
- 'lib/OptimizationPolyalgorithms'
38+
- 'lib/OptimizationPyCMA'
39+
- 'lib/OptimizationQuadDIRECT'
40+
- 'lib/OptimizationSciPy'
41+
- 'lib/OptimizationSpeedMapping'
42+
steps:
43+
- uses: actions/checkout@v4
44+
- uses: julia-actions/setup-julia@v2
45+
with:
46+
version: ${{ matrix.julia-version }}
47+
- uses: julia-actions/julia-downgrade-compat@v2
48+
with:
49+
project: ${{ matrix.project }}
50+
skip: Pkg,TOML
51+
- uses: julia-actions/julia-buildpkg@v1
52+
with:
53+
project: ${{ matrix.project }}
54+
- uses: julia-actions/julia-runtest@v1
55+
with:
56+
project: ${{ matrix.project }}
57+
ALLOW_RERESOLVE: false

.github/workflows/Invalidations.yml

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

.typos.toml

Lines changed: 78 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,79 @@
11
[default.extend-words]
2-
AGS = "AGS"
2+
# Julia-specific functions
3+
indexin = "indexin"
4+
findfirst = "findfirst"
5+
findlast = "findlast"
6+
eachindex = "eachindex"
7+
setp = "setp"
8+
getp = "getp"
9+
setu = "setu"
10+
getu = "getu"
11+
12+
# Mathematical/scientific terms
13+
jacobian = "jacobian"
14+
hessian = "hessian"
15+
eigenvalue = "eigenvalue"
16+
eigenvector = "eigenvector"
17+
discretization = "discretization"
18+
linearization = "linearization"
19+
parameterized = "parameterized"
20+
discretized = "discretized"
21+
vectorized = "vectorized"
22+
23+
# Common variable patterns in Julia/SciML
24+
ists = "ists"
25+
ispcs = "ispcs"
26+
osys = "osys"
27+
rsys = "rsys"
28+
usys = "usys"
29+
fsys = "fsys"
30+
eqs = "eqs"
31+
rhs = "rhs"
32+
lhs = "lhs"
33+
ode = "ode"
34+
pde = "pde"
35+
sde = "sde"
36+
dde = "dde"
37+
bvp = "bvp"
38+
ivp = "ivp"
39+
40+
# Common abbreviations
41+
tol = "tol"
42+
rtol = "rtol"
43+
atol = "atol"
44+
idx = "idx"
45+
jdx = "jdx"
46+
prev = "prev"
47+
curr = "curr"
48+
init = "init"
49+
tmp = "tmp"
50+
vec = "vec"
51+
arr = "arr"
52+
dt = "dt"
53+
du = "du"
54+
dx = "dx"
55+
dy = "dy"
56+
dz = "dz"
57+
58+
# Algorithm/type suffixes
59+
alg = "alg"
60+
prob = "prob"
61+
sol = "sol"
62+
cb = "cb"
63+
opts = "opts"
64+
args = "args"
65+
kwargs = "kwargs"
66+
67+
# Scientific abbreviations
68+
ND = "ND"
69+
nd = "nd"
70+
MTK = "MTK"
71+
ODE = "ODE"
72+
PDE = "PDE"
73+
SDE = "SDE"
74+
75+
# Optimization specific terms
76+
TikTak = "TikTak" # Legitimate algorithm name in MultistartOptimization
77+
Tak = "Tak" # Part of TikTak algorithm name
78+
opf = "opf" # Optimal Power Flow abbreviation
79+
AGS = "AGS" # Legitimate NLopt algorithm name

Project.toml

Lines changed: 3 additions & 3 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 = "4.4.0"
3+
version = "4.5.0"
44

55
[deps]
66
ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b"
@@ -41,7 +41,7 @@ Logging = "1.10"
4141
LoggingExtras = "0.4, 1"
4242
Lux = "1.12.4"
4343
MLUtils = "0.4"
44-
ModelingToolkit = "9"
44+
ModelingToolkit = "10"
4545
Mooncake = "0.4.138"
4646
Optim = ">= 1.4.1"
4747
OptimizationBase = "2"
@@ -56,7 +56,7 @@ Random = "1.10"
5656
Reexport = "1.2"
5757
ReverseDiff = "1"
5858
SafeTestsets = "0.1"
59-
SciMLBase = "2.39.0"
59+
SciMLBase = "2.82"
6060
SciMLSensitivity = "7"
6161
SparseArrays = "1.10"
6262
SparseDiffTools = "2"

docs/pages.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ pages = ["index.md",
77
"tutorials/linearandinteger.md",
88
"tutorials/minibatch.md",
99
"tutorials/remakecomposition.md",
10+
"tutorials/reusage_interface.md",
1011
"tutorials/symbolic.md"
1112
],
1213
"Examples" => [
@@ -23,7 +24,7 @@ pages = ["index.md",
2324
"API/modelingtoolkit.md",
2425
"API/FAQ.md"
2526
],
26-
"Optimizer Packages" => [
27+
"Optimizer Packages" => [
2728
"BlackBoxOptim.jl" => "optimization_packages/blackboxoptim.md",
2829
"CMAEvolutionStrategy.jl" => "optimization_packages/cmaevolutionstrategy.md",
2930
"Evolutionary.jl" => "optimization_packages/evolutionary.md",

docs/src/getting_started.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Tada! That's how you do it. Now let's dive in a little more into what each part
3737

3838
## Understanding the Solution Object
3939

40-
The solution object is a `SciMLBase.AbstractNoTimeSolution`, and thus it follows the
40+
The solution object is a `SciMLBase.AbstractNoTimeSolution`, and thus it follows the
4141
[SciMLBase Solution Interface for non-timeseries objects](https://docs.sciml.ai/SciMLBase/stable/interfaces/Solutions/) and is documented at the [solution type page](@ref solution).
4242
However, for simplicity let's show a bit of it in action.
4343

@@ -61,13 +61,13 @@ rosenbrock(sol.u, p)
6161
sol.objective
6262
```
6363

64-
The `sol.retcode` gives us more information about the solution process.
64+
The `sol.retcode` gives us more information about the solution process.
6565

6666
```@example intro
6767
sol.retcode
6868
```
6969

70-
Here it says `ReturnCode.Success` which means that the solutuion successfully solved. We can learn more about the different return codes at
70+
Here it says `ReturnCode.Success` which means that the solutuion successfully solved. We can learn more about the different return codes at
7171
[the ReturnCode part of the SciMLBase documentation](https://docs.sciml.ai/SciMLBase/stable/interfaces/Solutions/#retcodes).
7272

7373
If we are interested about some of the statistics of the solving process, for example to help choose a better solver, we can investigate the `sol.stats`

docs/src/optimization_packages/optimization.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,17 +76,18 @@ ps_ca = ComponentArray(ps)
7676
smodel = StatefulLuxLayer{true}(model, nothing, st)
7777
7878
function callback(state, l)
79-
state.iter % 25 == 1 && @show "Iteration: %5d, Loss: %.6e\n" state.iter l
79+
state.iter % 25 == 1 && @show "Iteration: $(state.iter), Loss: $l"
8080
return l < 1e-1 ## Terminate if loss is small
8181
end
8282
8383
function loss(ps, data)
84-
ypred = [smodel([data[1][i]], ps)[1] for i in eachindex(data[1])]
85-
return sum(abs2, ypred .- data[2])
84+
x_batch, y_batch = data
85+
ypred = [smodel([x_batch[i]], ps)[1] for i in eachindex(x_batch)]
86+
return sum(abs2, ypred .- y_batch)
8687
end
8788
8889
optf = OptimizationFunction(loss, AutoZygote())
8990
prob = OptimizationProblem(optf, ps_ca, data)
9091
91-
res = Optimization.solve(prob, Optimization.Sophia(), callback = callback)
92+
res = Optimization.solve(prob, Optimization.Sophia(), callback = callback, epochs = 100)
9293
```

docs/src/optimization_packages/pycma.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ sol = solve(prob, PyCMAOpt())
3131

3232
## Passing solver-specific options
3333

34-
Any keyword that `Optimization.jl` does not interpret is forwarded directly to PyCMA.
34+
Any keyword that `Optimization.jl` does not interpret is forwarded directly to PyCMA.
3535

36-
In the event an `Optimization.jl` keyword overlaps with a `PyCMA` keyword, the `Optimization.jl` keyword takes precedence.
36+
In the event an `Optimization.jl` keyword overlaps with a `PyCMA` keyword, the `Optimization.jl` keyword takes precedence.
3737

3838
An exhaustive list of keyword arguments can be found by running the following python script:
3939

@@ -44,6 +44,7 @@ print(options)
4444
```
4545

4646
An example passing the `PyCMA` keywords "verbose" and "seed":
47+
4748
```julia
4849
sol = solve(prob, PyCMA(), verbose = -9, seed = 42)
4950
```
@@ -54,10 +55,9 @@ The original Python result object is attached to the solution in the `original`
5455

5556
```julia
5657
sol = solve(prob, PyCMAOpt())
57-
println(sol.original)
58+
println(sol.original)
5859
```
5960

6061
## Contributing
6162

62-
Bug reports and feature requests are welcome in the [Optimization.jl](https://github.com/SciML/Optimization.jl) issue tracker. Pull requests that improve either the Julia wrapper or the documentation are highly appreciated.
63-
63+
Bug reports and feature requests are welcome in the [Optimization.jl](https://github.com/SciML/Optimization.jl) issue tracker. Pull requests that improve either the Julia wrapper or the documentation are highly appreciated.

0 commit comments

Comments
 (0)