Skip to content

Commit bebab57

Browse files
committed
Merge branch 'master' into myb/state_machine
2 parents c64d388 + 65799a1 commit bebab57

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

NEWS.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,10 @@
3333
`@parameters p::Int`. Array-valued parameters must be array symbolics; `@parameters p = [1.0, 2.0]`
3434
is now invalid and must be changed to `@parameters p[1:2] = [1.0, 2.0]`. The index of a parameter
3535
in the system is also not guaranteed to be an `Int`, and will instead be a custom undocumented type.
36-
To restore the old behavior:
36+
Parameters that have a default value depending on other parameters are now treated as dependent
37+
parameters. Their value cannot be modified directly. Whenever a parameter value is changed, dependent
38+
parameter values are recalculated. For example, if `@parameters p1 p2 = 3p1` then `p2` can not be
39+
modified directly. If `p1` is changed, then `p2` will be updated accordingly. To restore the old behavior:
3740

3841
+ Pass the `split = false` keyword to `structural_simplify`. E.g. `ss = structural_simplify(sys; split = false)`.
3942
+ Pass `split = false` to `@mtkbuild`. E.g. `@mtkbuild sys = ODESystem(...) split = false`.

src/bipartite_graph.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ function Base.push!(m::Matching, v)
8888
end
8989
end
9090

91-
function complete(m::Matching{U}, N = length(m.match)) where {U}
91+
function complete(m::Matching{U}, N = maximum((x for x in m.match if isa(x, Int)); init=0)) where {U}
9292
m.inv_match !== nothing && return m
9393
inv_match = Union{U, Int}[unassigned for _ in 1:N]
9494
for (i, eq) in enumerate(m.match)

src/structural_transformation/partial_state_selection.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ function pss_graph_modia!(structure::SystemStructure, maximal_top_matching, varl
5151
old_level_vars = ()
5252
ict = IncrementalCycleTracker(
5353
DiCMOBiGraph{true}(graph,
54-
complete(Matching(ndsts(graph))));
54+
complete(Matching(ndsts(graph)), nsrcs(graph))),
5555
dir = :in)
5656

5757
while level >= 0
@@ -124,7 +124,7 @@ function pss_graph_modia!(structure::SystemStructure, maximal_top_matching, varl
124124
level -= 1
125125
end
126126
end
127-
return complete(var_eq_matching)
127+
return complete(var_eq_matching, nsrcs(graph))
128128
end
129129

130130
struct SelectedUnknown end

0 commit comments

Comments
 (0)