Online dynamic flight optimisation applied to guidance of a variable-flow ducted rocket