Skip to content

Commit 9cdedc9

Browse files
committed
Add MadNCL solver to registry and methods
- Add CTSolvers.MadNCL to strategy registry - Add MadNCL variants to methods() function - Update tests to expect 4 solvers (Ipopt, MadNLP, MadNCL, Knitro) - Update tests to expect 8 total methods (2 modelers × 4 solvers) - Fix docstring examples to reflect new counts - All tests passing (25/25) MadNCL extends solver options for linear constraints handling.
1 parent 1df7df9 commit 9cdedc9

File tree

4 files changed

+20
-20
lines changed

4 files changed

+20
-20
lines changed

src/helpers/methods.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ julia> m = methods()
1717
((:collocation, :adnlp, :ipopt), (:collocation, :adnlp, :madnlp), ...)
1818
1919
julia> length(m)
20-
6
20+
8
2121
```
2222
2323
# See Also
@@ -30,6 +30,8 @@ function Base.methods()::Tuple{Vararg{Tuple{Symbol, Symbol, Symbol}}}
3030
(:collocation, :adnlp, :madnlp),
3131
(:collocation, :exa, :ipopt ),
3232
(:collocation, :exa, :madnlp),
33+
(:collocation, :adnlp, :madncl),
34+
(:collocation, :exa, :madncl),
3335
(:collocation, :adnlp, :knitro),
3436
(:collocation, :exa, :knitro),
3537
)

src/helpers/registry.jl

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,16 @@ The registry maps abstract strategy families to their concrete implementations:
99
- `CTSolvers.AbstractNLPSolver` → NLP solver strategies
1010
1111
# Returns
12-
- `CTSolvers.Strategies.StrategyRegistry`: Registry with all available strategies
12+
- `CTSolvers.StrategyRegistry`: Registry with all available strategies
1313
1414
# Examples
1515
```julia
16-
julia> registry = get_strategy_registry()
16+
julia> registry = OptimalControl.get_strategy_registry()
1717
StrategyRegistry with 3 families
18-
19-
julia> CTSolvers.Strategies.strategy_ids(CTDirect.AbstractDiscretizer, registry)
20-
(:collocation,)
2118
```
22-
23-
# See Also
24-
- [`CTSolvers.Strategies.create_registry`](@ref): Creates a strategy registry
25-
- [`CTSolvers.Strategies.StrategyRegistry`](@ref): Registry type
2619
"""
27-
function get_strategy_registry()::CTSolvers.Strategies.StrategyRegistry
28-
return CTSolvers.Strategies.create_registry(
20+
function get_strategy_registry()::CTSolvers.StrategyRegistry
21+
return CTSolvers.create_registry(
2922
CTDirect.AbstractDiscretizer => (
3023
CTDirect.Collocation,
3124
# Add other discretizers as they become available
@@ -37,6 +30,7 @@ function get_strategy_registry()::CTSolvers.Strategies.StrategyRegistry
3730
CTSolvers.AbstractNLPSolver => (
3831
CTSolvers.Ipopt,
3932
CTSolvers.MadNLP,
33+
CTSolvers.MadNCL,
4034
CTSolvers.Knitro,
4135
)
4236
)

test/suite/helpers/test_methods.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,13 @@ function test_methods()
2424

2525
Test.@test (:collocation, :adnlp, :ipopt) in methods
2626
Test.@test (:collocation, :adnlp, :madnlp) in methods
27+
Test.@test (:collocation, :adnlp, :madncl) in methods
2728
Test.@test (:collocation, :adnlp, :knitro) in methods
2829
Test.@test (:collocation, :exa, :ipopt) in methods
2930
Test.@test (:collocation, :exa, :madnlp) in methods
31+
Test.@test (:collocation, :exa, :madncl) in methods
3032
Test.@test (:collocation, :exa, :knitro) in methods
31-
Test.@test length(methods) == 6
33+
Test.@test length(methods) == 8
3234
end
3335

3436
Test.@testset "Uniqueness" begin

test/suite/helpers/test_registry.jl

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ using Test
44
import OptimalControl
55
import CTSolvers
66
import CTDirect
7+
78
const VERBOSE = isdefined(Main, :TestOptions) ? Main.TestOptions.VERBOSE : true
89
const SHOWTIMING = isdefined(Main, :TestOptions) ? Main.TestOptions.SHOWTIMING : true
910

@@ -16,38 +17,39 @@ function test_registry()
1617

1718
@testset "Registry Creation" begin
1819
registry = OptimalControl.get_strategy_registry()
19-
@test registry isa CTSolvers.Strategies.StrategyRegistry
20+
@test registry isa CTSolvers.StrategyRegistry
2021
end
2122

2223
@testset "Discretizer Family" begin
2324
registry = OptimalControl.get_strategy_registry()
24-
ids = CTSolvers.Strategies.strategy_ids(CTDirect.AbstractDiscretizer, registry)
25+
ids = CTSolvers.strategy_ids(CTDirect.AbstractDiscretizer, registry)
2526
@test :collocation in ids
2627
@test length(ids) >= 1
2728
end
2829

2930
@testset "Modeler Family" begin
3031
registry = OptimalControl.get_strategy_registry()
31-
ids = CTSolvers.Strategies.strategy_ids(CTSolvers.AbstractNLPModeler, registry)
32+
ids = CTSolvers.strategy_ids(CTSolvers.AbstractNLPModeler, registry)
3233
@test :adnlp in ids
3334
@test :exa in ids
3435
@test length(ids) == 2
3536
end
3637

3738
@testset "Solver Family" begin
3839
registry = OptimalControl.get_strategy_registry()
39-
ids = CTSolvers.Strategies.strategy_ids(CTSolvers.AbstractNLPSolver, registry)
40+
ids = CTSolvers.strategy_ids(CTSolvers.AbstractNLPSolver, registry)
4041
@test :ipopt in ids
4142
@test :madnlp in ids
43+
@test :madncl in ids
4244
@test :knitro in ids
43-
@test length(ids) == 3
45+
@test length(ids) == 4
4446
end
4547

4648
@testset "Determinism" begin
4749
r1 = OptimalControl.get_strategy_registry()
4850
r2 = OptimalControl.get_strategy_registry()
49-
ids1 = CTSolvers.Strategies.strategy_ids(CTSolvers.AbstractNLPSolver, r1)
50-
ids2 = CTSolvers.Strategies.strategy_ids(CTSolvers.AbstractNLPSolver, r2)
51+
ids1 = CTSolvers.strategy_ids(CTSolvers.AbstractNLPSolver, r1)
52+
ids2 = CTSolvers.strategy_ids(CTSolvers.AbstractNLPSolver, r2)
5153
@test ids1 == ids2
5254
end
5355
end

0 commit comments

Comments
 (0)