Skip to content

Commit 4d63e40

Browse files
Merge branch 'master' into compathelper/new_version/2024-09-21-00-22-18-420-00730187477
2 parents a25b43a + 939eaa9 commit 4d63e40

File tree

78 files changed

+5980
-1399
lines changed

Some content is hidden

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

78 files changed

+5980
-1399
lines changed

.github/workflows/Documentation.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
- uses: actions/checkout@v4
2121
- uses: julia-actions/setup-julia@latest
2222
with:
23-
version: '1'
23+
version: 'lts'
2424
- run: sudo apt-get update && sudo apt-get install -y xorg-dev mesa-utils xvfb libgl1 freeglut3-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libxext-dev
2525
- name: Install dependencies
2626
run: DISPLAY=:0 xvfb-run -s '-screen 0 1024x768x24' julia --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()'

.github/workflows/Tests.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ jobs:
2525
strategy:
2626
fail-fast: false
2727
matrix:
28+
version:
29+
- "1"
30+
- "lts"
31+
- "pre"
2832
group:
2933
- InterfaceI
3034
- InterfaceII
@@ -35,5 +39,6 @@ jobs:
3539
- RegressionI
3640
uses: "SciML/.github/.github/workflows/tests.yml@v1"
3741
with:
42+
julia-version: "${{ matrix.version }}"
3843
group: "${{ matrix.group }}"
3944
secrets: "inherit"

Project.toml

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
name = "ModelingToolkit"
22
uuid = "961ee093-0014-501f-94e3-6117800e7a78"
33
authors = ["Yingbo Ma <mayingbo5@gmail.com>", "Chris Rackauckas <accounts@chrisrackauckas.com> and contributors"]
4-
version = "9.40.0"
4+
version = "9.50.0"
55

66
[deps]
77
AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c"
88
ArrayInterface = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9"
99
BlockArrays = "8e7c35d0-a365-5155-bbbb-fb81a777f24e"
1010
Combinatorics = "861a8166-3701-5b0c-9a16-15d98fcdc6aa"
11+
CommonSolve = "38540f10-b2f7-11e9-35d8-d573e4eb0ff2"
1112
Compat = "34da2185-b29b-5c13-b0c7-acf172513d20"
1213
ConstructionBase = "187b0558-2788-49d3-abe0-74a17ed4e7c9"
1314
DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
@@ -20,10 +21,12 @@ Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
2021
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
2122
DomainSets = "5b8099bc-c8ec-5219-889f-1d9e522a28bf"
2223
DynamicQuantities = "06fc5a27-2a28-4c7c-a15d-362465fb6821"
24+
EnumX = "4e289a0a-7415-4d19-859d-a7e5c4648b56"
2325
ExprTools = "e2ba6199-217a-4e67-a87a-7c52f15ade04"
2426
Expronicon = "6b7a57c9-7cc1-4fdf-b7f5-e857abae3636"
2527
FindFirstFunctions = "64ca27bc-2ba2-4a57-88aa-44e436879224"
2628
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
29+
FunctionWrappers = "069b7b12-0de2-55c6-9aab-29f3d0a68a2e"
2730
FunctionWrappersWrappers = "77dc65aa-8811-40c2-897b-53d922fa7daf"
2831
Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6"
2932
InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
@@ -35,6 +38,7 @@ LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
3538
MLStyle = "d8e11817-5142-5d16-987a-aa16d5891078"
3639
NaNMath = "77ba4419-2d1f-58cd-9bb1-8ffee604a2e3"
3740
NonlinearSolve = "8913a72c-1f9b-4ce2-8d82-65094dcecaec"
41+
OffsetArrays = "6fe1bfb0-de20-5000-8ca7-80f57d26f881"
3842
OrderedCollections = "bac558e1-5e72-5ebc-8fee-abe8a469f55d"
3943
PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a"
4044
RecursiveArrayTools = "731186ca-8d62-57ce-b412-fbd966d074cd"
@@ -59,40 +63,47 @@ Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"
5963
BifurcationKit = "0f109fa4-8a5d-4b75-95aa-f515264e7665"
6064
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
6165
DeepDiffs = "ab62b9b5-e342-54a8-a765-a90f495de1a6"
66+
HomotopyContinuation = "f213a82b-91d6-5c5d-acf7-10f1c761b327"
6267
LabelledArrays = "2ee39098-c373-598a-b85f-a56591580800"
6368

6469
[extensions]
6570
MTKBifurcationKitExt = "BifurcationKit"
6671
MTKChainRulesCoreExt = "ChainRulesCore"
6772
MTKDeepDiffsExt = "DeepDiffs"
73+
MTKHomotopyContinuationExt = "HomotopyContinuation"
6874
MTKLabelledArraysExt = "LabelledArrays"
6975

7076
[compat]
7177
AbstractTrees = "0.3, 0.4"
7278
ArrayInterface = "6, 7"
73-
BifurcationKit = "0.3"
79+
BifurcationKit = "0.4"
7480
BlockArrays = "1.1"
7581
ChainRulesCore = "1"
7682
Combinatorics = "1"
83+
CommonSolve = "0.2.4"
7784
Compat = "3.42, 4"
7885
ConstructionBase = "1"
86+
DataInterpolations = "6.4"
7987
DataStructures = "0.17, 0.18"
8088
DeepDiffs = "1"
81-
DiffEqBase = "6.103.0"
82-
DiffEqCallbacks = "2.16, 3"
89+
DiffEqBase = "6.157"
90+
DiffEqCallbacks = "2.16, 3, 4"
8391
DiffEqNoiseProcess = "5"
8492
DiffRules = "0.1, 1.0"
8593
Distributed = "1"
8694
Distributions = "0.23, 0.24, 0.25"
8795
DocStringExtensions = "0.7, 0.8, 0.9"
8896
DomainSets = "0.6, 0.7"
8997
DynamicQuantities = "^0.11.2, 0.12, 0.13, 1"
98+
EnumX = "1.0.4"
9099
ExprTools = "0.1.10"
91100
Expronicon = "0.8"
92101
FindFirstFunctions = "1"
93102
ForwardDiff = "0.10.3"
103+
FunctionWrappers = "1.1"
94104
FunctionWrappersWrappers = "0.1"
95105
Graphs = "1.5.2"
106+
HomotopyContinuation = "2.11"
96107
InteractiveUtils = "1"
97108
JuliaFormatter = "1.0.47"
98109
JumpProcesses = "9.13.1"
@@ -102,24 +113,27 @@ Libdl = "1"
102113
LinearAlgebra = "1"
103114
MLStyle = "0.4.17"
104115
NaNMath = "0.3, 1"
105-
NonlinearSolve = "3.14"
116+
NonlinearSolve = "3.14, 4"
117+
OffsetArrays = "1"
106118
OrderedCollections = "1"
107119
OrdinaryDiffEq = "6.82.0"
120+
OrdinaryDiffEqCore = "1.7.0"
108121
PrecompileTools = "1"
122+
REPL = "1"
109123
RecursiveArrayTools = "3.26"
110124
Reexport = "0.2, 1"
111125
RuntimeGeneratedFunctions = "0.5.9"
112-
SciMLBase = "2.52.1"
126+
SciMLBase = "2.57.1"
113127
SciMLStructures = "1.0"
114128
Serialization = "1"
115129
Setfield = "0.7, 0.8, 1"
116-
SimpleNonlinearSolve = "0.1.0, 1"
130+
SimpleNonlinearSolve = "0.1.0, 1, 2"
117131
SparseArrays = "1"
118132
SpecialFunctions = "0.7, 0.8, 0.9, 0.10, 1.0, 2"
119133
StaticArrays = "0.10, 0.11, 0.12, 1.0"
120-
SymbolicIndexingInterface = "0.3.29"
121-
SymbolicUtils = "3.2"
122-
Symbolics = "6.3"
134+
SymbolicIndexingInterface = "0.3.35"
135+
SymbolicUtils = "3.7"
136+
Symbolics = "6.15.4"
123137
URIs = "1"
124138
UnPack = "0.1, 1.0"
125139
Unitful = "1.1"
@@ -129,6 +143,7 @@ julia = "1.9"
129143
AmplNLWriter = "7c4d4715-977e-5154-bfe0-e096adeac482"
130144
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
131145
ControlSystemsBase = "aaaaaaaa-a6ca-5380-bf3e-84a91bcd477e"
146+
DataInterpolations = "82cc6244-b520-54b8-b5a6-8a565e85f1d0"
132147
DeepDiffs = "ab62b9b5-e342-54a8-a765-a90f495de1a6"
133148
DelayDiffEq = "bcd4f6db-9728-5f36-b5f7-82caef46ccdb"
134149
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
@@ -141,7 +156,9 @@ Optimization = "7f7a1694-90dd-40f0-9382-eb1efda571ba"
141156
OptimizationMOI = "fd9f6733-72f4-499f-8506-86b2bdd0dea1"
142157
OptimizationOptimJL = "36348300-93cb-4f02-beb5-3c3902f8871e"
143158
OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
159+
OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8"
144160
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
161+
REPL = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb"
145162
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
146163
ReferenceTests = "324d217c-45ce-50fc-942e-d289b448e8cf"
147164
SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f"
@@ -154,4 +171,4 @@ Sundials = "c3572dad-4567-51f8-b174-8c6c989267f4"
154171
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
155172

156173
[targets]
157-
test = ["AmplNLWriter", "BenchmarkTools", "ControlSystemsBase", "DelayDiffEq", "NonlinearSolve", "ForwardDiff", "Ipopt", "Ipopt_jll", "ModelingToolkitStandardLibrary", "Optimization", "OptimizationOptimJL", "OptimizationMOI", "OrdinaryDiffEq", "Random", "ReferenceTests", "SafeTestsets", "StableRNGs", "Statistics", "SteadyStateDiffEq", "Test", "StochasticDiffEq", "Sundials", "StochasticDelayDiffEq", "Pkg", "JET"]
174+
test = ["AmplNLWriter", "BenchmarkTools", "ControlSystemsBase", "DataInterpolations", "DelayDiffEq", "NonlinearSolve", "ForwardDiff", "Ipopt", "Ipopt_jll", "ModelingToolkitStandardLibrary", "Optimization", "OptimizationOptimJL", "OptimizationMOI", "OrdinaryDiffEq", "OrdinaryDiffEqCore", "REPL", "Random", "ReferenceTests", "SafeTestsets", "StableRNGs", "Statistics", "SteadyStateDiffEq", "Test", "StochasticDiffEq", "Sundials", "StochasticDelayDiffEq", "Pkg", "JET"]

docs/Project.toml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[deps]
22
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
33
BifurcationKit = "0f109fa4-8a5d-4b75-95aa-f515264e7665"
4+
DataInterpolations = "82cc6244-b520-54b8-b5a6-8a565e85f1d0"
45
DifferentialEquations = "0c46a032-eb83-5123-abaf-570d42b7fbaa"
56
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
67
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
@@ -22,15 +23,16 @@ Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"
2223

2324
[compat]
2425
BenchmarkTools = "1.3"
25-
BifurcationKit = "0.3"
26+
BifurcationKit = "0.4"
27+
DataInterpolations = "6.5"
2628
DifferentialEquations = "7.6"
2729
Distributions = "0.25"
2830
Documenter = "1"
2931
DynamicQuantities = "^0.11.2, 0.12, 1"
3032
ModelingToolkit = "8.33, 9"
31-
NonlinearSolve = "3"
33+
NonlinearSolve = "3, 4"
3234
Optim = "1.7"
33-
Optimization = "3.9"
35+
Optimization = "3.9, 4"
3436
OptimizationOptimJL = "0.1, 0.4"
3537
OrdinaryDiffEq = "6.31"
3638
Plots = "1.36"

docs/pages.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ pages = [
1212
"tutorials/parameter_identifiability.md",
1313
"tutorials/bifurcation_diagram_computation.md",
1414
"tutorials/SampledData.md",
15-
"tutorials/domain_connections.md"],
15+
"tutorials/domain_connections.md",
16+
"tutorials/callable_params.md"],
1617
"Examples" => Any[
1718
"Basic Examples" => Any["examples/higher_order.md",
1819
"examples/spring_mass.md",
1920
"examples/modelingtoolkitize_index_reduction.md",
20-
"examples/parsing.md",
2121
"examples/remake.md"],
2222
"Advanced Examples" => Any["examples/tearing_parallelism.md",
2323
"examples/sparse_jacobians.md",

docs/src/basics/AbstractSystem.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ Optionally, a system could have:
6363
- `get_defaults(sys)`: A `Dict` that maps variables into their default values
6464
for the current-level system.
6565
- `get_noiseeqs(sys)`: Noise equations of the current-level system.
66+
- `get_description(sys)`: A string that describes what a system represents.
6667
- `get_metadata(sys)`: Any metadata about the system or its origin to be used by downstream packages.
6768

6869
Note that if you know a system is an `AbstractTimeDependentSystem` you could use `get_iv` to get the

docs/src/basics/FAQ.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,3 +244,62 @@ D = Differential(x)
244244
@variables y(x)
245245
@named sys = ODESystem([D(y) ~ x], x)
246246
```
247+
248+
## Ordering of tunable parameters
249+
250+
Tunable parameters are floating point parameters, not used in callbacks and not marked with `tunable = false` in their metadata. These are expected to be used with AD
251+
and optimization libraries. As such, they are stored together in one `Vector{T}`. To obtain the ordering of tunable parameters in this buffer, use:
252+
253+
```@docs
254+
tunable_parameters
255+
```
256+
257+
If you have an array in which a particular dimension is in the order of tunable parameters (e.g. the jacobian with respect to tunables) then that dimension of the
258+
array can be reordered into the required permutation using the symbolic variables:
259+
260+
```@docs
261+
reorder_dimension_by_tunables!
262+
reorder_dimension_by_tunables
263+
```
264+
265+
For example:
266+
267+
```@example reorder
268+
using ModelingToolkit
269+
270+
@parameters p q[1:3] r[1:2, 1:2]
271+
272+
@named sys = ODESystem(Equation[], ModelingToolkit.t_nounits, [], [p, q, r])
273+
sys = complete(sys)
274+
```
275+
276+
The canonicalized tunables portion of `MTKParameters` will be in the order of tunables:
277+
278+
```@example reorder
279+
using SciMLStructures: canonicalize, Tunable
280+
281+
ps = MTKParameters(sys, [p => 1.0, q => [2.0, 3.0, 4.0], r => [5.0 6.0; 7.0 8.0]])
282+
arr = canonicalize(Tunable(), ps)[1]
283+
```
284+
285+
We can reorder this to contain the value for `p`, then all values for `q`, then for `r` using:
286+
287+
```@example reorder
288+
reorder_dimension_by_tunables(sys, arr, [p, q, r])
289+
```
290+
291+
This also works with interleaved subarrays of symbolics:
292+
293+
```@example reorder
294+
reorder_dimension_by_tunables(sys, arr, [q[1], r[1, :], q[2], r[2, :], q[3], p])
295+
```
296+
297+
And arbitrary dimensions of higher dimensional arrays:
298+
299+
```@example reorder
300+
highdimarr = stack([i * arr for i in 1:5]; dims = 1)
301+
```
302+
303+
```@example reorder
304+
reorder_dimension_by_tunables(sys, highdimarr, [q[1:2], r[1, :], q[3], r[2, :], p]; dim = 2)
305+
```

docs/src/basics/InputOutput.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ We can inspect the state realization chosen by MTK
5555
x_sym
5656
```
5757

58-
as expected, `x` is chosen as the state variable.
5958
as expected, `x` is chosen as the state variable.
6059

6160
```@example inputoutput

0 commit comments

Comments
 (0)