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 implementations that integrate with various optimization backends (Ipopt, MadNLP, MadNCL, Knitro). All solvers implement the AbstractStrategy contract and provide a unified callable interface.
Solver Types
Solvers.Ipopt- Interior point optimizer (requires NLPModelsIpopt)Solvers.MadNLP- Matrix-free augmented Lagrangian (requires MadNLP)Solvers.MadNCL- NCL variant of MadNLP (requires MadNCL, MadNLP)Solvers.Knitro- Commercial solver (requires NLPModelsKnitro)Solvers.Uno- Unified solver (requires NLPModelsUno)
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
# Create solver with options
solver = Solvers.Ipopt(max_iter=1000, tol=1e-6)
# Solve NLP problem
using ADNLPModels
nlp = ADNLPModel(x -> sum(x.^2), zeros(10))
stats = solver(nlp, display=true)
# Or use CommonSolve API
using CommonSolve
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: 2. Be a subtype of AbstractNLPSolver
- Implement 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- Matrix-free augmented Lagrangian (MadNLP backend)Solvers.MadNCL- NCL variant of MadNLPSolvers.Knitro- Commercial solver (Knitro 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, 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{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{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{CPU}(max_iter=1000, tol=1e-6)
nlp = ADNLPModel(x -> sum(x.^2), zeros(10))
stats = solver(nlp, display=true)Invalid Usage
# GPU is NOT supported - will throw IncorrectArgument
solver = Ipopt{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.IncorrectArgumentCallable interface:
(solver::Ipopt)(nlp; display=true)provided by extension
Throws
CTBase.Exceptions.IncorrectArgument: If GPU or other unsupported parameter is specifiedCTBase.Exceptions.ExtensionError: If the NLPModelsIpopt extension is not loaded
See also: 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{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{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{CPU}(maxit=1000, outlev=2)
nlp = ADNLPModel(x -> sum(x.^2), zeros(10))
stats = solver(nlp, display=true)Invalid Usage
# GPU is NOT supported - will throw IncorrectArgument
solver = Knitro{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.IncorrectArgumentCallable interface:
(solver::Knitro)(nlp; display=true)provided by extensionRequires valid Knitro license for operation
Throws
CTBase.Exceptions.IncorrectArgument: If GPU or other unsupported parameter is specifiedCTBase.Exceptions.ExtensionError: If the NLPModelsKnitro extension is not loaded
See also: CPU, AbstractNLPSolver, Ipopt, MadNLP
MadNCL [Struct]
CTSolvers.Solvers.MadNCL Type
struct MadNCL{P<:Union{CTBase.Strategies.CPU, CTBase.Strategies.GPU}} <: CTSolvers.Solvers.AbstractNLPSolverNCL (Non-Convex Lagrangian) variant of MadNLP solver.
MadNCL extends MadNLP with specialized handling for non-convex problems using a modified Lagrangian approach, providing improved convergence for challenging nonlinear optimization problems.
Parameterized Types
The solver supports parameterization for execution backend:
MadNCL{CPU}: CPU execution (default)MadNCL{GPU}: GPU execution (requires CUDA.jl)
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 = solver(nlp, 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.IncorrectArgumentCallable interface:
(solver::MadNCL{P})(nlp; display=true)Extends MadNLP with NCL-specific optimizations
Default backend is automatically selected based on the parameter type
GPU linear solver: When using
MadNCL{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, CPU, 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{CPU}: CPU execution (default)MadNLP{GPU}: GPU execution (requires CUDA.jl)
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 = solver(nlp, 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.IncorrectArgumentCallable interface:
(solver::MadNLP{P}(nlp; display=true)Supports GPU acceleration when appropriate backends are loaded
Default backend is automatically selected based on the parameter type
GPU linear solver: When using
MadNLP{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, CPU, 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{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{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{CPU}(max_iterations=1000, dual_tolerance=1e-6)
nlp = ADNLPModel(x -> sum(x.^2), zeros(10))
stats = solver(nlp, display=true)Invalid Usage
# GPU is NOT supported - will throw IncorrectArgument
solver = Uno{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.IncorrectArgumentCallable interface:
(solver::Uno)(nlp; display=true)provided by extensionOnly compatible with ADNLP modeler (not ExaModeler)
Based on the unified framework described in Vanaret & Leyffer (2026)
Throws
CTBase.Exceptions.IncorrectArgument: If GPU or other unsupported parameter is specifiedCTBase.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: 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: solve_with_uno