# Optimal control problem with fixed endpoint; what I am doing wrong?

I am trying to solve the following problem (I choose a numerical example). The state $$x$$ is governed by a differential equation linear in $$x\in [0,1]$$. Two variables, $$\theta \in[0,1]$$ and $$\rho\in[0,1)$$, can change the state using a control $$\mu \in [0,1]$$. I want to choose $$\mu$$ such that the time it takes to reach $$x=1$$ is minimized.

Let me state the problem: $$\min_{\mu, T} \int_0^T \mathrm dt$$ subject to $$\dot{x}=\tfrac{1}{2}\left(x\left(\tfrac{4}{1-\rho}-5\right)+5\theta -1\right)$$ $$\dot{\theta} = (1-\theta)\mu$$ $$\dot{\rho} = (1-\rho)(1-\mu)$$ $$x(0)=x_0, x(T)=1, \theta(0)=\rho(0)=0$$ Then I set up the Lagrangian as: $$L=1+\lambda_1 \tfrac{1}{2}\left(x\left(\tfrac{4}{1-\rho}-5\right)+5\theta -1\right)+ \lambda_2(1-\theta)\mu+\lambda_3(1-\rho)(1-\mu)-w_1 \mu -w_2(1-\mu)$$ This is how I proceed. I write the conditions for an optimum as: $$\frac{\partial L}{\partial \mu}=\lambda_2(1-\theta)-\lambda_3(1-\rho)-w_1+w_2=0 \quad (1) \\ \frac{\partial L}{\partial x}=\frac{\lambda_1}{2}\left(\frac{4}{1-\rho}-5\right)=-\dot{\lambda_1} \quad (2) \\ \frac{\partial L}{\partial \theta}=\frac{5\lambda_1}{2} -\lambda_2 \mu=-\dot{\lambda_2} \quad (3) \\ \frac{\partial L}{\partial \rho}=\frac{\lambda_1}{2}\frac{4 x}{(1-\rho)^2} -\lambda_3 (1-\mu)=-\dot{\lambda_3} \quad (4) \\ w_1\geq 0, w_1 \mu=0 \\ w_2\geq 0, w_2(1-\mu)=0$$

The complementary slackness conditions suggest that $$\lambda_2(1-\theta)>(<)\lambda_3(1-\rho)$$ implies $$\mu=0 (1)$$. At this point I feel stuck. I did differentiate (1) one more time w.r.t. the time to get: $$\dot{\lambda}_2(1-\theta)-\lambda_2(1-\theta)\mu-\dot{\lambda}_3(1-\rho)+\lambda_3(1-\rho)-\dot{w}_1+\dot{w}_2=0$$ Since (I think) $$-\dot{w}_1+\dot{w}_2=0$$, I can substitute the remaining expression into equations (3) and (4), but then $$\lambda_1 = \dot{\lambda}_1=0$$.

What is wrong here?

Any help / hints / suggestions / admonishments would be great!

• I am not sure if this problem is actually well defined, since $\theta(0)=\rho(0)=0$ so $\dot{x}(0)=-(1+x(0))/2<0\ \forall\,x(0)\in[0,1]$. So if $x(0)=0$ then $x(t)$ will not remain in the interval $[0,1]$. – Kwin van der Veen Nov 26 '18 at 8:58

Since your cost function is not a function of $$\mu$$ and the differential equations are only linear in $$\mu$$ then the partial derivative of the Lagragian with respect to $$\mu$$ is not going to be a function of $$\mu$$. So when you set the partial derivative equal to zero in equation $$(1)$$ you can not find an expression for an optimal $$\mu$$ as a function of the (co-)states.
What equation $$(1)$$ actually tries to do is minimize the Lagragian with respect to $$\mu$$. Now when there are constraints on the control variable you can also minimize the Lagragian directly, while also taking the constraints on $$\mu$$ into consideration. Also I would think that the co-states $$w_1$$ and $$w_2$$ are not needed once you solve for $$\mu$$ as mentioned above.
• Thanks, Kwin. Are you suggesting to solve the differential equations on $\theta$ and $\rho$ first and then substitute in the differential equation on x? – HJ Creens Nov 24 '18 at 7:26
• @HJCreens No, I am suggesting to solve for $\mu$ by minimizing the Lagragian instead of solving $(1)$. – Kwin van der Veen Nov 24 '18 at 7:31