Private API

This page lists non-exported (internal) symbols of CTSolvers.Strategies.


From CTSolvers.Strategies

_error_unknown_options_strict

CTSolvers.Strategies._error_unknown_options_strictFunction
_error_unknown_options_strict(
    remaining::NamedTuple,
    strategy_type::Type{<:CTSolvers.Strategies.AbstractStrategy},
    meta::CTSolvers.Strategies.StrategyMetadata
)

Throw an error for unknown options in strict mode.

This function generates a detailed error message that includes:

  • List of unrecognized options
  • Available options from metadata
  • Suggestions based on Levenshtein distance
  • Guidance on using permissive mode

Arguments

  • remaining::NamedTuple: Unknown options provided by user
  • strategy_type::Type{<:AbstractStrategy}: Strategy type being configured
  • meta::StrategyMetadata: Strategy metadata with option definitions

Throws

  • Exceptions.IncorrectArgument: Always throws with detailed error message

Example

# Internal use only - called by build_strategy_options()
_error_unknown_options_strict((unknown_opt=123,), Solvers.Ipopt, meta)

See also: build_strategy_options, suggest_options

_strategy_id_set

CTSolvers.Strategies._strategy_id_setFunction
_strategy_id_set(
    registry::CTSolvers.Strategies.StrategyRegistry
) -> Set{Symbol}

Internal helper returning the set of all registered strategy IDs.

This function is used by registry utilities that need to distinguish strategy tokens from other tokens that may appear in a method tuple (e.g. parameter tokens).

Arguments

  • registry::StrategyRegistry: Strategy registry.

Returns

  • Set{Symbol}: Set of all strategy IDs present in the registry.

Notes

  • This function is internal and not part of the public API.

_warn_unknown_options_permissive

CTSolvers.Strategies._warn_unknown_options_permissiveFunction
_warn_unknown_options_permissive(
    remaining::NamedTuple,
    strategy_type::Type{<:CTSolvers.Strategies.AbstractStrategy}
)

Warn about unknown options in permissive mode.

This function generates a warning message that informs the user that unvalidated options will be passed directly to the backend without validation.

Arguments

  • remaining::NamedTuple: Unknown options provided by user
  • strategy_type::Type{<:AbstractStrategy}: Strategy type being configured

Example

# Internal use only - called by build_strategy_options()
_warn_unknown_options_permissive((custom_opt=123,), Solvers.Ipopt)

See also: build_strategy_options, _error_unknown_options_strict

extract_global_parameter_from_method

CTSolvers.Strategies.extract_global_parameter_from_methodFunction
extract_global_parameter_from_method(
    method::Tuple{Vararg{Symbol}},
    registry::CTSolvers.Strategies.StrategyRegistry
) -> Union{Nothing, Type{<:CTSolvers.Strategies.AbstractStrategyParameter}}

Extract the global strategy parameter from a method tuple.

The method tuple may contain at most one parameter token (e.g. :cpu, :gpu). If present, it is resolved to a parameter type using registry.parameters.

If any of the selected strategies in the method are parameterized, then a parameter token is required and must be supported by each parameterized strategy.

Arguments

  • method::Tuple{Vararg{Symbol}}: Method tuple containing strategy IDs and optionally one parameter token.
  • registry::StrategyRegistry: Strategy registry.

Returns

  • Union{Nothing, Type{<:AbstractStrategyParameter}}: The extracted parameter type, or nothing if none is present.

Throws

  • Exceptions.IncorrectArgument: If more than one parameter token is present, if a parameter is missing but required, if a parameter is unsupported, or if a parameter token is provided but no selected strategy is parameterized.

See also: available_parameters, Strategies.AbstractStrategyParameter

levenshtein_distance

CTSolvers.Strategies.levenshtein_distanceFunction
levenshtein_distance(s1::String, s2::String) -> Int64

Compute the Levenshtein distance between two strings.

The Levenshtein distance is the minimum number of single-character edits (insertions, deletions, or substitutions) required to change one string into another.

Arguments

  • s1::String: First string
  • s2::String: Second string

Returns

  • Int: Levenshtein distance between the two strings

Example

julia> levenshtein_distance("kitten", "sitting")
3

julia> levenshtein_distance("max_iter", "max_it")
2

Algorithm

Uses dynamic programming with O(m*n) time and space complexity, where m and n are the lengths of the input strings.

See also: suggest_options