DynamicBoundsBase.jl: An extensible abstraction layer for DynamicBounds
Current supported problem types and constructors:
DynamicBoundsBase.AbstractDERelaxProblem
— Typeabstract type AbstractDERelaxProblem
Abstract supertype for all relaxation problems.
DynamicBoundsBase.AbstractODERelaxProblem
— TypeAbstractODERelaxProblem
Abstract type for problems used to construct relaxations of parametric ODEs.
DynamicBoundsBase.ODERelaxProb
— Typemutable struct ODERelaxProb{F, JX, JP, xType, K} <: AbstractODERelaxProblem
A structure used to hold a parametric ODEs problem.
f::Any
Right-hand side function.
Jx!::Any
Jacobian of rhs w.r.t x.
Jp!::Any
Jacobian of rhs w.r.t p.
x0::Any
Initial condition function.
xL::Vector{Float64}
Lower constant state bound storage.
xU::Vector{Float64}
Upper constant state bound storage.
tspan::Tuple{Float64, Float64}
Time span of integration.
tsupports::Vector{Float64}
Support points: Points 'x' values will be queried.
p::Vector{Float64}
Point to relax/bound in over the decision space.
pL::Vector{Float64}
Lower bounds of the decision space.
pU::Vector{Float64}
Upper bounds of the decision space.
user_Jx::Bool
Problem has a user-defined Jacobian of the rhs w.r.t x
user_Jp::Bool
Problem has a user-defined Jacobian of the rhs w.r.t p
user_state_bnd::Bool
Constant user state bounds have been set
variable_state_bnd::Bool
Variable user state bounds have been set
nx::Int64
State space dimension
np::Int64
Decision space dimension
params::Vector{Float64}
Optional keywork argument: Indicates the rhs function and the initial condition function take an additional argument
param
. For example, it is nowf!(dx, x, p, param)
.polyhedral_constraint::Union{Nothing, PolyhedralConstraint}
Storage for polyhedral constraint, if any
constant_state_bounds::Union{Nothing, ConstantStateBounds}
Storage for the constant state bounds, if any
support_set::SupportSet{Float64}
The support set if used
kwargs::Any
Additional keyword arguments
Problem attributes
DynamicBoundsBase.AbstractRelaxProblemAttribute
— Typeabstract type AbstractRelaxProblemAttribute
Abstract supertype for all problem attributes.
DynamicBoundsBase.HasStateBounds
— Typestruct HasStateBounds <: AbstractRelaxProblemAttribute
A problem attribute used to check whether state bounds are defined.
DynamicBoundsBase.HasConstantStateBounds
— Typestruct HasConstantStateBounds <: AbstractRelaxProblemAttribute
A problem attribute used to check whether state bounds are defined as constant.
DynamicBoundsBase.HasVariableStateBounds
— Typestruct HasVariableStateBounds <: AbstractRelaxProblemAttribute
A problem attribute used to check whether variable state bounds are defined.
DynamicBoundsBase.HasUserJacobian
— Typestruct HasUserJacobian <: AbstractRelaxProblemAttribute
A problem attribute used to check whether a user-defined jacobian was specified.
DynamicBoundsBase.AbstractPathConstraint
— Typeabstract type AbstractPathConstraint <: AbstractRelaxProblemAttribute
An abstract supertype for all manners of path constraints.
DynamicBoundsBase.ConstantStateBounds
— Typestruct ConstantStateBounds <: AbstractRelaxProblemAttribute
A problem attribute used to store constant state bounds.
xL::Vector{Float64}
Lower state variable bounds
xU::Vector{Float64}
Upper state variable bounds
DynamicBoundsBase.VariableStateBounds
— Typestruct VariableStateBounds{F1<:Function, F2<:Function} <: AbstractRelaxProblemAttribute
A problem attribute used to store time-varying state bounds.
xL::Function
Lower state variable bounds
xU::Function
Upper state variable bounds
DynamicBoundsBase.PolyhedralConstraint
— Typestruct PolyhedralConstraint <: AbstractPathConstraint
An object used to specify that the invariant Ax(t,p) <= b
is valid fo all t
.
DynamicBoundsBase.StateNumber
— Typestruct StateNumber
An integrator attribute retrieving the number of state variables (x
) aka nx
.
DynamicBoundsBase.ConstantParameterValue
— Typestruct ConstantParameterValue <: AbstractIntegratorAttribute
A integrator attribute used to access the constant parameter values.
DynamicBoundsBase.ParameterNumber
— Typestruct ParameterNumber
An integrator attribute retrieving the number of parameter variables (p
) aka np
.
DynamicBoundsBase.SupportNumber
— Typestruct SupportNumber
An integrator attribute retrieving the number of points in the support set of (x
) aka nt
.
Abstract Integrator Types
DynamicBoundsBase.AbstractDERelaxIntegrator
— Typeabstract type AbstractDERelaxIntegrator
Abstract supertype for any integrator that constructs relaxations of a differential equation problem.
DynamicBoundsBase.AbstractODERelaxIntegrator
— Typeabstract type AbstractODERelaxIntegrator <: AbstractDERelaxIntegrator
Abstract supertype for any integrator that constructs relaxations of an ordinary differential equation problem.
Bound locations for use with attributes such as Relaxation, Bound, Gradient. For Gradient{T<:AbstractBoundLoc}
, T = Lower
indicates the gradient of the lower relaxation (that is the convex relaxation) should be returned, T = Upper
indicates that the upper relaxation (the concave relaxation) should be returned, T = Nominal
indicates that the gradient of the local evaluation of the relaxation should be returned at the present parameter value.
DynamicBoundsBase.AbstractBoundLoc
— Typeabstract type AbstractBoundLoc
Abstract supertype indicating the type of value returned at a specific index.
DynamicBoundsBase.Lower
— Typestruct Lower <: AbstractBoundLoc
Indicates the lower bound, relaxation, or (sub)gradient should be returned.
DynamicBoundsBase.Upper
— Typestruct Upper <: AbstractBoundLoc
Indicates the upper bound, relaxation, or (sub)gradient should be returned.
DynamicBoundsBase.Nominal
— Typestruct Nominal <: AbstractBoundLoc
Indicates the nominal value or (sub)gradient should be returned.
DynamicBoundsBase.Undefined
— Typestruct Undefined <: AbstractBoundLoc
The variety of the attribute is unspecified.
Integrator attributes
DynamicBoundsBase.AbstractIntegratorAttribute
— Typeabstract type AbstractIntegratorAttribute
Abstract supertype for attributes that can be used to set
or get
attributes (properties) of variables in the model.
DynamicBoundsBase.AbstractDynamicIndex
— Typeabstract type AbstractDynamicIndex
An abstract supertype for index structures needed to reference parameters or time.
DynamicBoundsBase.TimeIndex
— Typestruct TimeIndex
A time index t
used to access the value at t.i
-th time point.
DynamicBoundsBase.IntegratorName
— Typestruct IntegratorName <: AbstractIntegratorAttribute
An integrator attribute for the string identifying the integration scheme.
DynamicBoundsBase.IsNumeric
— Typestruct IsNumeric <: AbstractIntegratorAttribute
An integrator attribute for indicating bounds/relaxations are of numeric solution.
DynamicBoundsBase.IsSolutionSet
— Typestruct IsSolutionSet <: AbstractIntegratorAttribute
An integrator attribute for indicating bounds & relaxations are of exact solution.
DynamicBoundsBase.TerminationStatus
— Typestruct TerminationStatus <: AbstractIntegratorAttribute
A integrator attribute used to query the TerminationStatusCode
of the integrator on completion. Current termination status codes are:
COMPLETED
: The algorithm terminate successfully with bounds and relaxations.EMPTY
: The algorithm terminated successfully but the solution set was empty for some points intspan
.NAN
: The algorithm terminated but some values are not a number (usually indicating a domain violation was encoutered when computing relaxations).RELAXATION_NOT_CALLED
: The relaxation has not yet been computed.NUMERICAL_ERROR
: A numerical error was encountered.LIMIT_EXCEEDED
: A preset limit was exceeded (number of steps and so on).INVALID_OPTION
: An invalid option was set.OTHER_ERROR
: Another error was encountered.
DynamicBoundsBase.Value
— Typestruct Value <: AbstractIntegratorAttribute
An integrator attribute for value of local solution bounds.
DynamicBoundsBase.SupportSet
— Typestruct SupportSet{T<:AbstractFloat} <: AbstractIntegratorAttribute
A integrator attribute used to access independent variable support set.
DynamicBoundsBase.ParameterValue
— Typestruct ParameterValue <: AbstractIntegratorAttribute
A integrator attribute used to access the current parameter value.
DynamicBoundsBase.ParameterBound
— Typestruct ParameterBound{T<:AbstractBoundLoc} <: AbstractIntegratorAttribute
A integrator attribute used to access the current parameter value.
DynamicBoundsBase.Bound
— Typestruct Bound{T<:AbstractBoundLoc} <: AbstractIntegratorAttribute
An integrator attribute for state bounds.
DynamicBoundsBase.Relaxation
— Typestruct Relaxation{T<:AbstractBoundLoc} <: AbstractIntegratorAttribute
An integrator attribute for relaxations.
DynamicBoundsBase.Gradient
— Typestruct Gradient{T<:AbstractBoundLoc} <: AbstractIntegratorAttribute
An integrator attribute for the Gradient.
DynamicBoundsBase.Subgradient
— Typestruct Subgradient{T<:AbstractBoundLoc} <: AbstractIntegratorAttribute
An integrator attribute for the Subgradient.
DynamicBoundsBase.LocalIntegrator
— Typestruct LocalIntegrator <: AbstractIntegratorAttribute
Retreives the LocalIntegrator that corresponds to the integration method used by the integrator.
DynamicBoundsBase.AttachedProblem
— Typestruct AttachedProblem <: AbstractIntegratorAttribute
Retreives the problem used by the integrator.
DynamicBoundsBase.LocalSensitivityOn
— Typestruct LocalSensitivityOn <: AbstractIntegratorAttribute
Set to true
if integrator should compute derivatives wrt p for the local ode integration.
The following constructors for integrator attributes are given below with T<:AbstractBoundLoc
. The TimeIndex
constructor is used to specify that the time point referenced using an integer (i.e. the first, second, or fifth time in the support set). The subgradient of the concave relaxation at the third point in the support set is then referenced using the command Subgradient{Upper}(TimeIndex(3))
whereas the subgradient of the concave relaxation at time 0.35
is referenced using Subgradient{Upper}(0.35)
. A full list of the AbstractIntegratorAttribute
structures using this constructor are list below:
Gradient{T}(i::TimeIndex)
Gradient{T}(x::Float64)
Subgradient{T}(i::TimeIndex)
Subgradient{T}(x::Float64)
Bound{T}(i::TimeIndex)
Bound{T}(x::Float64)
Relaxation{T}(i::TimeIndex)
Relaxation{T}(x::Float64)
Access and Interface Functions:
DynamicBoundsBase.supports
— Functionsupports
Return a Bool
indicating whether ::AbstractDERelaxIntegrator
supports the ::Union{AbstractDERelaxIntegrator, AbstractDERelaxProblem}
.
Base.get
— Functionget
Returns the value of attribute set for the ::Union{AbstractDERelaxIntegrator, AbstractDERelaxProblem}
. May be vector valued.
DynamicBoundsBase.getall
— Functiongetall
An version of get
which retreives all data asssociated with a particular integrator attribute.
DynamicBoundsBase.getall!
— Functiongetall!
An in-place version of get!
which retreives all data asssociated with a particular integrator attribute.
DynamicBoundsBase.set!
— Functionset!
Assigns a value
to the attr
attribute of the integrator, problem, or relaxation.
DynamicBoundsBase.setall!
— Functionsetall!
An in-place version of set!
which sets all data asssociated with a particular integrator attribute.
DynamicBoundsBase.relax!
— Functionrelax!
Computes the relaxation at the current parameter value with the current parameter and state bounds.
DynamicBoundsBase.integrate!
— Functionintegrate!
Provides a real-value integration at the current value set for each parameter.
General utilities:
DynamicBoundsBase.IntegratorStates
— Typemutable struct IntegratorStates
A structure that holds the state of the integrator.
first_pnt_eval::Bool
Has the first point been evaluated
new_decision_box::Bool
Have the box-constraints changed since the last evaluation
new_decision_pnt::Bool
Has the decision point changed since the last evaluation
set_lower_state::Bool
The relaxed problem has been updated
set_upper_state::Bool
The local problem has been updated
termination_status::TerminationStatusCode
How did the integrator terminate
DynamicBoundsBase.UnsupportedError
— TypeUnsupportedError <: Exception
Abstract type for error thrown when an element is not supported by the integrator.
DynamicBoundsBase.NotAllowedError
— TypeNotAllowedError <: Exception
Abstract type for error thrown when an operation is supported but cannot be applied in the current state of the integrator .
DynamicBoundsBase.UnsupportedRelaxAttribute
— Typestruct UnsupportedRelaxAttribute{AttrType<:Union{AbstractIntegratorAttribute, AbstractRelaxProblemAttribute}} <: UnsupportedError
An error indicating that the attribute attr
is unsupported.
DynamicBoundsBase.SetRelaxAttributeNotAllowed
— Typestruct SetRelaxAttributeNotAllowed{AttrType<:Union{AbstractIntegratorAttribute, AbstractRelaxProblemAttribute}} <: NotAllowedError
An error indicating that the attribute attr
is supported but cannot be set for some reason given in the error string.