Skip to content

Private API

This page lists non-exported (internal) symbols of CTSolvers.Integrators, CTSolversCUDA, CTSolversSciMLIntegrator, CTSolversMadNCL, CTSolversEnzyme, CTSolvers.Optimization, CTSolversKnitro, CTSolvers.Solvers, CTSolvers.Modelers, CTSolversMadNLPGPU, CTSolvers.DOCP, CTSolversOrdinaryDiffEqTsit5, CTSolversMadNLP, CTSolversUno, CTSolversZygote, CTSolversForwardDiff, CTSolversIpopt.


From CTSolvers.Integrators

__consistent_initial_condition [Function]

CTSolvers.Integrators.__consistent_initial_condition Function
julia
__consistent_initial_condition(
    _::Type{<:CTBase.Strategies.AbstractStrategyParameter},
    u0
) -> Bool

Check whether an initial condition u0 is consistent with the execution parameter P of a SciML{P} integrator.

Mirrors Modelers.__consistent_backend: the default returns true (all combinations allowed); the CTSolversCUDA extension adds the device-aware methods that flag a CuArray u0 under SciML{CPU}, or a host Array u0 under SciML{GPU}. The seam is defined here, next to the integrator; the consuming package (e.g. CTFlows) calls it where a concrete u0 is available (problem construction / solve), since SciML does not receive u0 at build time.

Arguments

  • parameter_type::Type{<:AbstractStrategyParameter}: CPU or GPU.

  • u0: The initial condition array to check.

Returns

  • Bool: true if consistent, false otherwise.

See also: CTSolvers.Integrators.SciML, CTBase.Strategies.CPU, CTBase.Strategies.GPU.

julia
__consistent_initial_condition(
    _::Type{CTBase.Strategies.CPU},
    u0::AnyCuArray
) -> Bool

A device CuArray initial condition is inconsistent with a SciML{CPU} integrator.

Overrides the true-returning stub in CTSolvers.Integrators. Other host-array cases fall through to the default (returns true).

julia
__consistent_initial_condition(
    _::Type{CTBase.Strategies.GPU},
    u0::Array
) -> Bool

A host Array initial condition is inconsistent with a SciML{GPU} integrator (the state must live on the device).

Overrides the true-returning stub in CTSolvers.Integrators.

julia
__consistent_initial_condition(
    _::Type{CTBase.Strategies.GPU},
    u0::AnyCuArray
) -> Bool

A device CuArray initial condition is consistent with a SciML{GPU} integrator.

__default_sciml_algorithm [Function]

CTSolvers.Integrators.__default_sciml_algorithm Function
julia
__default_sciml_algorithm(
    _::Type{<:CTBase.Core.AbstractTag}
) -> Tsit5{typeof(OrdinaryDiffEqCore.trivial_limiter!), typeof(OrdinaryDiffEqCore.trivial_limiter!), FastBroadcast.Serial}

Return the default SciML ODE algorithm for the given tag type.

This stub returns missing for the abstract tag type. The actual implementation for Tsit5Tag is provided by CTSolversOrdinaryDiffEqTsit5.

Returns

  • missing: Default stub implementation.

See also: CTSolvers.Integrators.SciML, CTSolvers.Integrators.Tsit5Tag.

julia
__default_sciml_algorithm(
    _::Type{<:CTSolvers.Integrators.Tsit5Tag}
) -> Tsit5{typeof(OrdinaryDiffEqCore.trivial_limiter!), typeof(OrdinaryDiffEqCore.trivial_limiter!), FastBroadcast.Serial}

Return the default SciML ODE algorithm (Tsit5) for Tsit5Tag.

Overrides the stub in src/Integrators/sciml.jl that returns missing.

See also: CTSolvers.Integrators.SciML, CTSolvers.Integrators.Tsit5Tag.

__unsafe [Function]

CTSolvers.Integrators.__unsafe Function
julia
__unsafe() -> Bool

Internal helper defining the default retcode-checking behavior. Returns false, meaning ODE solver retcodes are checked and failures throw exceptions unless explicitly bypassed.

deepvalue [Function]

CTSolvers.Integrators.deepvalue Function
julia
deepvalue(x::Number) -> Number

Extract the primal value from a number. Base case for scalar numbers.

This is a fallback implementation used when AD backends are not loaded. ForwardDiff-specific implementations are provided in CTSolversForwardDiff for recursive extraction from nested dual numbers.

Arguments

  • x::Number: A number (e.g., Float64, ComplexF64).

Returns

  • Number: The input value unchanged for real and complex numbers.

Notes

  • For ForwardDiff.Dual numbers, the more specific method in CTSolversForwardDiff recursively extracts the primal value via deepvalue(value(x)).

  • This method serves as the base case for all Number subtypes not handled by extensions.

See also: CTSolvers.Integrators.real_norm.

julia
deepvalue(x::ForwardDiff.Dual) -> Number

Recursively extract the primal (real) value from a ForwardDiff dual number.

Handles nested dual numbers for higher-order differentiation. Extends the fallback CTSolvers.Integrators.deepvalue to support ForwardDiff.

See also: CTSolvers.Integrators.deepvalue, CTSolvers.Integrators.real_norm.

real_norm [Function]

CTSolvers.Integrators.real_norm Function
julia
real_norm(u::Number, t) -> Any

Compute the internal norm for a scalar number.

This is a fallback implementation used when AD backends are not loaded. ForwardDiff-specific implementations are provided in CTSolversForwardDiff. The array overload (using DiffEqBase.ODE_DEFAULT_NORM) lives in the CTSolversSciMLIntegrator extension.

Arguments

  • u::Number: A scalar number (real or complex).

  • t: Time parameter (unused but required by the SciML interface).

Returns

  • Number: The absolute value for real numbers, or magnitude for complex numbers.

Notes

  • For real numbers, returns abs(u).

  • For complex numbers, returns abs(u) (the magnitude).

  • Used by SciML integrators for step-size control in grid-invariant computations.

See also: CTSolvers.Integrators.deepvalue.

julia
real_norm(u::ForwardDiff.Dual, t) -> Any

Compute the internal norm for a scalar ForwardDiff dual number using only its primal part.

Extends the fallback CTSolvers.Integrators.real_norm to support ForwardDiff dual numbers, ensuring grid invariance (IND) when integrating ODEs with dual numbers.

See also: CTSolvers.Integrators.real_norm, CTSolvers.Integrators.deepvalue.

julia
real_norm(u::AbstractArray, t) -> Any

Compute the internal norm for adaptive step-size control using only the primal parts of dual numbers.

Ensures grid invariance (IND) when integrating ODEs with ForwardDiff dual numbers: the adaptive time grid chosen by the solver is identical whether integrating with real or dual numbers. Uses CTSolvers.Integrators.deepvalue to extract primal parts and DiffEqBase.ODE_DEFAULT_NORM to compute the norm.

See also: CTSolvers.Integrators.deepvalue, CTSolvers.Integrators.real_norm.


From CTSolversSciMLIntegrator

SciMLIntegrationResult [Struct]

CTSolversSciMLIntegrator.SciMLIntegrationResult Type
julia
struct SciMLIntegrationResult{S<:SciMLBase.AbstractODESolution} <: CTSolvers.Integrators.AbstractIntegrationResult

Integration result from a SciML solver.

Wraps a SciMLBase.AbstractODESolution and implements the AbstractIntegrationResult interface.

Fields

  • ode_sol::S: The raw SciML ODE solution.

_AUTO_OPTION_KEYS [Constant]

CTSolversSciMLIntegrator._AUTO_OPTION_KEYS Constant

Tuple of option keys that support automatic resolution based on the integration kind.

These options use the :auto sentinel value in their metadata and are resolved during integrator construction into two cached dictionaries:

  • options_point: :autofalse (only the final state is needed)

  • options_trajectory: :autotrue (full trajectory storage needed)

Users can override automatic resolution by providing explicit true/false values when constructing the integrator.

See also: CTSolvers.Integrators.build_sciml_integrator.

_check_retcode [Function]

CTSolversSciMLIntegrator._check_retcode Function
julia
_check_retcode(sol, unsafe)

Check the return code of a SciML ODE solution and throw SolverFailure if integration failed.

Throws

  • CTBase.Exceptions.SolverFailure: If !unsafe and the retcode indicates failure.

_merged_retcode [Function]

CTSolversSciMLIntegrator._merged_retcode Function
julia
_merged_retcode(ode_sols) -> Any

Return the retcode to report for a merged multi-phase solution: the first non-successful retcode among ode_sols, or SciMLBase.ReturnCode.Success if every segment succeeded.

This keeps Integrators.status/Integrators.successful on a merged result truthful even when a segment was solved with unsafe=true (bypassing the retcode check at solve time).


From CTSolversMadNCL

base_type [Function]

CTSolversMadNCL.base_type Function
julia
base_type(
    _::MadNCL.NCLOptions{BaseType<:AbstractFloat}
) -> Type{BaseType} where BaseType<:AbstractFloat

Extract the base floating-point type from NCLOptions type parameter.

solve_with_madncl [Function]

CTSolversMadNCL.solve_with_madncl Function
julia
solve_with_madncl(
    nlp::AbstractNLPModel;
    ncl_options,
    kwargs...
)

Backend interface for MadNCL solver.

Calls MadNCL to solve the NLP problem.


From CTSolversKnitro

solve_with_knitro [Function]

CTSolversKnitro.solve_with_knitro Function
julia
solve_with_knitro(
    nlp::AbstractNLPModel;
    kwargs...
) -> SolverCore.GenericExecutionStats{T, S} where {T>:Float64, S>:Vector{Float64}}

Backend interface for Knitro solver.

Calls NLPModelsKnitro to solve the NLP problem.


From CTSolvers.Solvers

IpoptTag [Struct]

CTSolvers.Solvers.IpoptTag Type
julia
struct IpoptTag <: CTBase.Core.AbstractTag

Tag type for Ipopt-specific implementation dispatch.

KnitroTag [Struct]

CTSolvers.Solvers.KnitroTag Type
julia
struct KnitroTag <: CTBase.Core.AbstractTag

Tag type for Knitro-specific implementation dispatch.

MadNCLTag [Struct]

CTSolvers.Solvers.MadNCLTag Type
julia
struct MadNCLTag <: CTBase.Core.AbstractTag

Tag type for MadNCL-specific implementation dispatch.

MadNLPTag [Struct]

CTSolvers.Solvers.MadNLPTag Type
julia
struct MadNLPTag <: CTBase.Core.AbstractTag

Tag type for MadNLP-specific implementation dispatch.

UnoTag [Struct]

CTSolvers.Solvers.UnoTag Type
julia
struct UnoTag <: CTBase.Core.AbstractTag

Tag type for Uno-specific implementation dispatch.

__display [Function]

CTSolvers.Solvers.__display Function
julia
__display() -> Bool

Internal helper defining the default solver-display behavior.

__madnlp_suite_consistent_linear_solver [Function]

CTSolvers.Solvers.__madnlp_suite_consistent_linear_solver Function
julia
__madnlp_suite_consistent_linear_solver(
    _::Type{<:CTBase.Strategies.AbstractStrategyParameter},
    linear_solver::Type
) -> Bool

Check if linear solver is consistent with parameter type.

Arguments

  • parameter_type::Type{<:AbstractStrategyParameter}: CPU or GPU parameter

  • linear_solver::Type: Linear solver type

Returns

  • Bool: true if consistent, false otherwise

Notes

  • Default implementation returns true (all combinations allowed)

  • Specific implementations in extensions provide actual consistency checks

julia
__madnlp_suite_consistent_linear_solver(
    _::Type{<:CTBase.Strategies.AbstractStrategyParameter},
    _::Nothing
) -> Bool

Consistency check when the linear solver is unavailable (nothing).

Some MadNLPGPU versions bind MadNLPGPU.CUDSSSolver (and hence the GPU default linear solver) to nothing when CUDA is not functional. In that case there is no concrete solver type to validate against, so the pair is treated as consistent (no warning). This keeps metadata construction and describe robust on machines without a functional GPU.

julia
__madnlp_suite_consistent_linear_solver(
    _::Type{CTBase.Strategies.GPU},
    linear_solver::Type{MumpsSolver}
) -> Bool

Check if MumpsSolver is consistent with GPU parameter.

Arguments

  • parameter_type::Type{GPU}: GPU parameter type

  • linear_solver::Type{MadNLP.MumpsSolver}: CPU linear solver

Returns

  • Bool: false (CPU linear solver inconsistent with GPU parameter)

Notes

  • CPU linear solver should not be used with GPU parameter

  • Other linear solvers fall through to default implementation (returns true)

julia
__madnlp_suite_consistent_linear_solver(
    _::Type{CTBase.Strategies.GPU},
    linear_solver::Type{UmfpackSolver}
) -> Bool

Check if UmfpackSolver is consistent with GPU parameter.

Arguments

  • parameter_type::Type{GPU}: GPU parameter type

  • linear_solver::Type{MadNLP.UmfpackSolver}: CPU linear solver

Returns

  • Bool: false (CPU linear solver inconsistent with GPU parameter)

Notes

  • CPU linear solver should not be used with GPU parameter

  • Other linear solvers fall through to default implementation (returns true)

julia
__madnlp_suite_consistent_linear_solver(
    _::Type{CTBase.Strategies.GPU},
    linear_solver::Type{LapackCPUSolver}
) -> Bool

Check if LapackCPUSolver is consistent with GPU parameter.

Arguments

  • parameter_type::Type{GPU}: GPU parameter type

  • linear_solver::Type{MadNLP.LapackCPUSolver}: CPU linear solver

Returns

  • Bool: false (CPU linear solver inconsistent with GPU parameter)

Notes

  • CPU linear solver should not be used with GPU parameter

  • Other linear solvers fall through to default implementation (returns true)

julia
__madnlp_suite_consistent_linear_solver(
    _::Type{CTBase.Strategies.GPU},
    linear_solver::Type{LDLSolver}
) -> Bool

Check if LDLSolver is consistent with GPU parameter.

Arguments

  • parameter_type::Type{GPU}: GPU parameter type

  • linear_solver::Type{MadNLP.LDLSolver}: CPU linear solver

Returns

  • Bool: false (CPU linear solver inconsistent with GPU parameter)

Notes

  • CPU linear solver should not be used with GPU parameter

  • Other linear solvers fall through to default implementation (returns true)

julia
__madnlp_suite_consistent_linear_solver(
    _::Type{CTBase.Strategies.GPU},
    linear_solver::Type{CHOLMODSolver}
) -> Bool

Check if CHOLMODSolver is consistent with GPU parameter.

Arguments

  • parameter_type::Type{GPU}: GPU parameter type

  • linear_solver::Type{MadNLP.CHOLMODSolver}: CPU linear solver

Returns

  • Bool: false (CPU linear solver inconsistent with GPU parameter)

Notes

  • CPU linear solver should not be used with GPU parameter

  • Other linear solvers fall through to default implementation (returns true)

julia
__madnlp_suite_consistent_linear_solver(
    _::Type{CTBase.Strategies.CPU},
    linear_solver::Type{nothing}
) -> Bool

Check if CUDSSSolver is consistent with CPU parameter.

Arguments

  • parameter_type::Type{CPU}: CPU parameter type

  • linear_solver::MadNLPGPU.CUDSSSolver: GPU linear solver type

Returns

  • Bool: false (GPU linear solver inconsistent with CPU parameter)

Notes

  • GPU linear solver should not be used with CPU parameter

  • Other linear solvers fall through to default implementation (returns true)

julia
__madnlp_suite_consistent_linear_solver(
    _::Type{CTBase.Strategies.GPU},
    linear_solver::Type{nothing}
) -> Bool

Check if CUDSSSolver is consistent with GPU parameter.

Arguments

  • parameter_type::Type{GPU}: GPU parameter type

  • linear_solver::MadNLPGPU.CUDSSSolver: GPU linear solver type

Returns

  • Bool: true (CUDSSSolver consistent with GPU parameter)

Notes

  • CUDSSSolver is the recommended linear solver for GPU parameter

  • Other linear solvers fall through to default implementation (returns true)

__madnlp_suite_default_linear_solver [Function]

CTSolvers.Solvers.__madnlp_suite_default_linear_solver Function
julia
__madnlp_suite_default_linear_solver(
    _::Type{<:CTBase.Strategies.GPU}
) -> Any

Return the default linear solver for the given parameter type.

Arguments

  • parameter_type::Type{<:AbstractStrategyParameter}: CPU or GPU parameter

Returns

  • Type{<:MadNLP.AbstractLinearSolver}: Default linear solver type

Throws

  • Exceptions.ExtensionError: If GPU parameter used but MadNLPGPU not loaded

Notes

  • Default implementation throws ExtensionError for GPU

  • CPU implementation provided by CTSolversMadNLP extension

  • GPU implementation provided by CTSolversMadNLPGPU extension

julia
__madnlp_suite_default_linear_solver(
    _::Type{CTBase.Strategies.CPU}
) -> Type{MumpsSolver}

Return the default linear solver for CPU execution.

Returns MadNLP.MumpsSolver which is the standard CPU linear solver.

julia
__madnlp_suite_default_linear_solver(
    _::Type{CTBase.Strategies.GPU}
) -> Any

Return the default linear solver for GPU execution.

Returns

  • MadNLPGPU.CUDSSSolver: Default GPU linear solver

Notes

  • Overrides the stub implementation in CTSolvers.Solvers

  • Used automatically when MadNLP{GPU} or MadNCL{GPU} is created

build_ipopt_solver [Function]

CTSolvers.Solvers.build_ipopt_solver Function
julia
build_ipopt_solver(
    ::Type{<:CTBase.Core.AbstractTag},
    parameter::Type{<:CTBase.Strategies.AbstractStrategyParameter};
    kwargs...
) -> CTSolvers.Solvers.Ipopt

Stub function that throws ExtensionError if CTSolversIpopt extension is not loaded. Real implementation provided by the extension.

Throws

  • CTBase.Exceptions.ExtensionError: Always thrown by this stub implementation

See also: Ipopt, Strategies.metadata

julia
build_ipopt_solver(
    ::Type{CTSolvers.Solvers.IpoptTag},
    parameter::Type{<:CTBase.Strategies.AbstractStrategyParameter};
    mode,
    kwargs...
) -> CTSolvers.Solvers.Ipopt

Build an Ipopt with validated options.

Arguments

  • mode::Symbol=:strict: Validation mode (:strict or :permissive)

    • :strict (default): Rejects unknown options with detailed error message

    • :permissive: Accepts unknown options with warning, stores with :user source

  • kwargs...: Options to pass to the Ipopt constructor

Example

julia
# Conceptual usage
solver = build_ipopt_solver(IpoptTag; max_iter=1000)
solver_permissive = build_ipopt_solver(IpoptTag; max_iter=1000, custom_option=123; mode=:permissive)

See also: Solvers.Ipopt, Strategies.build_strategy_options

build_knitro_solver [Function]

CTSolvers.Solvers.build_knitro_solver Function
julia
build_knitro_solver(
    ::Type{<:CTBase.Core.AbstractTag},
    parameter::Type{<:CTBase.Strategies.AbstractStrategyParameter};
    kwargs...
) -> CTSolvers.Solvers.Knitro

Stub function that throws ExtensionError if CTSolversKnitro extension is not loaded. Real implementation provided by the extension.

Throws

  • CTBase.Exceptions.ExtensionError: Always thrown by this stub implementation

See also: Knitro, Strategies.metadata

julia
build_knitro_solver(
    ::Type{CTSolvers.Solvers.KnitroTag},
    parameter::Type{<:CTBase.Strategies.AbstractStrategyParameter};
    mode,
    kwargs...
) -> CTSolvers.Solvers.Knitro

Build a Knitro with validated options.

Arguments

  • mode::Symbol=:strict: Validation mode (:strict or :permissive)

    • :strict (default): Rejects unknown options with detailed error message

    • :permissive: Accepts unknown options with warning, stores with :user source

  • kwargs...: Options to pass to the Knitro constructor

Example

julia
# Conceptual usage
solver = build_knitro_solver(KnitroTag; max_iter=1000)
solver_permissive = build_knitro_solver(KnitroTag; max_iter=1000, custom_option=123; mode=:permissive)

build_madncl_solver [Function]

CTSolvers.Solvers.build_madncl_solver Function
julia
build_madncl_solver(
    ::Type{<:CTBase.Core.AbstractTag},
    parameter::Type{<:CTBase.Strategies.AbstractStrategyParameter};
    kwargs...
) -> CTSolvers.Solvers.MadNCL

Stub function that throws ExtensionError if CTSolversMadNCL extension is not loaded. Real implementation provided by the extension.

Throws

  • CTBase.Exceptions.ExtensionError: Always thrown by this stub implementation

See also: MadNCL, Strategies.metadata

julia
build_madncl_solver(
    ::Type{CTSolvers.Solvers.MadNCLTag},
    parameter::Type{<:CTBase.Strategies.AbstractStrategyParameter};
    mode,
    kwargs...
) -> CTSolvers.Solvers.MadNCL

Build a MadNCL with validated options.

Arguments

  • tag::Solvers.MadNCLTag: Tag for dispatch

  • parameter::AbstractStrategyParameter: Execution parameter (CPU or GPU)

  • mode::Symbol=:strict: Validation mode (:strict or :permissive)

    • :strict (default): Rejects unknown options with detailed error message

    • :permissive: Accepts unknown options with warning, stores with :user source

  • kwargs...: Options to pass to the MadNCL constructor

Example

julia
# Conceptual usage
solver_cpu = build_madncl_solver(MadNCLTag(), CPU(); max_iter=1000)
solver_gpu = build_madncl_solver(MadNCLTag(), GPU(); max_iter=1000)  # requires MadNLPGPU

build_madnlp_solver [Function]

CTSolvers.Solvers.build_madnlp_solver Function
julia
build_madnlp_solver(
    ::Type{<:CTBase.Core.AbstractTag},
    parameter::Type{<:CTBase.Strategies.AbstractStrategyParameter};
    kwargs...
) -> CTSolvers.Solvers.MadNLP

Stub function that throws ExtensionError if CTSolversMadNLP extension is not loaded. Real implementation provided by the extension.

Throws

  • CTBase.Exceptions.ExtensionError: Always thrown by this stub implementation

See also: MadNLP, Strategies.metadata

julia
build_madnlp_solver(
    ::Type{CTSolvers.Solvers.MadNLPTag},
    parameter::Type{<:CTBase.Strategies.AbstractStrategyParameter};
    mode,
    kwargs...
) -> CTSolvers.Solvers.MadNLP

Build a MadNLP with validated options.

Arguments

  • tag::Solvers.MadNLPTag: Tag for dispatch

  • parameter::AbstractStrategyParameter: Execution parameter (CPU or GPU)

  • mode::Symbol=:strict: Validation mode (:strict or :permissive)

    • :strict (default): Rejects unknown options with detailed error message

    • :permissive: Accepts unknown options with warning, stores with :user source

  • kwargs...: Options to pass to the MadNLP constructor

Example

julia
# Conceptual usage
solver_cpu = build_madnlp_solver(MadNLPTag(), CPU(); max_iter=1000)
solver_gpu = build_madnlp_solver(MadNLPTag(), GPU(); max_iter=1000)  # requires MadNLPGPU

build_uno_solver [Function]

CTSolvers.Solvers.build_uno_solver Function
julia
build_uno_solver(
    ::Type{<:CTBase.Core.AbstractTag},
    parameter::Type{<:CTBase.Strategies.AbstractStrategyParameter};
    kwargs...
) -> CTSolvers.Solvers.Uno

Stub function that throws ExtensionError if CTSolversUno extension is not loaded. Real implementation provided by the extension.

Throws

  • CTBase.Exceptions.ExtensionError: Always thrown by this stub implementation

See also: Uno, Strategies.metadata

julia
build_uno_solver(
    ::Type{CTSolvers.Solvers.UnoTag},
    parameter::Type{<:CTBase.Strategies.AbstractStrategyParameter};
    mode,
    kwargs...
) -> CTSolvers.Solvers.Uno

Build a Uno solver with validated options.

Arguments

  • mode::Symbol=:strict: Validation mode (:strict or :permissive)

    • :strict (default): Rejects unknown options with detailed error message

    • :permissive: Accepts unknown options with warning, stores with :user source

  • kwargs...: Options to pass to the Uno constructor

Example

julia
# Conceptual usage
solver = build_uno_solver(UnoTag; max_iterations=1000)
solver_permissive = build_uno_solver(UnoTag; max_iterations=1000, custom_option=123; mode=:permissive)

See also: Solvers.Uno, Strategies.build_strategy_options


From CTSolvers.Modelers

ADNLPTag [Struct]

CTSolvers.Modelers.ADNLPTag Type
julia
struct ADNLPTag <: CTBase.Core.AbstractTag

Tag type for ADNLP-specific implementation dispatch.

ExaTag [Struct]

CTSolvers.Modelers.ExaTag Type
julia
struct ExaTag <: CTBase.Core.AbstractTag

Tag type for Exa-specific implementation dispatch.

__adnlp_model_backend [Function]

CTSolvers.Modelers.__adnlp_model_backend Function
julia
__adnlp_model_backend() -> Symbol

Return the default automatic differentiation backend for Modelers.ADNLP.

Default is :optimized.

__consistent_backend [Function]

CTSolvers.Modelers.__consistent_backend Function
julia
__consistent_backend(
    _::Type{<:CTBase.Strategies.AbstractStrategyParameter},
    backend
) -> Bool

Check if backend is consistent with parameter type.

Arguments

  • parameter_type::Type{<:AbstractStrategyParameter}: CPU or GPU parameter

  • backend: Backend to check consistency for

Returns

  • Bool: true if consistent, false otherwise

Notes

  • Default implementation returns true (all combinations allowed)

  • Specific implementations in extensions provide actual consistency checks

julia
__consistent_backend(
    _::Type{CTBase.Strategies.CPU},
    backend::CUDABackend
) -> Bool

Check if CUDA backend is consistent with CPU parameter.

Arguments

  • parameter_type::Type{CPU}: CPU parameter type

  • backend::CUDA.CUDABackend: CUDA backend to check

Returns

  • Bool: false (CUDA backend inconsistent with CPU parameter)

Notes

  • CUDA backend should not be used with CPU parameter

  • Other backends fall through to default implementation (returns true)

julia
__consistent_backend(
    _::Type{CTBase.Strategies.GPU},
    backend::Nothing
) -> Bool

Check if no backend is consistent with GPU parameter.

Arguments

  • parameter_type::Type{GPU}: GPU parameter type

  • backend::Nothing: No backend

Returns

  • Bool: false (no backend inconsistent with GPU parameter)

Notes

  • GPU parameter requires a backend

  • CUDA backend case handled by separate method

julia
__consistent_backend(
    _::Type{CTBase.Strategies.GPU},
    backend::CUDABackend
) -> Bool

Check if CUDA backend is consistent with GPU parameter.

Arguments

  • parameter_type::Type{GPU}: GPU parameter type

  • backend::CUDA.CUDABackend: CUDA backend to check

Returns

  • Bool: true (CUDA backend consistent with GPU parameter)

Notes

  • CUDA backend is the recommended backend for GPU parameter

  • Other backends fall through to default implementation (returns true)

__exa_model_backend [Function]

CTSolvers.Modelers.__exa_model_backend Function
julia
__exa_model_backend()

Return the default execution backend for Modelers.Exa.

Default is nothing (CPU).

julia
__exa_model_backend(_::Type{CTBase.Strategies.CPU})

Return the default execution backend for CPU parameter.

Always returns nothing for CPU execution.

julia
__exa_model_backend(
    P::Type{CTBase.Strategies.GPU}
) -> CUDABackend

Return the default execution backend for GPU parameter.

Returns CUDA backend if available, throws ExtensionError otherwise.

__exa_model_base_type [Function]

CTSolvers.Modelers.__exa_model_base_type Function
julia
__exa_model_base_type() -> Type{Float64}

Return the default floating-point type for Modelers.Exa.

Default is Float64.

__get_adnlp_available_backends [Function]

CTSolvers.Modelers.__get_adnlp_available_backends Function
julia
__get_adnlp_available_backends(
    _::Type{<:CTBase.Core.AbstractTag}
) -> Any

Return the list of available AD backends for Modelers.ADNLP via tag dispatch.

Stub — throws CTBase.Exceptions.ExtensionError by default. Overridden by the CTSolversADNLPModels extension for ADNLPTag.

Throws

  • CTBase.Exceptions.ExtensionError: always, until overridden by the extension

See also: CTSolvers.Modelers.get_adnlp_available_backends, CTSolvers.Modelers.ADNLPTag

julia
__get_adnlp_available_backends(
    _::Type{CTSolvers.Modelers.ADNLPTag}
) -> Any

Return the list of available AD backends for Modelers.ADNLP using ADNLPModels.

Overrides the core stub; called via CTSolvers.Modelers.get_adnlp_available_backends. Includes all predefined backends from ADNLPModels.predefined_backend plus :manual.

Returns

  • Vector{Symbol}: available backend names (e.g. :default, :optimized, :manual)

See also: CTSolvers.Modelers.get_adnlp_available_backends, CTSolvers.Modelers.ADNLPTag

__get_cuda_backend [Function]

CTSolvers.Modelers.__get_cuda_backend Function
julia
__get_cuda_backend(
    _::Type{<:CTBase.Strategies.GPU}
) -> CUDABackend

Get CUDA backend for GPU execution.

This function checks if CUDA.jl is available and functional, and returns an appropriate CUDA backend.

Returns

  • CUDA backend object if CUDA is available and functional

Throws

  • CTBase.Exceptions.ExtensionError: If CUDA is not loaded or not functional

Notes

  • Issues a warning if CUDA is loaded but not functional

  • Uses CUDA.CUDABackend() for GPU execution

julia
__get_cuda_backend(
    _::Type{CTBase.Strategies.GPU}
) -> CUDABackend

Return the CUDA backend for GPU execution.

Returns

  • CUDA.CUDABackend(): CUDA backend object

Notes

  • Issues a warning if CUDA is loaded but not functional

  • Overrides the stub implementation in CTSolvers.Modelers

__is_adbackend_instance [Function]

CTSolvers.Modelers.__is_adbackend_instance Function
julia
__is_adbackend_instance(x) -> Bool

Return true if x is an instance of ADNLPModels.ADBackend.

Stub — always returns false. Overridden by the CTSolversADNLPModels extension (triggered when ADNLPModels is loaded) for concrete ADBackend instances.

Returns

  • Bool: false (stub); true when the extension is active and x isa ADBackend

See also: CTSolvers.Modelers.__is_adbackend_type, CTSolvers.Modelers.validate_backend_override

julia
__is_adbackend_instance(x::ADNLPModels.ADBackend) -> Bool

Return true for instances of ADNLPModels.ADBackend.

Overrides the core stub in CTSolvers.Modelers when ADNLPModels is loaded.

Returns

  • Bool: true

See also: CTSolvers.Modelers.__is_adbackend_instance, CTSolvers.Modelers.__is_adbackend_type

__is_adbackend_type [Function]

CTSolvers.Modelers.__is_adbackend_type Function
julia
__is_adbackend_type(_::Type) -> Bool

Return true if T is a subtype of ADNLPModels.ADBackend.

Stub — always returns false. Overridden by the CTSolversADNLPModels extension (triggered when ADNLPModels is loaded) for concrete ADBackend subtypes.

Returns

  • Bool: false (stub); true when the extension is active and T <: ADBackend

See also: CTSolvers.Modelers.__is_adbackend_instance, CTSolvers.Modelers.validate_backend_override

julia
__is_adbackend_type(
    _::Type{<:ADNLPModels.ADBackend}
) -> Bool

Return true for types that are subtypes of ADNLPModels.ADBackend.

Overrides the core stub in CTSolvers.Modelers when ADNLPModels is loaded.

Returns

  • Bool: true

See also: CTSolvers.Modelers.__is_adbackend_type, CTSolvers.Modelers.__is_adbackend_instance

build_adnlp_modeler [Function]

CTSolvers.Modelers.build_adnlp_modeler Function
julia
build_adnlp_modeler(
    ::Type{<:CTBase.Core.AbstractTag},
    parameter::Type{<:CTBase.Strategies.AbstractStrategyParameter};
    kwargs...
) -> CTSolvers.Modelers.ADNLP

Stub function that throws ExtensionError if CTSolversADNLPModels extension is not loaded. Real implementation provided by the extension.

Throws

  • CTBase.Exceptions.ExtensionError: Always thrown by this stub implementation

See also: Modelers.ADNLP, Strategies.metadata

julia
build_adnlp_modeler(
    ::Type{CTSolvers.Modelers.ADNLPTag},
    parameter::Type{<:CTBase.Strategies.AbstractStrategyParameter};
    mode,
    kwargs...
) -> CTSolvers.Modelers.ADNLP

Build a Modelers.ADNLP{parameter} modeler with validated options.

Overrides the core ExtensionError stub when ADNLPModels is loaded. Whenever the deprecated keyword :adnlp_backend is passed, a warning is issued and :backend should be used instead.

Arguments

  • parameter::Type{<:AbstractStrategyParameter}: strategy parameter type (e.g. CPU)

  • mode::Symbol: validation mode, :strict (default) or :permissive

  • kwargs...: options forwarded to CTBase.Strategies.build_strategy_options

Returns

  • CTSolvers.Modelers.ADNLP{parameter}: configured modeler instance

See also: CTSolvers.Modelers.ADNLP, CTSolvers.Modelers.build_adnlp_modeler

build_exa_modeler [Function]

CTSolvers.Modelers.build_exa_modeler Function
julia
build_exa_modeler(
    ::Type{<:CTBase.Core.AbstractTag},
    parameter::Type{<:CTBase.Strategies.AbstractStrategyParameter};
    kwargs...
) -> CTSolvers.Modelers.Exa

Stub function that throws ExtensionError if CTSolversExaModels extension is not loaded. Real implementation provided by the extension.

Throws

  • CTBase.Exceptions.ExtensionError: Always thrown by this stub implementation

See also: Modelers.Exa, Strategies.metadata

julia
build_exa_modeler(
    ::Type{CTSolvers.Modelers.ExaTag},
    parameter::Type{<:CTBase.Strategies.AbstractStrategyParameter};
    mode,
    kwargs...
) -> CTSolvers.Modelers.Exa

Build a Modelers.Exa{parameter} modeler with validated options.

Overrides the core ExtensionError stub when ExaModels and KernelAbstractions are loaded. Whenever the deprecated keyword :exa_backend is passed, a warning is issued and :backend should be used instead.

Arguments

  • parameter::Type{<:AbstractStrategyParameter}: strategy parameter type (e.g. CPU, GPU)

  • mode::Symbol: validation mode, :strict (default) or :permissive

  • kwargs...: options forwarded to CTBase.Strategies.build_strategy_options

Returns

  • CTSolvers.Modelers.Exa{parameter}: configured modeler instance

See also: CTSolvers.Modelers.Exa, CTSolvers.Modelers.build_exa_modeler

get_adnlp_available_backends [Function]

CTSolvers.Modelers.get_adnlp_available_backends Function
julia
get_adnlp_available_backends() -> Any

Return the list of available automatic differentiation backends for Modelers.ADNLP.

Requires the CTSolversADNLPModels extension (using ADNLPModels) to be loaded.

Returns

  • Vector{Symbol}: available backend names (e.g. :default, :optimized, :manual)

Throws

  • CTBase.Exceptions.ExtensionError: if ADNLPModels is not loaded

See also: CTSolvers.Modelers.ADNLP, CTSolvers.Modelers.get_validate_adnlp_backend

get_validate_adnlp_backend [Function]

CTSolvers.Modelers.get_validate_adnlp_backend Function
julia
get_validate_adnlp_backend(
    T::Type{<:CTBase.Core.AbstractTag}
) -> CTSolvers.Modelers.var"#get_validate_adnlp_backend##0#get_validate_adnlp_backend##1"

Factory function that returns a backend validator for the specified tag type.

Arguments

  • T::Type{<:Core.AbstractTag}: Tag type for dispatch (e.g., ADNLPTag, DummyTag)

Returns

  • Function: Validator function that takes backend and validates it

Examples

julia
julia> using CTSolvers.Modelers

julia> # Get validator for ADNLP (with extensions loaded)
julia> validator = get_validate_adnlp_backend(ADNLPTag)
(backend)->validate_adnlp_backend(#=method=#1, #=generic#=)

julia> validator(:default)
:default

julia> validator(:enzyme)  # Works with CTSolversEnzyme extension
:enzyme

julia> # Get validator for dummy tag (no extensions)
julia> dummy_validator = get_validate_adnlp_backend(DummyTag)
(backend)->validate_adnlp_backend(#=method=#1, #=generic#=)

julia> dummy_validator(:enzyme)  # Throws ExtensionError
ERROR: Control Toolbox Error
❌ Error: CTBase.Exceptions.ExtensionError, to use Enzyme backend with ADNLP modeler

Notes

  • Creates a closure that converts Symbol to Val for type-safe dispatch

  • Used by ADNLP metadata system for runtime validation

  • Extensions enable specific backends for their tag types

  • Default implementations throw ExtensionError for Enzyme/Zygote backends

See also: validate_adnlp_backend, ADNLPTag, Modelers.ADNLP

validate_adnlp_backend [Function]

CTSolvers.Modelers.validate_adnlp_backend Function
julia
validate_adnlp_backend(
    tag::CTBase.Core.AbstractTag,
    backend::Val
) -> Symbol

Fallback method for invalid ADNLP backends using tag dispatch.

Arguments

  • tag::Core.AbstractTag: Tag for dispatch (e.g., ADNLPTag, DummyTag)

  • backend::Val: Backend type as Val for dispatch (invalid backend)

Throws

  • CTBase.Exceptions.IncorrectArgument: Always thrown for invalid backends

Notes

  • This method is called when no more specific method matches the backend

  • Provides comprehensive error message with valid backend options

  • Uses structured exception with got/expected/suggestion fields

See also: validate_adnlp_backend(::Core.AbstractTag, ::Val{:default}), get_validate_adnlp_backend

julia
validate_adnlp_backend(
    tag::CTBase.Core.AbstractTag,
    _::Val{:default}
) -> Symbol

Validate always-available ADNLP backends using tag dispatch.

Arguments

  • tag::Core.AbstractTag: Tag for dispatch (e.g., ADNLPTag, DummyTag)

  • backend::Val{:default}: Default backend type

  • backend::Val{:optimized}: Optimized backend type

  • backend::Val{:generic}: Generic backend type

  • backend::Val{:manual}: Manual backend type

Returns

  • Symbol: Validated backend symbol (unchanged)

Notes

  • These methods handle backends that are always available regardless of extensions

  • Uses Julia's multiple dispatch for type-safe validation

  • Extensions can override these methods for tag-specific behavior

See also: validate_adnlp_backend(::Core.AbstractTag, ::Val{:enzyme}), get_validate_adnlp_backend

julia
validate_adnlp_backend(
    tag::CTBase.Core.AbstractTag,
    _::Val{:enzyme}
) -> Symbol

Validate Enzyme backend using tag dispatch.

Arguments

  • tag::Core.AbstractTag: Tag for dispatch (e.g., ADNLPTag, DummyTag)

  • backend::Val{:enzyme}: Enzyme backend type

Throws

  • CTBase.Exceptions.ExtensionError: If CTSolversEnzyme extension is not loaded

Notes

  • Default implementation throws ExtensionError for all tags except ADNLPTag with extension

  • CTSolversEnzyme extension overrides this method for ADNLPTag when Enzyme is available

  • Provides clear error message directing users to load the extension

See also: validate_adnlp_backend(::Core.AbstractTag, ::Val{:zygote}), get_validate_adnlp_backend

julia
validate_adnlp_backend(
    tag::CTBase.Core.AbstractTag,
    _::Val{:zygote}
) -> Symbol

Validate Zygote backend using tag dispatch.

Arguments

  • tag::Core.AbstractTag: Tag for dispatch (e.g., ADNLPTag, DummyTag)

  • backend::Val{:zygote}: Zygote backend type

Throws

  • CTBase.Exceptions.ExtensionError: If CTSolversZygote extension is not loaded

Notes

  • Default implementation throws ExtensionError for all tags except ADNLPTag with extension

  • CTSolversZygote extension overrides this method for ADNLPTag when Zygote is available

  • Provides clear error message directing users to load the extension

See also: validate_adnlp_backend(::Core.AbstractTag, ::Val{:enzyme}), get_validate_adnlp_backend

julia
validate_adnlp_backend(
    tag::CTSolvers.Modelers.ADNLPTag,
    _::Val{:enzyme}
) -> Symbol

Validate Enzyme backend for ADNLPTag when Enzyme extension is loaded.

Arguments

  • tag::Modelers.ADNLPTag: ADNLP tag (dispatch target)

  • backend::Val{:enzyme}: Enzyme backend type

Returns

  • Symbol: Validated backend symbol (:enzyme)

Notes

  • Overrides the default ExtensionError behavior for ADNLPTag

  • Only applies to ADNLPTag, other tags still throw ExtensionError

  • Enables Enzyme backend usage when extension is loaded

julia
validate_adnlp_backend(
    tag::CTSolvers.Modelers.ADNLPTag,
    _::Val{:zygote}
) -> Symbol

Validate Zygote backend for ADNLPTag when Zygote extension is loaded.

Arguments

  • tag::Modelers.ADNLPTag: ADNLP tag (dispatch target)

  • backend::Val{:zygote}: Zygote backend type

Returns

  • Symbol: Validated backend symbol (:zygote)

Notes

  • Overrides the default ExtensionError behavior for ADNLPTag

  • Only applies to ADNLPTag, other tags still throw ExtensionError

  • Enables Zygote backend usage when extension is loaded

validate_backend_override [Function]

CTSolvers.Modelers.validate_backend_override Function
julia
validate_backend_override(
    backend
) -> Union{Nothing, ADNLPModels.ADBackend, Type{<:ADNLPModels.ADBackend}}

Validate that a backend override is either nothing, a Type{<:ADBackend}, or an ADBackend instance.

ADNLPModels.jl accepts both types (to be constructed internally) and pre-constructed instances.

Arguments

  • backend: The backend to validate (any value accepted for dispatch)

Throws

  • CTBase.Exceptions.IncorrectArgument: If the backend is not nothing, a Type{<:ADBackend}, or an ADBackend instance

Examples

julia
validate_backend_override(nothing)
validate_backend_override(ADNLPModels.ForwardDiffADGradient)
validate_backend_override(ADNLPModels.ForwardDiffADGradient())

# Throws CTBase.Exceptions.IncorrectArgument
validate_backend_override("invalid")

validate_exa_base_type [Function]

CTSolvers.Modelers.validate_exa_base_type Function
julia
validate_exa_base_type(
    T::Type{<:AbstractFloat}
) -> Type{<:AbstractFloat}

Validate that the specified base type is appropriate for ExaModels.

Arguments

  • T::Type{<:AbstractFloat}: The floating-point type to validate

Returns

  • Type{<:AbstractFloat}: The validated type (unchanged)

Notes

  • Uses Julia's dispatch system for type-safe validation

  • Valid types include Float64, Float32, Float16, BigFloat

  • Invalid types throw IncorrectArgument with helpful error message

Examples

julia
julia> using CTSolvers.Modelers

julia> validate_exa_base_type(Float64)
Float64

julia> validate_exa_base_type(Float32)
Float32

# Throws IncorrectArgument for invalid types
julia> validate_exa_base_type(Int)
ERROR: Control Toolbox Error
❌ Error: CTBase.Exceptions.IncorrectArgument, Invalid base type for Modelers.Exa

See also: Modelers.Exa

julia
validate_exa_base_type(T) -> Type{<:AbstractFloat}

Fallback method for invalid base types in ExaModels validation.

Arguments

  • T::Type: The type to validate (not a subtype of AbstractFloat)

Throws

  • CTBase.Exceptions.IncorrectArgument: Always thrown for invalid types

Notes

  • This method is called when no more specific method matches

  • Provides clear error message with suggestions for valid types

  • Uses structured exception with got/expected/suggestion fields

See also: validate_exa_base_type(::Type{<:AbstractFloat})

validate_matrix_free [Function]

CTSolvers.Modelers.validate_matrix_free Function
julia
validate_matrix_free(matrix_free::Bool) -> Bool
validate_matrix_free(
    matrix_free::Bool,
    problem_size::Int64
) -> Bool

Validate matrix-free mode setting and provide recommendations.

Arguments

  • matrix_free::Bool: Whether to use matrix-free mode

  • problem_size::Int: Size of the optimization problem (default: 1000)

Returns

  • Bool: Validated matrix-free setting

Examples

julia
validate_matrix_free(true, 10_000)
validate_matrix_free(false, 1_000_000)

validate_model_name [Function]

CTSolvers.Modelers.validate_model_name Function
julia
validate_model_name(name::String) -> String

Validate that the model name is appropriate.

Arguments

  • name::String: The model name to validate

Throws

  • CTBase.Exceptions.IncorrectArgument: If the name is invalid

Examples

julia
validate_model_name("MyProblem")

# Throws CTBase.Exceptions.IncorrectArgument
validate_model_name("")

validate_optimization_direction [Function]

CTSolvers.Modelers.validate_optimization_direction Function
julia
validate_optimization_direction(minimize::Bool) -> Bool

Validate that the optimization direction is a boolean value.

Arguments

  • minimize::Bool: The optimization direction to validate

Throws

  • CTBase.Exceptions.IncorrectArgument: If the value is not a boolean

Examples

julia
validate_optimization_direction(true)
validate_optimization_direction(false)

From CTSolversMadNLP

solve_with_madnlp [Function]

CTSolversMadNLP.solve_with_madnlp Function
julia
solve_with_madnlp(
    nlp::AbstractNLPModel;
    kwargs...
) -> MadNLPExecutionStats

Backend interface for MadNLP solver.

Calls MadNLP to solve the NLP problem.


From CTSolversUno

solve_with_uno [Function]

CTSolversUno.solve_with_uno Function
julia
solve_with_uno(
    nlp::AbstractNLPModel;
    kwargs...
) -> UnoExecutionStats{M} where M<:AbstractNLPModel{Float64, Vector{Float64}}

Backend interface for Uno solver.

Solves the NLP problem using UnoSolver backend.

Arguments

  • nlp::NLPModels.AbstractNLPModel: The NLP problem to solve

  • kwargs...: Uno options as keyword arguments

Returns

  • UnoSolver.UnoExecutionStats: Solver execution statistics

See also: Solvers.Uno, UnoSolver.uno, Solvers.extract_solver_infos


From CTSolversIpopt

solve_with_ipopt [Function]

CTSolversIpopt.solve_with_ipopt Function
julia
solve_with_ipopt(
    nlp::AbstractNLPModel;
    kwargs...
) -> SolverCore.GenericExecutionStats{T, S} where {T>:Float64, S>:Vector{Float64}}

Backend interface for Ipopt solver.

Solves the NLP problem using NLPModelsIpopt backend.

Arguments

  • nlp::NLPModels.AbstractNLPModel: The NLP problem to solve

  • options...: Ipopt options as keyword arguments

Returns

  • SolverCore.GenericExecutionStats: Solver execution statistics

See also: Solvers.Ipopt, NLPModelsIpopt.ipopt