Skip to content

feat: add unified System type #3543

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 227 commits into
base: v10
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
227 commits
Select commit Hold shift + click to select a range
31a7a0a
chore!: bump MAJOR version
AayushSabharwal Apr 14, 2025
8997693
ci: run workflows on PR to v10 branch
AayushSabharwal Apr 14, 2025
5da8129
docs: bump MTK compat
AayushSabharwal Apr 14, 2025
46c93e6
TEMP COMMIT: use branch of MTKStdlib
AayushSabharwal Apr 14, 2025
a408e11
feat: make `@named` always wrap arguments in `ParentScope`
AayushSabharwal Apr 3, 2025
c7569b4
test: test `@named` always wrapping in `ParentScope`
AayushSabharwal Apr 14, 2025
90696fd
refactor: remove `DelayParentScope`
AayushSabharwal Apr 14, 2025
7cdf184
refactor: remove `time_varying_as_func`
AayushSabharwal Apr 14, 2025
c193dcb
test: update tests with removed `time_varying_as_func`
AayushSabharwal Apr 14, 2025
edd0bab
refactor: remove input_idxs output
vyudu Apr 18, 2025
42e0d17
refactor: use new `structural_simplify` in linearization
vyudu Apr 21, 2025
fad65c2
fix: fix linearization tests
vyudu Apr 22, 2025
62b7ebf
test: test updates
vyudu Apr 24, 2025
96601aa
fix input output tests
vyudu Apr 24, 2025
56c83c8
more test fixes
vyudu Apr 25, 2025
352d001
fix: fix sort_eqs and check distrubances in markio
vyudu Apr 28, 2025
33fe355
test: fix input output test
AayushSabharwal May 7, 2025
49f14fa
test: fix usage of old `structural_simplify` io syntax
AayushSabharwal May 7, 2025
334861f
chore!: bump MAJOR version
AayushSabharwal Apr 14, 2025
31bb1e5
feat: add unified `System` type
AayushSabharwal Apr 7, 2025
c85e0f9
feat: add `is_discrete_system`
AayushSabharwal Apr 13, 2025
a089f3b
feat: add initial codegen for `System`
AayushSabharwal Apr 13, 2025
b8a00a0
feat: add `is_dde` to `System`
AayushSabharwal Apr 13, 2025
dcf9a03
feat: add more codegen implementation
AayushSabharwal Apr 13, 2025
0424dad
refactor: remove old `System` function
AayushSabharwal Apr 14, 2025
dd14b74
refactor: change defaults of `costs` and `consolidate`
AayushSabharwal Apr 14, 2025
7977a74
feat: implement `is_time_dependent` for `System`
AayushSabharwal Apr 14, 2025
0a4ffb6
feat: add getters for new `System` fields
AayushSabharwal Apr 14, 2025
df7c76a
feat: add hierarchical aggregator functions for jumps, brownians and …
AayushSabharwal Apr 14, 2025
55af0c2
feat: add `check_complete`
AayushSabharwal Apr 14, 2025
26824b1
feat: add `@fallback_iip_specialize`
AayushSabharwal Apr 14, 2025
95bde5d
feat: add `check_compatible_system`
AayushSabharwal Apr 14, 2025
14d1c23
feat: implement `ODEProblem` and `ODEFunction` for `System`
AayushSabharwal Apr 14, 2025
4238d61
feat: implement `generate_initializesystem` for `System`
AayushSabharwal Apr 14, 2025
f654624
refactor: don't warn about system supertype for `System`
AayushSabharwal Apr 14, 2025
2b53386
feat: add `flatten(::System)`
AayushSabharwal Apr 14, 2025
c9daab3
refactor: compile functions in `generate_*`
AayushSabharwal Apr 16, 2025
3368ad2
refactor: use new compiled `generate_*` functions
AayushSabharwal Apr 15, 2025
dd2c230
refactor: centralize mass matrix and W sparsity handling
AayushSabharwal Apr 15, 2025
a4052fb
refactor: centralize problem `kwargs` handling
AayushSabharwal Apr 15, 2025
d8e4c09
refactor: modularize compatibility checks
AayushSabharwal Apr 15, 2025
b2b0b4d
refactor: fix and document `delay_to_function`, implement it for `Sys…
AayushSabharwal Apr 15, 2025
c76ddbb
feat: implement `DDEProblem` and `DDEFunction` for `System`
AayushSabharwal Apr 15, 2025
c25144a
feat: implement `DAEProblem` and `DAEFunction` for `System`
AayushSabharwal Apr 15, 2025
fe75d41
refactor: remove `generate_factorized_W`
AayushSabharwal Apr 16, 2025
6312891
feat: support `SDEProblem` and `SDEFunction` for `System`
AayushSabharwal Apr 16, 2025
8c60a4f
feat: implement `SDDEProblem`, `SDDEFunction` for `System`
AayushSabharwal Apr 16, 2025
4c96073
feat: implement `NonlinearProblem` and `NonlinearFunction` for `System`
AayushSabharwal Apr 16, 2025
e49f442
fix: fix `remake` for `IntervalNonlinearProblem`
AayushSabharwal Apr 16, 2025
d7a808d
feat: implement `IntervalNonlinearProblem`, `IntervalNonlinearFunctio…
AayushSabharwal Apr 16, 2025
b6daeba
feat: implement `DiscreteProblem` and `DiscreteFunction` for `System`
AayushSabharwal Apr 17, 2025
b3480f3
feat: add `check_is_continuous` to relevant compatibility checks
AayushSabharwal Apr 17, 2025
f91e989
feat: implement `ImplicitDiscreteProblem`, `ImplicitDiscreteFunction`…
AayushSabharwal Apr 17, 2025
3644af4
feat: allow manually choosing time-independent initialization
AayushSabharwal Apr 17, 2025
b201b3b
feat: implement `BVProblem` for `System`
AayushSabharwal Apr 17, 2025
8cd7ddc
feat: implement `OptimizationProblem`, `OptimizationFunction` for `Sy…
AayushSabharwal Apr 18, 2025
c6b1551
feat: implement `supports_initialization(::System)`
AayushSabharwal Apr 19, 2025
4c06d91
feat: implement `JumpProblem` for `System`
AayushSabharwal Apr 19, 2025
de1bd87
refactor: move `InitializationProblem` to its own file
AayushSabharwal Apr 19, 2025
237ee73
feat: add `isscheduled` to `System`
AayushSabharwal Apr 19, 2025
c66b482
refactor: move improved handling of ODE costs/constraints to `System`
AayushSabharwal Apr 19, 2025
0e64a53
feat: implement `Base.:(==)` for `System`
AayushSabharwal Apr 19, 2025
3c5404d
refactor: remove `odesystem.jl`
AayushSabharwal Apr 20, 2025
1dcff5b
refactor: add `_eq_unordered` to `utils.jl`
AayushSabharwal Apr 20, 2025
7dbc8f2
refactor: port `build_explicit_observed_function` to `codegen.jl`
AayushSabharwal Apr 20, 2025
2ce1c79
refactor: remove `sdesystem.jl`
AayushSabharwal Apr 20, 2025
9bac25f
refactor: port `stochastic_integral_transform` and `Girsanov_transform`
AayushSabharwal Apr 20, 2025
e0da1db
refactor: move `__num_isdiag_noise`, `get_num_diag_noise` to location…
AayushSabharwal Apr 20, 2025
1c27902
refactor: move `shift_u0map_forward` to `discreteproblem.jl`
AayushSabharwal Apr 20, 2025
e1ace69
refactor: remove `discrete_system.jl`
AayushSabharwal Apr 20, 2025
51da01e
refactor: remove `implicit_discrete_system.jl`
AayushSabharwal Apr 20, 2025
0b951af
refactor: move jumpsystem functions to generalized locations
AayushSabharwal Apr 20, 2025
c6d250d
refactor: remove `jumpsystem.jl`
AayushSabharwal Apr 20, 2025
6fe87a6
feat: implement `NonlinearLeastSquaresProblem` for `System`
AayushSabharwal Apr 20, 2025
20bdc3e
refactor: port `SCCNonlinearProblem` to separate file
AayushSabharwal Apr 20, 2025
026acdf
refactor: remove `nonlinearsystem.jl`
AayushSabharwal Apr 20, 2025
bdb9209
refactor: move `constraints` to `abstractsystem.jl`
AayushSabharwal Apr 21, 2025
3edc95c
refactor: remove `optimizationsystem.jl`
AayushSabharwal Apr 21, 2025
1970d7e
refactor: remove `constraints_system.jl`
AayushSabharwal Apr 21, 2025
a9530bc
docs: add docstring for new `BVProblem` constructor
AayushSabharwal Apr 21, 2025
d552f11
refactor: improve `BVProblem` validation
AayushSabharwal Apr 21, 2025
a1d528b
feat: implement `SteadyStateProblem` for `System`
AayushSabharwal Apr 21, 2025
b626110
fix: fix `toexpr(::AbstractSystem)`
AayushSabharwal Apr 21, 2025
3c992c6
fix: fix `extend(::AbstractSystem)`
AayushSabharwal Apr 21, 2025
88d5946
fix: fix `substitute(::AbstractSystem, _...)`
AayushSabharwal Apr 21, 2025
569229f
fix: construct `System` in `@mtkmodel`
AayushSabharwal Apr 21, 2025
239c79f
docs: fix docstring of `process_SciMLProblem`
AayushSabharwal Apr 21, 2025
6c7185c
refactor: move `filter_kwargs` and `SymbolicTstops` to `problem_utils…
AayushSabharwal Apr 21, 2025
84147fe
feat: add `schedule` field in `System`
AayushSabharwal Apr 21, 2025
510c310
refactor: move `flatten_equations` to `utils.jl`
AayushSabharwal Apr 21, 2025
f7efd31
refactor: remove old clock handling code, retain error messages
AayushSabharwal Apr 21, 2025
6d23074
fix: add temporary error message when simplifying systems with `noise…
AayushSabharwal Apr 21, 2025
55062ed
refactor: remove `abstractodesystem.jl`
AayushSabharwal Apr 21, 2025
1e8c709
refactor: remove `schedule(sys)`
AayushSabharwal Apr 21, 2025
d9f2ce9
feat: set system scheduling information in `structural_simplify`
AayushSabharwal Apr 21, 2025
10208b9
refactor: remove `AbstractODESystem`
AayushSabharwal Apr 21, 2025
380816c
refactor: remove references to `ODESystem` in source code
AayushSabharwal Apr 21, 2025
ca4ed05
refactor: remove `__structural_simplify(::JumpSystem)`
AayushSabharwal Apr 21, 2025
d7492ee
refactor: remove references to `SDESystem` in source code
AayushSabharwal Apr 21, 2025
ba0d384
refactor: remove references to `NonlinearSystem`
AayushSabharwal Apr 21, 2025
f2c28e4
refactor: remove references to `DiscreteSystem`
AayushSabharwal Apr 21, 2025
e726754
refactor: do not use `sys.substitutions`
AayushSabharwal Apr 22, 2025
82412a9
refactor: move `JumpType` definition to `utils.jl`
AayushSabharwal Apr 22, 2025
b49aa85
feat: `include` newly added files
AayushSabharwal Apr 22, 2025
d565a31
feat: add fallback for `_eq_unordered` in non-array case
AayushSabharwal Apr 22, 2025
557f7d9
refactor: improve `System` constructors
AayushSabharwal Apr 22, 2025
1579ba6
fix: fix `==` and `hash` implementations for `System`
AayushSabharwal Apr 22, 2025
96d4641
feat: add utility constructors for `OptimizationSystem` and `JumpSystem`
AayushSabharwal Apr 22, 2025
23829f0
test: replace `ODESystem` with `System`
AayushSabharwal Apr 22, 2025
7b3a99d
feat: add utility constructor for `SDESystem`
AayushSabharwal Apr 22, 2025
4714ae9
test: replace `NonlinearSystem` with `System`
AayushSabharwal Apr 22, 2025
75abb9b
test: replace `ImplicitDiscreteSystem` with `System`
AayushSabharwal Apr 22, 2025
c2ce4d8
test: replace `DiscreteSystem` with `System`
AayushSabharwal Apr 22, 2025
d6d2a79
refactor: do not accept `dvs` and `ps` in `XFunction` constructors
AayushSabharwal Apr 25, 2025
56ce96e
fix: ensure equations are `Vector{Equation}` in `generate_initializes…
AayushSabharwal Apr 25, 2025
a92fe79
test: fix usage of array equations in test
AayushSabharwal Apr 25, 2025
297dd39
test: ensure equations passed to system are `Vector{Equation}`
AayushSabharwal Apr 25, 2025
c4c79ad
refactor: remove `process_equations`
AayushSabharwal Apr 25, 2025
005303c
docs: document `collect_var!`
AayushSabharwal Apr 25, 2025
e4933dc
refactor: change default operator in `collect_vars!` to `Symbolics.Op…
AayushSabharwal Apr 25, 2025
c54fa12
feat: add `validate_operator`
AayushSabharwal Apr 25, 2025
330d09a
refactor: document `collect_vars!` and use `validate_operator`
AayushSabharwal Apr 25, 2025
9746011
fix: fix error message for events in time-independent systems
AayushSabharwal Apr 25, 2025
0239f7c
refactor: do not use `process_equations` in `System` constructor
AayushSabharwal Apr 25, 2025
ef69d00
fix: fix default `costs` in `System` constructor
AayushSabharwal Apr 25, 2025
2ebf71e
feat: add `is_floatingpoint_symtype`
AayushSabharwal Apr 25, 2025
7d7128a
refactor: use `is_floatingpoint_symtype` in `is_variable_floatingpoint`
AayushSabharwal Apr 25, 2025
00f071f
refactor: allow real values in `costs`
AayushSabharwal Apr 25, 2025
ec73be0
feat: add `initializesystem` field to `System`
AayushSabharwal Apr 25, 2025
5d69d42
fix: fix brownians passed to `System` constructor
AayushSabharwal Apr 25, 2025
b8d3445
feat: add `System(::Equation, ...)` constructor
AayushSabharwal Apr 25, 2025
88623ab
fix: fix `flatten(::System)`
AayushSabharwal Apr 25, 2025
1ef7579
fix: unwrap costs in `System` constructor
AayushSabharwal Apr 25, 2025
b5c7eed
test: don't pass dvs/ps to `ODEFunction`
AayushSabharwal Apr 25, 2025
11ecc16
test: fix shadowing of `System` in tests
AayushSabharwal Apr 25, 2025
4a52a7e
test: pass `u0map` and `tspan` to `ODEProblem`
AayushSabharwal Apr 25, 2025
ce407e9
test: create `JumpProblem` directly
AayushSabharwal Apr 25, 2025
a1872d4
test: pass `Vector{Equation}` to `System`
AayushSabharwal Apr 25, 2025
8628e6d
fix: correctly order unknowns in `System` constructor
AayushSabharwal Apr 27, 2025
28c2108
refactor: remove `build_torn_function`, `tearing_assignments`
AayushSabharwal Apr 27, 2025
4a97979
refactor: remove `get_substitutions`, `has_substitutions` field getters
AayushSabharwal Apr 27, 2025
61fd3a8
refactor: implement `empty_substitutions` and `get_substitutions` usi…
AayushSabharwal Apr 27, 2025
35d5cd5
refactor: remove `get_substitutions_and_solved_unknowns`
AayushSabharwal Apr 27, 2025
7f2a40d
refactor: update `tearing_substitute_expr`, `full_equations` to use `…
AayushSabharwal Apr 27, 2025
c6b0bff
refactor: do not use `get_substitutions` in `get_cmap`
AayushSabharwal Apr 27, 2025
4b27553
fix: fix noise equations unit checking
AayushSabharwal Apr 27, 2025
7696510
fix: convert `constraints` to appropriate type
AayushSabharwal Apr 27, 2025
78bbe9a
test: fix mass matrix tests
AayushSabharwal Apr 27, 2025
eec7bbf
test: fix odesystem tests
AayushSabharwal Apr 27, 2025
a7dc44a
fix: fix bugs in `@fallback_iip_specialize`, handle static array prob…
AayushSabharwal Apr 27, 2025
d3f8ebb
refactor: rename `generate_function` to `generate_rhs`
AayushSabharwal Apr 27, 2025
c28b732
refactor: move `eval_or_rgf` to `codegen_utils.jl`
AayushSabharwal Apr 27, 2025
8170fbd
feat: allow `GeneratedFunctionWrapper` to compile functions and build…
AayushSabharwal Apr 27, 2025
4bebe9c
feat: add `maybe_compile_function`
AayushSabharwal Apr 28, 2025
c96d6d1
refactor: use `maybe_compile_function` in codegen
AayushSabharwal Apr 28, 2025
5ca1d47
feat: support returning `Expr` from `SymbolicTstops` and `ObservedFun…
AayushSabharwal Apr 28, 2025
09a14bd
feat: handle `expression = Val{true}` in `process_kwargs`
AayushSabharwal Apr 28, 2025
6befee3
feat: add `maybe_codegen_scimlfn` and `maybe_codegen_scimlproblem`
AayushSabharwal Apr 28, 2025
733bf53
feat: add `expression` kwarg to `ODEFunction`, `ODEProblem`
AayushSabharwal Apr 28, 2025
7eb3f31
feat: add `expression` kwarg to `SteadyStateProblem`
AayushSabharwal Apr 28, 2025
337cc16
feat: add `expression` kwarg to `BVProblem`
AayushSabharwal Apr 28, 2025
14da27e
feat: add `expression` kwarg to `DAEFunction`, `DAEProblem`
AayushSabharwal Apr 28, 2025
5424652
feat: add `expression` kwarg to `DDEFunction`, `DDEProblem`
AayushSabharwal Apr 28, 2025
42562c0
feat: add `expression` kwarg to `SDEFunction`, `SDEProblem`
AayushSabharwal Apr 28, 2025
39b842d
feat: add `expression` kwarg to `SDDEFunction`, `SDDEProblem`
AayushSabharwal Apr 28, 2025
c5bef66
feat: add `expression` kwarg to `DiscreteFunction`, `DiscreteProblem`
AayushSabharwal Apr 28, 2025
33b82a4
feat: add `expression` kwarg for `NonlinearFunction`, `NonlinearProbl…
AayushSabharwal Apr 28, 2025
7e2efcc
feat: add `expression` kwarg to `OptimizationFunction`, `Optimization…
AayushSabharwal Apr 28, 2025
bf49117
feat: add `expression` kwarg to `ImplicitDiscreteFunction`, `Implicit…
AayushSabharwal Apr 28, 2025
97093a3
feat: add `expression` kwarg to `IntervalNonlinearFunction`, `Interva…
AayushSabharwal Apr 28, 2025
aa120bd
fix: fix type-piracy of `Symbolics.rename`
AayushSabharwal Apr 29, 2025
da8d735
refactor: remove `systems/diffeqs/modelingtoolkitize.jl`
AayushSabharwal Apr 29, 2025
8ee31f1
feat: add `modelingtoolkitize` for `ODEProblem`
AayushSabharwal Apr 29, 2025
7eb02a1
feat: add `modelingtoolkitize` for `SDEProblem`
AayushSabharwal Apr 29, 2025
2e9aa0b
feat: add `add_accumulations`
AayushSabharwal Apr 29, 2025
9e01051
fix: allow generating callbacks for `System`
AayushSabharwal Apr 29, 2025
02d717a
feat: add `preface` to `System`
AayushSabharwal Apr 29, 2025
46c22ea
test: fix `odesystem` tests
AayushSabharwal Apr 29, 2025
5f9e966
refactor: store jumps as `Vector{JumpType}`
AayushSabharwal Apr 29, 2025
f57bdc1
fix: validate units of jumps
AayushSabharwal Apr 29, 2025
3977fdb
fix: respect scoping in `System` constructor variable discovery
AayushSabharwal Apr 29, 2025
1b41990
fix: fix `flatten(::System)`
AayushSabharwal Apr 29, 2025
93e0465
feat: export `jumps`
AayushSabharwal Apr 29, 2025
c1b49be
fix: validate that `Sample` operates on unknowns
AayushSabharwal Apr 29, 2025
d0946c3
test: fix `test/structural_transformation/utils.jl`
AayushSabharwal Apr 29, 2025
3fbcbcf
test: simplify test for metadata retention in `complete`
AayushSabharwal Apr 29, 2025
0091e58
test: improve readability of dependency graph tests
AayushSabharwal Apr 29, 2025
5c1a9f4
test: fix usage of `ODEProblemExpr` in lowering test
AayushSabharwal Apr 29, 2025
5ae1544
test: remove test for specifying type of system in `@mtkmodel`
AayushSabharwal Apr 29, 2025
7b25839
test: fix parameter dependencies test
AayushSabharwal Apr 29, 2025
0d53999
test: fix symbolic events test
AayushSabharwal Apr 29, 2025
5e30fc4
fix: fix `calculate_jacobian`
AayushSabharwal Apr 29, 2025
883aaf6
fix: respect `return_sparsity` in `generate_cost_hessian`
AayushSabharwal Apr 29, 2025
01a43c7
test: fix modelingtoolkitize test
AayushSabharwal Apr 29, 2025
971b56f
test: remove outdated test
AayushSabharwal May 1, 2025
a2b43e1
refactor: remove old `modelingtoolkitize(::OptimizationProblem)`
AayushSabharwal May 1, 2025
3515c96
feat: add `modelingtoolkitize(::OptimizationProblem)`
AayushSabharwal May 1, 2025
f094733
feat: support time-independent variable declaration in mtkize utils
AayushSabharwal May 1, 2025
d3d23d1
feat: support passing `t::Nothing` to `trace_rhs`
AayushSabharwal May 1, 2025
79a5785
refactor: remove old `modelingtoolkitize(::NonlinearProblem)`
AayushSabharwal May 1, 2025
9f87921
feat: add `modelingtoolkitize(::NonlinearProblem)`
AayushSabharwal May 1, 2025
5ef6666
refactor: remove old `modelingtoolkitize(::ODEProblem)` and `::SDEPro…
AayushSabharwal May 1, 2025
cec3ceb
fix: handle bounds in `construct_vars` when `prob.f.sys isa System`
AayushSabharwal May 2, 2025
22f532b
feat: add `OptimizationSystem` ctor where cost is an array
AayushSabharwal May 2, 2025
f4dd254
feat: add `structural_simplify` for optimization systems
AayushSabharwal May 2, 2025
ccfb254
feat: add `generate_control_jacobian`
AayushSabharwal May 7, 2025
fa2ccdd
fix: change default `consolidate` to `default_consolidate` in `@mtkmo…
AayushSabharwal May 7, 2025
dd10754
fix: handle `Shift`s in `is_diff_equation`
AayushSabharwal May 8, 2025
fb2523e
feat: implement `calculate_hessian` and `hessian_sparsity` for `System`
AayushSabharwal May 8, 2025
1f4e135
feat: make delay processing more modular in `build_function_wrapper`
AayushSabharwal May 8, 2025
f4f3107
fix: fix `generate_cost` for time-dependent (BV) systems
AayushSabharwal May 8, 2025
d73f4f9
fix: default `build_initializeprob` to `supports_initialization(sys)`
AayushSabharwal May 8, 2025
c5c7bcc
fix: disallow simplification of jump systems
AayushSabharwal May 8, 2025
30549c0
fix: remove usage of `is_scalar_noise` kwarg
AayushSabharwal May 8, 2025
24bf5e5
feat: inspect jumps in `collect_scoped_vars!`
AayushSabharwal May 8, 2025
88eadf4
test: comment out jac/tgrad caching test
AayushSabharwal May 8, 2025
8004ff0
test: update BVProblem tests to new semantics
AayushSabharwal May 8, 2025
1edbdec
test: update DDE tests to new semantics
AayushSabharwal May 8, 2025
bd6e0f4
test: make debugging tests more reproducible
AayushSabharwal May 8, 2025
c3d57d2
test: update discrete system tests to new semantics
AayushSabharwal May 8, 2025
a219a33
test: update implicit discrete system tests to new semantics
AayushSabharwal May 8, 2025
b333abc
test: remove redundant initial values tests
AayushSabharwal May 8, 2025
ffc6d62
test: update initialization system tests to new semantics
AayushSabharwal May 8, 2025
6819760
test: fix jump system tests
AayushSabharwal May 8, 2025
e818b97
test: remove redundant namespacing tests
AayushSabharwal May 8, 2025
2c14c75
fix: fix `independent_variables`
AayushSabharwal May 8, 2025
e19533b
feat: export newly added functions
AayushSabharwal May 8, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/Documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- master
- v10
tags: '*'
pull_request:

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/FormatCheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- 'master'
- v10
tags: '*'
pull_request:

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/Tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
branches:
- master
- 'release-'
- v10
paths-ignore:
- 'docs/**'
push:
Expand Down
10 changes: 8 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "ModelingToolkit"
uuid = "961ee093-0014-501f-94e3-6117800e7a78"
authors = ["Yingbo Ma <mayingbo5@gmail.com>", "Chris Rackauckas <accounts@chrisrackauckas.com> and contributors"]
version = "9.78.0"
version = "10.0.0"

[deps]
ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b"
Expand Down Expand Up @@ -174,6 +174,7 @@ Logging = "56ddb016-857b-54e1-b83d-db4d58db5568"
ModelingToolkitStandardLibrary = "16a59e39-deab-5bd0-87e4-056b12336739"
NonlinearSolve = "8913a72c-1f9b-4ce2-8d82-65094dcecaec"
Optimization = "7f7a1694-90dd-40f0-9382-eb1efda571ba"
OptimizationBase = "bca83a33-5cc9-4baa-983d-23429ab6bcbb"
OptimizationMOI = "fd9f6733-72f4-499f-8506-86b2bdd0dea1"
OptimizationOptimJL = "36348300-93cb-4f02-beb5-3c3902f8871e"
OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
Expand All @@ -193,5 +194,10 @@ StochasticDiffEq = "789caeaf-c7a9-5a7d-9973-96adeb23e2a0"
Sundials = "c3572dad-4567-51f8-b174-8c6c989267f4"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[sources]
ModelingToolkitStandardLibrary = { url = "https://github.com/SciML/ModelingToolkitStandardLibrary.jl/", rev = "mtk-v10" }
OptimizationBase = { url = "https://github.com/AayushSabharwal/OptimizationBase.jl", rev = "as/mtk-v10" }
OptimizationMOI = { url = "https://github.com/AayushSabharwal/Optimization.jl", subdir = "lib/OptimizationMOI", rev = "as/mtk-v10" }

[targets]
test = ["AmplNLWriter", "BenchmarkTools", "BoundaryValueDiffEqMIRK", "BoundaryValueDiffEqAscher", "ControlSystemsBase", "DataInterpolations", "DelayDiffEq", "NonlinearSolve", "ForwardDiff", "Ipopt", "Ipopt_jll", "ModelingToolkitStandardLibrary", "Optimization", "OptimizationOptimJL", "OptimizationMOI", "OrdinaryDiffEq", "OrdinaryDiffEqCore", "OrdinaryDiffEqDefault", "REPL", "Random", "ReferenceTests", "SafeTestsets", "StableRNGs", "Statistics", "SteadyStateDiffEq", "Test", "StochasticDiffEq", "Sundials", "StochasticDelayDiffEq", "Pkg", "JET", "OrdinaryDiffEqNonlinearSolve", "Logging"]
test = ["AmplNLWriter", "BenchmarkTools", "BoundaryValueDiffEqMIRK", "BoundaryValueDiffEqAscher", "ControlSystemsBase", "DataInterpolations", "DelayDiffEq", "NonlinearSolve", "ForwardDiff", "Ipopt", "Ipopt_jll", "ModelingToolkitStandardLibrary", "Optimization", "OptimizationOptimJL", "OptimizationMOI", "OrdinaryDiffEq", "OrdinaryDiffEqCore", "OrdinaryDiffEqDefault", "REPL", "Random", "ReferenceTests", "SafeTestsets", "StableRNGs", "Statistics", "SteadyStateDiffEq", "Test", "StochasticDiffEq", "Sundials", "StochasticDelayDiffEq", "Pkg", "JET", "OrdinaryDiffEqNonlinearSolve", "Logging", "OptimizationBase"]
2 changes: 1 addition & 1 deletion docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Documenter = "1"
DynamicQuantities = "^0.11.2, 0.12, 1"
FMI = "0.14"
FMIZoo = "1"
ModelingToolkit = "8.33, 9"
ModelingToolkit = "10"
ModelingToolkitStandardLibrary = "2.19"
NonlinearSolve = "3, 4"
Optim = "1.7"
Expand Down
20 changes: 6 additions & 14 deletions docs/src/basics/Composition.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,42 +135,34 @@ sys.y = u * 1.1
In a hierarchical system, variables of the subsystem get namespaced by the name of the system they are in. This prevents naming clashes, but also enforces that every unknown and parameter is local to the subsystem it is used in. In some cases it might be desirable to have variables and parameters that are shared between subsystems, or even global. This can be accomplished as follows.

```julia
@parameters a b c d e f
@parameters a b c d

# a is a local variable
b = ParentScope(b) # b is a variable that belongs to one level up in the hierarchy
c = ParentScope(ParentScope(c)) # ParentScope can be nested
d = DelayParentScope(d) # skips one level before applying ParentScope
e = DelayParentScope(e, 2) # second argument allows skipping N levels
f = GlobalScope(f)
d = GlobalScope(d)

p = [a, b, c, d, e, f]
p = [a, b, c, d]

level0 = ODESystem(Equation[], t, [], p; name = :level0)
level1 = ODESystem(Equation[], t, [], []; name = :level1) ∘ level0
parameters(level1)
#level0₊a
#b
#c
#level0₊d
#level0₊e
#f
#d
level2 = ODESystem(Equation[], t, [], []; name = :level2) ∘ level1
parameters(level2)
#level1₊level0₊a
#level1₊b
#c
#level0₊d
#level1₊level0₊e
#f
#d
level3 = ODESystem(Equation[], t, [], []; name = :level3) ∘ level2
parameters(level3)
#level2₊level1₊level0₊a
#level2₊level1₊b
#level2₊c
#level2₊level0₊d
#level1₊level0₊e
#f
#d
```

## Structural Simplify
Expand Down
68 changes: 36 additions & 32 deletions src/ModelingToolkit.jl
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,8 @@ TODO
abstract type AbstractSystem end
abstract type AbstractTimeDependentSystem <: AbstractSystem end
abstract type AbstractTimeIndependentSystem <: AbstractSystem end
abstract type AbstractODESystem <: AbstractTimeDependentSystem end
abstract type AbstractMultivariateSystem <: AbstractSystem end
abstract type AbstractOptimizationSystem <: AbstractTimeIndependentSystem end
abstract type AbstractDiscreteSystem <: AbstractTimeDependentSystem end

function independent_variable end

Expand Down Expand Up @@ -159,30 +157,39 @@ include("systems/connectors.jl")
include("systems/analysis_points.jl")
include("systems/imperative_affect.jl")
include("systems/callbacks.jl")
include("systems/system.jl")
include("systems/codegen_utils.jl")
include("systems/codegen.jl")
include("systems/problem_utils.jl")
include("linearization.jl")

include("systems/optimization/constraints_system.jl")
include("systems/optimization/optimizationsystem.jl")
include("systems/optimization/modelingtoolkitize.jl")
include("problems/compatibility.jl")
include("problems/odeproblem.jl")
include("problems/daeproblem.jl")
include("problems/ddeproblem.jl")
include("problems/sdeproblem.jl")
include("problems/sddeproblem.jl")
include("problems/bvproblem.jl")
include("problems/discreteproblem.jl")
include("problems/implicitdiscreteproblem.jl")
include("problems/nonlinearproblem.jl")
include("problems/intervalnonlinearproblem.jl")
include("problems/sccnonlinearproblem.jl")
include("problems/initializationproblem.jl")
include("problems/jumpproblem.jl")
include("problems/optimizationproblem.jl")

include("modelingtoolkitize/common.jl")
include("modelingtoolkitize/odeproblem.jl")
include("modelingtoolkitize/sdeproblem.jl")
include("modelingtoolkitize/optimizationproblem.jl")
include("modelingtoolkitize/nonlinearproblem.jl")

include("systems/nonlinear/nonlinearsystem.jl")
include("systems/nonlinear/homotopy_continuation.jl")
include("systems/diffeqs/odesystem.jl")
include("systems/diffeqs/sdesystem.jl")
include("systems/diffeqs/abstractodesystem.jl")
include("systems/nonlinear/modelingtoolkitize.jl")
include("systems/nonlinear/initializesystem.jl")
include("systems/diffeqs/first_order_transform.jl")
include("systems/diffeqs/modelingtoolkitize.jl")
include("systems/diffeqs/basic_transformations.jl")

include("systems/discrete_system/discrete_system.jl")
include("systems/discrete_system/implicit_discrete_system.jl")

include("systems/jumps/jumpsystem.jl")

include("systems/pde/pdesystem.jl")

include("systems/sparsematrixclil.jl")
Expand Down Expand Up @@ -226,7 +233,7 @@ const D = Differential(t)
PrecompileTools.@compile_workload begin
using ModelingToolkit
@variables x(ModelingToolkit.t_nounits)
@named sys = ODESystem([ModelingToolkit.D_nounits(x) ~ -x], ModelingToolkit.t_nounits)
@named sys = System([ModelingToolkit.D_nounits(x) ~ -x], ModelingToolkit.t_nounits)
prob = ODEProblem(structural_simplify(sys), [x => 30.0], (0, 100), [], jac = true)
@mtkmodel __testmod__ begin
@constants begin
Expand Down Expand Up @@ -262,16 +269,14 @@ export AbstractTimeDependentSystem,
AbstractTimeIndependentSystem,
AbstractMultivariateSystem

export ODESystem,
ODEFunction, ODEFunctionExpr, ODEProblemExpr, convert_system,
add_accumulations, System
export ODEFunction, ODEFunctionExpr, ODEProblemExpr, convert_system,
System, OptimizationSystem, JumpSystem, SDESystem
export DAEFunctionExpr, DAEProblemExpr
export SDESystem, SDEFunction, SDEFunctionExpr, SDEProblemExpr
export SDEFunction, SDEFunctionExpr, SDEProblemExpr
export SystemStructure
export DiscreteSystem, DiscreteProblem, DiscreteFunction, DiscreteFunctionExpr
export ImplicitDiscreteSystem, ImplicitDiscreteProblem, ImplicitDiscreteFunction,
export DiscreteProblem, DiscreteFunction, DiscreteFunctionExpr
export ImplicitDiscreteProblem, ImplicitDiscreteFunction,
ImplicitDiscreteFunctionExpr
export JumpSystem
export ODEProblem, SDEProblem
export NonlinearFunction, NonlinearFunctionExpr
export NonlinearProblem, NonlinearProblemExpr
Expand All @@ -280,7 +285,6 @@ export IntervalNonlinearProblem, IntervalNonlinearProblemExpr
export OptimizationProblem, OptimizationProblemExpr, constraints
export SteadyStateProblem, SteadyStateProblemExpr
export JumpProblem
export NonlinearSystem, OptimizationSystem, ConstraintsSystem
export alias_elimination, flatten
export connect, domain_connect, @connector, Connection, AnalysisPoint, Flow, Stream,
instream
Expand All @@ -292,25 +296,25 @@ export isinput, isoutput, getbounds, hasbounds, getguess, hasguess, isdisturbanc
hasunit, getunit, hasconnect, getconnect,
hasmisc, getmisc, state_priority
export ode_order_lowering, dae_order_lowering, liouville_transform,
change_independent_variable, substitute_component
change_independent_variable, substitute_component, add_accumulations
export PDESystem
export Differential, expand_derivatives, @derivatives
export Equation, ConstrainedEquation
export Term, Sym
export SymScope, LocalScope, ParentScope, DelayParentScope, GlobalScope
export independent_variable, equations, controls, observed, full_equations
export SymScope, LocalScope, ParentScope, GlobalScope
export independent_variable, equations, controls, observed, full_equations, jumps, cost
export initialization_equations, guesses, defaults, parameter_dependencies, hierarchy
export structural_simplify, expand_connections, linearize, linearization_function,
LinearizationProblem
export solve

export calculate_jacobian, generate_jacobian, generate_function, generate_custom_function,
generate_W
export calculate_jacobian, generate_jacobian, generate_rhs, generate_custom_function,
generate_W, calculate_hessian
export calculate_control_jacobian, generate_control_jacobian
export calculate_tgrad, generate_tgrad
export calculate_gradient, generate_gradient
export generate_cost, calculate_cost_gradient, generate_cost_gradient
export calculate_factorized_W, generate_factorized_W
export calculate_hessian, generate_hessian
export calculate_cost_hessian, generate_cost_hessian
export calculate_massmatrix, generate_diffusion_function
export stochastic_integral_transform
export TearingState
Expand Down
26 changes: 26 additions & 0 deletions src/discretedomain.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ SymbolicUtils.promote_symtype(::Type{<:SampleTime}, t...) = Real
Base.nameof(::SampleTime) = :SampleTime
SymbolicUtils.isbinop(::SampleTime) = false

function validate_operator(op::SampleTime, args, iv; context = nothing) end

# Shift

"""
Expand Down Expand Up @@ -68,6 +70,13 @@ Base.hash(D::Shift, u::UInt) = hash(D.steps, hash(D.t, xor(u, 0x055640d6d952f101
Base.:^(D::Shift, n::Integer) = Shift(D.t, D.steps * n)
Base.literal_pow(f::typeof(^), D::Shift, ::Val{n}) where {n} = Shift(D.t, D.steps * n)

function validate_operator(op::Shift, args, iv; context = nothing)
isequal(op.t, iv) || throw(OperatorIndepvarMismatchError(op, iv, context))
op.steps <= 0 || error("""
Only non-positive shifts are allowed. Found shift of $(op.steps) in $context.
""")
end

hasshift(eq::Equation) = hasshift(eq.lhs) || hasshift(eq.rhs)

"""
Expand Down Expand Up @@ -128,6 +137,18 @@ Base.show(io::IO, D::Sample) = print(io, "Sample(", D.clock, ")")
Base.:(==)(D1::Sample, D2::Sample) = isequal(D1.clock, D2.clock)
Base.hash(D::Sample, u::UInt) = hash(D.clock, xor(u, 0x055640d6d952f101))

function validate_operator(op::Sample, args, iv; context = nothing)
arg = unwrap(only(args))
if !is_variable_floatingpoint(arg)
throw(ContinuousOperatorDiscreteArgumentError(op, arg, context))
end
if isparameter(arg)
throw(ArgumentError("""
Expected argument of $op to be an unknown, found $arg which is a parameter.
"""))
end
end

"""
hassample(O)

Expand Down Expand Up @@ -156,6 +177,11 @@ SymbolicUtils.isbinop(::Hold) = false

Hold(x) = Hold()(x)

function validate_operator(op::Hold, args, iv; context = nothing)
# TODO: maybe validate `VariableTimeDomain`?
return nothing
end

"""
hashold(O)

Expand Down
Loading
Loading