Skip to content

Commit 9749e37

Browse files
committed
Merge branch 'master' into myb/one_tearing_state
2 parents ef95ef9 + 0490417 commit 9749e37

File tree

9 files changed

+29
-36
lines changed

9 files changed

+29
-36
lines changed

.github/workflows/Downstream.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ jobs:
2525
- {user: SciML, repo: DataDrivenDiffEq.jl, group: Standard}
2626
- {user: SciML, repo: StructuralIdentifiability.jl, group: All}
2727
- {user: SciML, repo: ModelingToolkitStandardLibrary.jl}
28+
- {user: SciML, repo: ModelOrderReduction.jl, group: All}
2829
steps:
2930
- uses: actions/checkout@v2
3031
- uses: julia-actions/setup-julia@v1

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "ModelingToolkit"
22
uuid = "961ee093-0014-501f-94e3-6117800e7a78"
33
authors = ["Yingbo Ma <[email protected]>", "Chris Rackauckas <[email protected]> and contributors"]
4-
version = "8.27.0"
4+
version = "8.27.1"
55

66
[deps]
77
AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c"

src/structural_transformation/codegen.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,8 @@ function build_torn_function(sys;
339339
states_idxs) :
340340
nothing,
341341
syms = syms,
342+
paramsyms = Symbol.(parameters(sys)),
343+
indepsym = Symbol(get_iv(sys)),
342344
observed = observedfun,
343345
mass_matrix = mass_matrix), states
344346
end

src/systems/diffeqs/abstractodesystem.jl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ function process_DEProblem(constructor, sys::AbstractODESystem, u0map, parammap;
547547
jac = false,
548548
checkbounds = false, sparse = false,
549549
simplify = false,
550-
linenumbers = true, parallel = nothing,
550+
linenumbers = true, parallel = SerialForm(),
551551
eval_expression = true,
552552
use_union = false,
553553
kwargs...)
@@ -640,7 +640,7 @@ function DiffEqBase.ODEProblem{iip}(sys::AbstractODESystem,u0map,tspan,
640640
jac = false,
641641
checkbounds = false, sparse = false,
642642
simplify=false,
643-
linenumbers = true, parallel=nothing,
643+
linenumbers = true, parallel=SerialForm(),
644644
kwargs...) where iip
645645
```
646646
@@ -689,7 +689,7 @@ function DiffEqBase.DAEProblem{iip}(sys::AbstractODESystem,du0map,u0map,tspan,
689689
jac = false,
690690
checkbounds = false, sparse = false,
691691
simplify=false,
692-
linenumbers = true, parallel=nothing,
692+
linenumbers = true, parallel=SerialForm(),
693693
kwargs...) where iip
694694
```
695695
@@ -730,7 +730,7 @@ function ODEProblemExpr{iip}(sys::AbstractODESystem,u0map,tspan,
730730
version = nothing, tgrad=false,
731731
jac = false,
732732
checkbounds = false, sparse = false,
733-
linenumbers = true, parallel=nothing,
733+
linenumbers = true, parallel=SerialForm(),
734734
skipzeros=true, fillzeros=true,
735735
simplify=false,
736736
kwargs...) where iip
@@ -772,7 +772,7 @@ function DAEProblemExpr{iip}(sys::AbstractODESystem,u0map,tspan,
772772
version = nothing, tgrad=false,
773773
jac = false,
774774
checkbounds = false, sparse = false,
775-
linenumbers = true, parallel=nothing,
775+
linenumbers = true, parallel=SerialForm(),
776776
skipzeros=true, fillzeros=true,
777777
simplify=false,
778778
kwargs...) where iip
@@ -821,7 +821,7 @@ function SciMLBase.SteadyStateProblem(sys::AbstractODESystem,u0map,
821821
version = nothing, tgrad=false,
822822
jac = false,
823823
checkbounds = false, sparse = false,
824-
linenumbers = true, parallel=nothing,
824+
linenumbers = true, parallel=SerialForm(),
825825
kwargs...) where iip
826826
```
827827
Generates an SteadyStateProblem from an ODESystem and allows for automatically
@@ -849,7 +849,7 @@ function SciMLBase.SteadyStateProblemExpr(sys::AbstractODESystem,u0map,
849849
jac = false,
850850
checkbounds = false, sparse = false,
851851
skipzeros=true, fillzeros=true,
852-
linenumbers = true, parallel=nothing,
852+
linenumbers = true, parallel=SerialForm(),
853853
kwargs...) where iip
854854
```
855855
Generates a Julia expression for building a SteadyStateProblem from

src/systems/diffeqs/sdesystem.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,7 @@ function DiffEqBase.SDEProblem{iip}(sys::SDESystem,u0map,tspan,p=parammap;
562562
checkbounds = false, sparse = false,
563563
sparsenoise = sparse,
564564
skipzeros = true, fillzeros = true,
565-
linenumbers = true, parallel=nothing,
565+
linenumbers = true, parallel=SerialForm(),
566566
kwargs...)
567567
```
568568
@@ -580,7 +580,7 @@ function DiffEqBase.SDEProblemExpr{iip}(sys::AbstractODESystem,u0map,tspan,
580580
version = nothing, tgrad=false,
581581
jac = false, Wfact = false,
582582
checkbounds = false, sparse = false,
583-
linenumbers = true, parallel=nothing,
583+
linenumbers = true, parallel=SerialForm(),
584584
kwargs...) where iip
585585
```
586586

src/systems/nonlinear/nonlinearsystem.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ function process_NonlinearProblem(constructor, sys::NonlinearSystem, u0map, para
309309
jac = false,
310310
checkbounds = false, sparse = false,
311311
simplify = false,
312-
linenumbers = true, parallel = nothing,
312+
linenumbers = true, parallel = SerialForm(),
313313
eval_expression = true,
314314
use_union = false,
315315
kwargs...)
@@ -339,7 +339,7 @@ function DiffEqBase.NonlinearProblem{iip}(sys::NonlinearSystem,u0map,
339339
parammap=DiffEqBase.NullParameters();
340340
jac = false, sparse=false,
341341
checkbounds = false,
342-
linenumbers = true, parallel=nothing,
342+
linenumbers = true, parallel=SerialForm(),
343343
kwargs...) where iip
344344
```
345345
@@ -365,7 +365,7 @@ function DiffEqBase.NonlinearProblemExpr{iip}(sys::NonlinearSystem,u0map,
365365
parammap=DiffEqBase.NullParameters();
366366
jac = false, sparse=false,
367367
checkbounds = false,
368-
linenumbers = true, parallel=nothing,
368+
linenumbers = true, parallel=SerialForm(),
369369
kwargs...) where iip
370370
```
371371

src/systems/optimization/optimizationsystem.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ function DiffEqBase.OptimizationProblem{iip}(sys::OptimizationSystem,u0map,
187187
grad = false,
188188
hess = false, sparse = false,
189189
checkbounds = false,
190-
linenumbers = true, parallel=nothing,
190+
linenumbers = true, parallel=SerialForm(),
191191
kwargs...) where iip
192192
```
193193
@@ -204,7 +204,7 @@ function DiffEqBase.OptimizationProblem{iip}(sys::OptimizationSystem, u0map,
204204
grad = false,
205205
hess = false, sparse = false,
206206
checkbounds = false,
207-
linenumbers = true, parallel = nothing,
207+
linenumbers = true, parallel = SerialForm(),
208208
use_union = false,
209209
kwargs...) where {iip}
210210
dvs = states(sys)
@@ -315,7 +315,7 @@ function DiffEqBase.OptimizationProblemExpr{iip}(sys::OptimizationSystem,
315315
grad = false,
316316
hes = false, sparse = false,
317317
checkbounds = false,
318-
linenumbers = true, parallel=nothing,
318+
linenumbers = true, parallel=SerialForm(),
319319
kwargs...) where iip
320320
```
321321
@@ -335,7 +335,7 @@ function OptimizationProblemExpr{iip}(sys::OptimizationSystem, u0,
335335
grad = false,
336336
hess = false, sparse = false,
337337
checkbounds = false,
338-
linenumbers = false, parallel = nothing,
338+
linenumbers = false, parallel = SerialForm(),
339339
use_union = false,
340340
kwargs...) where {iip}
341341
dvs = states(sys)

test/odesystem.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -861,14 +861,16 @@ let
861861
@variables y(t) = 1
862862
@parameters pp = -1
863863
der = Differential(t)
864-
@named sys4 = ODESystem([der(x) ~ -y; der(y) ~ 1 - y + x], t)
864+
@named sys4 = ODESystem([der(x) ~ -y; der(y) ~ 1 + pp * y + x], t)
865865
as = alias_elimination(sys4)
866866
@test length(equations(as)) == 1
867867
@test isequal(equations(as)[1].lhs, -der(der(x)))
868868
# TODO: maybe do not emit x_t
869869
sys4s = structural_simplify(sys4)
870870
prob = ODAEProblem(sys4s, [x => 1.0, D(x) => 1.0], (0, 1.0))
871871
@test string.(prob.f.syms) == ["x(t)", "xˍt(t)"]
872+
@test string.(prob.f.paramsyms) == ["pp"]
873+
@test string(prob.f.indepsym) == "t"
872874
end
873875

874876
let

test/optimizationsystem.jl

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -41,23 +41,17 @@ p = [sys1.a => 6.0
4141
sys2.b => 9.0
4242
β => 10.0]
4343

44-
prob = OptimizationProblem(combinedsys, u0, p, grad = true)
44+
prob = OptimizationProblem(combinedsys, u0, p, grad = true, hess = true)
4545
@test prob.f.sys === combinedsys
46-
sol = solve(prob, NelderMead())
46+
sol = solve(prob, Ipopt.Optimizer())
4747
@test sol.minimum < -1e5
4848

49-
prob2 = remake(prob, u0 = sol.minimizer)
50-
sol = solve(prob, BFGS(initial_stepnorm = 0.0001), allow_f_increases = true)
51-
@test sol.minimum < -1e8
52-
sol = solve(prob2, BFGS(initial_stepnorm = 0.0001), allow_f_increases = true)
53-
@test sol.minimum < -1e9
54-
5549
#inequality constraint, the bounds for constraints lcons !== ucons
5650
prob = OptimizationProblem(sys2, [x => 0.0, y => 0.0], [a => 1.0, b => 100.0],
5751
lcons = [-1.0, -1.0], ucons = [500.0, 500.0], grad = true,
5852
hess = true)
5953
@test prob.f.sys === sys2
60-
sol = solve(prob, IPNewton(), allow_f_increases = true)
54+
sol = solve(prob, IPNewton())
6155
@test sol.minimum < 1.0
6256
sol = solve(prob, Ipopt.Optimizer())
6357
@test sol.minimum < 1.0
@@ -154,23 +148,17 @@ end
154148
sys2.b => 9.0
155149
β => 10.0]
156150

157-
prob = OptimizationProblem(combinedsys, u0, p, grad = true)
151+
prob = OptimizationProblem(combinedsys, u0, p, grad = true, hess = true)
158152
@test prob.f.sys === combinedsys
159-
sol = solve(prob, NelderMead())
153+
sol = solve(prob, Ipopt.Optimizer())
160154
@test sol.minimum < -1e5
161155

162-
prob2 = remake(prob, u0 = sol.minimizer)
163-
sol = solve(prob, BFGS(initial_stepnorm = 0.0001), allow_f_increases = true)
164-
@test sol.minimum < -1e8
165-
sol = solve(prob2, BFGS(initial_stepnorm = 0.0001), allow_f_increases = true)
166-
@test sol.minimum < -1e9
167-
168156
#inequality constraint, the bounds for constraints lcons !== ucons
169157
prob = OptimizationProblem(sys2, [x => 0.0, y => 0.0], [a => 1.0, b => 100.0],
170158
lcons = [-1.0, -1.0], ucons = [500.0, 500.0], grad = true,
171159
hess = true)
172160
@test prob.f.sys === sys2
173-
sol = solve(prob, IPNewton(), allow_f_increases = true)
161+
sol = solve(prob, IPNewton())
174162
@test sol.minimum < 1.0
175163
sol = solve(prob, Ipopt.Optimizer())
176164
@test sol.minimum < 1.0

0 commit comments

Comments
 (0)