Skip to content

Commit 7f6e858

Browse files
committed
Add docstring references to solver documentation for problem constructors
This adds comprehensive docstrings to all major problem constructors in ModelingToolkit.jl that reference the appropriate solver documentation for extended keyword arguments: - ODEProblem, SDEProblem, DAEProblem, BVProblem, DDEProblem, JumpProblem → DifferentialEquations.jl docs - NonlinearProblem → NonlinearSolve.jl docs - OptimizationProblem → Optimization.jl docs - LinearProblem → LinearSolve.jl docs Each docstring now clearly indicates that additional keyword arguments are supported beyond those listed, with links to the relevant solver documentation for complete details on available options. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 1302373 commit 7f6e858

File tree

9 files changed

+230
-0
lines changed

9 files changed

+230
-0
lines changed

src/problems/bvproblem.jl

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,30 @@
1+
"""
2+
BVProblem(sys::System, op, tspan; kwargs...)
3+
4+
Construct a `BVProblem` from a ModelingToolkit `System` for boundary value problems.
5+
6+
## Additional Keyword Arguments
7+
8+
Beyond the arguments listed below, this constructor accepts all keyword arguments
9+
supported by the DifferentialEquations.jl `solve` function. For a complete list
10+
and detailed descriptions, see the [DifferentialEquations.jl solve documentation](https://docs.sciml.ai/DiffEqDocs/stable/basics/common_solver_opts/).
11+
12+
## Arguments
13+
- `sys::System`: The ModelingToolkit system to convert (with boundary conditions)
14+
- `op`: Operating point/initial conditions
15+
- `tspan`: Time span for the problem
16+
17+
## Keywords
18+
- `check_compatibility=true`: Whether to check system compatibility
19+
- `cse=true`: Whether to perform common subexpression elimination
20+
- `checkbounds=false`: Whether to enable bounds checking
21+
- `eval_expression=false`: Whether to evaluate expressions
22+
- `eval_module=@__MODULE__`: Module for expression evaluation
23+
- `expression=Val{false}`: Expression evaluation mode
24+
- `guesses=Dict()`: Initial guesses for boundary value problem
25+
- `callback=nothing`: Callback functions (note: BVP solvers do not support callbacks)
26+
- `kwargs...`: Additional keyword arguments passed to the solver
27+
"""
128
@fallback_iip_specialize function SciMLBase.BVProblem{iip, spec}(
229
sys::System, op, tspan;
330
check_compatibility = true, cse = true,

src/problems/daeproblem.jl

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,31 @@
5959
return maybe_codegen_scimlfn(expression, DAEFunction{iip, spec}, args; kwargs...)
6060
end
6161

62+
"""
63+
DAEProblem(sys::System, op, tspan; kwargs...)
64+
65+
Construct a `DAEProblem` from a ModelingToolkit `System` for differential-algebraic equations.
66+
67+
## Additional Keyword Arguments
68+
69+
Beyond the arguments listed below, this constructor accepts all keyword arguments
70+
supported by the DifferentialEquations.jl `solve` function. For a complete list
71+
and detailed descriptions, see the [DifferentialEquations.jl solve documentation](https://docs.sciml.ai/DiffEqDocs/stable/basics/common_solver_opts/).
72+
73+
## Arguments
74+
- `sys::System`: The ModelingToolkit system to convert (differential-algebraic system)
75+
- `op`: Operating point/initial conditions
76+
- `tspan`: Time span for the problem
77+
78+
## Keywords
79+
- `callback=nothing`: Callback functions for the solver
80+
- `check_length=true`: Whether to check length compatibility
81+
- `eval_expression=false`: Whether to evaluate expressions
82+
- `eval_module=@__MODULE__`: Module for expression evaluation
83+
- `check_compatibility=true`: Whether to check system compatibility
84+
- `expression=Val{false}`: Expression evaluation mode
85+
- `kwargs...`: Additional keyword arguments passed to the solver
86+
"""
6287
@fallback_iip_specialize function SciMLBase.DAEProblem{iip, spec}(
6388
sys::System, op, tspan;
6489
callback = nothing, check_length = true, eval_expression = false,

src/problems/ddeproblem.jl

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,34 @@
3838
return maybe_codegen_scimlfn(expression, DDEFunction{iip, spec}, args; kwargs...)
3939
end
4040

41+
"""
42+
DDEProblem(sys::System, op, tspan; kwargs...)
43+
44+
Construct a `DDEProblem` from a ModelingToolkit `System` for delay differential equations.
45+
46+
## Additional Keyword Arguments
47+
48+
Beyond the arguments listed below, this constructor accepts all keyword arguments
49+
supported by the DifferentialEquations.jl `solve` function. For a complete list
50+
and detailed descriptions, see the [DifferentialEquations.jl solve documentation](https://docs.sciml.ai/DiffEqDocs/stable/basics/common_solver_opts/).
51+
52+
## Arguments
53+
- `sys::System`: The ModelingToolkit system to convert (must contain delay equations)
54+
- `op`: Operating point/initial conditions
55+
- `tspan`: Time span for the problem
56+
57+
## Keywords
58+
- `callback=nothing`: Callback functions for the solver
59+
- `check_length=true`: Whether to check length compatibility
60+
- `cse=true`: Whether to perform common subexpression elimination
61+
- `checkbounds=false`: Whether to enable bounds checking
62+
- `eval_expression=false`: Whether to evaluate expressions
63+
- `eval_module=@__MODULE__`: Module for expression evaluation
64+
- `check_compatibility=true`: Whether to check system compatibility
65+
- `u0_constructor=identity`: Constructor for initial conditions
66+
- `expression=Val{false}`: Expression evaluation mode
67+
- `kwargs...`: Additional keyword arguments passed to the solver
68+
"""
4169
@fallback_iip_specialize function SciMLBase.DDEProblem{iip, spec}(
4270
sys::System, op, tspan;
4371
callback = nothing, check_length = true, cse = true, checkbounds = false,

src/problems/jumpproblem.jl

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,30 @@
1+
"""
2+
JumpProblem(sys::System, op, tspan; kwargs...)
3+
4+
Construct a `JumpProblem` from a ModelingToolkit `System` for jump processes.
5+
6+
## Additional Keyword Arguments
7+
8+
Beyond the arguments listed below, this constructor accepts all keyword arguments
9+
supported by the DifferentialEquations.jl `solve` function. For a complete list
10+
and detailed descriptions, see the [DifferentialEquations.jl solve documentation](https://docs.sciml.ai/DiffEqDocs/stable/basics/common_solver_opts/).
11+
12+
## Arguments
13+
- `sys::System`: The ModelingToolkit system to convert (must contain jump processes)
14+
- `op`: Operating point/initial conditions
15+
- `tspan`: Time span for the problem (can be a tuple or nothing)
16+
17+
## Keywords
18+
- `check_compatibility=true`: Whether to check system compatibility
19+
- `eval_expression=false`: Whether to evaluate expressions
20+
- `eval_module=@__MODULE__`: Module for expression evaluation
21+
- `checkbounds=false`: Whether to enable bounds checking
22+
- `cse=true`: Whether to perform common subexpression elimination
23+
- `aggregator=JumpProcesses.NullAggregator()`: Aggregator for jump processes
24+
- `callback=nothing`: Callback functions for the solver
25+
- `rng=nothing`: Random number generator
26+
- `kwargs...`: Additional keyword arguments passed to the solver
27+
"""
128
@fallback_iip_specialize function JumpProcesses.JumpProblem{iip, spec}(
229
sys::System, op, tspan::Union{Tuple, Nothing};
330
check_compatibility = true, eval_expression = false, eval_module = @__MODULE__,

src/problems/linearproblem.jl

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,34 @@ function SciMLBase.LinearProblem(sys::System, op::StaticArray; kwargs...)
66
SciMLBase.LinearProblem{false}(sys, op; kwargs...)
77
end
88

9+
"""
10+
LinearProblem(sys::System, op; kwargs...)
11+
12+
Construct a `LinearProblem` from a ModelingToolkit `System` for linear systems.
13+
14+
## Additional Keyword Arguments
15+
16+
Beyond the arguments listed below, this constructor accepts all keyword arguments
17+
supported by the LinearSolve.jl `solve` function. For a complete list
18+
and detailed descriptions, see the [LinearSolve.jl documentation](https://docs.sciml.ai/LinearSolve/stable/).
19+
20+
## Arguments
21+
- `sys::System`: The ModelingToolkit system to convert (linear system)
22+
- `op`: Operating point/initial conditions
23+
24+
## Keywords
25+
- `check_length=true`: Whether to check length compatibility
26+
- `expression=Val{false}`: Expression evaluation mode
27+
- `check_compatibility=true`: Whether to check system compatibility
28+
- `sparse=false`: Whether to use sparse arrays
29+
- `eval_expression=false`: Whether to evaluate expressions
30+
- `eval_module=@__MODULE__`: Module for expression evaluation
31+
- `checkbounds=false`: Whether to enable bounds checking
32+
- `cse=true`: Whether to perform common subexpression elimination
33+
- `u0_constructor=identity`: Constructor for initial conditions
34+
- `u0_eltype=nothing`: Element type for initial conditions
35+
- `kwargs...`: Additional keyword arguments passed to the solver
36+
"""
937
function SciMLBase.LinearProblem{iip}(
1038
sys::System, op; check_length = true, expression = Val{false},
1139
check_compatibility = true, sparse = false, eval_expression = false,

src/problems/nonlinearproblem.jl

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,27 @@
5454
return maybe_codegen_scimlfn(expression, NonlinearFunction{iip, spec}, args; kwargs...)
5555
end
5656

57+
"""
58+
NonlinearProblem(sys::System, op; kwargs...)
59+
60+
Construct a `NonlinearProblem` from a ModelingToolkit `System` for nonlinear equations.
61+
62+
## Additional Keyword Arguments
63+
64+
Beyond the arguments listed below, this constructor accepts all keyword arguments
65+
supported by the NonlinearSolve.jl `solve` function. For a complete list
66+
and detailed descriptions, see the [NonlinearSolve.jl documentation](https://docs.sciml.ai/NonlinearSolve/stable/).
67+
68+
## Arguments
69+
- `sys::System`: The ModelingToolkit system to convert (nonlinear system)
70+
- `op`: Operating point/initial guess
71+
72+
## Keywords
73+
- `expression=Val{false}`: Expression evaluation mode
74+
- `check_length=true`: Whether to check length compatibility
75+
- `check_compatibility=true`: Whether to check system compatibility
76+
- `kwargs...`: Additional keyword arguments passed to the solver
77+
"""
5778
@fallback_iip_specialize function SciMLBase.NonlinearProblem{iip, spec}(
5879
sys::System, op; expression = Val{false},
5980
check_length = true, check_compatibility = true, kwargs...) where {iip, spec}

src/problems/odeproblem.jl

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,31 @@
6969
maybe_codegen_scimlfn(expression, ODEFunction{iip, spec}, args; kwargs...)
7070
end
7171

72+
"""
73+
ODEProblem(sys::System, op, tspan; kwargs...)
74+
75+
Construct an `ODEProblem` from a ModelingToolkit `System`.
76+
77+
## Additional Keyword Arguments
78+
79+
Beyond the arguments listed below, this constructor accepts all keyword arguments
80+
supported by the DifferentialEquations.jl `solve` function. For a complete list
81+
and detailed descriptions, see the [DifferentialEquations.jl solve documentation](https://docs.sciml.ai/DiffEqDocs/stable/basics/common_solver_opts/).
82+
83+
## Arguments
84+
- `sys::System`: The ModelingToolkit system to convert
85+
- `op`: Operating point/initial conditions
86+
- `tspan`: Time span for the problem
87+
88+
## Keywords
89+
- `callback=nothing`: Callback functions for the solver
90+
- `check_length=true`: Whether to check length compatibility
91+
- `eval_expression=false`: Whether to evaluate expressions
92+
- `expression=Val{false}`: Expression evaluation mode
93+
- `eval_module=@__MODULE__`: Module for expression evaluation
94+
- `check_compatibility=true`: Whether to check system compatibility
95+
- `kwargs...`: Additional keyword arguments passed to the solver
96+
"""
7297
@fallback_iip_specialize function SciMLBase.ODEProblem{iip, spec}(
7398
sys::System, op, tspan;
7499
callback = nothing, check_length = true, eval_expression = false,

src/problems/optimizationproblem.jl

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,28 @@ function SciMLBase.OptimizationProblem(sys::System, args...; kwargs...)
8888
return OptimizationProblem{true}(sys, args...; kwargs...)
8989
end
9090

91+
"""
92+
OptimizationProblem(sys::System, op; kwargs...)
93+
94+
Construct an `OptimizationProblem` from a ModelingToolkit `System` for optimization.
95+
96+
## Additional Keyword Arguments
97+
98+
Beyond the arguments listed below, this constructor accepts all keyword arguments
99+
supported by the Optimization.jl `solve` function. For a complete list
100+
and detailed descriptions, see the [Optimization.jl documentation](https://docs.sciml.ai/Optimization/stable/).
101+
102+
## Arguments
103+
- `sys::System`: The ModelingToolkit system to convert (optimization system with cost and constraints)
104+
- `op`: Operating point/initial guess
105+
106+
## Keywords
107+
- `lb=nothing`: Lower bounds for optimization variables
108+
- `ub=nothing`: Upper bounds for optimization variables
109+
- `check_compatibility=true`: Whether to check system compatibility
110+
- `expression=Val{false}`: Expression evaluation mode
111+
- `kwargs...`: Additional keyword arguments passed to the solver
112+
"""
91113
function SciMLBase.OptimizationProblem{iip}(
92114
sys::System, op; lb = nothing,
93115
ub = nothing, check_compatibility = true, expression = Val{false},

src/problems/sdeproblem.jl

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,33 @@
6464
return maybe_codegen_scimlfn(expression, SDEFunction{iip, spec}, args; kwargs...)
6565
end
6666

67+
"""
68+
SDEProblem(sys::System, op, tspan; kwargs...)
69+
70+
Construct an `SDEProblem` from a ModelingToolkit `System` with noise.
71+
72+
## Additional Keyword Arguments
73+
74+
Beyond the arguments listed below, this constructor accepts all keyword arguments
75+
supported by the DifferentialEquations.jl `solve` function. For a complete list
76+
and detailed descriptions, see the [DifferentialEquations.jl solve documentation](https://docs.sciml.ai/DiffEqDocs/stable/basics/common_solver_opts/).
77+
78+
## Arguments
79+
- `sys::System`: The ModelingToolkit system to convert (must contain noise equations)
80+
- `op`: Operating point/initial conditions
81+
- `tspan`: Time span for the problem
82+
83+
## Keywords
84+
- `callback=nothing`: Callback functions for the solver
85+
- `check_length=true`: Whether to check length compatibility
86+
- `eval_expression=false`: Whether to evaluate expressions
87+
- `eval_module=@__MODULE__`: Module for expression evaluation
88+
- `check_compatibility=true`: Whether to check system compatibility
89+
- `sparse=false`: Whether to use sparse arrays
90+
- `sparsenoise=sparse`: Whether to use sparse noise representation
91+
- `expression=Val{false}`: Expression evaluation mode
92+
- `kwargs...`: Additional keyword arguments passed to the solver
93+
"""
6794
@fallback_iip_specialize function SciMLBase.SDEProblem{iip, spec}(
6895
sys::System, op, tspan;
6996
callback = nothing, check_length = true, eval_expression = false,

0 commit comments

Comments
 (0)