Skip to content

Commit 2f7c853

Browse files
committed
foo
1 parent dd272f5 commit 2f7c853

1 file changed

Lines changed: 84 additions & 0 deletions

File tree

src/helpers/descriptive_routing.jl

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,101 @@
1717
# Action option defaults (single source of truth)
1818
# ----------------------------------------------------------------------------
1919

20+
"""
21+
_DEFAULT_DISPLAY::Bool
22+
23+
Default value for the `display` action option in solve functions.
24+
25+
When `true`, the solve configuration and method information will be displayed
26+
to the user during the solving process.
27+
28+
# Value
29+
- `true`: Display solve configuration (default)
30+
- `false`: Suppress configuration display
31+
32+
See also: [`_route_descriptive_options`](@ref), [`solve`](@ref)
33+
"""
2034
const _DEFAULT_DISPLAY::Bool = true
35+
36+
"""
37+
_DEFAULT_INITIAL_GUESS::Nothing
38+
39+
Default value for the `initial_guess` action option in solve functions.
40+
41+
When `nothing`, no initial guess is provided and the solver will use its
42+
default initialization strategy.
43+
44+
# Value
45+
- `nothing`: No initial guess provided (default)
46+
47+
See also: [`_route_descriptive_options`](@ref), [`solve`](@ref)
48+
"""
2149
const _DEFAULT_INITIAL_GUESS::Nothing = nothing
2250

2351
# Aliases for initial_guess (single source of truth)
2452
# _INITIAL_GUESS_ALIASES_ONLY : used in OptionDefinition (name is separate)
2553
# _INITIAL_GUESS_ALIASES : used in _extract_action_kwarg (includes primary name)
54+
55+
"""
56+
_INITIAL_GUESS_ALIASES_ONLY::Tuple{Symbol}
57+
58+
Aliases for the `initial_guess` parameter, excluding the primary name.
59+
60+
Used in `CTSolvers.OptionDefinition` where the primary name is specified separately.
61+
62+
# Value
63+
- `(:init,)`: Alias for `initial_guess`
64+
65+
See also: [`_INITIAL_GUESS_ALIASES`](@ref), [`_route_descriptive_options`](@ref)
66+
"""
2667
const _INITIAL_GUESS_ALIASES_ONLY::Tuple{Symbol} = (:init,)
68+
69+
"""
70+
_INITIAL_GUESS_ALIASES::Tuple{Symbol, Symbol}
71+
72+
All valid names for the initial guess parameter, including the primary name and aliases.
73+
74+
Used in `_extract_action_kwarg` to extract the initial guess from keyword arguments.
75+
76+
# Value
77+
- `(:initial_guess, :init)`: Primary name and alias
78+
79+
See also: [`_INITIAL_GUESS_ALIASES_ONLY`](@ref), [`_extract_action_kwarg`](@ref)
80+
"""
2781
const _INITIAL_GUESS_ALIASES::Tuple{Symbol, Symbol} = (:initial_guess, :init)
2882

2983
# Unwrap an OptionValue (from route_all_options) to its raw value.
3084
# Falls back to `fallback` if `opt` is not an OptionValue.
85+
86+
"""
87+
_unwrap_option(opt, fallback)
88+
89+
Unwrap an `CTSolvers.OptionValue` to its raw value, with fallback support.
90+
91+
If `opt` is an `OptionValue`, returns `opt.value`. Otherwise, returns `opt` if it's not `nothing`,
92+
or `fallback` if `opt` is `nothing`.
93+
94+
# Arguments
95+
- `opt`: Either an `CTSolvers.OptionValue` or a raw value
96+
- `fallback`: Default value to use when `opt` is `nothing`
97+
98+
# Returns
99+
- The unwrapped value or the fallback
100+
101+
# Example
102+
```julia
103+
julia> opt_val = CTSolvers.OptionValue(42, :user)
104+
OptionValue(42, :user)
105+
106+
julia> _unwrap_option(opt_val, 0)
107+
42
108+
109+
julia> _unwrap_option(nothing, 0)
110+
0
111+
```
112+
113+
See also: [`_route_descriptive_options`](@ref), [`CTSolvers.OptionValue`](@ref)
114+
"""
31115
_unwrap_option(opt::CTSolvers.OptionValue, fallback) = opt.value
32116
_unwrap_option(opt, fallback) = opt === nothing ? fallback : opt
33117

0 commit comments

Comments
 (0)