Skip to content

Double integrator, Wang (xuezhong_wang)

Question. Fixed-horizon double-integrator problems with and without a sign restriction on the control.

Formulation

Ex. 1 — unconstrained energy.

\[ \min\int_0^2 \tfrac12 a^2\,\mathrm{d}t,\qquad \dot x=v,\;\dot v=a,\quad (x,v)(0)=(0,0),\; (x,v)(2)=(5,2). \]

Closed form \(a^*(t)=-4.5 t+5.5\), \(J^*=7.75\).

Ex. 2 — nonnegative control. \(a\ge 0\), \((x,v)(0)=(1,1)\), \(x(2)=3\), \(v(2)\ge 0\). Optimum \(u^*=0\), \(J^*=0\).

Horizon. Fixed, \(T=2\).

What was done

Two scripts; same integrator chain as Bryson–Denham but fixed \(T\) and no path bound on \(x\).

What we found

Ex. 1 matches \(J^*=7.75\). Ex. 2 is the trivial zero-control solution.

Ex. 1

Ex. 2

Interpretation

A sign restriction on \(u\) can collapse the problem (here to “do nothing”). That is a constraint effect, not a failure of collocation.

Public API

Fixed-time double integrator (examples/xuezhong_wang/bryson_denham_fixed_tf.py):

import eco_opt
from eco_opt import Namespace


def trolley_model(t, x, u):
    position, speed, acceleration = x[0], x[1], u[0]
    y = Namespace(position=position, speed=speed, acceleration=acceleration)
    return [speed, acceleration], y


sys = eco_opt.System(states=2, controls=1, model=trolley_model)
ocp = eco_opt.Ocp()
ocp.min([0.5 * sys.y.acceleration ** 2])
ocp.st(system=sys, constraints=[...])

Run and tests

cd examples/xuezhong_wang
python bryson_denham_fixed_tf.py
python double_integrator_nonneg_control.py
python plot_xuezhong_wang.py
python -m pytest ../../tests/test_xuezhong_wang.py -q

References

Wang, X. (n.d.). Solving optimal control problems with MATLAB — Indirect methods, 21.