LQ ICIOC - Cheapest path problem

Following the procedure described in \cite{mennerPredictiveModelingInfiniteHorizon} the following cheapest path problem can be derived.