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
__consistent_initial_condition(
_::Type{<:CTBase.Strategies.AbstractStrategyParameter},
u0
) -> BoolCheck 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}:CPUorGPU.u0: The initial condition array to check.
Returns
Bool:trueif consistent,falseotherwise.
See also: CTSolvers.Integrators.SciML, CTBase.Strategies.CPU, CTBase.Strategies.GPU.
__consistent_initial_condition(
_::Type{CTBase.Strategies.CPU},
u0::AnyCuArray
) -> BoolA 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).
__consistent_initial_condition(
_::Type{CTBase.Strategies.GPU},
u0::Array
) -> BoolA 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.
__consistent_initial_condition(
_::Type{CTBase.Strategies.GPU},
u0::AnyCuArray
) -> BoolA device CuArray initial condition is consistent with a SciML{GPU} integrator.
__default_sciml_algorithm [Function]
CTSolvers.Integrators.__default_sciml_algorithm Function
__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.
__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
__unsafe() -> BoolInternal 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
deepvalue(x::Number) -> NumberExtract 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.Dualnumbers, the more specific method inCTSolversForwardDiffrecursively extracts the primal value viadeepvalue(value(x)).This method serves as the base case for all
Numbersubtypes not handled by extensions.
See also: CTSolvers.Integrators.real_norm.
deepvalue(x::ForwardDiff.Dual) -> NumberRecursively 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
real_norm(u::Number, t) -> AnyCompute 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.
real_norm(u::ForwardDiff.Dual, t) -> AnyCompute 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.
real_norm(u::AbstractArray, t) -> AnyCompute 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
struct SciMLIntegrationResult{S<:SciMLBase.AbstractODESolution} <: CTSolvers.Integrators.AbstractIntegrationResultIntegration 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::auto→false(only the final state is needed)options_trajectory::auto→true(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
_check_retcode(sol, unsafe)Check the return code of a SciML ODE solution and throw SolverFailure if integration failed.
Throws
CTBase.Exceptions.SolverFailure: If!unsafeand the retcode indicates failure.
_merged_retcode [Function]
CTSolversSciMLIntegrator._merged_retcode Function
_merged_retcode(ode_sols) -> AnyReturn 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
base_type(
_::MadNCL.NCLOptions{BaseType<:AbstractFloat}
) -> Type{BaseType} where BaseType<:AbstractFloatExtract the base floating-point type from NCLOptions type parameter.
solve_with_madncl [Function]
CTSolversMadNCL.solve_with_madncl Function
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
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
struct IpoptTag <: CTBase.Core.AbstractTagTag type for Ipopt-specific implementation dispatch.
KnitroTag [Struct]
CTSolvers.Solvers.KnitroTag Type
struct KnitroTag <: CTBase.Core.AbstractTagTag type for Knitro-specific implementation dispatch.
MadNCLTag [Struct]
CTSolvers.Solvers.MadNCLTag Type
struct MadNCLTag <: CTBase.Core.AbstractTagTag type for MadNCL-specific implementation dispatch.
MadNLPTag [Struct]
CTSolvers.Solvers.MadNLPTag Type
struct MadNLPTag <: CTBase.Core.AbstractTagTag type for MadNLP-specific implementation dispatch.
UnoTag [Struct]
CTSolvers.Solvers.UnoTag Type
struct UnoTag <: CTBase.Core.AbstractTagTag type for Uno-specific implementation dispatch.
__display [Function]
CTSolvers.Solvers.__display Function
__display() -> BoolInternal helper defining the default solver-display behavior.
__madnlp_suite_consistent_linear_solver [Function]
CTSolvers.Solvers.__madnlp_suite_consistent_linear_solver Function
__madnlp_suite_consistent_linear_solver(
_::Type{<:CTBase.Strategies.AbstractStrategyParameter},
linear_solver::Type
) -> BoolCheck if linear solver is consistent with parameter type.
Arguments
parameter_type::Type{<:AbstractStrategyParameter}: CPU or GPU parameterlinear_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
__madnlp_suite_consistent_linear_solver(
_::Type{<:CTBase.Strategies.AbstractStrategyParameter},
_::Nothing
) -> BoolConsistency 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.
__madnlp_suite_consistent_linear_solver(
_::Type{CTBase.Strategies.GPU},
linear_solver::Type{MumpsSolver}
) -> BoolCheck if MumpsSolver is consistent with GPU parameter.
Arguments
parameter_type::Type{GPU}: GPU parameter typelinear_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)
__madnlp_suite_consistent_linear_solver(
_::Type{CTBase.Strategies.GPU},
linear_solver::Type{UmfpackSolver}
) -> BoolCheck if UmfpackSolver is consistent with GPU parameter.
Arguments
parameter_type::Type{GPU}: GPU parameter typelinear_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)
__madnlp_suite_consistent_linear_solver(
_::Type{CTBase.Strategies.GPU},
linear_solver::Type{LapackCPUSolver}
) -> BoolCheck if LapackCPUSolver is consistent with GPU parameter.
Arguments
parameter_type::Type{GPU}: GPU parameter typelinear_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)
__madnlp_suite_consistent_linear_solver(
_::Type{CTBase.Strategies.GPU},
linear_solver::Type{LDLSolver}
) -> BoolCheck if LDLSolver is consistent with GPU parameter.
Arguments
parameter_type::Type{GPU}: GPU parameter typelinear_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)
__madnlp_suite_consistent_linear_solver(
_::Type{CTBase.Strategies.GPU},
linear_solver::Type{CHOLMODSolver}
) -> BoolCheck if CHOLMODSolver is consistent with GPU parameter.
Arguments
parameter_type::Type{GPU}: GPU parameter typelinear_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)
__madnlp_suite_consistent_linear_solver(
_::Type{CTBase.Strategies.CPU},
linear_solver::Type{nothing}
) -> BoolCheck if CUDSSSolver is consistent with CPU parameter.
Arguments
parameter_type::Type{CPU}: CPU parameter typelinear_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)
__madnlp_suite_consistent_linear_solver(
_::Type{CTBase.Strategies.GPU},
linear_solver::Type{nothing}
) -> BoolCheck if CUDSSSolver is consistent with GPU parameter.
Arguments
parameter_type::Type{GPU}: GPU parameter typelinear_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
__madnlp_suite_default_linear_solver(
_::Type{<:CTBase.Strategies.GPU}
) -> AnyReturn 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
__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.
__madnlp_suite_default_linear_solver(
_::Type{CTBase.Strategies.GPU}
) -> AnyReturn 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
build_ipopt_solver(
::Type{<:CTBase.Core.AbstractTag},
parameter::Type{<:CTBase.Strategies.AbstractStrategyParameter};
kwargs...
) -> CTSolvers.Solvers.IpoptStub 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
build_ipopt_solver(
::Type{CTSolvers.Solvers.IpoptTag},
parameter::Type{<:CTBase.Strategies.AbstractStrategyParameter};
mode,
kwargs...
) -> CTSolvers.Solvers.IpoptBuild an Ipopt with validated options.
Arguments
mode::Symbol=:strict: Validation mode (:strictor:permissive):strict(default): Rejects unknown options with detailed error message:permissive: Accepts unknown options with warning, stores with:usersource
kwargs...: Options to pass to the Ipopt constructor
Example
# 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
build_knitro_solver(
::Type{<:CTBase.Core.AbstractTag},
parameter::Type{<:CTBase.Strategies.AbstractStrategyParameter};
kwargs...
) -> CTSolvers.Solvers.KnitroStub 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
build_knitro_solver(
::Type{CTSolvers.Solvers.KnitroTag},
parameter::Type{<:CTBase.Strategies.AbstractStrategyParameter};
mode,
kwargs...
) -> CTSolvers.Solvers.KnitroBuild a Knitro with validated options.
Arguments
mode::Symbol=:strict: Validation mode (:strictor:permissive):strict(default): Rejects unknown options with detailed error message:permissive: Accepts unknown options with warning, stores with:usersource
kwargs...: Options to pass to the Knitro constructor
Example
# 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
build_madncl_solver(
::Type{<:CTBase.Core.AbstractTag},
parameter::Type{<:CTBase.Strategies.AbstractStrategyParameter};
kwargs...
) -> CTSolvers.Solvers.MadNCLStub 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
build_madncl_solver(
::Type{CTSolvers.Solvers.MadNCLTag},
parameter::Type{<:CTBase.Strategies.AbstractStrategyParameter};
mode,
kwargs...
) -> CTSolvers.Solvers.MadNCLBuild a MadNCL with validated options.
Arguments
tag::Solvers.MadNCLTag: Tag for dispatchparameter::AbstractStrategyParameter: Execution parameter (CPU or GPU)mode::Symbol=:strict: Validation mode (:strictor:permissive):strict(default): Rejects unknown options with detailed error message:permissive: Accepts unknown options with warning, stores with:usersource
kwargs...: Options to pass to the MadNCL constructor
Example
# Conceptual usage
solver_cpu = build_madncl_solver(MadNCLTag(), CPU(); max_iter=1000)
solver_gpu = build_madncl_solver(MadNCLTag(), GPU(); max_iter=1000) # requires MadNLPGPUbuild_madnlp_solver [Function]
CTSolvers.Solvers.build_madnlp_solver Function
build_madnlp_solver(
::Type{<:CTBase.Core.AbstractTag},
parameter::Type{<:CTBase.Strategies.AbstractStrategyParameter};
kwargs...
) -> CTSolvers.Solvers.MadNLPStub 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
build_madnlp_solver(
::Type{CTSolvers.Solvers.MadNLPTag},
parameter::Type{<:CTBase.Strategies.AbstractStrategyParameter};
mode,
kwargs...
) -> CTSolvers.Solvers.MadNLPBuild a MadNLP with validated options.
Arguments
tag::Solvers.MadNLPTag: Tag for dispatchparameter::AbstractStrategyParameter: Execution parameter (CPU or GPU)mode::Symbol=:strict: Validation mode (:strictor:permissive):strict(default): Rejects unknown options with detailed error message:permissive: Accepts unknown options with warning, stores with:usersource
kwargs...: Options to pass to the MadNLP constructor
Example
# Conceptual usage
solver_cpu = build_madnlp_solver(MadNLPTag(), CPU(); max_iter=1000)
solver_gpu = build_madnlp_solver(MadNLPTag(), GPU(); max_iter=1000) # requires MadNLPGPUbuild_uno_solver [Function]
CTSolvers.Solvers.build_uno_solver Function
build_uno_solver(
::Type{<:CTBase.Core.AbstractTag},
parameter::Type{<:CTBase.Strategies.AbstractStrategyParameter};
kwargs...
) -> CTSolvers.Solvers.UnoStub 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
build_uno_solver(
::Type{CTSolvers.Solvers.UnoTag},
parameter::Type{<:CTBase.Strategies.AbstractStrategyParameter};
mode,
kwargs...
) -> CTSolvers.Solvers.UnoBuild a Uno solver with validated options.
Arguments
mode::Symbol=:strict: Validation mode (:strictor:permissive):strict(default): Rejects unknown options with detailed error message:permissive: Accepts unknown options with warning, stores with:usersource
kwargs...: Options to pass to the Uno constructor
Example
# 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
struct ADNLPTag <: CTBase.Core.AbstractTagTag type for ADNLP-specific implementation dispatch.
ExaTag [Struct]
CTSolvers.Modelers.ExaTag Type
struct ExaTag <: CTBase.Core.AbstractTagTag type for Exa-specific implementation dispatch.
__adnlp_model_backend [Function]
CTSolvers.Modelers.__adnlp_model_backend Function
__adnlp_model_backend() -> SymbolReturn the default automatic differentiation backend for Modelers.ADNLP.
Default is :optimized.
__consistent_backend [Function]
CTSolvers.Modelers.__consistent_backend Function
__consistent_backend(
_::Type{<:CTBase.Strategies.AbstractStrategyParameter},
backend
) -> BoolCheck if backend is consistent with parameter type.
Arguments
parameter_type::Type{<:AbstractStrategyParameter}: CPU or GPU parameterbackend: 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
__consistent_backend(
_::Type{CTBase.Strategies.CPU},
backend::CUDABackend
) -> BoolCheck if CUDA backend is consistent with CPU parameter.
Arguments
parameter_type::Type{CPU}: CPU parameter typebackend::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)
__consistent_backend(
_::Type{CTBase.Strategies.GPU},
backend::Nothing
) -> BoolCheck if no backend is consistent with GPU parameter.
Arguments
parameter_type::Type{GPU}: GPU parameter typebackend::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
__consistent_backend(
_::Type{CTBase.Strategies.GPU},
backend::CUDABackend
) -> BoolCheck if CUDA backend is consistent with GPU parameter.
Arguments
parameter_type::Type{GPU}: GPU parameter typebackend::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
__exa_model_backend()Return the default execution backend for Modelers.Exa.
Default is nothing (CPU).
__exa_model_backend(_::Type{CTBase.Strategies.CPU})Return the default execution backend for CPU parameter.
Always returns nothing for CPU execution.
__exa_model_backend(
P::Type{CTBase.Strategies.GPU}
) -> CUDABackendReturn 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
__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
__get_adnlp_available_backends(
_::Type{<:CTBase.Core.AbstractTag}
) -> AnyReturn 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
__get_adnlp_available_backends(
_::Type{CTSolvers.Modelers.ADNLPTag}
) -> AnyReturn 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
__get_cuda_backend(
_::Type{<:CTBase.Strategies.GPU}
) -> CUDABackendGet 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
__get_cuda_backend(
_::Type{CTBase.Strategies.GPU}
) -> CUDABackendReturn 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
__is_adbackend_instance(x) -> BoolReturn 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);truewhen the extension is active andx isa ADBackend
See also: CTSolvers.Modelers.__is_adbackend_type, CTSolvers.Modelers.validate_backend_override
__is_adbackend_instance(x::ADNLPModels.ADBackend) -> BoolReturn 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
__is_adbackend_type(_::Type) -> BoolReturn 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);truewhen the extension is active andT <: ADBackend
See also: CTSolvers.Modelers.__is_adbackend_instance, CTSolvers.Modelers.validate_backend_override
__is_adbackend_type(
_::Type{<:ADNLPModels.ADBackend}
) -> BoolReturn 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
build_adnlp_modeler(
::Type{<:CTBase.Core.AbstractTag},
parameter::Type{<:CTBase.Strategies.AbstractStrategyParameter};
kwargs...
) -> CTSolvers.Modelers.ADNLPStub 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
build_adnlp_modeler(
::Type{CTSolvers.Modelers.ADNLPTag},
parameter::Type{<:CTBase.Strategies.AbstractStrategyParameter};
mode,
kwargs...
) -> CTSolvers.Modelers.ADNLPBuild 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:permissivekwargs...: options forwarded toCTBase.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
build_exa_modeler(
::Type{<:CTBase.Core.AbstractTag},
parameter::Type{<:CTBase.Strategies.AbstractStrategyParameter};
kwargs...
) -> CTSolvers.Modelers.ExaStub 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
build_exa_modeler(
::Type{CTSolvers.Modelers.ExaTag},
parameter::Type{<:CTBase.Strategies.AbstractStrategyParameter};
mode,
kwargs...
) -> CTSolvers.Modelers.ExaBuild 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:permissivekwargs...: options forwarded toCTBase.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
get_adnlp_available_backends() -> AnyReturn 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: ifADNLPModelsis 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
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 takesbackendand validates it
Examples
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 modelerNotes
Creates a closure that converts
SymboltoValfor type-safe dispatchUsed by ADNLP metadata system for runtime validation
Extensions enable specific backends for their tag types
Default implementations throw
ExtensionErrorfor Enzyme/Zygote backends
See also: validate_adnlp_backend, ADNLPTag, Modelers.ADNLP
validate_adnlp_backend [Function]
CTSolvers.Modelers.validate_adnlp_backend Function
validate_adnlp_backend(
tag::CTBase.Core.AbstractTag,
backend::Val
) -> SymbolFallback 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
validate_adnlp_backend(
tag::CTBase.Core.AbstractTag,
_::Val{:default}
) -> SymbolValidate always-available ADNLP backends using tag dispatch.
Arguments
tag::Core.AbstractTag: Tag for dispatch (e.g., ADNLPTag, DummyTag)backend::Val{:default}: Default backend typebackend::Val{:optimized}: Optimized backend typebackend::Val{:generic}: Generic backend typebackend::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
validate_adnlp_backend(
tag::CTBase.Core.AbstractTag,
_::Val{:enzyme}
) -> SymbolValidate 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
validate_adnlp_backend(
tag::CTBase.Core.AbstractTag,
_::Val{:zygote}
) -> SymbolValidate 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
validate_adnlp_backend(
tag::CTSolvers.Modelers.ADNLPTag,
_::Val{:enzyme}
) -> SymbolValidate 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
validate_adnlp_backend(
tag::CTSolvers.Modelers.ADNLPTag,
_::Val{:zygote}
) -> SymbolValidate 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
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 notnothing, aType{<:ADBackend}, or anADBackendinstance
Examples
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
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,BigFloatInvalid types throw
IncorrectArgumentwith helpful error message
Examples
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.ExaSee also: Modelers.Exa
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
validate_matrix_free(matrix_free::Bool) -> Bool
validate_matrix_free(
matrix_free::Bool,
problem_size::Int64
) -> BoolValidate matrix-free mode setting and provide recommendations.
Arguments
matrix_free::Bool: Whether to use matrix-free modeproblem_size::Int: Size of the optimization problem (default: 1000)
Returns
Bool: Validated matrix-free setting
Examples
validate_matrix_free(true, 10_000)
validate_matrix_free(false, 1_000_000)validate_model_name [Function]
CTSolvers.Modelers.validate_model_name Function
validate_model_name(name::String) -> StringValidate that the model name is appropriate.
Arguments
name::String: The model name to validate
Throws
CTBase.Exceptions.IncorrectArgument: If the name is invalid
Examples
validate_model_name("MyProblem")
# Throws CTBase.Exceptions.IncorrectArgument
validate_model_name("")validate_optimization_direction [Function]
CTSolvers.Modelers.validate_optimization_direction Function
validate_optimization_direction(minimize::Bool) -> BoolValidate 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
validate_optimization_direction(true)
validate_optimization_direction(false)From CTSolversMadNLP
solve_with_madnlp [Function]
CTSolversMadNLP.solve_with_madnlp Function
solve_with_madnlp(
nlp::AbstractNLPModel;
kwargs...
) -> MadNLPExecutionStatsBackend interface for MadNLP solver.
Calls MadNLP to solve the NLP problem.
From CTSolversUno
solve_with_uno [Function]
CTSolversUno.solve_with_uno Function
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 solvekwargs...: 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
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 solveoptions...: Ipopt options as keyword arguments
Returns
SolverCore.GenericExecutionStats: Solver execution statistics
See also: Solvers.Ipopt, NLPModelsIpopt.ipopt