Skip to content

Commit ed4c859

Browse files
committed
Merge remote-tracking branch 'origin/s/calling-convention-update' into s/calling-convention-update
2 parents a9e5ee1 + 0f915f3 commit ed4c859

28 files changed

+1080
-669
lines changed

Project.toml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "ModelingToolkit"
22
uuid = "961ee093-0014-501f-94e3-6117800e7a78"
33
authors = ["Chris Rackauckas <[email protected]>"]
4-
version = "8.14.1"
4+
version = "8.15.2"
55

66
[deps]
77
AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c"
@@ -11,16 +11,17 @@ ConstructionBase = "187b0558-2788-49d3-abe0-74a17ed4e7c9"
1111
DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
1212
DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e"
1313
DiffEqCallbacks = "459566f4-90b8-5000-8ac3-15dfb0a30def"
14-
DiffEqJump = "c894b116-72e5-5b58-be3c-e6d8d4ac2b12"
1514
DiffRules = "b552c78f-8df3-52c6-915a-8e097449b14b"
1615
Distributed = "8ba89e20-285c-5b6f-9357-94700520ee1b"
1716
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
1817
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
1918
DomainSets = "5b8099bc-c8ec-5219-889f-1d9e522a28bf"
19+
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
2020
Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6"
2121
IfElse = "615f187c-cbe4-4ef1-ba3b-2fcf58d6d173"
2222
InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
2323
JuliaFormatter = "98e50ef6-434e-11e9-1051-2b60c6c9e899"
24+
JumpProcesses = "ccbc3e58-028d-4f4c-8cd5-9ae44345cda5"
2425
LabelledArrays = "2ee39098-c373-598a-b85f-a56591580800"
2526
Latexify = "23fbe1c1-3f47-55db-b15f-69d7ec21a316"
2627
Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb"
@@ -30,7 +31,6 @@ NaNMath = "77ba4419-2d1f-58cd-9bb1-8ffee604a2e3"
3031
NonlinearSolve = "8913a72c-1f9b-4ce2-8d82-65094dcecaec"
3132
RecursiveArrayTools = "731186ca-8d62-57ce-b412-fbd966d074cd"
3233
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
33-
Requires = "ae029012-a4dd-5104-9daa-d747884805df"
3434
RuntimeGeneratedFunctions = "7e49a35a-f44a-4d26-94aa-eba1b4ca6b47"
3535
SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462"
3636
Serialization = "9e88b42a-f829-5b0c-bbe9-9e923198166b"
@@ -51,22 +51,22 @@ ConstructionBase = "1"
5151
DataStructures = "0.17, 0.18"
5252
DiffEqBase = "6.83.0"
5353
DiffEqCallbacks = "2.16"
54-
DiffEqJump = "7.0, 8"
5554
DiffRules = "0.1, 1.0"
5655
Distributions = "0.23, 0.24, 0.25"
5756
DocStringExtensions = "0.7, 0.8, 0.9"
5857
DomainSets = "0.5"
58+
ForwardDiff = "0.10.3"
5959
Graphs = "1.5.2"
6060
IfElse = "0.1"
6161
JuliaFormatter = "1"
62+
JumpProcesses = "9"
6263
LabelledArrays = "1.3"
6364
Latexify = "0.11, 0.12, 0.13, 0.14, 0.15"
6465
MacroTools = "0.5"
6566
NaNMath = "0.3, 1"
6667
NonlinearSolve = "0.3.8"
6768
RecursiveArrayTools = "2.3"
6869
Reexport = "0.2, 1"
69-
Requires = "1.0"
7070
RuntimeGeneratedFunctions = "0.4.3, 0.5"
7171
SciMLBase = "1.26.2"
7272
Setfield = "0.7, 0.8, 1"
@@ -79,9 +79,14 @@ Unitful = "1.1"
7979
julia = "1.6"
8080

8181
[extras]
82+
AmplNLWriter = "7c4d4715-977e-5154-bfe0-e096adeac482"
8283
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
8384
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
85+
Ipopt = "b6b21f68-93f8-5de0-b562-5493be1d77c9"
86+
Ipopt_jll = "9cc047cb-c261-5740-88fc-0cf96f7bdcc7"
87+
ModelingToolkitStandardLibrary = "16a59e39-deab-5bd0-87e4-056b12336739"
8488
Optimization = "7f7a1694-90dd-40f0-9382-eb1efda571ba"
89+
OptimizationMOI = "fd9f6733-72f4-499f-8506-86b2bdd0dea1"
8590
OptimizationOptimJL = "36348300-93cb-4f02-beb5-3c3902f8871e"
8691
OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
8792
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
@@ -93,4 +98,4 @@ Sundials = "c3572dad-4567-51f8-b174-8c6c989267f4"
9398
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
9499

95100
[targets]
96-
test = ["BenchmarkTools", "ForwardDiff", "Optimization", "OptimizationOptimJL", "OrdinaryDiffEq", "Random", "ReferenceTests", "SafeTestsets", "SteadyStateDiffEq", "Test", "StochasticDiffEq", "Sundials"]
101+
test = ["AmplNLWriter", "BenchmarkTools", "ForwardDiff", "Ipopt", "Ipopt_jll", "ModelingToolkitStandardLibrary", "Optimization", "OptimizationOptimJL", "OptimizationMOI", "OrdinaryDiffEq", "Random", "ReferenceTests", "SafeTestsets", "SteadyStateDiffEq", "Test", "StochasticDiffEq", "Sundials"]

docs/pages.jl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ pages = [
88
"tutorials/nonlinear.md",
99
"tutorials/optimization.md",
1010
"tutorials/stochastic_diffeq.md",
11-
"tutorials/nonlinear_optimal_control.md",
1211
"tutorials/parameter_identifiability.md"],
1312
"ModelingToolkitize Tutorials" => Any["mtkitize_tutorials/modelingtoolkitize.md",
1413
"mtkitize_tutorials/modelingtoolkitize_index_reduction.md",
@@ -25,7 +24,6 @@ pages = [
2524
"systems/JumpSystem.md",
2625
"systems/NonlinearSystem.md",
2726
"systems/OptimizationSystem.md",
28-
"systems/ControlSystem.md",
2927
"systems/PDESystem.md"],
3028
"comparison.md",
3129
"internals.md",

docs/src/systems/ControlSystem.md

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

docs/src/tutorials/nonlinear_optimal_control.md

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

src/ModelingToolkit.jl

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ $(DocStringExtensions.README)
44
module ModelingToolkit
55
using DocStringExtensions
66
using AbstractTrees
7-
using DiffEqBase, SciMLBase, Reexport
7+
using DiffEqBase, SciMLBase, ForwardDiff, Reexport
88
using Distributed
99
using StaticArrays, LinearAlgebra, SparseArrays, LabelledArrays
1010
using InteractiveUtils
1111
using Latexify, Unitful, ArrayInterfaceCore
1212
using MacroTools
1313
@reexport using UnPack
1414
using Setfield, ConstructionBase
15-
using DiffEqJump
15+
using JumpProcesses
1616
using DataStructures
1717
using SpecialFunctions, NaNMath
1818
using RuntimeGeneratedFunctions
@@ -60,8 +60,6 @@ import DiffEqBase: @add_kwonly
6060

6161
import Graphs: SimpleDiGraph, add_edge!, incidence_matrix
6262

63-
using Requires
64-
6563
for fun in [:toexpr]
6664
@eval begin
6765
function $fun(eq::Equation; kw...)
@@ -121,6 +119,7 @@ include("domains.jl")
121119

122120
include("systems/abstractsystem.jl")
123121
include("systems/connectors.jl")
122+
include("systems/callbacks.jl")
124123

125124
include("systems/diffeqs/odesystem.jl")
126125
include("systems/diffeqs/sdesystem.jl")
@@ -136,8 +135,6 @@ include("systems/nonlinear/modelingtoolkitize.jl")
136135

137136
include("systems/optimization/optimizationsystem.jl")
138137

139-
include("systems/control/controlsystem.jl")
140-
141138
include("systems/pde/pdesystem.jl")
142139

143140
include("systems/sparsematrixclil.jl")
@@ -172,21 +169,19 @@ export AutoModelingToolkit
172169
export SteadyStateProblem, SteadyStateProblemExpr
173170
export JumpProblem, DiscreteProblem
174171
export NonlinearSystem, OptimizationSystem
175-
export ControlSystem
176172
export alias_elimination, flatten
177173
export connect, @connector, Connection, Flow, Stream, instream
178174
export isinput, isoutput, getbounds, hasbounds, isdisturbance, istunable, getdist, hasdist,
179175
tunable_parameters, isirreducible
180176
export ode_order_lowering, dae_order_lowering, liouville_transform
181-
export runge_kutta_discretize
182177
export PDESystem
183178
export Differential, expand_derivatives, @derivatives
184179
export Equation, ConstrainedEquation
185180
export Term, Sym
186181
export SymScope, LocalScope, ParentScope, GlobalScope
187182
export independent_variables, independent_variable, states, parameters, equations, controls,
188183
observed, structure, full_equations
189-
export structural_simplify, expand_connections
184+
export structural_simplify, expand_connections, linearize, linear_statespace
190185
export DiscreteSystem, DiscreteProblem
191186

192187
export calculate_jacobian, generate_jacobian, generate_function

src/bipartite_graph.jl

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,53 @@ function complete(g::BipartiteGraph{I}) where {I}
184184
BipartiteGraph(g.ne, g.fadjlist, badjlist)
185185
end
186186

187+
# Matrix whose only purpose is to pretty-print the bipartite graph
188+
struct BipartiteAdjacencyList
189+
u::Union{Vector{Int}, Nothing}
190+
end
191+
function Base.show(io::IO, l::BipartiteAdjacencyList)
192+
if l.u === nothing
193+
printstyled(io, '', color = :light_black)
194+
elseif isempty(l.u)
195+
printstyled(io, '', color = :light_black)
196+
else
197+
print(io, l.u)
198+
end
199+
end
200+
201+
struct Label
202+
s::String
203+
end
204+
Base.show(io::IO, l::Label) = print(io, l.s)
205+
206+
struct BipartiteGraphPrintMatrix <:
207+
AbstractMatrix{Union{Label, Int, BipartiteAdjacencyList}}
208+
bpg::BipartiteGraph
209+
end
210+
Base.size(bgpm::BipartiteGraphPrintMatrix) = (max(nsrcs(bgpm.bpg), ndsts(bgpm.bpg)) + 1, 3)
211+
function Base.getindex(bgpm::BipartiteGraphPrintMatrix, i::Integer, j::Integer)
212+
checkbounds(bgpm, i, j)
213+
if i == 1
214+
return (Label.(("#", "src", "dst")))[j]
215+
elseif j == 1
216+
return i - 1
217+
elseif j == 2
218+
return BipartiteAdjacencyList(i - 1 <= nsrcs(bgpm.bpg) ?
219+
𝑠neighbors(bgpm.bpg, i - 1) : nothing)
220+
elseif j == 3
221+
return BipartiteAdjacencyList(i - 1 <= ndsts(bgpm.bpg) ?
222+
𝑑neighbors(bgpm.bpg, i - 1) : nothing)
223+
else
224+
@assert false
225+
end
226+
end
227+
228+
function Base.show(io::IO, b::BipartiteGraph)
229+
print(io, "BipartiteGraph with (", length(b.fadjlist), ", ",
230+
isa(b.badjlist, Int) ? b.badjlist : length(b.badjlist), ") (𝑠,𝑑)-vertices\n")
231+
Base.print_matrix(io, BipartiteGraphPrintMatrix(b))
232+
end
233+
187234
"""
188235
```julia
189236
Base.isequal(bg1::BipartiteGraph{T}, bg2::BipartiteGraph{T}) where {T<:Integer}

0 commit comments

Comments
 (0)