Public API
This page lists exported symbols of CTSolvers.Solvers.
From CTSolvers.Solvers
CTSolvers.Solvers [Module]
CTSolvers.Solvers Module
SolversOptimization solvers module for the Control Toolbox.
This module provides concrete solver strategies that wrap NLP backends (Ipopt, MadNLP, MadNCL, Knitro, Uno). All solvers implement the AbstractStrategy contract and are called through CommonSolve.solve.
Solver Types
Solvers.Ipopt- Interior point optimizer, CPU (requires NLPModelsIpopt)Solvers.MadNLP- Pure-Julia interior point optimizer, CPU/GPU (requires MadNLP)Solvers.MadNCL- Augmented Lagrangian (NCL) solver built on MadNLP, CPU/GPU (requires MadNCL, MadNLP)Solvers.Knitro- Commercial solver, CPU (requires NLPModelsKnitro)Solvers.Uno- Unified Lagrange-Newton solver, CPU (requires UnoSolver)
Architecture
Types and logic: Defined in src/Solvers/ (this module)
Backend interfaces: Implemented in ext/ as minimal extensions
Strategy contract: All solvers implement AbstractStrategy
Example
using CTSolvers
using NLPModelsIpopt # Load backend extension
using ADNLPModels
using CommonSolve
solver = Solvers.Ipopt(max_iter=1000, tol=1e-6)
nlp = ADNLPModel(x -> sum(x.^2), zeros(10))
stats = solve(nlp, solver; display=false)See also: AbstractNLPSolver, Solvers.Ipopt
AbstractNLPSolver [Abstract Type]
CTSolvers.Solvers.AbstractNLPSolver Type
abstract type AbstractNLPSolver <: CTBase.Strategies.AbstractStrategyAbstract base type for optimization solvers in the Control Toolbox.
All concrete solver types must:
Be a subtype of
AbstractNLPSolverImplement the
AbstractStrategycontract:Strategies.id(::Type{<:MySolver})- Return unique Symbol identifierStrategies.metadata(::Type{<:MySolver})- Return StrategyMetadata with optionsHave an
options::Strategies.StrategyOptionsfield
Implement the solve method (typically in a backend extension):
CommonSolve.solve(nlp::NLPModels.AbstractNLPModel, solver::MySolver; display=Bool)
Solver Types
Solvers.Ipopt- Interior point optimizer (Ipopt backend)Solvers.MadNLP- Pure-Julia interior point optimizer (MadNLP backend)Solvers.MadNCL- Augmented Lagrangian (NCL) solver built on MadNLP (MadNCL backend)Solvers.Knitro- Commercial solver (Knitro backend)Solvers.Uno- Unified Lagrange-Newton solver (Uno backend)
Example
using CommonSolve
# Create solver with options
solver = Solvers.Ipopt(max_iter=1000, tol=1e-8)
# Solve an NLP problem
nlp = ADNLPModel(x -> sum(x.^2), zeros(10))
stats = solve(nlp, solver; display=true)See also: Solvers.Ipopt, Solvers.MadNLP, Solvers.MadNCL, Solvers.Knitro, Solvers.Uno, CommonSolve.solve
Ipopt [Struct]
CTSolvers.Solvers.Ipopt Type
struct Ipopt{P<:CTBase.Strategies.CPU} <: CTSolvers.Solvers.AbstractNLPSolverInterior point optimization solver using the Ipopt backend.
Ipopt (Interior Point OPTimizer) is an open-source software package for large-scale nonlinear optimization. It implements a primal-dual interior point method with proven global convergence properties.
Parameterized Types
The solver supports parameterization for execution backend:
Ipopt{Strategies.CPU}: CPU execution (default and only supported parameter)
Note: Unlike MadNLP and MadNCL, this solver only supports CPU execution. GPU execution is not available for Ipopt.
Constructors
# Default constructor (CPU)
Solvers.Ipopt(; mode::Symbol=:strict, kwargs...)
# Explicit parameter specification (only CPU supported)
Solvers.Ipopt{Strategies.CPU}(; mode::Symbol=:strict, kwargs...)Fields
options::CTBase.Strategies.StrategyOptions: Solver configuration options containing validated option values
Parameter Behavior
CPU Parameter (Default)
The CPU parameter indicates standard CPU-based execution:
Uses Ipopt's standard interior point algorithm
No GPU acceleration available
Compatible with all standard Julia environments
Proven global convergence properties
Solver Options
Solver options are defined in the CTSolversIpopt extension. Load the extension to access option definitions and documentation:
using NLPModelsIpoptExamples
Basic Usage
# Conceptual usage pattern (requires NLPModelsIpopt extension)
using NLPModelsIpopt
# Default solver (CPU)
solver = Ipopt(max_iter=1000, tol=1e-6, print_level=3)
# Explicit CPU specification
solver_cpu = Ipopt{Strategies.CPU}(max_iter=1000, tol=1e-6)
nlp = ADNLPModel(x -> sum(x.^2), zeros(10))
stats = CommonSolve.solve(nlp, solver; display=true)Invalid Usage
# GPU is NOT supported - rejected by the type parameter bound (TypeError)
solver = Ipopt{Strategies.GPU}() # ❌ Error!Extension Required
This solver requires the NLPModelsIpopt package to be loaded:
using NLPModelsIpoptImplementation Notes
Implements the
AbstractStrategycontract viaStrategies.id()Metadata and constructor implementation provided by CTSolversIpopt extension
Options are validated at construction time using enriched
Exceptions.IncorrectArgumentSolve method:
CommonSolve.solve(nlp, solver::Ipopt; display=true)provided by extension
Throws
TypeError: IfStrategies.GPUor another unsupported parameter is specified (the type parameter is bounded byStrategies.CPU)CTBase.Exceptions.ExtensionError: If the NLPModelsIpopt extension is not loaded
See also: Strategies.CPU, AbstractNLPSolver, MadNLP, Knitro
Knitro [Struct]
CTSolvers.Solvers.Knitro Type
struct Knitro{P<:CTBase.Strategies.CPU} <: CTSolvers.Solvers.AbstractNLPSolverCommercial optimization solver with advanced algorithms.
Knitro is a commercial solver offering state-of-the-art algorithms for nonlinear optimization, including interior point, active set, and SQP methods. It provides excellent performance and robustness for large-scale problems.
Parameterized Types
The solver supports parameterization for execution backend:
Knitro{Strategies.CPU}: CPU execution (default and only supported parameter)
Note: Unlike MadNLP and MadNCL, this solver only supports CPU execution. GPU execution is not available for Knitro.
Constructors
# Default constructor (CPU)
Solvers.Knitro(; mode::Symbol=:strict, kwargs...)
# Explicit parameter specification (only CPU supported)
Solvers.Knitro{Strategies.CPU}(; mode::Symbol=:strict, kwargs...)Fields
options::CTBase.Strategies.StrategyOptions: Solver configuration options containing validated option values
Parameter Behavior
CPU Parameter (Default)
The CPU parameter indicates standard CPU-based execution:
Uses Knitro's advanced optimization algorithms
No GPU acceleration available
Compatible with all standard Julia environments
Requires valid Knitro license
Solver Options
Solver options are defined in the CTSolversKnitro extension. Load the extension to access option definitions and documentation:
using NLPModelsKnitroExamples
Basic Usage
# Conceptual usage pattern (requires NLPModelsKnitro extension)
using NLPModelsKnitro
# Default solver (CPU)
solver = Knitro(maxit=1000, maxtime=3600, ftol=1e-10, outlev=2)
# Explicit CPU specification
solver_cpu = Knitro{Strategies.CPU}(maxit=1000, outlev=2)
nlp = ADNLPModel(x -> sum(x.^2), zeros(10))
stats = CommonSolve.solve(nlp, solver; display=true)Invalid Usage
# GPU is NOT supported - rejected by the type parameter bound (TypeError)
solver = Knitro{Strategies.GPU}() # ❌ Error!Extension Required
This solver requires the NLPModelsKnitro package:
using NLPModelsKnitroNote: Knitro is a commercial solver requiring a valid license.
Implementation Notes
Implements the
AbstractStrategycontract viaStrategies.id()Metadata and constructor implementation provided by CTSolversKnitro extension
Options are validated at construction time using enriched
Exceptions.IncorrectArgumentSolve method:
CommonSolve.solve(nlp, solver::Knitro; display=true)provided by extensionRequires valid Knitro license for operation
Throws
TypeError: IfStrategies.GPUor another unsupported parameter is specified (the type parameter is bounded byStrategies.CPU)CTBase.Exceptions.ExtensionError: If the NLPModelsKnitro extension is not loaded
See also: Strategies.CPU, AbstractNLPSolver, Ipopt, MadNLP
MadNCL [Struct]
CTSolvers.Solvers.MadNCL Type
struct MadNCL{P<:Union{CTBase.Strategies.CPU, CTBase.Strategies.GPU}} <: CTSolvers.Solvers.AbstractNLPSolverAugmented Lagrangian solver built on MadNLP.
MadNCL implements the NCL (Nonlinearly Constrained augmented Lagrangian) method: a sequence of augmented Lagrangian subproblems, each solved by MadNLP's interior point method. This makes it robust on degenerate problems where constraint qualifications fail.
Parameterized Types
The solver supports parameterization for execution backend:
MadNCL{Strategies.CPU}: CPU execution (default)MadNCL{Strategies.GPU}: GPU execution (requires MadNLPGPU, CUDA and CUDSS)
Fields
options::CTBase.Strategies.StrategyOptions: Solver configuration options containing validated option values
Solver Options
Solver options are defined in the CTSolversMadNCL extension. Load the extension to access option definitions and documentation:
using MadNCL, MadNLPExample
# Conceptual usage pattern (requires MadNCL, MadNLP extensions)
using MadNCL, MadNLP
solver = Solvers.MadNCL(max_iter=1000, tol=1e-6, print_level=MadNLP.DEBUG)
nlp = ADNLPModel(x -> sum(x.^2), zeros(10))
stats = CommonSolve.solve(nlp, solver; display=true)Extension Required
This solver requires the MadNCL package:
using MadNCL, MadNLPImplementation Notes
Implements the
AbstractStrategycontract viaStrategies.id,Strategies.metadata, andStrategies.optionsOptions are validated at construction time using enriched
Exceptions.IncorrectArgumentSolve method:
CommonSolve.solve(nlp, solver::MadNCL; display=true)provided by extensionSolves each augmented Lagrangian subproblem with MadNLP
Default backend is automatically selected based on the parameter type
GPU linear solver: When using
MadNCL{Strategies.GPU}, the linear solver automatically defaults toMadNLPGPU.CUDSSSolverinstead ofMadNLP.MumpsSolver. This ensures compatibility with GPU execution and avoids attempting to use CPU-only solvers on CUDA backends.
See also: AbstractNLPSolver, MadNLP, Ipopt, Strategies.CPU, Strategies.GPU
MadNLP [Struct]
CTSolvers.Solvers.MadNLP Type
struct MadNLP{P<:Union{CTBase.Strategies.CPU, CTBase.Strategies.GPU}} <: CTSolvers.Solvers.AbstractNLPSolverPure-Julia interior point solver with GPU support.
MadNLP is a modern implementation of an interior point method written entirely in Julia, with support for GPU acceleration and various linear solver backends. It provides excellent performance for large-scale optimization problems.
Parameterized Types
The solver supports parameterization for execution backend:
MadNLP{Strategies.CPU}: CPU execution (default)MadNLP{Strategies.GPU}: GPU execution (requires MadNLPGPU, CUDA and CUDSS)
Fields
options::CTBase.Strategies.StrategyOptions: Solver configuration options containing validated option values
Solver Options
max_iter::Integer: Maximum number of iterations (default: 3000, must be ≥ 0)tol::Real: Convergence tolerance (default: 1e-8, must be > 0)print_level::MadNLP.LogLevels: MadNLP log level (default: MadNLP.INFO)MadNLP.DEBUG: Detailed debugging output
MadNLP.INFO: Standard informational output
MadNLP.WARN: Warning messages only
MadNLP.ERROR: Error messages only
linear_solver::Type{<:MadNLP.AbstractLinearSolver}: Linear solver backendDefault for CPU:
MadNLP.MumpsSolverDefault for GPU:
MadNLPGPU.CUDSSSolver(requires MadNLPGPU.jl)
backend: Execution backend (default depends on parameter: CPU backend for CPU, CUDA backend for GPU)
Example
# Conceptual usage pattern (requires MadNLP extension)
using MadNLP
solver = MadNLP(max_iter=1000, tol=1e-6, print_level=MadNLP.DEBUG)
nlp = ADNLPModel(x -> sum(x.^2), zeros(10))
stats = CommonSolve.solve(nlp, solver; display=true)Extension Required
This solver requires the MadNLP package:
using MadNLPImplementation Notes
Implements the
AbstractStrategycontract viaStrategies.id,Strategies.metadata, andStrategies.optionsOptions are validated at construction time using enriched
Exceptions.IncorrectArgumentSolve method:
CommonSolve.solve(nlp, solver::MadNLP; display=true)provided by extensionSupports GPU acceleration when appropriate backends are loaded
Default backend is automatically selected based on the parameter type
GPU linear solver: When using
MadNLP{Strategies.GPU}, the linear solver automatically defaults toMadNLPGPU.CUDSSSolverinstead ofMadNLP.MumpsSolver. This ensures compatibility with GPU execution and avoids attempting to use CPU-only solvers on CUDA backends.
See also: AbstractNLPSolver, Ipopt, Solvers.MadNCL, Strategies.CPU, Strategies.GPU
Uno [Struct]
CTSolvers.Solvers.Uno Type
struct Uno{P<:CTBase.Strategies.CPU} <: CTSolvers.Solvers.AbstractNLPSolverUnified nonlinear optimization solver using the Uno backend.
Uno (Unifying Nonlinear Optimization) is a C++ library that unifies Lagrange-Newton methods (essentially SQP and interior-point) by breaking them down into modular building blocks. It solves nonlinearly constrained optimization problems by iteratively solving the optimality (KKT) conditions with Newton's method.
Unification Framework
Uno implements a modular framework with the following strategies:
Constraint relaxation: feasibility restoration
Inequality handling: inequality constrained method, interior-point method
Hessian models: exact, L-BFGS, identity, zero
Inertia control: primal, primal-dual, none
Globalization strategies: filter method, funnel method, merit function
Globalization mechanisms: backtracking line search, trust-region method
Presets
Uno provides presets that mimic existing solvers:
"ipopt": Line-search feasibility restoration filter barrier method with exact Hessian and primal-dual inertia correction (mimics IPOPT)"filtersqp": Trust-region feasibility restoration filter SQP method with exact Hessian (mimics filterSQP)
Parameterized Types
The solver supports parameterization for execution backend:
Uno{Strategies.CPU}: CPU execution (default and only supported parameter)
Note: This solver only supports CPU execution with ADNLP modeler. GPU execution is not available for Uno.
Constructors
# Default constructor (CPU)
Solvers.Uno(; mode::Symbol=:strict, kwargs...)
# Explicit parameter specification (only CPU supported)
Solvers.Uno{Strategies.CPU}(; mode::Symbol=:strict, kwargs...)Fields
options::CTBase.Strategies.StrategyOptions: Solver configuration options containing validated option values
Parameter Behavior
CPU Parameter (Default)
The CPU parameter indicates standard CPU-based execution:
Uses Uno's unified algorithmic framework
Supports multiple presets (ipopt, filtersqp)
Compatible with ADNLP modeler only
No GPU acceleration available
Solver Options
Solver options are defined in the CTSolversUno extension. Load the extension to access option definitions and documentation:
using UnoSolverExamples
Basic Usage
# Conceptual usage pattern (requires UnoSolver extension)
using UnoSolver
# Default solver (CPU) with ipopt preset
solver = Uno(max_iterations=1000, primal_tolerance=1e-6, preset="ipopt")
# Using filtersqp preset
solver_sqp = Uno(max_iterations=1000, preset="filtersqp")
# Explicit CPU specification
solver_cpu = Uno{Strategies.CPU}(max_iterations=1000, dual_tolerance=1e-6)
nlp = ADNLPModel(x -> sum(x.^2), zeros(10))
stats = CommonSolve.solve(nlp, solver; display=true)Invalid Usage
# GPU is NOT supported - rejected by the type parameter bound (TypeError)
solver = Uno{Strategies.GPU}() # ❌ Error!Extension Required
This solver requires the UnoSolver package to be loaded:
using UnoSolverImplementation Notes
Implements the
AbstractStrategycontract viaStrategies.id()Metadata and constructor implementation provided by CTSolversUno extension
Options are validated at construction time using enriched
Exceptions.IncorrectArgumentSolve method:
CommonSolve.solve(nlp, solver::Uno; display=true)provided by extensionCPU only: works with
Modelers.ADNLPandModelers.Exa{CPU}(anyNLPModels.AbstractNLPModelon the host)Based on the unified framework described in Vanaret & Leyffer (2026)
Throws
TypeError: IfStrategies.GPUor another unsupported parameter is specified (the type parameter is bounded byStrategies.CPU)CTBase.Exceptions.ExtensionError: If the UnoSolver extension is not loaded
References
Vanaret, C., & Leyffer, S. (2026). Implementing a unified solver for nonlinearly constrained optimization. Mathematical Programming Computation (accepted).
See also: Strategies.CPU, AbstractNLPSolver, Ipopt, MadNLP
extract_solver_infos [Function]
CTSolvers.Solvers.extract_solver_infos Function
extract_solver_infos(
nlp_solution::SolverCore.GenericExecutionStats
) -> Tuple{Any, Int64, Any, String, Symbol, Bool}Retrieve convergence information from an NLP solution.
This function extracts standardized solver information from NLP solver execution statistics. It returns a 6-element tuple that can be used to construct solver metadata for optimal control solutions.
Arguments
nlp_solution::SolverCore.GenericExecutionStats: A solver execution statistics object.
Returns
A 6-element tuple (objective, iterations, constraints_violation, message, status, successful):
objective::Float64: The final objective valueiterations::Int: Number of iterations performedconstraints_violation::Float64: Maximum constraint violation (primal feasibility)message::String: Solver identifier string (e.g., "Ipopt/generic")status::Symbol: Termination status (e.g.,:first_order,:acceptable)successful::Bool: Whether the solver converged successfully
Example
obj, iter, viol, msg, stat, success = extract_solver_infos(nlp_solution)extract_solver_infos(
nlp_solution::MadNLPExecutionStats
) -> Tuple{Any, Int64, Any, String, Symbol, Bool}Extract solver information from MadNLP execution statistics.
Arguments
nlp_solution::MadNLP.MadNLPExecutionStats: MadNLP execution statistics
Returns
A 6-element tuple (objective, iterations, constraints_violation, message, status, successful):
objective::Float64: The final objective valueiterations::Int: Number of iterations performedconstraints_violation::Float64: Maximum constraint violation (primal feasibility)message::String: Solver identifier string ("MadNLP")status::Symbol: Termination status from SolverCoresuccessful::Bool: Whether the solver converged successfully
extract_solver_infos(
nlp_solution::MadNCL.NCLStats
) -> Tuple{Any, Int64, Any, String, Symbol, Bool}Extract solver information from MadNCL execution statistics.
Uses the same field mapping as MadNLP since NCLStats has compatible structure.
Arguments
nlp_solution::MadNCL.NCLStats: MadNCL execution statistics
Returns
A 6-element tuple (objective, iterations, constraints_violation, message, status, successful):
objective::Float64: The final objective valueiterations::Int: Number of iterations performedconstraints_violation::Float64: Maximum constraint violation (primal feasibility)message::String: Solver identifier string ("MadNCL")status::Symbol: Termination status from SolverCoresuccessful::Bool: Whether the solver converged successfully
extract_solver_infos(
nlp_solution::UnoExecutionStats
) -> Tuple{Float64, Int64, Float64, String, Symbol, Bool}Extract solver information from Uno execution statistics.
Arguments
nlp_solution::UnoSolver.UnoExecutionStats: Uno execution statistics
Returns
A 6-element tuple (objective, iterations, constraints_violation, message, status, successful):
objective::Float64: The final objective valueiterations::Int: Number of iterations performedconstraints_violation::Float64: Maximum constraint violation (primal feasibility)message::String: Solver identifier string ("Uno")status::Symbol: Termination status from SolverCoresuccessful::Bool: Whether the solver converged successfully
Notes
The successful flag is
truewhen status is:first_orderor:acceptableThis function enables integration with the CTSolvers pipeline by providing standardized solver information
See also: CTSolversUno.solve_with_uno