Skip to content

Add comprehensive state constraint example with Bryson-Denham problem#758

Merged
ocots merged 17 commits intomainfrom
state-constraint
Apr 14, 2026
Merged

Add comprehensive state constraint example with Bryson-Denham problem#758
ocots merged 17 commits intomainfrom
state-constraint

Conversation

@ocots
Copy link
Copy Markdown
Member

@ocots ocots commented Apr 14, 2026

This PR adds a comprehensive state constraint example to the documentation, starting from the extraction of a first-order constraint example and extending it with a detailed second-order constraint (Bryson-Denham problem) treatment.

Initial commit (76e5a30): Extracted the state constraint example from example-double-integrator-energy.md into a separate autonomous file example-state-constraint.md. This refactoring improves documentation organization by:

  • Creating a dedicated example for state-constrained optimal control
  • Adding cross-references between the energy minimization and state constraint examples
  • Updating the Basic Examples menu in make.jl

Main additions:

  1. Second-order state constraint (Bryson-Denham problem): Added a complete treatment of the position constraint q(t) ≤ a with boundary conditions x(0) = (0,1), x(1) = (0,-1), including:

    • Corrected solution structure based on Bryson & Ho (1975): touch point regime for 1/6 ≤ a ≤ 1/4, boundary arc regime for a < 1/6
    • Theoretical references: Bryson et al. (1963), Jacobson et al. (1971), Bryson & Ho (1975)
  2. Direct method: Implemented parametric OCP via make_ocp(a) function to avoid code duplication, solving both cases (a=0.2 touch point, a=0.1 boundary arc) in a single workflow

  3. Indirect methods:

    • Touch point case (a=0.2): 2-arc structure with costate jump at contact time
    • Boundary arc case (a=0.1): 3-arc structure with boundary arc flow and costate jumps at entry/exit
    • Both include shooting functions, initial guess extraction from direct solutions, and Hamiltonian-based adjoint chain explanations
  4. Code quality improvements:

    • Harmonized entry/exit time extraction using findall pattern
    • Added return nothing to shooting functions
    • Improved plot superposition and transitions

ocots added 2 commits April 14, 2026 16:57
- Create new autonomous example-state-constraint.md with state constraint variant
- Remove state constraint section from example-double-integrator-energy.md
- Add cross-references between the two examples
- Add state constraint example to Basic Examples menu in make.jl
… example

- Rename 'Adding a state constraint' -> 'First-order state constraint'
- Add explanation of constraint order for order-1 case
- Add new 'Second-order state constraint' section (Bryson-Denham problem)
- Explain order-2 via two differentiations of g(x)
- Show two cases: touch point (a=1/4) and boundary arc (a=1/9)
- Direct method only, solutions superimposed on same plot
- Add Bryson et al. 1963 reference
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 14, 2026

Breakage test results
Date: 2026-04-14 19:40:27

Name Latest Stable
OptimalControlProblems
Tutorials

ocots added 13 commits April 14, 2026 18:21
- Correct three-regime description: unconstrained (a>=1/4), touch point (1/6<=a<=1/4), boundary arc (a<1/6)
- Use a=1/5 (touch point) and a=1/7 (boundary arc) as example values
- Add Bryson & Ho (1975) Applied Optimal Control as [^3]
- Two unconstrained arcs joined at t1 with costate jump [Δpq, 0]
- Shooting unknowns: p0 (2D), t1, Δpq (4 equations)
- Initial guess extracted from direct solution sol_touch
- Flow concatenation: fs_bd * (t1, [Δpq, 0], fs_bd)
- Analytical verification: pq = ±4.8, jump = 9.6, cost = 2.24
- Three arcs: unconstrained → boundary arc → unconstrained
- Flow: fs_arc * (t1, [Δpq1,0], fc_bd) * (t2, [Δpq2,0], fs_arc)
- 6 unknowns: p0 (2D), t1, t2, Δpq1, Δpq2
- 6 conditions: x(tf)=xf (×2), q(t1)=a, v(t1)=0, pv(t1+)=0, pq(t1+)=0
- Initial guess extracted from sol_arc
- Symmetry check: Δpq1 = Δpq2, t2 = 1 - t1
@ocots ocots changed the title Extract state constraint example to separate file Add comprehensive state constraint example with Bryson-Denham problem Apr 14, 2026
@ocots ocots merged commit fa84cd5 into main Apr 14, 2026
15 checks passed
@ocots ocots deleted the state-constraint branch April 14, 2026 20:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant