diff --git a/docs/src/API/problems.md b/docs/src/API/problems.md index 72147a7e09..1d76aaa445 100644 --- a/docs/src/API/problems.md +++ b/docs/src/API/problems.md @@ -14,17 +14,17 @@ code for a variety of such numerical problems. ```@docs SciMLBase.ODEFunction -SciMLBase.ODEProblem +SciMLBase.ODEProblem(::System, ::Any, ::Any) SciMLBase.DAEFunction -SciMLBase.DAEProblem +SciMLBase.DAEProblem(::System, ::Any, ::Any) SciMLBase.SDEFunction -SciMLBase.SDEProblem +SciMLBase.SDEProblem(::System, ::Any, ::Any) SciMLBase.DDEFunction -SciMLBase.DDEProblem +SciMLBase.DDEProblem(::System, ::Any, ::Any) SciMLBase.SDDEFunction SciMLBase.SDDEProblem -JumpProcesses.JumpProblem -SciMLBase.BVProblem +JumpProcesses.JumpProblem(::System, ::Any, ::Any) +SciMLBase.BVProblem(::System, ::Any, ::Any) SciMLBase.DiscreteProblem SciMLBase.ImplicitDiscreteProblem ``` @@ -33,22 +33,22 @@ SciMLBase.ImplicitDiscreteProblem ```@docs SciMLBase.NonlinearFunction -SciMLBase.NonlinearProblem +SciMLBase.NonlinearProblem(::System, ::Any) SciMLBase.SCCNonlinearProblem SciMLBase.NonlinearLeastSquaresProblem -SciMLBase.SteadyStateProblem +DiffEqBase.SteadyStateProblem(::System, ::Any) SciMLBase.IntervalNonlinearFunction SciMLBase.IntervalNonlinearProblem ModelingToolkit.HomotopyContinuationProblem SciMLBase.HomotopyNonlinearFunction -SciMLBase.LinearProblem +SciMLBase.LinearProblem(::System, ::Any) ``` ## Optimization and optimal control ```@docs SciMLBase.OptimizationFunction -SciMLBase.OptimizationProblem +SciMLBase.OptimizationProblem(::System, ::Any) SciMLBase.ODEInputFunction ModelingToolkit.JuMPDynamicOptProblem ModelingToolkit.InfiniteOptDynamicOptProblem diff --git a/src/problems/bvproblem.jl b/src/problems/bvproblem.jl index 1c193bca51..30d968b80a 100644 --- a/src/problems/bvproblem.jl +++ b/src/problems/bvproblem.jl @@ -1,3 +1,31 @@ +""" + BVProblem(sys::System, op, tspan; kwargs...) + +Construct a `BVProblem` from a ModelingToolkit `System` for boundary value problems. + +## Additional Keyword Arguments + +Beyond the arguments listed below, this constructor accepts all keyword arguments +supported by the DifferentialEquations.jl `solve` function. For a complete list +and detailed descriptions, see the [ModelingToolkit.jl problem building documentation](https://docs.sciml.ai/ModelingToolkit/stable/API/problems/) +and the [DifferentialEquations.jl solve documentation](https://docs.sciml.ai/DiffEqDocs/stable/basics/common_solver_opts/). + +## Arguments +- `sys::System`: The ModelingToolkit system to convert (with boundary conditions) +- `op`: Operating point/initial conditions +- `tspan`: Time span for the problem + +## Keywords +- `check_compatibility=true`: Whether to check system compatibility +- `cse=true`: Whether to perform common subexpression elimination +- `checkbounds=false`: Whether to enable bounds checking +- `eval_expression=false`: Whether to evaluate expressions +- `eval_module=@__MODULE__`: Module for expression evaluation +- `expression=Val{false}`: Expression evaluation mode +- `guesses=Dict()`: Initial guesses for boundary value problem +- `callback=nothing`: Callback functions (note: BVP solvers do not support callbacks) +- `kwargs...`: Additional keyword arguments passed to the solver +""" @fallback_iip_specialize function SciMLBase.BVProblem{iip, spec}( sys::System, op, tspan; check_compatibility = true, cse = true, diff --git a/src/problems/daeproblem.jl b/src/problems/daeproblem.jl index e2de96b7f5..07f1c96080 100644 --- a/src/problems/daeproblem.jl +++ b/src/problems/daeproblem.jl @@ -59,6 +59,32 @@ return maybe_codegen_scimlfn(expression, DAEFunction{iip, spec}, args; kwargs...) end +""" + DAEProblem(sys::System, op, tspan; kwargs...) + +Construct a `DAEProblem` from a ModelingToolkit `System` for differential-algebraic equations. + +## Additional Keyword Arguments + +Beyond the arguments listed below, this constructor accepts all keyword arguments +supported by the DifferentialEquations.jl `solve` function. For a complete list +and detailed descriptions, see the [ModelingToolkit.jl problem building documentation](https://docs.sciml.ai/ModelingToolkit/stable/API/problems/) +and the [DifferentialEquations.jl solve documentation](https://docs.sciml.ai/DiffEqDocs/stable/basics/common_solver_opts/). + +## Arguments +- `sys::System`: The ModelingToolkit system to convert (differential-algebraic system) +- `op`: Operating point/initial conditions +- `tspan`: Time span for the problem + +## Keywords +- `callback=nothing`: Callback functions for the solver +- `check_length=true`: Whether to check length compatibility +- `eval_expression=false`: Whether to evaluate expressions +- `eval_module=@__MODULE__`: Module for expression evaluation +- `check_compatibility=true`: Whether to check system compatibility +- `expression=Val{false}`: Expression evaluation mode +- `kwargs...`: Additional keyword arguments passed to the solver +""" @fallback_iip_specialize function SciMLBase.DAEProblem{iip, spec}( sys::System, op, tspan; callback = nothing, check_length = true, eval_expression = false, diff --git a/src/problems/ddeproblem.jl b/src/problems/ddeproblem.jl index fb4634f418..31600a8bb3 100644 --- a/src/problems/ddeproblem.jl +++ b/src/problems/ddeproblem.jl @@ -38,6 +38,35 @@ return maybe_codegen_scimlfn(expression, DDEFunction{iip, spec}, args; kwargs...) end +""" + DDEProblem(sys::System, op, tspan; kwargs...) + +Construct a `DDEProblem` from a ModelingToolkit `System` for delay differential equations. + +## Additional Keyword Arguments + +Beyond the arguments listed below, this constructor accepts all keyword arguments +supported by the DifferentialEquations.jl `solve` function. For a complete list +and detailed descriptions, see the [ModelingToolkit.jl problem building documentation](https://docs.sciml.ai/ModelingToolkit/stable/API/problems/) +and the [DifferentialEquations.jl solve documentation](https://docs.sciml.ai/DiffEqDocs/stable/basics/common_solver_opts/). + +## Arguments +- `sys::System`: The ModelingToolkit system to convert (must contain delay equations) +- `op`: Operating point/initial conditions +- `tspan`: Time span for the problem + +## Keywords +- `callback=nothing`: Callback functions for the solver +- `check_length=true`: Whether to check length compatibility +- `cse=true`: Whether to perform common subexpression elimination +- `checkbounds=false`: Whether to enable bounds checking +- `eval_expression=false`: Whether to evaluate expressions +- `eval_module=@__MODULE__`: Module for expression evaluation +- `check_compatibility=true`: Whether to check system compatibility +- `u0_constructor=identity`: Constructor for initial conditions +- `expression=Val{false}`: Expression evaluation mode +- `kwargs...`: Additional keyword arguments passed to the solver +""" @fallback_iip_specialize function SciMLBase.DDEProblem{iip, spec}( sys::System, op, tspan; callback = nothing, check_length = true, cse = true, checkbounds = false, diff --git a/src/problems/jumpproblem.jl b/src/problems/jumpproblem.jl index 3bc0e11f61..85a4fba566 100644 --- a/src/problems/jumpproblem.jl +++ b/src/problems/jumpproblem.jl @@ -1,3 +1,31 @@ +""" + JumpProblem(sys::System, op, tspan; kwargs...) + +Construct a `JumpProblem` from a ModelingToolkit `System` for jump processes. + +## Additional Keyword Arguments + +Beyond the arguments listed below, this constructor accepts all keyword arguments +supported by the DifferentialEquations.jl `solve` function. For a complete list +and detailed descriptions, see the [ModelingToolkit.jl problem building documentation](https://docs.sciml.ai/ModelingToolkit/stable/API/problems/) +and the [DifferentialEquations.jl solve documentation](https://docs.sciml.ai/DiffEqDocs/stable/basics/common_solver_opts/). + +## Arguments +- `sys::System`: The ModelingToolkit system to convert (must contain jump processes) +- `op`: Operating point/initial conditions +- `tspan`: Time span for the problem (can be a tuple or nothing) + +## Keywords +- `check_compatibility=true`: Whether to check system compatibility +- `eval_expression=false`: Whether to evaluate expressions +- `eval_module=@__MODULE__`: Module for expression evaluation +- `checkbounds=false`: Whether to enable bounds checking +- `cse=true`: Whether to perform common subexpression elimination +- `aggregator=JumpProcesses.NullAggregator()`: Aggregator for jump processes +- `callback=nothing`: Callback functions for the solver +- `rng=nothing`: Random number generator +- `kwargs...`: Additional keyword arguments passed to the solver +""" @fallback_iip_specialize function JumpProcesses.JumpProblem{iip, spec}( sys::System, op, tspan::Union{Tuple, Nothing}; check_compatibility = true, eval_expression = false, eval_module = @__MODULE__, diff --git a/src/problems/linearproblem.jl b/src/problems/linearproblem.jl index 4244e462c6..d9257d31ef 100644 --- a/src/problems/linearproblem.jl +++ b/src/problems/linearproblem.jl @@ -6,6 +6,35 @@ function SciMLBase.LinearProblem(sys::System, op::StaticArray; kwargs...) SciMLBase.LinearProblem{false}(sys, op; kwargs...) end +""" + LinearProblem(sys::System, op; kwargs...) + +Construct a `LinearProblem` from a ModelingToolkit `System` for linear systems. + +## Additional Keyword Arguments + +Beyond the arguments listed below, this constructor accepts all keyword arguments +supported by the LinearSolve.jl `solve` function. For a complete list +and detailed descriptions, see the [ModelingToolkit.jl problem building documentation](https://docs.sciml.ai/ModelingToolkit/stable/API/problems/) +and the [LinearSolve.jl documentation](https://docs.sciml.ai/LinearSolve/stable/). + +## Arguments +- `sys::System`: The ModelingToolkit system to convert (linear system) +- `op`: Operating point/initial conditions + +## Keywords +- `check_length=true`: Whether to check length compatibility +- `expression=Val{false}`: Expression evaluation mode +- `check_compatibility=true`: Whether to check system compatibility +- `sparse=false`: Whether to use sparse arrays +- `eval_expression=false`: Whether to evaluate expressions +- `eval_module=@__MODULE__`: Module for expression evaluation +- `checkbounds=false`: Whether to enable bounds checking +- `cse=true`: Whether to perform common subexpression elimination +- `u0_constructor=identity`: Constructor for initial conditions +- `u0_eltype=nothing`: Element type for initial conditions +- `kwargs...`: Additional keyword arguments passed to the solver +""" function SciMLBase.LinearProblem{iip}( sys::System, op; check_length = true, expression = Val{false}, check_compatibility = true, sparse = false, eval_expression = false, diff --git a/src/problems/nonlinearproblem.jl b/src/problems/nonlinearproblem.jl index 093e8db762..c65891aa33 100644 --- a/src/problems/nonlinearproblem.jl +++ b/src/problems/nonlinearproblem.jl @@ -54,6 +54,28 @@ return maybe_codegen_scimlfn(expression, NonlinearFunction{iip, spec}, args; kwargs...) end +""" + NonlinearProblem(sys::System, op; kwargs...) + +Construct a `NonlinearProblem` from a ModelingToolkit `System` for nonlinear equations. + +## Additional Keyword Arguments + +Beyond the arguments listed below, this constructor accepts all keyword arguments +supported by the NonlinearSolve.jl `solve` function. For a complete list +and detailed descriptions, see the [ModelingToolkit.jl problem building documentation](https://docs.sciml.ai/ModelingToolkit/stable/API/problems/) +and the [NonlinearSolve.jl documentation](https://docs.sciml.ai/NonlinearSolve/stable/). + +## Arguments +- `sys::System`: The ModelingToolkit system to convert (nonlinear system) +- `op`: Operating point/initial guess + +## Keywords +- `expression=Val{false}`: Expression evaluation mode +- `check_length=true`: Whether to check length compatibility +- `check_compatibility=true`: Whether to check system compatibility +- `kwargs...`: Additional keyword arguments passed to the solver +""" @fallback_iip_specialize function SciMLBase.NonlinearProblem{iip, spec}( sys::System, op; expression = Val{false}, check_length = true, check_compatibility = true, kwargs...) where {iip, spec} diff --git a/src/problems/odeproblem.jl b/src/problems/odeproblem.jl index 68a38c95cf..cba8214520 100644 --- a/src/problems/odeproblem.jl +++ b/src/problems/odeproblem.jl @@ -69,6 +69,32 @@ maybe_codegen_scimlfn(expression, ODEFunction{iip, spec}, args; kwargs...) end +""" + ODEProblem(sys::System, op, tspan; kwargs...) + +Construct an `ODEProblem` from a ModelingToolkit `System`. + +## Additional Keyword Arguments + +Beyond the arguments listed below, this constructor accepts all keyword arguments +supported by the DifferentialEquations.jl `solve` function. For a complete list +and detailed descriptions, see the [ModelingToolkit.jl problem building documentation](https://docs.sciml.ai/ModelingToolkit/stable/API/problems/) +and the [DifferentialEquations.jl solve documentation](https://docs.sciml.ai/DiffEqDocs/stable/basics/common_solver_opts/). + +## Arguments +- `sys::System`: The ModelingToolkit system to convert +- `op`: Operating point/initial conditions +- `tspan`: Time span for the problem + +## Keywords +- `callback=nothing`: Callback functions for the solver +- `check_length=true`: Whether to check length compatibility +- `eval_expression=false`: Whether to evaluate expressions +- `expression=Val{false}`: Expression evaluation mode +- `eval_module=@__MODULE__`: Module for expression evaluation +- `check_compatibility=true`: Whether to check system compatibility +- `kwargs...`: Additional keyword arguments passed to the solver +""" @fallback_iip_specialize function SciMLBase.ODEProblem{iip, spec}( sys::System, op, tspan; callback = nothing, check_length = true, eval_expression = false, diff --git a/src/problems/optimizationproblem.jl b/src/problems/optimizationproblem.jl index 978f973d83..436739680d 100644 --- a/src/problems/optimizationproblem.jl +++ b/src/problems/optimizationproblem.jl @@ -88,6 +88,29 @@ function SciMLBase.OptimizationProblem(sys::System, args...; kwargs...) return OptimizationProblem{true}(sys, args...; kwargs...) end +""" + OptimizationProblem(sys::System, op; kwargs...) + +Construct an `OptimizationProblem` from a ModelingToolkit `System` for optimization. + +## Additional Keyword Arguments + +Beyond the arguments listed below, this constructor accepts all keyword arguments +supported by the Optimization.jl `solve` function. For a complete list +and detailed descriptions, see the [ModelingToolkit.jl problem building documentation](https://docs.sciml.ai/ModelingToolkit/stable/API/problems/) +and the [Optimization.jl documentation](https://docs.sciml.ai/Optimization/stable/). + +## Arguments +- `sys::System`: The ModelingToolkit system to convert (optimization system with cost and constraints) +- `op`: Operating point/initial guess + +## Keywords +- `lb=nothing`: Lower bounds for optimization variables +- `ub=nothing`: Upper bounds for optimization variables +- `check_compatibility=true`: Whether to check system compatibility +- `expression=Val{false}`: Expression evaluation mode +- `kwargs...`: Additional keyword arguments passed to the solver +""" function SciMLBase.OptimizationProblem{iip}( sys::System, op; lb = nothing, ub = nothing, check_compatibility = true, expression = Val{false}, diff --git a/src/problems/sdeproblem.jl b/src/problems/sdeproblem.jl index e322775d2b..3fefac6ef2 100644 --- a/src/problems/sdeproblem.jl +++ b/src/problems/sdeproblem.jl @@ -64,6 +64,34 @@ return maybe_codegen_scimlfn(expression, SDEFunction{iip, spec}, args; kwargs...) end +""" + SDEProblem(sys::System, op, tspan; kwargs...) + +Construct an `SDEProblem` from a ModelingToolkit `System` with noise. + +## Additional Keyword Arguments + +Beyond the arguments listed below, this constructor accepts all keyword arguments +supported by the DifferentialEquations.jl `solve` function. For a complete list +and detailed descriptions, see the [ModelingToolkit.jl problem building documentation](https://docs.sciml.ai/ModelingToolkit/stable/API/problems/) +and the [DifferentialEquations.jl solve documentation](https://docs.sciml.ai/DiffEqDocs/stable/basics/common_solver_opts/). + +## Arguments +- `sys::System`: The ModelingToolkit system to convert (must contain noise equations) +- `op`: Operating point/initial conditions +- `tspan`: Time span for the problem + +## Keywords +- `callback=nothing`: Callback functions for the solver +- `check_length=true`: Whether to check length compatibility +- `eval_expression=false`: Whether to evaluate expressions +- `eval_module=@__MODULE__`: Module for expression evaluation +- `check_compatibility=true`: Whether to check system compatibility +- `sparse=false`: Whether to use sparse arrays +- `sparsenoise=sparse`: Whether to use sparse noise representation +- `expression=Val{false}`: Expression evaluation mode +- `kwargs...`: Additional keyword arguments passed to the solver +""" @fallback_iip_specialize function SciMLBase.SDEProblem{iip, spec}( sys::System, op, tspan; callback = nothing, check_length = true, eval_expression = false,