Skip to content

Commit

Permalink
Merge pull request #222 from control-toolbox/221-default-functions
Browse files Browse the repository at this point in the history
add default values
  • Loading branch information
ocots authored Aug 7, 2024
2 parents 2e90c45 + 6f2befc commit 1566625
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 22 deletions.
17 changes: 3 additions & 14 deletions src/default.jl
Original file line number Diff line number Diff line change
Expand Up @@ -162,21 +162,10 @@ function __init_interpolation()
return (T, U) -> Interpolations.linear_interpolation(T, U, extrapolation_bc = Interpolations.Line())
end

# ------------------------------------------------------------------------------------
# IPOPT

"""
$(TYPEDSIGNATURES)
Used to set the default value of the print level of ipopt for the direct method.
The default value is `5`.
"""
__print_level_ipopt() = 5

"""
$(TYPEDSIGNATURES)
Used to set the default value of the μ strategy of ipopt for the direct method.
The default value is `adaptive`.
Used to set the default initial guess.
The default value is `nothing`.
"""
__mu_strategy_ipopt() = "adaptive"
__ocp_init() = nothing
10 changes: 2 additions & 8 deletions test/test_default.jl
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,8 @@ function test_default()
@test CTBase.__init_interpolation() isa Function
end

@testset "Default value of the print level of ipopt for the direct method" begin
@test CTBase.__print_level_ipopt() isa Integer
@test CTBase.__print_level_ipopt() 12
@test CTBase.__print_level_ipopt() 0
end

@testset "Default value of the mu strategy of ipopt for the direct method" begin
@test CTBase.__mu_strategy_ipopt() isa String
@testset "Default value of the initial guess" begin
@test isnothing(CTBase.__ocp_init())
end

end

0 comments on commit 1566625

Please sign in to comment.