Skip to content

Commit cfae130

Browse files
committed
doc: add docstring for Layer 3 CommonSolve.solve in canonical.jl
1 parent c0976f7 commit cfae130

1 file changed

Lines changed: 36 additions & 0 deletions

File tree

src/solve/canonical.jl

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,42 @@
99
# ------------------------------------------------------------------------
1010
# Canonical solve function - Layer 3 (Pure Execution)
1111
# All inputs are concrete types, no defaults, no normalization
12+
13+
"""
14+
$(TYPEDSIGNATURES)
15+
16+
Resolve an optimal control problem using fully specified, concrete components (Layer 3).
17+
18+
This is the lowest-level execution layer for solving an optimal control problem. It expects all
19+
components (initial guess, discretizer, modeler, and solver) to be fully instantiated and
20+
normalized. It discretizes the problem and passes it to the underlying `solve` pipeline.
21+
22+
# Arguments
23+
- `ocp::CTModels.AbstractModel`: The optimal control problem to solve
24+
- `initial_guess::CTModels.AbstractInitialGuess`: Normalized initial guess for the solution
25+
- `discretizer::CTDirect.AbstractDiscretizer`: Concrete discretization strategy
26+
- `modeler::CTSolvers.AbstractNLPModeler`: Concrete NLP modeling strategy
27+
- `solver::CTSolvers.AbstractNLPSolver`: Concrete NLP solver strategy
28+
- `display::Bool`: Whether to display the OCP configuration before solving
29+
30+
# Returns
31+
- `CTModels.AbstractSolution`: The solution to the optimal control problem
32+
33+
# Example
34+
```julia
35+
# Conceptual usage pattern for Layer 3 solve
36+
ocp = Model(time=:final)
37+
# ... define OCP ...
38+
init = CTModels.build_initial_guess(ocp, nothing)
39+
disc = CTDirect.Collocation(grid_size=100)
40+
mod = CTSolvers.ADNLP()
41+
sol = CTSolvers.Ipopt()
42+
43+
solution = solve(ocp, init, disc, mod, sol; display=true)
44+
```
45+
46+
See also: [`solve_explicit`](@ref), [`solve_descriptive`](@ref)
47+
"""
1248
function CommonSolve.solve(
1349
ocp::CTModels.AbstractModel,
1450
initial_guess::CTModels.AbstractInitialGuess, # Already normalized by Layer 1

0 commit comments

Comments
 (0)