Context
CTBase v0.28.0-beta introduces a breaking change in the strategy parameter contract. See control-toolbox/CTBase.jl#497 for the full PR.
What changed in CTBase
get_parameter_type is removed from the public API.
- A new
parameter(::Type{<:S}) contract method is added to AbstractStrategy. Every concrete strategy must implement it:
- Non-parameterized:
Strategies.parameter(::Type{<:MyStrategy}) = nothing
- Parameterized:
Strategies.parameter(::Type{<:MyStrategy{P}}) where {P<:Strategies.AbstractStrategyParameter} = P
- The default stub throws
Exceptions.NotImplemented so any strategy that forgets to implement it fails loudly at load time.
_default_parameter is renamed to default_parameter (now exported).
parameter and default_parameter are now exported from CTBase.Strategies.
Migration steps
-
For each concrete strategy struct in CTSolvers, add a parameter method:
# Non-parameterized strategy
CTBase.Strategies.parameter(::Type{<:Ipopt}) = nothing
# Parameterized strategy
CTBase.Strategies.parameter(::Type{<:MadNLP{P}}) where {P<:CTBase.Strategies.AbstractStrategyParameter} = P
-
Rename all _default_parameter calls to default_parameter:
# Before
CTBase.Strategies._default_parameter(::Type{<:MadNLP}) = CTBase.Strategies.CPU
# After
CTBase.Strategies.default_parameter(::Type{<:MadNLP}) = CTBase.Strategies.CPU
-
Remove any usage of get_parameter_type — replace with parameter.
-
Run tests against CTBase feature/parameter-contract branch (or main after merge).
Context
CTBase v0.28.0-beta introduces a breaking change in the strategy parameter contract. See control-toolbox/CTBase.jl#497 for the full PR.
What changed in CTBase
get_parameter_typeis removed from the public API.parameter(::Type{<:S})contract method is added toAbstractStrategy. Every concrete strategy must implement it:Strategies.parameter(::Type{<:MyStrategy}) = nothingStrategies.parameter(::Type{<:MyStrategy{P}}) where {P<:Strategies.AbstractStrategyParameter} = PExceptions.NotImplementedso any strategy that forgets to implement it fails loudly at load time._default_parameteris renamed todefault_parameter(now exported).parameteranddefault_parameterare now exported fromCTBase.Strategies.Migration steps
For each concrete strategy struct in CTSolvers, add a
parametermethod:Rename all
_default_parametercalls todefault_parameter:Remove any usage of
get_parameter_type— replace withparameter.Run tests against CTBase
feature/parameter-contractbranch (ormainafter merge).