I wanna solve an optimal control problem with the fixed-end-point condition on state variables in Gekko. I like to know how it is possible to define an optimal control problem with fixed-end-point as follows in Gekko:
$\min \int_{0}^{1} u^2+(u-x)^2 $
$\dot{x}=x+u$
$x(0)=1$
$x(1)=4$
Moreover, how can I retrieve the objective function value?
You can retrieve the objective function value with
m.options.OBJFCNVAL
. Here is a similar script to some of the Benchmark problems (see 1b in particular).