feat: Add support for zero control dimension (NLP_u = 0)#578
feat: Add support for zero control dimension (NLP_u = 0)#578PierreMartinon merged 3 commits intomainfrom
Conversation
ocots
commented
Mar 21, 2026
- Add efficiency guards in DOCP_variables.jl and ode/common.jl
- Fix reshape bug in collocation.jl for zero control dimension
- Add parameter estimation test problems (estimate_initial_condition, estimate_rotation_rate, least_squares_with_constraint)
- Add comprehensive unit tests (49 tests) for zero control allocations
- Add integration tests (118 tests) for zero control dimension
- All tests pass successfully
- Add efficiency guards in DOCP_variables.jl and ode/common.jl - Fix reshape bug in collocation.jl for zero control dimension - Add parameter estimation test problems (estimate_initial_condition, estimate_rotation_rate, least_squares_with_constraint) - Add comprehensive unit tests (49 tests) for zero control allocations - Add integration tests (118 tests) for zero control dimension - All tests pass successfully
Add support for zero control dimension (NLP_u = 0)This PR implements full support for optimal control problems with zero control dimension in CTDirect.jl, enabling parameter estimation. Problem StatementPreviously, CTDirect.jl did not properly handle problems where
Solution1. Efficiency Guards in Source Code
|
Implementation NotesCTParser LimitationCurrently, CTParser does not support zero control dimension problems. Therefore, all test problems must be defined using CTModels.PreModel API instead of the Why CTModels is required:
Test Implementation: pre = CTModels.PreModel()
CTModels.time!(pre; t0=0.0, tf=1.0)
CTModels.state!(pre, 2)
CTModels.variable!(pre, n) # For parameter estimation
# ... dynamics, objective, constraints ...
CTModels.definition!(pre, quote ... end)
CTModels.time_dependence!(pre; autonomous=true/false)
ocp = CTModels.build(pre)Future Work: @def begin
t ∈ [0, 1], time
x ∈ R², state
v ∈ Rⁿ, variable # parameters only, no control
x(0) == v
ẋ(t) == f(t, x, v)
objective → min
endFor now, CTModels provides the necessary flexibility to define parameter estimation problems with zero control dimension. |
|
@PierreMartinon please review and merge ps: @jbcaillau waiting for a new beta release of CTParser |
|
Note: for now I have commented the inclusion of |