OptimizationSystem
System Constructors
ModelingToolkit.OptimizationSystem
— Typestruct OptimizationSystem <: ModelingToolkit.AbstractOptimizationSystem
A scalar equation for optimization.
Fields
tag
: A tag for the system. If two systems have the same tag, then they are structurally identical.
op
: Objective function of the system.unknowns
: Unknown variables.ps
: Parameters.var_to_name
: Array variables.observed
: Observed equations.constraints
: List of constraint equations of the system.name
: The name of the system.description
: A description of the system.systems
: The internal systems. These are required to have unique names.defaults
: The default values to use when initial guess and/or parameters are not supplied inOptimizationProblem
.
metadata
: Metadata for the system, to be used by downstream packages.
gui_metadata
: Metadata for MTK GUI.
namespacing
: If false, thensys.x
no longer performs namespacing.
complete
: If true, denotes the model will not be modified any further.
index_cache
: Cached data for fast symbolic indexing.
parent
: The hierarchical parent system before simplification.
isscheduled
Examples
@variables x y z
@parameters a b c
obj = a * (y - x) + x * (b - z) - y + x * y - c * z
cons = [x^2 + y^2 ≲ 1]
@named os = OptimizationSystem(obj, [x, y, z], [a, b, c]; constraints = cons)
Composition and Accessor Functions
get_op(sys)
: The objective to be minimized.get_unknowns(sys)
orunknowns(sys)
: The set of unknowns for the optimization.get_ps(sys)
orparameters(sys)
: The parameters for the optimization.get_constraints(sys)
orconstraints(sys)
: The constraints for the optimization.
Transformations
Analyses
Applicable Calculation and Generation Functions
calculate_gradient
calculate_hessian
generate_gradient
generate_hessian
hessian_sparsity
Problem Constructors
SciMLBase.OptimizationProblem
— MethodDiffEqBase.OptimizationProblem{iip}(sys::OptimizationSystem, u0map,
parammap = DiffEqBase.NullParameters();
grad = false,
hess = false, sparse = false,
cons_j = false, cons_h = false,
checkbounds = false,
linenumbers = true, parallel = SerialForm(),
kwargs...) where {iip}
Generates an OptimizationProblem from an OptimizationSystem and allows for automatically symbolically calculating numerical enhancements.
Certain solvers require setting cons_j
, cons_h
to true
for constrained-optimization problems.
Expression Constructors
ModelingToolkit.OptimizationProblemExpr
— TypeDiffEqBase.OptimizationProblemExpr{iip}(sys::OptimizationSystem,
parammap = DiffEqBase.NullParameters();
u0 = nothing,
grad = false,
hes = false, sparse = false,
checkbounds = false,
linenumbers = true, parallel = SerialForm(),
kwargs...) where {iip}
Generates a Julia expression for an OptimizationProblem from an OptimizationSystem and allows for automatically symbolically calculating numerical enhancements.