Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion docs/api_reference.jl
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ function generate_api_reference(src_dir::String, ext_dir::String)
title_in_menu="Solvers",
filename="solvers",
),

]

# ───────────────────────────────────────────────────────────────────
Expand Down
2 changes: 1 addition & 1 deletion docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ include("api_reference.jl")
# Build documentation
# ═══════════════════════════════════════════════════════════════════════════════
with_api_reference(src_dir, ext_dir) do api_pages
makedocs(;
return makedocs(;
draft=draft,
remotes=nothing, # Disable remote links. Needed for DocumenterReference
warnonly=true,
Expand Down
4 changes: 2 additions & 2 deletions src/Modelers/abstract_modeler.jl
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Build an NLP model from a discretized optimal control problem and initial guess.
function (modeler::AbstractNLPModeler)(
::Optimization.AbstractOptimizationProblem, initial_guess
)
throw(
return throw(
Exceptions.NotImplemented(
"Model building not implemented";
required_method="(modeler::$(typeof(modeler)))(prob::Optimization.AbstractOptimizationProblem, initial_guess)",
Expand Down Expand Up @@ -87,7 +87,7 @@ Build a solution object from a discretized optimal control problem and NLP solut
function (modeler::AbstractNLPModeler)(
::Optimization.AbstractOptimizationProblem, ::SolverCore.AbstractExecutionStats
)
throw(
return throw(
Exceptions.NotImplemented(
"Solution building not implemented";
required_method="(modeler::$(typeof(modeler)))(prob::Optimization.AbstractOptimizationProblem, nlp_solution::SolverCore.AbstractExecutionStats)",
Expand Down
4 changes: 2 additions & 2 deletions src/Modelers/adnlp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,8 @@ $(TYPEDSIGNATURES)
Return the description for the ADNLP modeler.
"""
function Strategies.description(::Type{<:Modelers.ADNLP})
"NLP modeler using ADNLPModels with automatic differentiation.\n" *
"See: https://jso.dev/ADNLPModels.jl"
return "NLP modeler using ADNLPModels with automatic differentiation.\n" *
"See: https://jso.dev/ADNLPModels.jl"
end

"""
Expand Down
6 changes: 3 additions & 3 deletions src/Modelers/exa.jl
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ and returns an appropriate CUDA backend.
- Uses CUDA.CUDABackend() for GPU execution
"""
function __get_cuda_backend(::Type{<:GPU})
throw(
return throw(
Exceptions.ExtensionError(
:CUDA;
message="to use GPU backend with Exa modeler",
Expand Down Expand Up @@ -226,8 +226,8 @@ $(TYPEDSIGNATURES)
Return the description for the Exa modeler.
"""
function Strategies.description(::Type{<:Modelers.Exa})
"NLP modeler using ExaModels, supporting CPU and GPU execution.\n" *
"See: https://exanauts.github.io/ExaModels.jl"
return "NLP modeler using ExaModels, supporting CPU and GPU execution.\n" *
"See: https://exanauts.github.io/ExaModels.jl"
end

"""
Expand Down
10 changes: 5 additions & 5 deletions src/Modelers/validation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ See also: `validate_adnlp_backend(::Core.AbstractTag, ::Val{:default})`, `get_va
"""
function validate_adnlp_backend(tag::Core.AbstractTag, backend::Val)
# This is the generic fallback - should never be reached
throw(
return throw(
Exceptions.IncorrectArgument(
"Invalid ADNLPModels backend";
got="backend=$(backend)",
Expand Down Expand Up @@ -85,7 +85,7 @@ Validate Enzyme backend using tag dispatch.
See also: `validate_adnlp_backend(::Core.AbstractTag, ::Val{:zygote})`, `get_validate_adnlp_backend`
"""
function validate_adnlp_backend(tag::Core.AbstractTag, ::Val{:enzyme})
throw(
return throw(
Exceptions.ExtensionError(
:Enzyme;
message="to use Enzyme backend with ADNLP modeler",
Expand Down Expand Up @@ -115,7 +115,7 @@ Validate Zygote backend using tag dispatch.
See also: `validate_adnlp_backend(::Core.AbstractTag, ::Val{:enzyme})`, `get_validate_adnlp_backend`
"""
function validate_adnlp_backend(tag::Core.AbstractTag, ::Val{:zygote})
throw(
return throw(
Exceptions.ExtensionError(
:Zygote;
message="to use Zygote backend with ADNLP modeler",
Expand Down Expand Up @@ -182,7 +182,7 @@ Fallback method for invalid base types in ExaModels validation.
See also: `validate_exa_base_type(::Type{<:AbstractFloat})`
"""
function validate_exa_base_type(T)
throw(
return throw(
Exceptions.IncorrectArgument(
"Invalid base type for Modelers.Exa";
got="base_type=$T",
Expand Down Expand Up @@ -315,7 +315,7 @@ function validate_backend_override(backend)
isa(backend, Type) && backend <: ADNLPModels.ADBackend && return backend
# Accept an ADBackend instance (e.g., ForwardDiffADGradient())
isa(backend, ADNLPModels.ADBackend) && return backend
throw(
return throw(
Exceptions.IncorrectArgument(
"Backend override must be nothing, a Type{<:ADBackend}, or an ADBackend instance";
got=string(typeof(backend)),
Expand Down
8 changes: 4 additions & 4 deletions src/Optimization/contract.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ nlp = builder(initial_guess; show_time=false, backend=:optimized)
See also: `get_exa_model_builder`, `build_model`
"""
function get_adnlp_model_builder(prob::AbstractOptimizationProblem)
throw(
return throw(
Exceptions.NotImplemented(
"ADNLP model builder not implemented";
required_method="get_adnlp_model_builder(prob::$(typeof(prob)))",
Expand Down Expand Up @@ -69,7 +69,7 @@ nlp = builder(Float64, initial_guess; backend=nothing, minimize=true)
See also: `get_adnlp_model_builder`, `build_model`
"""
function get_exa_model_builder(prob::AbstractOptimizationProblem)
throw(
return throw(
Exceptions.NotImplemented(
"ExaModel builder not implemented";
required_method="get_exa_model_builder(prob::$(typeof(prob)))",
Expand Down Expand Up @@ -107,7 +107,7 @@ sol = builder(nlp_stats)
See also: `get_exa_solution_builder`, `build_solution`
"""
function get_adnlp_solution_builder(prob::AbstractOptimizationProblem)
throw(
return throw(
Exceptions.NotImplemented(
"ADNLP solution builder not implemented";
required_method="get_adnlp_solution_builder(prob::$(typeof(prob)))",
Expand Down Expand Up @@ -145,7 +145,7 @@ sol = builder(nlp_stats)
See also: `get_adnlp_solution_builder`, `build_solution`
"""
function get_exa_solution_builder(prob::AbstractOptimizationProblem)
throw(
return throw(
Exceptions.NotImplemented(
"ExaSolution builder not implemented";
required_method="get_exa_solution_builder(prob::$(typeof(prob)))",
Expand Down
2 changes: 1 addition & 1 deletion src/Solvers/abstract_solver.jl
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ stats = solver(nlp, display=false)
See also: `AbstractNLPSolver`, `CommonSolve.solve`
"""
function (solver::AbstractNLPSolver)(nlp; display::Bool=true)
throw(
return throw(
Exceptions.NotImplemented(
"Solver callable not implemented";
required_method="(solver::$(typeof(solver)))(nlp; display=Bool)",
Expand Down
8 changes: 4 additions & 4 deletions src/Solvers/ipopt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ $(TYPEDSIGNATURES)
Return the description for the Ipopt solver.
"""
function Strategies.description(::Type{<:Solvers.Ipopt})
"Interior-point NLP solver (COIN-OR Ipopt).\n" *
"See: https://coin-or.github.io/Ipopt/OPTIONS.html"
return "Interior-point NLP solver (COIN-OR Ipopt).\n" *
"See: https://coin-or.github.io/Ipopt/OPTIONS.html"
end

"""
Expand Down Expand Up @@ -229,7 +229,7 @@ See also: `Ipopt`, `Strategies.metadata`
function build_ipopt_solver(
::Type{<:Core.AbstractTag}, parameter::Type{<:AbstractStrategyParameter}; kwargs...
)
throw(
return throw(
Exceptions.ExtensionError(
:NLPModelsIpopt;
message="to create Ipopt, access options, and solve problems",
Expand All @@ -254,7 +254,7 @@ See also: `Ipopt`, `Strategies.StrategyMetadata`
"""
function Strategies.metadata(::Type{<:Solvers.Ipopt{P}}) where {P<:CPU}
# Extension is missing
throw(
return throw(
Exceptions.ExtensionError(
:NLPModelsIpopt;
message="to access Ipopt{$P} options metadata",
Expand Down
8 changes: 4 additions & 4 deletions src/Solvers/knitro.jl
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ $(TYPEDSIGNATURES)
Return the description for the Knitro solver.
"""
function Strategies.description(::Type{<:Solvers.Knitro})
"Commercial NLP solver by Artelys (requires license).\n" *
"See: https://www.artelys.com/app/docs/knitro/3_referenceManual/userOptions.html"
return "Commercial NLP solver by Artelys (requires license).\n" *
"See: https://www.artelys.com/app/docs/knitro/3_referenceManual/userOptions.html"
end

"""
Expand Down Expand Up @@ -232,7 +232,7 @@ See also: `Knitro`, `Strategies.metadata`
function build_knitro_solver(
::Type{<:Core.AbstractTag}, parameter::Type{<:AbstractStrategyParameter}; kwargs...
)
throw(
return throw(
Exceptions.ExtensionError(
:NLPModelsKnitro;
message="to create Knitro, access options, and solve problems",
Expand All @@ -257,7 +257,7 @@ See also: `Knitro`, `Strategies.StrategyMetadata`
"""
function Strategies.metadata(::Type{<:Solvers.Knitro{P}}) where {P<:CPU}
# Extension is missing
throw(
return throw(
Exceptions.ExtensionError(
:NLPModelsKnitro;
message="to access Knitro{$P} options metadata",
Expand Down
8 changes: 4 additions & 4 deletions src/Solvers/madncl.jl
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ $(TYPEDSIGNATURES)
Return the description for the MadNCL solver.
"""
function Strategies.description(::Type{<:Solvers.MadNCL})
"Augmented Lagrangian NLP solver built on MadNLP.\n" *
"See: https://github.com/MadNLP/MadNCL.jl"
return "Augmented Lagrangian NLP solver built on MadNLP.\n" *
"See: https://github.com/MadNLP/MadNCL.jl"
end

"""
Expand Down Expand Up @@ -189,7 +189,7 @@ See also: `MadNCL`, `Strategies.metadata`
function build_madncl_solver(
::Type{<:Core.AbstractTag}, parameter::Type{<:AbstractStrategyParameter}; kwargs...
)
throw(
return throw(
Exceptions.ExtensionError(
:MadNCL,
:MadNLP;
Expand All @@ -216,7 +216,7 @@ See also: `MadNCL`, `Strategies.StrategyMetadata`
function Strategies.metadata(
::Type{<:Solvers.MadNCL{P}}
) where {P<:AbstractStrategyParameter}
throw(
return throw(
Exceptions.ExtensionError(
:MadNCL,
:MadNLP;
Expand Down
8 changes: 4 additions & 4 deletions src/Solvers/madnlp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ $(TYPEDSIGNATURES)
Return the description for the MadNLP solver.
"""
function Strategies.description(::Type{<:Solvers.MadNLP})
"Interior-point NLP solver with sparse linear algebra and GPU support.\n" *
"See: https://madsuite.org/MadNLP.jl/stable/options/"
return "Interior-point NLP solver with sparse linear algebra and GPU support.\n" *
"See: https://madsuite.org/MadNLP.jl/stable/options/"
end

"""
Expand Down Expand Up @@ -195,7 +195,7 @@ See also: `MadNLP`, `Strategies.metadata`
function build_madnlp_solver(
::Type{<:Core.AbstractTag}, parameter::Type{<:AbstractStrategyParameter}; kwargs...
)
throw(
return throw(
Exceptions.ExtensionError(
:MadNLP;
message="to create MadNLP, access options, and solve problems",
Expand All @@ -221,7 +221,7 @@ See also: `MadNLP`, `Strategies.StrategyMetadata`
function Strategies.metadata(
::Type{<:Solvers.MadNLP{P}}
) where {P<:AbstractStrategyParameter}
throw(
return throw(
Exceptions.ExtensionError(
:MadNLP;
message="to access MadNLP{$P} options metadata",
Expand Down
2 changes: 1 addition & 1 deletion src/Solvers/madnlpsuite.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Return the default linear solver for the given parameter type.
- GPU implementation provided by CTSolversMadNLPGPU extension
"""
function __madnlp_suite_default_linear_solver(::Type{<:GPU})
throw(
return throw(
Exceptions.ExtensionError(
:MadNLPGPU;
message="to use GPU linear solver with MadNLP/MadNCL",
Expand Down
8 changes: 4 additions & 4 deletions src/Solvers/uno.jl
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,8 @@ $(TYPEDSIGNATURES)
Return the description for the Uno solver.
"""
function Strategies.description(::Type{<:Solvers.Uno})
"Unified modular NLP solver combining interior-point, SQP, trust-region and filter strategies.\n" *
"See: https://unosolver.readthedocs.io/en/latest/"
return "Unified modular NLP solver combining interior-point, SQP, trust-region and filter strategies.\n" *
"See: https://unosolver.readthedocs.io/en/latest/"
end

"""
Expand Down Expand Up @@ -258,7 +258,7 @@ See also: `Uno`, `Strategies.metadata`
function build_uno_solver(
::Type{<:Core.AbstractTag}, parameter::Type{<:AbstractStrategyParameter}; kwargs...
)
throw(
return throw(
Exceptions.ExtensionError(
:UnoSolver;
message="to create Uno, access options, and solve problems",
Expand All @@ -283,7 +283,7 @@ See also: `Uno`, `Strategies.StrategyMetadata`
"""
function Strategies.metadata(::Type{<:Solvers.Uno{P}}) where {P<:CPU}
# Extension is missing
throw(
return throw(
Exceptions.ExtensionError(
:UnoSolver;
message="to access Uno{$P} options metadata",
Expand Down
2 changes: 1 addition & 1 deletion test/problems/elec.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using Random

function elec_objective(x, y, z, i, j)
1.0 / sqrt((x[i] - x[j])^2 + (y[i] - y[j])^2 + (z[i] - z[j])^2)
return 1.0 / sqrt((x[i] - x[j])^2 + (y[i] - y[j])^2 + (z[i] - z[j])^2)
end
elec_constraint(x, y, z, i) = x[i]^2 + y[i]^2 + z[i]^2 - 1.0
function elec_objective(x, y, z)
Expand Down
6 changes: 2 additions & 4 deletions test/suite/extensions/test_madncl_extension.jl
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,10 @@ function test_madncl_extension()
Test.@test :jacobian_constant in keys(meta)
Test.@test Options.default(meta[:bound_push]) isa Core.NotProvidedType
Test.@test Options.default(meta[:bound_fac]) isa Core.NotProvidedType
Test.@test Options.default(meta[:constr_mult_init_max]) isa
Core.NotProvidedType
Test.@test Options.default(meta[:constr_mult_init_max]) isa Core.NotProvidedType
Test.@test Options.default(meta[:fixed_variable_treatment]) isa
Core.NotProvidedType
Test.@test Options.default(meta[:equality_treatment]) isa
Core.NotProvidedType
Test.@test Options.default(meta[:equality_treatment]) isa Core.NotProvidedType
Test.@test :kkt_system in keys(meta)
Test.@test :hessian_approximation in keys(meta)
Test.@test :mu_init in keys(meta)
Expand Down
8 changes: 3 additions & 5 deletions test/suite/extensions/test_madnlp_extension.jl
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,10 @@ function test_madnlp_extension()
# Test initialization defaults
Test.@test Options.default(meta[:bound_push]) isa Core.NotProvidedType
Test.@test Options.default(meta[:bound_fac]) isa Core.NotProvidedType
Test.@test Options.default(meta[:constr_mult_init_max]) isa
Core.NotProvidedType
Test.@test Options.default(meta[:constr_mult_init_max]) isa Core.NotProvidedType
Test.@test Options.default(meta[:fixed_variable_treatment]) isa
Core.NotProvidedType
Test.@test Options.default(meta[:equality_treatment]) isa
Core.NotProvidedType
Test.@test Options.default(meta[:equality_treatment]) isa Core.NotProvidedType
end

# ====================================================================
Expand All @@ -152,7 +150,7 @@ function test_madnlp_extension()
Test.@testset "Contract validation" begin
Test.@test Strategies.id(Solvers.MadNLP) isa Symbol
Test.@test Strategies.metadata(Solvers.MadNLP) isa Strategies.StrategyMetadata
solver = Solvers.MadNLP(print_level = MadNLP.ERROR)
solver = Solvers.MadNLP(print_level=MadNLP.ERROR)
Test.@test Strategies.options(solver) isa Strategies.StrategyOptions
end

Expand Down
2 changes: 1 addition & 1 deletion test/suite/integration/test_comprehensive_validation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -857,5 +857,5 @@ end # module

# Redefine in outer scope for TestRunner
function test_comprehensive_validation()
TestComprehensiveValidation.test_comprehensive_validation()
return TestComprehensiveValidation.test_comprehensive_validation()
end
2 changes: 1 addition & 1 deletion test/suite/integration/test_mode_propagation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ end
function FakeStrategy(; mode::Symbol=:strict, kwargs...)
# Redirect warnings to avoid polluting test output
opts = redirect_stderr(devnull) do
Strategies.build_strategy_options(FakeStrategy; mode=mode, kwargs...)
return Strategies.build_strategy_options(FakeStrategy; mode=mode, kwargs...)
end
return FakeStrategy(opts)
end
Expand Down
Loading