API Reference

JuDO.BoundaryConditionExpr — Type
BoundaryConditionExpr{L,R} <: JuMP.AbstractJuMPScalar

A boundary condition expression representing conditions on the initial or final values of variables or phases.

source
JuDO.BoundaryOperator — Type
BoundaryOperator()

A boundary operator representing either the initial or final value of a variable or phase.

source
JuDO.DerivativeTerm — Type
DerivativeTerm <: JuMP.AbstractJuMPScalar

Represents the time-derivative of a DynamicVarRef, optionally scaled by a coefficient. Created by calling derivative(x) on a dynamic variable.

Fields

  • var: the DynamicVarRef being differentiated.
  • coef: scalar multiplier (default 1.0).
source
JuDO.DyBoundaryConstraint — Type
DyBoundaryConstraint <: JuMP.AbstractConstraint

Internal constraint object produced by JuMP.build_constraint when a BoundaryConditionExpr is constrained with ==, <=, or >=. Holds the parsed boundary expression and the MOI set encoding the right-hand side.

Fields

  • expr: the BoundaryConditionExpr representing the boundary condition.
  • set: an MOI scalar set (EqualTo, LessThan, or GreaterThan).
source
JuDO.DynamicAffExpr — Type
DynamicAffExpr{Ctype, Vtype} <: JuMP.AbstractJuMPScalar

An affine expression over dynamic variables of the form

constant + Σ coeff_i * var_i

where each var_i is a DynamicVarRef. Produced automatically by arithmetic operations such as x + 2.0 or 3*x - y.

Fields

  • constant: scalar offset of type Ctype (typically Float64).
  • terms: ordered mapping from each DynamicVarRef to its coefficient.
source
JuDO.DynamicQuadExpr — Type
DynamicQuadExpr{Ctype, Vtype} <: JuMP.AbstractJuMPScalar

A quadratic expression over dynamic variables of the form

affine_part + Σ coeff_ij * var_i * var_j

Produced automatically by operations such as x * y or x^2.

Fields

  • aff: the affine part as a DynamicAffExpr.
  • terms: ordered mapping from JuMP.UnorderedPair{Vtype} to its coefficient.
source
JuDO.DynamicVar — Type
DynamicVar <: JuMP.AbstractVariable

Represents a single dynamic (state or control) variable that evolves continuously over a given phase. Stores JuMP-level bound information plus JuDO-specific fields for initial/final point values and trajectory bounds.

Fields

  • Jumpinfo: standard JuMP VariableInfo carrying lower/upper bounds.
  • Phase: integer index of the phase this variable belongs to.
  • Initial_value: optional fixed value at the start of the phase.
  • Final_value: optional fixed value at the end of the phase.
  • Trajectory_bound: two-element vector [lb, ub] bounding the trajectory.
source
JuDO.Integral — Type
Integral <: JuMP.AbstractJuMPScalar

Represents a definite integral of a dynamic expression over a phase, used to express Lagrange (running-cost) objectives. Created via the integral() function.

Fields

  • expr: the integrand as a JuMP scalar expression.
  • phase: integer index of the phase over which the integral is taken.
source
JuDO.NonlinearExpr — Type
NonlinearExpr <: JuMP.AbstractJuMPScalar

An expression tree node used to represent nonlinear dynamic expressions that cannot be captured by DynamicAffExpr or DynamicQuadExpr. Mirrors the structure of Julia's Expr type.

Fields

  • head: node type, typically :call.
  • args: vector whose first element is the operator Symbol (e.g. :sin, :*) and whose remaining elements are sub-expressions or numbers.
source
JuDO.Phase — Type
Phase

A sentinel type used to tag a JuDO phase object. It carries no data and is used internally to distinguish phase-related dispatch.

source
JuDO.PhaseVar — Type
PhaseVar <: JuMP.AbstractVariable

Stores the user-specified bounds for a phase (the independent variable domain, usually time). The Initial and Final fields hold the start and end values of the domain, which may be fixed numbers or free JuMP.VariableRefs.

Fields

  • Initial: lower bound of the phase domain (-Inf if unbounded).
  • Final: upper bound of the phase domain (Inf if unbounded).
source
JuDO.PhaseVarRef — Type
PhaseVarRef{M<:JuMP.AbstractModel} <: JuMP.AbstractVariableRef

A reference to a phase that has been registered in a DynModel. Holds a pointer to the parent model, an integer index, and the symbolic name assigned by the @phase macro.

Fields

  • model: the DynModel that owns this phase.
  • Index: integer position of the phase in the model's internal registry.
  • name: the Symbol used as the phase identifier (e.g. :t).
source
JuDO.DynModel — Method
DynModel(args...; kwargs...) -> JuMP.Model

Construct a dynamic optimization model. DynModel wraps a standard JuMP.Model and initialises the internal data structures required for dynamic optimization:

  • :Phases / :Phasenum — registry of phases and their count.
  • :variables / :varnum — registry of dynamic variables and their count.
  • :phase_name_to_idx / :var_name_to_idx — name-to-index lookup dictionaries.

Any positional or keyword arguments are forwarded to JuMP.Model, so an optimizer can be attached at construction time:

using JuDO, Interesso
model = DynModel(Interesso.Optimizer)
source
JuDO.dyn_value — Method
value(m::JuMP.Model, var::DynamicVarRef)
Get the value of a dynamic variable.
source
JuDO.final — Method
final(x) -> BoundaryOperator

Return a BoundaryOperator that evaluates x at the end of its phase. Use inside @constraint or @objective:

@constraint(model, final(x) == 1.0)
@objective(model, Max, final(altitude))
source
JuDO.get_phase — Method
get_phase(model) -> OrderedDict{Int, PhaseVar}

Return the ordered dictionary mapping phase indices to their PhaseVar data stored in model.

source
JuDO.get_phasenum — Method
get_phasenum(model) -> Dict{Symbol, Int}

Return the counter dictionary (key :phase) tracking how many phases have been added to model.

source
JuDO.get_solutions — Method
get_solutions(m::JuMP.Model)

Return a dictionary mapping dynamic variable names to their solutions.

source
JuDO.get_var — Method
get_var(model) -> OrderedDict{Int, DynamicVar}

Return the ordered dictionary mapping variable indices to their DynamicVar data stored in model.

source
JuDO.get_varnum — Method
get_varnum(model) -> Dict{Symbol, Int}

Return the counter dictionary (key :var) tracking how many dynamic variables have been added to model.

source
JuDO.initial — Method
initial(x) -> BoundaryOperator

Return a BoundaryOperator that evaluates x at the start of its phase. Use inside @constraint or @objective:

@constraint(model, initial(x) == 0.0)
@objective(model, Min, initial(fuel))
source
JuDO.integral — Method
JuMP.integral(expr::JuMP.AbstractJuMPScalar, phase::Int) -> Integral

Creates an integral representation for the given expression and phase.

source
JuDO.optimize! — Method
optimize!(m::JuMP.Model)

Optimize the model. Keyword arguments are a convenience shorthand for calling

JuMP.set_attribute individually before optimizing.

source
JuDO.phase_final — Method
phase_final(t::PhaseVarRef)

Returns the final time of the phase t.

  • If the final time is fixed (e.g., final(t) == 10), returns that value.
  • If the final time is free/optimized (e.g., final(t) <= 10), queries the solver for the result.
source
JuDO.phase_initial — Method
phase_initial(t::PhaseVarRef)

Returns the initial time of the phase t defined in the model.

source
JuDO.to_NDF — Function
to_NDF(f::AbstractDynamicFunction)

Convert an AbstractDynamicFunction into its NonlinearDynamicFunction equivalent.

This function builds a nested expression tree to represent the input function.

source
JuDO.warmstart! — Method
warmstart!(m::DynModel, interpolant::DOI.AbstractDynamicSolution, var::DynamicVarRef)
set the interpolant for a dynamic variable in the model
source
JuMP.derivative — Method
derivative(x::DynamicVarRef) -> DerivativeTerm

Return a DerivativeTerm representing the derivative of the dynamic variable x with respect to its phase domain (e.g. time). Use this inside a @constraint to specify differential equations:

@constraint(model, derivative(x) == -x + u)
source
JuMP.set_attribute — Method
JuMP.set_attribute(m::JuMP.Model, ::DOI.GeneralBounds, value::DOI.AbstractBounds)

Set the bounds enforcement strategy. value must subtype DOI.AbstractBounds. Refer to the attached solver's documentation for supported concrete types (e.g. ExactBounds(), BernsteinBounds()).

source
JuMP.set_attribute — Method
JuMP.set_attribute(m::JuMP.Model, ::DOI.GeneralIntervals, value::DOI.AbstractIntervals)

Set the mesh interval structure. value must subtype DOI.AbstractIntervals. Refer to the attached solver's documentation for supported concrete types (e.g. FixedIntervals(n), FlexibleIntervals(n, flexibility)).

source
JuMP.set_attribute — Method
JuMP.set_attribute(m::JuMP.Model, ::DOI.GeneralMethod, value::DOI.AbstractMethod)

Set the discretization method. value must subtype DOI.AbstractMethod. Refer to the attached solver's documentation for supported concrete types (e.g. Collocation(), DAIR(n)).

source
JuMP.set_attribute — Method
JuMP.set_attribute(m::JuMP.Model, ::DOI.GeneralPoints, value::DOI.AbstractPoints)

Set the collocation point scheme. value must subtype DOI.AbstractPoints. Refer to the attached solver's documentation for supported concrete types (e.g. LGRPoints(n), LGLPoints(n)).

source
JuMP.set_attribute — Method
JuMP.set_attribute(m::JuMP.Model, attr::MOI.AbstractOptimizerAttribute, value)

Generic fallback for any backend-specific MOI.AbstractOptimizerAttribute not covered by a more specific overload (e.g. CTDirectDOI.GridSize, CTDirectDOI.DiscMethod).

source
JuMP.set_attribute — Method
JuMP.set_attribute(m::JuMP.Model, ::MOI.Silent, value::Bool)

Silence (or un-silence) the inner NLP solver. Routes to the inner optimizer rather than the Interesso layer, since MOI.Silent is an NLP-solver attribute.

set_attribute(model, MOI.Silent(), true)   # suppress Ipopt output
set_attribute(model, MOI.Silent(), false)  # restore Ipopt output
source
JuDO.@phase — Macro
@phase(model, name)
@phase(model, name, start, stop)

Register a new phase (independent variable domain) in model under the identifier name.

  • Unbounded form — @phase(model, t): creates a phase with bounds [-Inf, Inf]. Use this when the start or end time will be determined by the optimizer or set later via boundary constraints.
  • Bounded form — @phase(model, t, 0, 10): fixes the phase domain to [start, stop] and immediately adds the corresponding equality constraints to the backend.

Returns a PhaseVarRef that can be passed to @variable, initial, final, and other JuDO functions.

Examples

model = DynModel(Interesso.Optimizer)

@phase(model, t)           # free phase
@phase(model, t, 0.0, 1.0) # fixed phase from 0 to 1
source