<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://mintoc.de/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=TobiasWeber</id>
	<title>mintOC - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://mintoc.de/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=TobiasWeber"/>
	<link rel="alternate" type="text/html" href="https://mintoc.de/index.php?title=Special:Contributions/TobiasWeber"/>
	<updated>2026-06-09T09:05:53Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.1</generator>
	<entry>
		<id>https://mintoc.de/index.php?title=Industrial_robot&amp;diff=2143</id>
		<title>Industrial robot</title>
		<link rel="alternate" type="text/html" href="https://mintoc.de/index.php?title=Industrial_robot&amp;diff=2143"/>
		<updated>2016-08-01T07:44:20Z</updated>

		<summary type="html">&lt;p&gt;TobiasWeber: /* Parameters */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Dimensions&lt;br /&gt;
		|nd        = 1&lt;br /&gt;
		|nx        = 2&lt;br /&gt;
		|nu        = 2&lt;br /&gt;
		|nc        = 4&lt;br /&gt;
		|nre       = 2&lt;br /&gt;
	}}&amp;lt;!-- Do not insert line break here or Dimensions Box moves up in the layout...&lt;br /&gt;
	&lt;br /&gt;
	--&amp;gt;The Industrial robot problem focuses on the KUKA LWR IV drawing a pre-defined curve on a white board, which results in a path-following problem. This means that a system should be steered along a given path while there are no constraints regarding the position at a specific time &amp;lt;math&amp;gt; t &amp;gt; t_0 &amp;lt;/math&amp;gt;. This concept arises often where autonomous vehicles or steering of robots are involved. The source for this problem can be found online on [https://arxiv.org/abs/1506.09084 arXiv &amp;quot;Implementation of Nonlinear Model Predictive Path-Following Control for an Industrial Robot&amp;quot;].&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
== Path-following problems ==&lt;br /&gt;
	&lt;br /&gt;
As the robot should follow a geometric curve but is not constrained as to when it has to be where, a path-following problem arises. The path is given by &lt;br /&gt;
&amp;lt;math&amp;gt; \mathcal{P} = \{ y \in \mathcal{R}^n: \theta \in [ \theta_0, \theta_1 ] \mapsto y = p(\theta)\} &amp;lt;/math&amp;gt;&lt;br /&gt;
where “&amp;lt;math&amp;gt; \theta &amp;lt;/math&amp;gt; is called path parameter and &amp;lt;math&amp;gt; p(\theta) &amp;lt;/math&amp;gt; is a parametrization of &amp;lt;math&amp;gt; \mathcal{P} &amp;lt;/math&amp;gt;”. The path parameter does depend on the time however the exact timing is not known beforehand but rather integrated into the optimization problem by making use of a virtual system. &lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
== Virtual system ==&lt;br /&gt;
	&lt;br /&gt;
A virtual system is introduced to take care of the timing of the robot. This is an additional degree of freedom which is used here as an input into an integrator. This additional optimization variable, the virtual input, &amp;lt;math&amp;gt; v &amp;lt;/math&amp;gt; is integrated twice to produce the virtual state &amp;lt;math&amp;gt; z_1 &amp;lt;/math&amp;gt; which is used as the time parameter for the path (i.e. &amp;lt;math&amp;gt; p(z_1) &amp;lt;/math&amp;gt;).&lt;br /&gt;
	&lt;br /&gt;
&amp;lt;math&amp;gt; \left(&lt;br /&gt;
\begin{array}{c}&lt;br /&gt;
	\dot{z_1}\\&lt;br /&gt;
	\dot{z_2}\\&lt;br /&gt;
\end{array}&lt;br /&gt;
\right)&lt;br /&gt;
=&lt;br /&gt;
\dot{z}&lt;br /&gt;
=&lt;br /&gt;
l(z, v)&lt;br /&gt;
=&lt;br /&gt;
\left(&lt;br /&gt;
\begin{array}{c}&lt;br /&gt;
	z_2\\&lt;br /&gt;
	v\\&lt;br /&gt;
\end{array}&lt;br /&gt;
\right)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The virtual state and input are constrained by the sets &amp;lt;math&amp;gt; \mathcal{Z} &amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt; \mathcal{V} &amp;lt;/math&amp;gt; respectively.&lt;br /&gt;
&lt;br /&gt;
== Model ==&lt;br /&gt;
The system for the motions of the robot are given by the function &amp;lt;math&amp;gt; f &amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; f(x) = E^{-1} &lt;br /&gt;
\left(&lt;br /&gt;
\begin{array}{c}&lt;br /&gt;
	x_2\\&lt;br /&gt;
	u - C(x_1,x_2) x_2 - g(x_1) - \tau_F(x_2)\\&lt;br /&gt;
\end{array}&lt;br /&gt;
\right)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
with&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E = diag(I, B(x_1)) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt; B, C, E, g, \tau_F &amp;lt;/math&amp;gt; are given in the Parameters section.&lt;br /&gt;
&lt;br /&gt;
The objective function &amp;lt;math&amp;gt; J &amp;lt;/math&amp;gt; will be the integral over the so-called cost function &amp;lt;math&amp;gt; F: \mathbb{R}^{n_u} \times \mathbb{R} \times \mathcal{U} \times \mathcal{V} \mapsto \mathbb{R}_0^{+} &amp;lt;/math&amp;gt;, i.e.&lt;br /&gt;
&amp;lt;math&amp;gt; J(x(t_k),\bar{e}, \bar{u}, \bar{z}, \bar{v}) = \displaystyle \int_{t_k}^{t_k+T} F(\bar{e}, \bar{z}, \bar{u}, \bar{v}) d \tau &amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math&amp;gt; T \in (\delta, \infty) &amp;lt;/math&amp;gt; is the prediction horizon and the function &amp;lt;math&amp;gt; F &amp;lt;/math&amp;gt; is given by &amp;lt;math&amp;gt; F(e,z,u,v) = || (e,z_1-\theta_1, z_2 - \dot{\theta}_{ref})^T||_Q^2 + ||(u,v)^T||_R^2 &amp;lt;/math&amp;gt; with positive semi definite matrix &amp;lt;math&amp;gt; Q &amp;lt;/math&amp;gt; and positive definite matrix &amp;lt;math&amp;gt; R &amp;lt;/math&amp;gt;, which can be found in the original paper cited above.&lt;br /&gt;
	&lt;br /&gt;
&lt;br /&gt;
The path-following is introduced into the problem by optimizing the error &amp;lt;math&amp;gt; e &amp;lt;/math&amp;gt; measuring the deviation of the robot from the path:  &lt;br /&gt;
	&lt;br /&gt;
&amp;lt;math&amp;gt; e(x, z) = h(x) - p(z_1) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt; p &amp;lt;/math&amp;gt; is the parametrization of &amp;lt;math&amp;gt; \mathcal{P} &amp;lt;/math&amp;gt; as above and &amp;lt;math&amp;gt; h &amp;lt;/math&amp;gt; is the position of the robot given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
h(x_1)&lt;br /&gt;
=&lt;br /&gt;
\left(&lt;br /&gt;
\begin{array}{c}&lt;br /&gt;
	-\cos(q_1)(d_3 \sin(q_2) + \bar{d}_5 + \sin(q_2-q_3))\\&lt;br /&gt;
	-\sin(q_1)(d_3 \sin(q_2) + \bar{d}_5 + \sin(q_2-q_3))\\&lt;br /&gt;
	d_1 + d_3 \cos(q_2) + \bar{d}_5 \cos(q_2-q_3)\\ &lt;br /&gt;
\end{array}&lt;br /&gt;
\right)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt; q = x_1 &amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt; \bar{d}_5 = d_5 + d_{tool} &amp;lt;/math&amp;gt; with &amp;lt;math&amp;gt; d_i, i \in \{ 1,3,5 \}  &amp;lt;/math&amp;gt; being the lengths of the links of the robot and &amp;lt;math&amp;gt; d_{tool} &amp;lt;/math&amp;gt; is the length of the pen and tool. These values can be found in the Parameters section as well.&lt;br /&gt;
&lt;br /&gt;
== OCP ==&lt;br /&gt;
The optimization problem which is solved repetitively is given by&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{llclr}&lt;br /&gt;
	\displaystyle \min_{\bar{u}, \bar{v}} &amp;amp; J &amp;amp;=&amp;amp; J(x(t_k),\bar{e}, \bar{u}, \bar{z}, \bar{v})  \\[1.5ex]&lt;br /&gt;
	\mbox{s.t.}&lt;br /&gt;
	&amp;amp; \dot{\bar{x}} &amp;amp; = &amp;amp; f(\bar{x},\bar{u}), \\&lt;br /&gt;
	&amp;amp; \dot{\bar{z}} &amp;amp; = &amp;amp; l(\bar{z},\bar{v}),  \\&lt;br /&gt;
	&amp;amp; \bar{e} &amp;amp; = &amp;amp; h(\bar{x}) - p(\bar{z}_1),  \\[1ex]&lt;br /&gt;
	&amp;amp; \bar{x}(t_k) &amp;amp; = &amp;amp; x(t_k), \\&lt;br /&gt;
	&amp;amp; \bar{z}(t_k) &amp;amp; = &amp;amp; z(t_k), \\[1ex]&lt;br /&gt;
	&amp;amp; \bar{x} &amp;amp; \in &amp;amp; \mathcal{X}, \\&lt;br /&gt;
	&amp;amp; \bar{u} &amp;amp; \in &amp;amp; \mathcal{U}, \\&lt;br /&gt;
	&amp;amp; \bar{z} &amp;amp; \in &amp;amp; \mathcal{Z}, \\&lt;br /&gt;
	&amp;amp; \bar{v} &amp;amp; \in &amp;amp; \mathcal{V}. \\&lt;br /&gt;
\end{array} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Parameters ==&lt;br /&gt;
&lt;br /&gt;
The matlab script which implements the implicit formulation for &amp;lt;math&amp;gt; f &amp;lt;/math&amp;gt;, i.e. &amp;lt;math&amp;gt; F(x) = E \dot{x} - f(x) &amp;lt;/math&amp;gt; can be found on [[Parameters for Industrial Robot]].&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
	|+Robot-specific constants&lt;br /&gt;
	|-&lt;br /&gt;
	|Symbol&lt;br /&gt;
	|Value&lt;br /&gt;
        |Unit&lt;br /&gt;
	|-&lt;br /&gt;
	|&amp;lt;math&amp;gt; d_1 &amp;lt;/math&amp;gt;&lt;br /&gt;
	|&amp;lt;math&amp;gt; 0.31&amp;lt;/math&amp;gt;&lt;br /&gt;
        | &amp;lt;math&amp;gt; m &amp;lt;/math&amp;gt;&lt;br /&gt;
	|-&lt;br /&gt;
	|&amp;lt;math&amp;gt; d_3 &amp;lt;/math&amp;gt;&lt;br /&gt;
	|&amp;lt;math&amp;gt; 0.40&amp;lt;/math&amp;gt;&lt;br /&gt;
        | &amp;lt;math&amp;gt; m &amp;lt;/math&amp;gt;&lt;br /&gt;
	|-&lt;br /&gt;
	|&amp;lt;math&amp;gt; d_5 &amp;lt;/math&amp;gt;&lt;br /&gt;
	|&amp;lt;math&amp;gt; 0.39&amp;lt;/math&amp;gt;&lt;br /&gt;
        | &amp;lt;math&amp;gt; m &amp;lt;/math&amp;gt;&lt;br /&gt;
	|-&lt;br /&gt;
	|&amp;lt;math&amp;gt; d_{tool} &amp;lt;/math&amp;gt;&lt;br /&gt;
	|&amp;lt;math&amp;gt; 0.15&amp;lt;/math&amp;gt;&lt;br /&gt;
        | &amp;lt;math&amp;gt; m &amp;lt;/math&amp;gt;&lt;br /&gt;
	|}&lt;br /&gt;
&lt;br /&gt;
The Implementation Parameters for the MPFC scheme are as follows.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt; \mathcal{X} = [-\bar{x}, \bar{x}], \text{ where } \bar{x} = (\bar{q},\bar{q},\bar{q},\bar{\dot{q}},\bar{\dot{q}},\bar{\dot{q}})^T \text{ with } \bar{q} = \infty \text{ rad}, \quad \bar{\dot{q}} = 0.5 \text{ rad/s} &amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt; \mathcal{U} = [-\bar{u}, \bar{u}], \text{ where } \bar{u} = (\bar{\tau},\bar{\tau},\bar{\tau})^T \text{ with } \bar{\tau} = 60 \text{ Nm} &amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt; \mathcal{Z} = [\underline{z}, \bar{z}], \text{ where } \underline{z} = (0,0)^T, \bar{z} = (1750, \infty)^T &amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt; \mathcal{V} = [-10^4, 8 \cdot 10^3] &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Reference Solutions ==&lt;br /&gt;
coming soon&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;biblist /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--List of all categories this page is part of. List characterization of solution behavior, model properties, ore presence of implementation details (e.g., AMPL for AMPL model) here --&amp;gt;&lt;br /&gt;
[[Category:MIOCP]]&lt;br /&gt;
[[Category:ODE model]]&lt;br /&gt;
[[Category:Path-constrained arcs]]&lt;/div&gt;</summary>
		<author><name>TobiasWeber</name></author>
	</entry>
	<entry>
		<id>https://mintoc.de/index.php?title=Industrial_robot&amp;diff=2142</id>
		<title>Industrial robot</title>
		<link rel="alternate" type="text/html" href="https://mintoc.de/index.php?title=Industrial_robot&amp;diff=2142"/>
		<updated>2016-08-01T07:41:39Z</updated>

		<summary type="html">&lt;p&gt;TobiasWeber: /* Parameters */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Dimensions&lt;br /&gt;
		|nd        = 1&lt;br /&gt;
		|nx        = 2&lt;br /&gt;
		|nu        = 2&lt;br /&gt;
		|nc        = 4&lt;br /&gt;
		|nre       = 2&lt;br /&gt;
	}}&amp;lt;!-- Do not insert line break here or Dimensions Box moves up in the layout...&lt;br /&gt;
	&lt;br /&gt;
	--&amp;gt;The Industrial robot problem focuses on the KUKA LWR IV drawing a pre-defined curve on a white board, which results in a path-following problem. This means that a system should be steered along a given path while there are no constraints regarding the position at a specific time &amp;lt;math&amp;gt; t &amp;gt; t_0 &amp;lt;/math&amp;gt;. This concept arises often where autonomous vehicles or steering of robots are involved. The source for this problem can be found online on [https://arxiv.org/abs/1506.09084 arXiv &amp;quot;Implementation of Nonlinear Model Predictive Path-Following Control for an Industrial Robot&amp;quot;].&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
== Path-following problems ==&lt;br /&gt;
	&lt;br /&gt;
As the robot should follow a geometric curve but is not constrained as to when it has to be where, a path-following problem arises. The path is given by &lt;br /&gt;
&amp;lt;math&amp;gt; \mathcal{P} = \{ y \in \mathcal{R}^n: \theta \in [ \theta_0, \theta_1 ] \mapsto y = p(\theta)\} &amp;lt;/math&amp;gt;&lt;br /&gt;
where “&amp;lt;math&amp;gt; \theta &amp;lt;/math&amp;gt; is called path parameter and &amp;lt;math&amp;gt; p(\theta) &amp;lt;/math&amp;gt; is a parametrization of &amp;lt;math&amp;gt; \mathcal{P} &amp;lt;/math&amp;gt;”. The path parameter does depend on the time however the exact timing is not known beforehand but rather integrated into the optimization problem by making use of a virtual system. &lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
== Virtual system ==&lt;br /&gt;
	&lt;br /&gt;
A virtual system is introduced to take care of the timing of the robot. This is an additional degree of freedom which is used here as an input into an integrator. This additional optimization variable, the virtual input, &amp;lt;math&amp;gt; v &amp;lt;/math&amp;gt; is integrated twice to produce the virtual state &amp;lt;math&amp;gt; z_1 &amp;lt;/math&amp;gt; which is used as the time parameter for the path (i.e. &amp;lt;math&amp;gt; p(z_1) &amp;lt;/math&amp;gt;).&lt;br /&gt;
	&lt;br /&gt;
&amp;lt;math&amp;gt; \left(&lt;br /&gt;
\begin{array}{c}&lt;br /&gt;
	\dot{z_1}\\&lt;br /&gt;
	\dot{z_2}\\&lt;br /&gt;
\end{array}&lt;br /&gt;
\right)&lt;br /&gt;
=&lt;br /&gt;
\dot{z}&lt;br /&gt;
=&lt;br /&gt;
l(z, v)&lt;br /&gt;
=&lt;br /&gt;
\left(&lt;br /&gt;
\begin{array}{c}&lt;br /&gt;
	z_2\\&lt;br /&gt;
	v\\&lt;br /&gt;
\end{array}&lt;br /&gt;
\right)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The virtual state and input are constrained by the sets &amp;lt;math&amp;gt; \mathcal{Z} &amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt; \mathcal{V} &amp;lt;/math&amp;gt; respectively.&lt;br /&gt;
&lt;br /&gt;
== Model ==&lt;br /&gt;
The system for the motions of the robot are given by the function &amp;lt;math&amp;gt; f &amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; f(x) = E^{-1} &lt;br /&gt;
\left(&lt;br /&gt;
\begin{array}{c}&lt;br /&gt;
	x_2\\&lt;br /&gt;
	u - C(x_1,x_2) x_2 - g(x_1) - \tau_F(x_2)\\&lt;br /&gt;
\end{array}&lt;br /&gt;
\right)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
with&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E = diag(I, B(x_1)) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt; B, C, E, g, \tau_F &amp;lt;/math&amp;gt; are given in the Parameters section.&lt;br /&gt;
&lt;br /&gt;
The objective function &amp;lt;math&amp;gt; J &amp;lt;/math&amp;gt; will be the integral over the so-called cost function &amp;lt;math&amp;gt; F: \mathbb{R}^{n_u} \times \mathbb{R} \times \mathcal{U} \times \mathcal{V} \mapsto \mathbb{R}_0^{+} &amp;lt;/math&amp;gt;, i.e.&lt;br /&gt;
&amp;lt;math&amp;gt; J(x(t_k),\bar{e}, \bar{u}, \bar{z}, \bar{v}) = \displaystyle \int_{t_k}^{t_k+T} F(\bar{e}, \bar{z}, \bar{u}, \bar{v}) d \tau &amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math&amp;gt; T \in (\delta, \infty) &amp;lt;/math&amp;gt; is the prediction horizon and the function &amp;lt;math&amp;gt; F &amp;lt;/math&amp;gt; is given by &amp;lt;math&amp;gt; F(e,z,u,v) = || (e,z_1-\theta_1, z_2 - \dot{\theta}_{ref})^T||_Q^2 + ||(u,v)^T||_R^2 &amp;lt;/math&amp;gt; with positive semi definite matrix &amp;lt;math&amp;gt; Q &amp;lt;/math&amp;gt; and positive definite matrix &amp;lt;math&amp;gt; R &amp;lt;/math&amp;gt;, which can be found in the original paper cited above.&lt;br /&gt;
	&lt;br /&gt;
&lt;br /&gt;
The path-following is introduced into the problem by optimizing the error &amp;lt;math&amp;gt; e &amp;lt;/math&amp;gt; measuring the deviation of the robot from the path:  &lt;br /&gt;
	&lt;br /&gt;
&amp;lt;math&amp;gt; e(x, z) = h(x) - p(z_1) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt; p &amp;lt;/math&amp;gt; is the parametrization of &amp;lt;math&amp;gt; \mathcal{P} &amp;lt;/math&amp;gt; as above and &amp;lt;math&amp;gt; h &amp;lt;/math&amp;gt; is the position of the robot given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
h(x_1)&lt;br /&gt;
=&lt;br /&gt;
\left(&lt;br /&gt;
\begin{array}{c}&lt;br /&gt;
	-\cos(q_1)(d_3 \sin(q_2) + \bar{d}_5 + \sin(q_2-q_3))\\&lt;br /&gt;
	-\sin(q_1)(d_3 \sin(q_2) + \bar{d}_5 + \sin(q_2-q_3))\\&lt;br /&gt;
	d_1 + d_3 \cos(q_2) + \bar{d}_5 \cos(q_2-q_3)\\ &lt;br /&gt;
\end{array}&lt;br /&gt;
\right)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt; q = x_1 &amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt; \bar{d}_5 = d_5 + d_{tool} &amp;lt;/math&amp;gt; with &amp;lt;math&amp;gt; d_i, i \in \{ 1,3,5 \}  &amp;lt;/math&amp;gt; being the lengths of the links of the robot and &amp;lt;math&amp;gt; d_{tool} &amp;lt;/math&amp;gt; is the length of the pen and tool. These values can be found in the Parameters section as well.&lt;br /&gt;
&lt;br /&gt;
== OCP ==&lt;br /&gt;
The optimization problem which is solved repetitively is given by&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{llclr}&lt;br /&gt;
	\displaystyle \min_{\bar{u}, \bar{v}} &amp;amp; J &amp;amp;=&amp;amp; J(x(t_k),\bar{e}, \bar{u}, \bar{z}, \bar{v})  \\[1.5ex]&lt;br /&gt;
	\mbox{s.t.}&lt;br /&gt;
	&amp;amp; \dot{\bar{x}} &amp;amp; = &amp;amp; f(\bar{x},\bar{u}), \\&lt;br /&gt;
	&amp;amp; \dot{\bar{z}} &amp;amp; = &amp;amp; l(\bar{z},\bar{v}),  \\&lt;br /&gt;
	&amp;amp; \bar{e} &amp;amp; = &amp;amp; h(\bar{x}) - p(\bar{z}_1),  \\[1ex]&lt;br /&gt;
	&amp;amp; \bar{x}(t_k) &amp;amp; = &amp;amp; x(t_k), \\&lt;br /&gt;
	&amp;amp; \bar{z}(t_k) &amp;amp; = &amp;amp; z(t_k), \\[1ex]&lt;br /&gt;
	&amp;amp; \bar{x} &amp;amp; \in &amp;amp; \mathcal{X}, \\&lt;br /&gt;
	&amp;amp; \bar{u} &amp;amp; \in &amp;amp; \mathcal{U}, \\&lt;br /&gt;
	&amp;amp; \bar{z} &amp;amp; \in &amp;amp; \mathcal{Z}, \\&lt;br /&gt;
	&amp;amp; \bar{v} &amp;amp; \in &amp;amp; \mathcal{V}. \\&lt;br /&gt;
\end{array} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Parameters ==&lt;br /&gt;
&lt;br /&gt;
The matlab script which implements the implicit formulation for &amp;lt;math&amp;gt; f &amp;lt;/math&amp;gt;, i.e. &amp;lt;math&amp;gt; F(x) = E \dot{x} - f(x) &amp;lt;/math&amp;gt; can be found on [[Parameters for Industrial Robot]].&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
	|+Robot-specific constants&lt;br /&gt;
	|-&lt;br /&gt;
	|Symbol&lt;br /&gt;
	|Value&lt;br /&gt;
        |Unit&lt;br /&gt;
	|-&lt;br /&gt;
	|&amp;lt;math&amp;gt; d_1 &amp;lt;/math&amp;gt;&lt;br /&gt;
	|&amp;lt;math&amp;gt; 0.31&amp;lt;/math&amp;gt;&lt;br /&gt;
        | &amp;lt;math&amp;gt; m &amp;lt;/math&amp;gt;&lt;br /&gt;
	|-&lt;br /&gt;
	|&amp;lt;math&amp;gt; d_3 &amp;lt;/math&amp;gt;&lt;br /&gt;
	|&amp;lt;math&amp;gt; 0.40&amp;lt;/math&amp;gt;&lt;br /&gt;
        | &amp;lt;math&amp;gt; m &amp;lt;/math&amp;gt;&lt;br /&gt;
	|-&lt;br /&gt;
	|&amp;lt;math&amp;gt; d_5 &amp;lt;/math&amp;gt;&lt;br /&gt;
	|&amp;lt;math&amp;gt; 0.39&amp;lt;/math&amp;gt;&lt;br /&gt;
        | &amp;lt;math&amp;gt; m &amp;lt;/math&amp;gt;&lt;br /&gt;
	|-&lt;br /&gt;
	|&amp;lt;math&amp;gt; d_{tool} &amp;lt;/math&amp;gt;&lt;br /&gt;
	|&amp;lt;math&amp;gt; 0.15&amp;lt;/math&amp;gt;&lt;br /&gt;
        | &amp;lt;math&amp;gt; m &amp;lt;/math&amp;gt;&lt;br /&gt;
	|}&lt;br /&gt;
&lt;br /&gt;
The Implementation Parameters for the MPFC scheme are as follows.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt; \mathcal{X} = [-\bar{x}, \bar{x}], \text{ where } \bar{x} = (\bar{q},\bar{q},\bar{q},\bar{\dot{q}},\bar{\dot{q}},\bar{\dot{q}})^T \text{ with } \bar{q} = \infty \text{ rad}, \quad \bar{\dot{q}} = 0.5 \text{ rad/s} &amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt; \mathcal{U} = [-\bar{u}, \bar{u}], \text{ where } \bar{u} = - (\bar{\tau},\bar{\tau},\bar{\tau})^T \text{ with } \bar{\tau} = 60 \text{ Nm} &amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt; \mathcal{Z} = [\underline{z}, \bar{z}], \text{ where } \underline{z} = (0,0)^T, \bar{z} = (1750, \infty)^T &amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt; \mathcal{V} = [-10^4, 8 \cdot 10^3] &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Reference Solutions ==&lt;br /&gt;
coming soon&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;biblist /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--List of all categories this page is part of. List characterization of solution behavior, model properties, ore presence of implementation details (e.g., AMPL for AMPL model) here --&amp;gt;&lt;br /&gt;
[[Category:MIOCP]]&lt;br /&gt;
[[Category:ODE model]]&lt;br /&gt;
[[Category:Path-constrained arcs]]&lt;/div&gt;</summary>
		<author><name>TobiasWeber</name></author>
	</entry>
	<entry>
		<id>https://mintoc.de/index.php?title=Parameters_for_Industrial_Robot&amp;diff=2129</id>
		<title>Parameters for Industrial Robot</title>
		<link rel="alternate" type="text/html" href="https://mintoc.de/index.php?title=Parameters_for_Industrial_Robot&amp;diff=2129"/>
		<updated>2016-07-28T14:51:55Z</updated>

		<summary type="html">&lt;p&gt;TobiasWeber: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page contains a matlab script for the implicit formulation of the parameters for the [[Industrial robot]] problem.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;Matlab&amp;quot;&amp;gt;&lt;br /&gt;
% Robot dynamics with 3 DOF, this function should be equal to zero at all&lt;br /&gt;
% times. e.g. f(t,x=[q,dq],dx=[dq,ddq])=0! This model is only containing&lt;br /&gt;
% the inerta Matrix and the torques of the joints. Friction, gravity and coriolis&lt;br /&gt;
% effects are incorporated.&lt;br /&gt;
&lt;br /&gt;
function diff=f_full_effects(~,y,dy,tau)&lt;br /&gt;
&lt;br /&gt;
    dq=zeros(3,1);&lt;br /&gt;
    dotq=zeros(3,1);&lt;br /&gt;
    ddq=zeros(3,1);&lt;br /&gt;
    &lt;br /&gt;
    q=y(1:3);&lt;br /&gt;
    dq(1:3,1)=y(4:6);&lt;br /&gt;
    dotq(1:3,1)=dy(1:3);&lt;br /&gt;
    ddq(1:3,1)=dy(4:6);&lt;br /&gt;
    &lt;br /&gt;
    % intermediate states&lt;br /&gt;
&lt;br /&gt;
    cosq=zeros(3,1);&lt;br /&gt;
&lt;br /&gt;
    cosq(1,1) =   cos(q(1));&lt;br /&gt;
    cosq(2,1) =   cos(q(2));&lt;br /&gt;
    cosq(3,1) =   cos(q(3));&lt;br /&gt;
    &lt;br /&gt;
    sinq=zeros(3,1);&lt;br /&gt;
    &lt;br /&gt;
    sinq(1,1) =   sin(q(1));&lt;br /&gt;
    sinq(2,1) =   sin(q(2));&lt;br /&gt;
    sinq(3,1) =   sin(q(3));&lt;br /&gt;
    &lt;br /&gt;
    cosq2q3 =   cos(q(2) - q(3));&lt;br /&gt;
    &lt;br /&gt;
    sinq1q2=   sin(q(1) - q(2));&lt;br /&gt;
    sinq2q3=   sin(q(2) - q(3));&lt;br /&gt;
    &lt;br /&gt;
    sin2q2=     sin(2*q(2));&lt;br /&gt;
    &lt;br /&gt;
    sin2q22q3=  sin(2*q(2) - 2*q(3));&lt;br /&gt;
    sin2q2q3=   sin(2*q(2) - q(3));&lt;br /&gt;
    &lt;br /&gt;
    cos2q2=     cos(2*q(2));&lt;br /&gt;
    &lt;br /&gt;
    % Modell parameters&lt;br /&gt;
&lt;br /&gt;
    b_1 =  2.6491674286195;&lt;br /&gt;
    b_2 =  0.0168799610481578;&lt;br /&gt;
    b_3 =  1.43009916890323;&lt;br /&gt;
    b_4 =  0.53524835732352;&lt;br /&gt;
    b_5 =  0.791116620901176;&lt;br /&gt;
    b_6 =  0.626240578068518;&lt;br /&gt;
    b_7 =  1.57199673626875;&lt;br /&gt;
    b_8 =  0.0175195488386143;&lt;br /&gt;
    b_9 =  0.0204978721411787;&lt;br /&gt;
    b_10=  1.07049671464704;&lt;br /&gt;
    b_11=  1.81771647041588;&lt;br /&gt;
    b_12=  0.422954084243519;&lt;br /&gt;
    &lt;br /&gt;
    b=zeros(3,3);       % Inerta Matrix of Robot Modell (3DOF)&lt;br /&gt;
    &lt;br /&gt;
    b(1,1) =  b_1*(sinq(2)^2) - b_2*sin2q2 + b_3*(cosq(2)^2) + b_4*cosq(3) + b_5*(cosq2q3^2) - b_6*cos(2*q(2) - 2*q(3)) - b_4*cos(2*q(2) - q(3)) - b_7;&lt;br /&gt;
    b(2,1) =  b_8*cosq(2) + b_9*cosq2q3;&lt;br /&gt;
    b(3,1) = -b_9*cosq2q3;&lt;br /&gt;
    b(1,2) =  b_8*cosq(2) + b_9*cosq2q3;&lt;br /&gt;
    b(2,2) =  b_10*cosq(3) + b_11;&lt;br /&gt;
    b(3,2) = -b_4*cosq(3) - b_12;&lt;br /&gt;
    b(1,3) = -b_9*cosq2q3;&lt;br /&gt;
    b(2,3) = -b_4*cosq(3) - b_12;&lt;br /&gt;
    b(3,3) =  b_12;&lt;br /&gt;
    &lt;br /&gt;
    g=zeros(3,1);       % gravity torque vector&lt;br /&gt;
    &lt;br /&gt;
    g_1 =   32.4854155934467;&lt;br /&gt;
    g_2 =   13.1269659633593;&lt;br /&gt;
    g_3 =   0.41398104470607;&lt;br /&gt;
        &lt;br /&gt;
    g(1) = 0;&lt;br /&gt;
    g(2) =-g_1*sinq(2) - g_2*sinq2q3 + g_3*cosq(2);&lt;br /&gt;
    g(3) = g_2*sinq2q3;&lt;br /&gt;
    &lt;br /&gt;
    f=zeros(3,1);       % friction torque vector&lt;br /&gt;
    &lt;br /&gt;
    f(1) = 0.186461043875677*atan(100*dq(1));&lt;br /&gt;
    f(2) = 0.184489618216264*atan(100*dq(2));&lt;br /&gt;
    f(3) = 0.156066608371045*atan(100*dq(3));&lt;br /&gt;
            &lt;br /&gt;
    c=zeros(3,3);   % coriolis matrix&lt;br /&gt;
    &lt;br /&gt;
    c_1 =   0.609534129858137;&lt;br /&gt;
    c_2 =   0.23068226761793;&lt;br /&gt;
    c_3 =   b_4;&lt;br /&gt;
    c_4 =   b_2;&lt;br /&gt;
    c_5 =   0.26762417866176;&lt;br /&gt;
    c_6 =   152.383532464534;&lt;br /&gt;
    c_7 =   57.6705669044826;&lt;br /&gt;
    c_8 =   133.81208933088;&lt;br /&gt;
    c_9 =   4.21999026203945;&lt;br /&gt;
    c_10=   66.90604466544;&lt;br /&gt;
    c_11=   b_8;&lt;br /&gt;
    c_12=   b_9;&lt;br /&gt;
    c_13=   1.3381208933088;&lt;br /&gt;
    &lt;br /&gt;
    c(1,1) = c_1*dq(2)*sin2q2 + c_2*dq(2)*sin2q22q3 + c_3*dq(2)*sin2q2q3 - c_4*dq(2)*cos2q2 - c_5*dq(3)*sinq(3) - c_2*dq(3)*sin2q22q3 - c_5*dq(3)*sin2q2q3;&lt;br /&gt;
    c(2,1) = -(-1)*dq(1)*(-c_6*sin2q2 - c_7*sin2q22q3 - c_8*sin2q2q3 + c_9*cos2q2)/250;&lt;br /&gt;
    c(3,1) = -(-1)*(-1)*dq(1)*(-c_10*sinq(3) - c_7*sin2q22q3 - c_10*sin2q2q3)/250;&lt;br /&gt;
    c(1,2) = -(-1)*(-1)*dq(1)*(-c_6*sin2q2 - c_7*sin2q22q3 - c_8*sin2q2q3 + c_9*cos2q2)/250 + dq(2)*(-c_11*sinq(2) - c_12*sinq2q3) + c_12*dq(3)*sinq2q3;&lt;br /&gt;
    c(2,2) = -c_3*dq(3)*sinq(3);&lt;br /&gt;
    c(3,2) = c_3*dq(2)*sinq(3);&lt;br /&gt;
    c(1,3) = -c_5*dq(1)*sinq(3) - c_2*dq(1)*sin2q22q3 - c_5*dq(1)*sin2q2q3 + c_12*dq(2)*sinq2q3 - c_12*dq(3)*sinq2q3;&lt;br /&gt;
    c(2,3) = c_13*(-(-1)*(-2)*dq(2)/5 - (-1)*2*dq(3)/5)*sinq(3);&lt;br /&gt;
    c(3,3) = 0; &lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    diff=[dq-dotq;...&lt;br /&gt;
        b*ddq+g+c*dq+f-tau&#039;];&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>TobiasWeber</name></author>
	</entry>
	<entry>
		<id>https://mintoc.de/index.php?title=Industrial_robot&amp;diff=2128</id>
		<title>Industrial robot</title>
		<link rel="alternate" type="text/html" href="https://mintoc.de/index.php?title=Industrial_robot&amp;diff=2128"/>
		<updated>2016-07-27T11:09:15Z</updated>

		<summary type="html">&lt;p&gt;TobiasWeber: /* Parameters */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Dimensions&lt;br /&gt;
		|nd        = 1&lt;br /&gt;
		|nx        = 2&lt;br /&gt;
		|nu        = 2&lt;br /&gt;
		|nc        = 4&lt;br /&gt;
		|nre       = 2&lt;br /&gt;
	}}&amp;lt;!-- Do not insert line break here or Dimensions Box moves up in the layout...&lt;br /&gt;
	&lt;br /&gt;
	--&amp;gt;The Industrial robot problem focuses on the KUKA LWR IV drawing a pre-defined curve on a white board, which results in a path-following problem. This means that a system should be steered along a given path while there are no constraints regarding the position at a specific time &amp;lt;math&amp;gt; t &amp;gt; t_0 &amp;lt;/math&amp;gt;. This concept arises often where autonomous vehicles or steering of robots are involved. The source for this problem can be found online on [https://arxiv.org/abs/1506.09084 arXiv &amp;quot;Implementation of Nonlinear Model Predictive Path-Following Control for an Industrial Robot&amp;quot;].&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
== Path-following problems ==&lt;br /&gt;
	&lt;br /&gt;
As the robot should follow a geometric curve but is not constrained as to when it has to be where, a path-following problem arises. The path is given by &lt;br /&gt;
&amp;lt;math&amp;gt; \mathcal{P} = \{ y \in \mathcal{R}^n: \theta \in [ \theta_0, \theta_1 ] \mapsto y = p(\theta)\} &amp;lt;/math&amp;gt;&lt;br /&gt;
where “&amp;lt;math&amp;gt; \theta &amp;lt;/math&amp;gt; is called path parameter and &amp;lt;math&amp;gt; p(\theta) &amp;lt;/math&amp;gt; is a parametrization of &amp;lt;math&amp;gt; \mathcal{P} &amp;lt;/math&amp;gt;”. The path parameter does depend on the time however the exact timing is not known beforehand but rather integrated into the optimization problem by making use of a virtual system. &lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
== Virtual system ==&lt;br /&gt;
	&lt;br /&gt;
A virtual system is introduced to take care of the timing of the robot. This is an additional degree of freedom which is used here as an input into an integrator. This additional optimization variable &amp;lt;math&amp;gt; v &amp;lt;/math&amp;gt; is integrated twice to produce &amp;lt;math&amp;gt; z_1 &amp;lt;/math&amp;gt; which is used as the time parameter for the path (i.e. &amp;lt;math&amp;gt; p(z_1) &amp;lt;/math&amp;gt;).&lt;br /&gt;
	&lt;br /&gt;
&amp;lt;math&amp;gt; \left(&lt;br /&gt;
\begin{array}{c}&lt;br /&gt;
	\dot{z_1}\\&lt;br /&gt;
	\dot{z_2}\\&lt;br /&gt;
\end{array}&lt;br /&gt;
\right)&lt;br /&gt;
=&lt;br /&gt;
\dot{z}&lt;br /&gt;
=&lt;br /&gt;
l(z, v)&lt;br /&gt;
=&lt;br /&gt;
\left(&lt;br /&gt;
\begin{array}{c}&lt;br /&gt;
	z_2\\&lt;br /&gt;
	v\\&lt;br /&gt;
\end{array}&lt;br /&gt;
\right)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Model ==&lt;br /&gt;
The system for the motions of the robot are given by the function &amp;lt;math&amp;gt; f &amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; f(x) = E^{-1} &lt;br /&gt;
\left(&lt;br /&gt;
\begin{array}{c}&lt;br /&gt;
	x_2\\&lt;br /&gt;
	u - C(x_1,x_2) x_2 - g(x_1) - \tau_F(x_2)\\&lt;br /&gt;
\end{array}&lt;br /&gt;
\right)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
with&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E = diag(I, B(x_1)) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt; B, C, E, g, \tau_F &amp;lt;/math&amp;gt; are given in the Parameters section.&lt;br /&gt;
&lt;br /&gt;
The objective function &amp;lt;math&amp;gt; J &amp;lt;/math&amp;gt; will be the integral over the so-called cost function &amp;lt;math&amp;gt; F: \mathbb{R}^{n_u} \times \mathbb{R} \times \mathcal{U} \times \mathcal{V} \mapsto \mathbb{R}_0^{+} &amp;lt;/math&amp;gt;, i.e.&lt;br /&gt;
&amp;lt;math&amp;gt; J(x(t_k),\bar{e}, \bar{u}, \bar{z}, \bar{v}) = \displaystyle \int_{t_k}^{t_k+T} F(\bar{e}, \bar{z}, \bar{u}, \bar{v}) d \tau &amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math&amp;gt; T \in (\delta, \infty) &amp;lt;/math&amp;gt; is the prediction horizon and the function &amp;lt;math&amp;gt; F &amp;lt;/math&amp;gt; is given by &amp;lt;math&amp;gt; F(e,z,u,v) = || (e,z_1-\theta_1, z_2 - \dot{\theta}_{ref})^T||_Q^2 + ||(u,v)^T||_R^2 &amp;lt;/math&amp;gt; with positive semi definite matrix &amp;lt;math&amp;gt; Q &amp;lt;/math&amp;gt; and positive definite matrix &amp;lt;math&amp;gt; R &amp;lt;/math&amp;gt;, which can be found in the original paper cited above.&lt;br /&gt;
	&lt;br /&gt;
&lt;br /&gt;
The path-following is introduced into the problem by optimizing the error &amp;lt;math&amp;gt; e &amp;lt;/math&amp;gt; measuring the deviation of the robot from the path:  &lt;br /&gt;
	&lt;br /&gt;
&amp;lt;math&amp;gt; e(x, z) = h(x) - p(z_1) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt; p &amp;lt;/math&amp;gt; is the parametrization of &amp;lt;math&amp;gt; \mathcal{P} &amp;lt;/math&amp;gt; as above and &amp;lt;math&amp;gt; h &amp;lt;/math&amp;gt; is the position of the robot given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
h(x_1)&lt;br /&gt;
=&lt;br /&gt;
\left(&lt;br /&gt;
\begin{array}{c}&lt;br /&gt;
	-\cos(q_1)(d_3 \sin(q_2) + \bar{d}_5 + \sin(q_2-q_3))\\&lt;br /&gt;
	-\sin(q_1)(d_3 \sin(q_2) + \bar{d}_5 + \sin(q_2-q_3))\\&lt;br /&gt;
	d_1 + d_3 \cos(q_2) + \bar{d}_5 \cos(q_2-q_3)\\ &lt;br /&gt;
\end{array}&lt;br /&gt;
\right)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt; q = x_1 &amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt; \bar{d}_5 = d_5 + d_{tool} &amp;lt;/math&amp;gt; with &amp;lt;math&amp;gt; d_i, i \in \{ 1,3,5 \}  &amp;lt;/math&amp;gt; being the lengths of the links of the robot and &amp;lt;math&amp;gt; d_{tool} &amp;lt;/math&amp;gt; is the length of the pen and tool. These values can be found in the Parameters section as well.&lt;br /&gt;
&lt;br /&gt;
== OCP ==&lt;br /&gt;
The optimization problem which is solved repetitively is given by&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{llclr}&lt;br /&gt;
	\displaystyle \min_{\bar{u}, \bar{v}} &amp;amp; J &amp;amp;=&amp;amp; J(x(t_k),\bar{e}, \bar{u}, \bar{z}, \bar{v})  \\[1.5ex]&lt;br /&gt;
	\mbox{s.t.}&lt;br /&gt;
	&amp;amp; \dot{\bar{x}} &amp;amp; = &amp;amp; f(\bar{x},\bar{u}), \\&lt;br /&gt;
	&amp;amp; \dot{\bar{z}} &amp;amp; = &amp;amp; l(\bar{z},\bar{v}),  \\&lt;br /&gt;
	&amp;amp; \bar{e} &amp;amp; = &amp;amp; h(\bar{x}) - p(\bar{z}_1),  \\[1ex]&lt;br /&gt;
	&amp;amp; \bar{x}(t_k) &amp;amp; = &amp;amp; x(t_k), \\&lt;br /&gt;
	&amp;amp; \bar{z}(t_k) &amp;amp; = &amp;amp; z(t_k), \\[1ex]&lt;br /&gt;
	&amp;amp; \bar{x} &amp;amp; \in &amp;amp; \mathcal{X}, \\&lt;br /&gt;
	&amp;amp; \bar{u} &amp;amp; \in &amp;amp; \mathcal{U}, \\&lt;br /&gt;
	&amp;amp; \bar{z} &amp;amp; \in &amp;amp; \mathcal{Z}, \\&lt;br /&gt;
	&amp;amp; \bar{v} &amp;amp; \in &amp;amp; \mathcal{V}. \\&lt;br /&gt;
\end{array} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Parameters ==&lt;br /&gt;
&lt;br /&gt;
The matlab script which implements the implicit formulation for &amp;lt;math&amp;gt; f &amp;lt;/math&amp;gt;, i.e. &amp;lt;math&amp;gt; F(x) = E \dot{x} - f(x) &amp;lt;/math&amp;gt; can be found on [[Parameters for Industrial Robot]].&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
	|+Robot-specific constants&lt;br /&gt;
	|-&lt;br /&gt;
	|Symbol&lt;br /&gt;
	|Value&lt;br /&gt;
        |Unit&lt;br /&gt;
	|-&lt;br /&gt;
	|&amp;lt;math&amp;gt; d_1 &amp;lt;/math&amp;gt;&lt;br /&gt;
	|&amp;lt;math&amp;gt; 0.31&amp;lt;/math&amp;gt;&lt;br /&gt;
        | &amp;lt;math&amp;gt; m &amp;lt;/math&amp;gt;&lt;br /&gt;
	|-&lt;br /&gt;
	|&amp;lt;math&amp;gt; d_3 &amp;lt;/math&amp;gt;&lt;br /&gt;
	|&amp;lt;math&amp;gt; 0.40&amp;lt;/math&amp;gt;&lt;br /&gt;
        | &amp;lt;math&amp;gt; m &amp;lt;/math&amp;gt;&lt;br /&gt;
	|-&lt;br /&gt;
	|&amp;lt;math&amp;gt; d_5 &amp;lt;/math&amp;gt;&lt;br /&gt;
	|&amp;lt;math&amp;gt; 0.39&amp;lt;/math&amp;gt;&lt;br /&gt;
        | &amp;lt;math&amp;gt; m &amp;lt;/math&amp;gt;&lt;br /&gt;
	|-&lt;br /&gt;
	|&amp;lt;math&amp;gt; d_{tool} &amp;lt;/math&amp;gt;&lt;br /&gt;
	|&amp;lt;math&amp;gt; 0.15&amp;lt;/math&amp;gt;&lt;br /&gt;
        | &amp;lt;math&amp;gt; m &amp;lt;/math&amp;gt;&lt;br /&gt;
	|}&lt;br /&gt;
&lt;br /&gt;
== Reference Solutions ==&lt;br /&gt;
coming soon&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;biblist /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--List of all categories this page is part of. List characterization of solution behavior, model properties, ore presence of implementation details (e.g., AMPL for AMPL model) here --&amp;gt;&lt;br /&gt;
[[Category:MIOCP]]&lt;br /&gt;
[[Category:ODE model]]&lt;br /&gt;
[[Category:Path-constrained arcs]]&lt;/div&gt;</summary>
		<author><name>TobiasWeber</name></author>
	</entry>
	<entry>
		<id>https://mintoc.de/index.php?title=Industrial_robot&amp;diff=2127</id>
		<title>Industrial robot</title>
		<link rel="alternate" type="text/html" href="https://mintoc.de/index.php?title=Industrial_robot&amp;diff=2127"/>
		<updated>2016-07-27T11:05:31Z</updated>

		<summary type="html">&lt;p&gt;TobiasWeber: /* Model */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Dimensions&lt;br /&gt;
		|nd        = 1&lt;br /&gt;
		|nx        = 2&lt;br /&gt;
		|nu        = 2&lt;br /&gt;
		|nc        = 4&lt;br /&gt;
		|nre       = 2&lt;br /&gt;
	}}&amp;lt;!-- Do not insert line break here or Dimensions Box moves up in the layout...&lt;br /&gt;
	&lt;br /&gt;
	--&amp;gt;The Industrial robot problem focuses on the KUKA LWR IV drawing a pre-defined curve on a white board, which results in a path-following problem. This means that a system should be steered along a given path while there are no constraints regarding the position at a specific time &amp;lt;math&amp;gt; t &amp;gt; t_0 &amp;lt;/math&amp;gt;. This concept arises often where autonomous vehicles or steering of robots are involved. The source for this problem can be found online on [https://arxiv.org/abs/1506.09084 arXiv &amp;quot;Implementation of Nonlinear Model Predictive Path-Following Control for an Industrial Robot&amp;quot;].&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
== Path-following problems ==&lt;br /&gt;
	&lt;br /&gt;
As the robot should follow a geometric curve but is not constrained as to when it has to be where, a path-following problem arises. The path is given by &lt;br /&gt;
&amp;lt;math&amp;gt; \mathcal{P} = \{ y \in \mathcal{R}^n: \theta \in [ \theta_0, \theta_1 ] \mapsto y = p(\theta)\} &amp;lt;/math&amp;gt;&lt;br /&gt;
where “&amp;lt;math&amp;gt; \theta &amp;lt;/math&amp;gt; is called path parameter and &amp;lt;math&amp;gt; p(\theta) &amp;lt;/math&amp;gt; is a parametrization of &amp;lt;math&amp;gt; \mathcal{P} &amp;lt;/math&amp;gt;”. The path parameter does depend on the time however the exact timing is not known beforehand but rather integrated into the optimization problem by making use of a virtual system. &lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
== Virtual system ==&lt;br /&gt;
	&lt;br /&gt;
A virtual system is introduced to take care of the timing of the robot. This is an additional degree of freedom which is used here as an input into an integrator. This additional optimization variable &amp;lt;math&amp;gt; v &amp;lt;/math&amp;gt; is integrated twice to produce &amp;lt;math&amp;gt; z_1 &amp;lt;/math&amp;gt; which is used as the time parameter for the path (i.e. &amp;lt;math&amp;gt; p(z_1) &amp;lt;/math&amp;gt;).&lt;br /&gt;
	&lt;br /&gt;
&amp;lt;math&amp;gt; \left(&lt;br /&gt;
\begin{array}{c}&lt;br /&gt;
	\dot{z_1}\\&lt;br /&gt;
	\dot{z_2}\\&lt;br /&gt;
\end{array}&lt;br /&gt;
\right)&lt;br /&gt;
=&lt;br /&gt;
\dot{z}&lt;br /&gt;
=&lt;br /&gt;
l(z, v)&lt;br /&gt;
=&lt;br /&gt;
\left(&lt;br /&gt;
\begin{array}{c}&lt;br /&gt;
	z_2\\&lt;br /&gt;
	v\\&lt;br /&gt;
\end{array}&lt;br /&gt;
\right)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Model ==&lt;br /&gt;
The system for the motions of the robot are given by the function &amp;lt;math&amp;gt; f &amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; f(x) = E^{-1} &lt;br /&gt;
\left(&lt;br /&gt;
\begin{array}{c}&lt;br /&gt;
	x_2\\&lt;br /&gt;
	u - C(x_1,x_2) x_2 - g(x_1) - \tau_F(x_2)\\&lt;br /&gt;
\end{array}&lt;br /&gt;
\right)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
with&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E = diag(I, B(x_1)) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt; B, C, E, g, \tau_F &amp;lt;/math&amp;gt; are given in the Parameters section.&lt;br /&gt;
&lt;br /&gt;
The objective function &amp;lt;math&amp;gt; J &amp;lt;/math&amp;gt; will be the integral over the so-called cost function &amp;lt;math&amp;gt; F: \mathbb{R}^{n_u} \times \mathbb{R} \times \mathcal{U} \times \mathcal{V} \mapsto \mathbb{R}_0^{+} &amp;lt;/math&amp;gt;, i.e.&lt;br /&gt;
&amp;lt;math&amp;gt; J(x(t_k),\bar{e}, \bar{u}, \bar{z}, \bar{v}) = \displaystyle \int_{t_k}^{t_k+T} F(\bar{e}, \bar{z}, \bar{u}, \bar{v}) d \tau &amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math&amp;gt; T \in (\delta, \infty) &amp;lt;/math&amp;gt; is the prediction horizon and the function &amp;lt;math&amp;gt; F &amp;lt;/math&amp;gt; is given by &amp;lt;math&amp;gt; F(e,z,u,v) = || (e,z_1-\theta_1, z_2 - \dot{\theta}_{ref})^T||_Q^2 + ||(u,v)^T||_R^2 &amp;lt;/math&amp;gt; with positive semi definite matrix &amp;lt;math&amp;gt; Q &amp;lt;/math&amp;gt; and positive definite matrix &amp;lt;math&amp;gt; R &amp;lt;/math&amp;gt;, which can be found in the original paper cited above.&lt;br /&gt;
	&lt;br /&gt;
&lt;br /&gt;
The path-following is introduced into the problem by optimizing the error &amp;lt;math&amp;gt; e &amp;lt;/math&amp;gt; measuring the deviation of the robot from the path:  &lt;br /&gt;
	&lt;br /&gt;
&amp;lt;math&amp;gt; e(x, z) = h(x) - p(z_1) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt; p &amp;lt;/math&amp;gt; is the parametrization of &amp;lt;math&amp;gt; \mathcal{P} &amp;lt;/math&amp;gt; as above and &amp;lt;math&amp;gt; h &amp;lt;/math&amp;gt; is the position of the robot given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
h(x_1)&lt;br /&gt;
=&lt;br /&gt;
\left(&lt;br /&gt;
\begin{array}{c}&lt;br /&gt;
	-\cos(q_1)(d_3 \sin(q_2) + \bar{d}_5 + \sin(q_2-q_3))\\&lt;br /&gt;
	-\sin(q_1)(d_3 \sin(q_2) + \bar{d}_5 + \sin(q_2-q_3))\\&lt;br /&gt;
	d_1 + d_3 \cos(q_2) + \bar{d}_5 \cos(q_2-q_3)\\ &lt;br /&gt;
\end{array}&lt;br /&gt;
\right)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt; q = x_1 &amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt; \bar{d}_5 = d_5 + d_{tool} &amp;lt;/math&amp;gt; with &amp;lt;math&amp;gt; d_i, i \in \{ 1,3,5 \}  &amp;lt;/math&amp;gt; being the lengths of the links of the robot and &amp;lt;math&amp;gt; d_{tool} &amp;lt;/math&amp;gt; is the length of the pen and tool. These values can be found in the Parameters section as well.&lt;br /&gt;
&lt;br /&gt;
== OCP ==&lt;br /&gt;
The optimization problem which is solved repetitively is given by&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{llclr}&lt;br /&gt;
	\displaystyle \min_{\bar{u}, \bar{v}} &amp;amp; J &amp;amp;=&amp;amp; J(x(t_k),\bar{e}, \bar{u}, \bar{z}, \bar{v})  \\[1.5ex]&lt;br /&gt;
	\mbox{s.t.}&lt;br /&gt;
	&amp;amp; \dot{\bar{x}} &amp;amp; = &amp;amp; f(\bar{x},\bar{u}), \\&lt;br /&gt;
	&amp;amp; \dot{\bar{z}} &amp;amp; = &amp;amp; l(\bar{z},\bar{v}),  \\&lt;br /&gt;
	&amp;amp; \bar{e} &amp;amp; = &amp;amp; h(\bar{x}) - p(\bar{z}_1),  \\[1ex]&lt;br /&gt;
	&amp;amp; \bar{x}(t_k) &amp;amp; = &amp;amp; x(t_k), \\&lt;br /&gt;
	&amp;amp; \bar{z}(t_k) &amp;amp; = &amp;amp; z(t_k), \\[1ex]&lt;br /&gt;
	&amp;amp; \bar{x} &amp;amp; \in &amp;amp; \mathcal{X}, \\&lt;br /&gt;
	&amp;amp; \bar{u} &amp;amp; \in &amp;amp; \mathcal{U}, \\&lt;br /&gt;
	&amp;amp; \bar{z} &amp;amp; \in &amp;amp; \mathcal{Z}, \\&lt;br /&gt;
	&amp;amp; \bar{v} &amp;amp; \in &amp;amp; \mathcal{V}. \\&lt;br /&gt;
\end{array} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Parameters ==&lt;br /&gt;
&lt;br /&gt;
The matlab script which implements the implicit formulation for &amp;lt;math&amp;gt; f &amp;lt;/math&amp;gt;, i.e. &amp;lt;math&amp;gt; F(x) = E \dot{x} - f(x) &amp;lt;/math&amp;gt; can be found on [[Parameters for Industrial Robot]].&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
	|+Robot-specific constants&lt;br /&gt;
	|-&lt;br /&gt;
	|Symbol&lt;br /&gt;
	|Value&lt;br /&gt;
        |Unit&lt;br /&gt;
	|-&lt;br /&gt;
	|&amp;lt;math&amp;gt; d_1 &amp;lt;/math&amp;gt;&lt;br /&gt;
	|&amp;lt;math&amp;gt; 0.31&amp;lt;/math&amp;gt;&lt;br /&gt;
        | &amp;lt;math&amp;gt; m &amp;lt;/math&amp;gt;&lt;br /&gt;
	|-&lt;br /&gt;
	|&amp;lt;math&amp;gt; d_3 &amp;lt;/math&amp;gt;&lt;br /&gt;
	|&amp;lt;math&amp;gt; 0.40&amp;lt;/math&amp;gt;&lt;br /&gt;
        | &amp;lt;math&amp;gt; m &amp;lt;/math&amp;gt;&lt;br /&gt;
	|-&lt;br /&gt;
	|&amp;lt;math&amp;gt; d_5 &amp;lt;/math&amp;gt;&lt;br /&gt;
	|&amp;lt;math&amp;gt; 0.39&amp;lt;/math&amp;gt;&lt;br /&gt;
        | &amp;lt;math&amp;gt; m &amp;lt;/math&amp;gt;&lt;br /&gt;
	|-&lt;br /&gt;
	|&amp;lt;math&amp;gt; d_{tool} &amp;lt;/math&amp;gt;&lt;br /&gt;
	|&amp;lt;math&amp;gt; 0.08&amp;lt;/math&amp;gt;&lt;br /&gt;
        | &amp;lt;math&amp;gt; m &amp;lt;/math&amp;gt;&lt;br /&gt;
	|}&lt;br /&gt;
&lt;br /&gt;
== Reference Solutions ==&lt;br /&gt;
coming soon&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;biblist /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--List of all categories this page is part of. List characterization of solution behavior, model properties, ore presence of implementation details (e.g., AMPL for AMPL model) here --&amp;gt;&lt;br /&gt;
[[Category:MIOCP]]&lt;br /&gt;
[[Category:ODE model]]&lt;br /&gt;
[[Category:Path-constrained arcs]]&lt;/div&gt;</summary>
		<author><name>TobiasWeber</name></author>
	</entry>
	<entry>
		<id>https://mintoc.de/index.php?title=Industrial_robot&amp;diff=2126</id>
		<title>Industrial robot</title>
		<link rel="alternate" type="text/html" href="https://mintoc.de/index.php?title=Industrial_robot&amp;diff=2126"/>
		<updated>2016-07-27T11:04:42Z</updated>

		<summary type="html">&lt;p&gt;TobiasWeber: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Dimensions&lt;br /&gt;
		|nd        = 1&lt;br /&gt;
		|nx        = 2&lt;br /&gt;
		|nu        = 2&lt;br /&gt;
		|nc        = 4&lt;br /&gt;
		|nre       = 2&lt;br /&gt;
	}}&amp;lt;!-- Do not insert line break here or Dimensions Box moves up in the layout...&lt;br /&gt;
	&lt;br /&gt;
	--&amp;gt;The Industrial robot problem focuses on the KUKA LWR IV drawing a pre-defined curve on a white board, which results in a path-following problem. This means that a system should be steered along a given path while there are no constraints regarding the position at a specific time &amp;lt;math&amp;gt; t &amp;gt; t_0 &amp;lt;/math&amp;gt;. This concept arises often where autonomous vehicles or steering of robots are involved. The source for this problem can be found online on [https://arxiv.org/abs/1506.09084 arXiv &amp;quot;Implementation of Nonlinear Model Predictive Path-Following Control for an Industrial Robot&amp;quot;].&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
== Path-following problems ==&lt;br /&gt;
	&lt;br /&gt;
As the robot should follow a geometric curve but is not constrained as to when it has to be where, a path-following problem arises. The path is given by &lt;br /&gt;
&amp;lt;math&amp;gt; \mathcal{P} = \{ y \in \mathcal{R}^n: \theta \in [ \theta_0, \theta_1 ] \mapsto y = p(\theta)\} &amp;lt;/math&amp;gt;&lt;br /&gt;
where “&amp;lt;math&amp;gt; \theta &amp;lt;/math&amp;gt; is called path parameter and &amp;lt;math&amp;gt; p(\theta) &amp;lt;/math&amp;gt; is a parametrization of &amp;lt;math&amp;gt; \mathcal{P} &amp;lt;/math&amp;gt;”. The path parameter does depend on the time however the exact timing is not known beforehand but rather integrated into the optimization problem by making use of a virtual system. &lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
== Virtual system ==&lt;br /&gt;
	&lt;br /&gt;
A virtual system is introduced to take care of the timing of the robot. This is an additional degree of freedom which is used here as an input into an integrator. This additional optimization variable &amp;lt;math&amp;gt; v &amp;lt;/math&amp;gt; is integrated twice to produce &amp;lt;math&amp;gt; z_1 &amp;lt;/math&amp;gt; which is used as the time parameter for the path (i.e. &amp;lt;math&amp;gt; p(z_1) &amp;lt;/math&amp;gt;).&lt;br /&gt;
	&lt;br /&gt;
&amp;lt;math&amp;gt; \left(&lt;br /&gt;
\begin{array}{c}&lt;br /&gt;
	\dot{z_1}\\&lt;br /&gt;
	\dot{z_2}\\&lt;br /&gt;
\end{array}&lt;br /&gt;
\right)&lt;br /&gt;
=&lt;br /&gt;
\dot{z}&lt;br /&gt;
=&lt;br /&gt;
l(z, v)&lt;br /&gt;
=&lt;br /&gt;
\left(&lt;br /&gt;
\begin{array}{c}&lt;br /&gt;
	z_2\\&lt;br /&gt;
	v\\&lt;br /&gt;
\end{array}&lt;br /&gt;
\right)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Model ==&lt;br /&gt;
The system for the motions of the robot are given by the function &amp;lt;math&amp;gt; f &amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; f(x) = E^{-1} &lt;br /&gt;
\left(&lt;br /&gt;
\begin{array}{c}&lt;br /&gt;
	x_2\\&lt;br /&gt;
	u - C(x_1,x_2) x_2 - g(x_1) - \tau_F(x_2)\\&lt;br /&gt;
\end{array}&lt;br /&gt;
\right)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
with&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E = diag(I, B(x_1)) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt; B, C, E, g, \tau_F &amp;lt;/math&amp;gt; are given in the Parameters section.&lt;br /&gt;
&lt;br /&gt;
The objective function &amp;lt;math&amp;gt; J &amp;lt;/math&amp;gt; will be the integral over the so-called cost function &amp;lt;math&amp;gt; F: \mathbb{R}^{n_u} \times \mathbb{R} \times \mathcal{U} \times \mathcal{V} \mapsto \mathbb{R}_0^{+} &amp;lt;/math&amp;gt;, i.e.&lt;br /&gt;
&amp;lt;math&amp;gt; J(x(t_k),\bar{e}, \bar{u}, \bar{z}, \bar{v}) = \displaystyle \int_{t_k}^{t_k+T} F(\bar{e}, \bar{z}, \bar{u}, \bar{v}) d \tau &amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math&amp;gt; T \in (\delta, \infty) &amp;lt;/math&amp;gt; is the prediction horizon and the function &amp;lt;math&amp;gt; F &amp;lt;/math&amp;gt; is given by &amp;lt;math&amp;gt; F(e,z,u,v) = || (e,z_1-\theta_1, z_2 - \dot{\theta}_{ref})^T||_Q^2 + ||(u,v)^T||_R^2 &amp;lt;/math&amp;gt; with positive semi definite matrix &amp;lt;math&amp;gt; Q &amp;lt;/math&amp;gt; and positive definite matrix &amp;lt;math&amp;gt; R &amp;lt;/math&amp;gt;, which can be found in the original paper cited above.&lt;br /&gt;
	&lt;br /&gt;
&lt;br /&gt;
The path-following is introduced into the problem by optimizing the error &amp;lt;math&amp;gt; e &amp;lt;/math&amp;gt; measuring the deviation of the robot from the path:  &lt;br /&gt;
	&lt;br /&gt;
&amp;lt;math&amp;gt; e(x, z) = h(x) - p(z_1) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt; p &amp;lt;/math&amp;gt; is the parametrization of &amp;lt;math&amp;gt; \mathcal{P} &amp;lt;/math&amp;gt; as above and &amp;lt;math&amp;gt; h &amp;lt;/math&amp;gt; is the position of the robot given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
h(x_1)&lt;br /&gt;
=&lt;br /&gt;
\left(&lt;br /&gt;
\begin{array}{c}&lt;br /&gt;
	-\cos(q_1)(d_3 \sin(q_2) + \bar{d}_5 + \sin(q_2-q_3))\\&lt;br /&gt;
	-\sin(q_1)(d_3 \sin(q_2) + \bar{d}_5 + \sin(q_2-q_3))\\&lt;br /&gt;
	d_1 + d_3 \cos(q_2) + \bar{d}_5 \cos(q_2-q_3)\\ &lt;br /&gt;
\end{array}&lt;br /&gt;
\right)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt; q = x_1 &amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt; \bar{d}_5 = d_5 + d_{tool} &amp;lt;/math&amp;gt; with &amp;lt;math&amp;gt; d_i, i \in \{ 1,3,5 \}  &amp;lt;/math&amp;gt; being the lengths of the link of the robot and &amp;lt;math&amp;gt; d_{tool} &amp;lt;/math&amp;gt; is the length of the pen and tool. These values can be found in the Parameters section as well.&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
== OCP ==&lt;br /&gt;
The optimization problem which is solved repetitively is given by&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{llclr}&lt;br /&gt;
	\displaystyle \min_{\bar{u}, \bar{v}} &amp;amp; J &amp;amp;=&amp;amp; J(x(t_k),\bar{e}, \bar{u}, \bar{z}, \bar{v})  \\[1.5ex]&lt;br /&gt;
	\mbox{s.t.}&lt;br /&gt;
	&amp;amp; \dot{\bar{x}} &amp;amp; = &amp;amp; f(\bar{x},\bar{u}), \\&lt;br /&gt;
	&amp;amp; \dot{\bar{z}} &amp;amp; = &amp;amp; l(\bar{z},\bar{v}),  \\&lt;br /&gt;
	&amp;amp; \bar{e} &amp;amp; = &amp;amp; h(\bar{x}) - p(\bar{z}_1),  \\[1ex]&lt;br /&gt;
	&amp;amp; \bar{x}(t_k) &amp;amp; = &amp;amp; x(t_k), \\&lt;br /&gt;
	&amp;amp; \bar{z}(t_k) &amp;amp; = &amp;amp; z(t_k), \\[1ex]&lt;br /&gt;
	&amp;amp; \bar{x} &amp;amp; \in &amp;amp; \mathcal{X}, \\&lt;br /&gt;
	&amp;amp; \bar{u} &amp;amp; \in &amp;amp; \mathcal{U}, \\&lt;br /&gt;
	&amp;amp; \bar{z} &amp;amp; \in &amp;amp; \mathcal{Z}, \\&lt;br /&gt;
	&amp;amp; \bar{v} &amp;amp; \in &amp;amp; \mathcal{V}. \\&lt;br /&gt;
\end{array} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Parameters ==&lt;br /&gt;
&lt;br /&gt;
The matlab script which implements the implicit formulation for &amp;lt;math&amp;gt; f &amp;lt;/math&amp;gt;, i.e. &amp;lt;math&amp;gt; F(x) = E \dot{x} - f(x) &amp;lt;/math&amp;gt; can be found on [[Parameters for Industrial Robot]].&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
	|+Robot-specific constants&lt;br /&gt;
	|-&lt;br /&gt;
	|Symbol&lt;br /&gt;
	|Value&lt;br /&gt;
        |Unit&lt;br /&gt;
	|-&lt;br /&gt;
	|&amp;lt;math&amp;gt; d_1 &amp;lt;/math&amp;gt;&lt;br /&gt;
	|&amp;lt;math&amp;gt; 0.31&amp;lt;/math&amp;gt;&lt;br /&gt;
        | &amp;lt;math&amp;gt; m &amp;lt;/math&amp;gt;&lt;br /&gt;
	|-&lt;br /&gt;
	|&amp;lt;math&amp;gt; d_3 &amp;lt;/math&amp;gt;&lt;br /&gt;
	|&amp;lt;math&amp;gt; 0.40&amp;lt;/math&amp;gt;&lt;br /&gt;
        | &amp;lt;math&amp;gt; m &amp;lt;/math&amp;gt;&lt;br /&gt;
	|-&lt;br /&gt;
	|&amp;lt;math&amp;gt; d_5 &amp;lt;/math&amp;gt;&lt;br /&gt;
	|&amp;lt;math&amp;gt; 0.39&amp;lt;/math&amp;gt;&lt;br /&gt;
        | &amp;lt;math&amp;gt; m &amp;lt;/math&amp;gt;&lt;br /&gt;
	|-&lt;br /&gt;
	|&amp;lt;math&amp;gt; d_{tool} &amp;lt;/math&amp;gt;&lt;br /&gt;
	|&amp;lt;math&amp;gt; 0.08&amp;lt;/math&amp;gt;&lt;br /&gt;
        | &amp;lt;math&amp;gt; m &amp;lt;/math&amp;gt;&lt;br /&gt;
	|}&lt;br /&gt;
&lt;br /&gt;
== Reference Solutions ==&lt;br /&gt;
coming soon&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;biblist /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--List of all categories this page is part of. List characterization of solution behavior, model properties, ore presence of implementation details (e.g., AMPL for AMPL model) here --&amp;gt;&lt;br /&gt;
[[Category:MIOCP]]&lt;br /&gt;
[[Category:ODE model]]&lt;br /&gt;
[[Category:Path-constrained arcs]]&lt;/div&gt;</summary>
		<author><name>TobiasWeber</name></author>
	</entry>
	<entry>
		<id>https://mintoc.de/index.php?title=Industrial_robot&amp;diff=2125</id>
		<title>Industrial robot</title>
		<link rel="alternate" type="text/html" href="https://mintoc.de/index.php?title=Industrial_robot&amp;diff=2125"/>
		<updated>2016-07-27T11:02:43Z</updated>

		<summary type="html">&lt;p&gt;TobiasWeber: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Dimensions&lt;br /&gt;
		|nd        = 1&lt;br /&gt;
		|nx        = 2&lt;br /&gt;
		|nu        = 2&lt;br /&gt;
		|nc        = 4&lt;br /&gt;
		|nre       = 2&lt;br /&gt;
	}}&amp;lt;!-- Do not insert line break here or Dimensions Box moves up in the layout...&lt;br /&gt;
	&lt;br /&gt;
	--&amp;gt;The Industrial robot problem focuses on the KUKA LWR IV drawing a pre-defined curve on a white board, which results in a path-following problem. This means that a system should be steered along a given path while there are no constraints regarding the position at a specific time &amp;lt;math&amp;gt; t &amp;gt; t_0 &amp;lt;/math&amp;gt;. This concept arises often where autonomous vehicles or steering of robots are involved. The source for this problem can be found online on [https://arxiv.org/abs/1506.09084 arXiv &amp;quot;Implementation of Nonlinear Model Predictive Path-Following Control for an Industrial Robot&amp;quot;].&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
== Path-following problems ==&lt;br /&gt;
	&lt;br /&gt;
As the robot should follow a geometric curve but is not constrained as to when it has to be where, a path-following problem arises. The path is given by &lt;br /&gt;
&amp;lt;math&amp;gt; \mathcal{P} = \{ y \in \mathcal{R}^n: \theta \in [ \theta_0, \theta_1 ] \mapsto y = p(\theta)\} &amp;lt;/math&amp;gt;&lt;br /&gt;
where “&amp;lt;math&amp;gt; \theta &amp;lt;/math&amp;gt; is called path parameter and &amp;lt;math&amp;gt; p(\theta) &amp;lt;/math&amp;gt; is a parametrization of &amp;lt;math&amp;gt; \mathcal{P} &amp;lt;/math&amp;gt;”. The path parameter does depend on the time however the exact timing is not known beforehand but rather integrated into the optimization problem by making use of a virtual system. &lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
== Virtual system ==&lt;br /&gt;
	&lt;br /&gt;
A virtual system is introduced to take care of the timing of the robot. This is an additional degree of freedom which is used here as an input into an integrator. This additional optimization variable &amp;lt;math&amp;gt; v &amp;lt;/math&amp;gt; is integrated twice to produce &amp;lt;math&amp;gt; z &amp;lt;/math&amp;gt; which is used as the time parameter for the path (i.e. &amp;lt;math&amp;gt; p(z) &amp;lt;/math&amp;gt;).&lt;br /&gt;
	&lt;br /&gt;
&amp;lt;math&amp;gt; \left(&lt;br /&gt;
\begin{array}{c}&lt;br /&gt;
	\dot{z_1}\\&lt;br /&gt;
	\dot{z_2}\\&lt;br /&gt;
\end{array}&lt;br /&gt;
\right)&lt;br /&gt;
=&lt;br /&gt;
\dot{z}&lt;br /&gt;
=&lt;br /&gt;
l(z, v)&lt;br /&gt;
=&lt;br /&gt;
\left(&lt;br /&gt;
\begin{array}{c}&lt;br /&gt;
	z_2\\&lt;br /&gt;
	v\\&lt;br /&gt;
\end{array}&lt;br /&gt;
\right)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Model ==&lt;br /&gt;
The system for the motions of the robot are given by the function &amp;lt;math&amp;gt; f &amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; f(x) = E^{-1} &lt;br /&gt;
\left(&lt;br /&gt;
\begin{array}{c}&lt;br /&gt;
	x_2\\&lt;br /&gt;
	u - C(x_1,x_2) x_2 - g(x_1) - \tau_F(x_2)\\&lt;br /&gt;
\end{array}&lt;br /&gt;
\right)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
with&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E = diag(I, B(x_1)) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt; B, C, E, g, \tau_F &amp;lt;/math&amp;gt; are given in the Parameters section.&lt;br /&gt;
&lt;br /&gt;
The objective function &amp;lt;math&amp;gt; J &amp;lt;/math&amp;gt; will be the integral over the so-called cost function &amp;lt;math&amp;gt; F: \mathbb{R}^{n_u} \times \mathbb{R} \times \mathcal{U} \times \mathcal{V} \mapsto \mathbb{R}_0^{+} &amp;lt;/math&amp;gt;, i.e.&lt;br /&gt;
&amp;lt;math&amp;gt; J(x(t_k),\bar{e}, \bar{u}, \bar{z}, \bar{v}) = \displaystyle \int_{t_k}^{t_k+T} F(\bar{e}, \bar{z}, \bar{u}, \bar{v}) d \tau &amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math&amp;gt; T \in (\delta, \infty) &amp;lt;/math&amp;gt; is the prediction horizon and the function &amp;lt;math&amp;gt; F &amp;lt;/math&amp;gt; is given by &amp;lt;math&amp;gt; F(e,z,u,v) = || (e,z_1-\theta_1, z_2 - \dot{\theta}_{ref})^T||_Q^2 + ||(u,v)^T||_R^2 &amp;lt;/math&amp;gt; with positive semi definite matrix &amp;lt;math&amp;gt; Q &amp;lt;/math&amp;gt; and positive definite matrix &amp;lt;math&amp;gt; R &amp;lt;/math&amp;gt;, which can be found in the original paper cited above.&lt;br /&gt;
	&lt;br /&gt;
&lt;br /&gt;
The path-following is introduced into the problem by optimizing the error &amp;lt;math&amp;gt; e &amp;lt;/math&amp;gt; measuring the deviation of the robot from the path:  &lt;br /&gt;
	&lt;br /&gt;
&amp;lt;math&amp;gt; e(x, z) = h(x) - p(z_1) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt; p &amp;lt;/math&amp;gt; is the parametrization of &amp;lt;math&amp;gt; \mathcal{P} &amp;lt;/math&amp;gt; as above and &amp;lt;math&amp;gt; h &amp;lt;/math&amp;gt; is the position of the robot given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
h(x_1)&lt;br /&gt;
=&lt;br /&gt;
\left(&lt;br /&gt;
\begin{array}{c}&lt;br /&gt;
	-\cos(q_1)(d_3 \sin(q_2) + \bar{d}_5 + \sin(q_2-q_3))\\&lt;br /&gt;
	-\sin(q_1)(d_3 \sin(q_2) + \bar{d}_5 + \sin(q_2-q_3))\\&lt;br /&gt;
	d_1 + d_3 \cos(q_2) + \bar{d}_5 \cos(q_2-q_3)\\ &lt;br /&gt;
\end{array}&lt;br /&gt;
\right)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt; q = x_1 &amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt; \bar{d}_5 = d_5 + d_{tool} &amp;lt;/math&amp;gt; with &amp;lt;math&amp;gt; d_i, i \in \{ 1,3,5 \}  &amp;lt;/math&amp;gt; being the lengths of the link of the robot and &amp;lt;math&amp;gt; d_{tool} &amp;lt;/math&amp;gt; is the length of the pen and tool. These values can be found in the Parameters section as well.&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
== OCP ==&lt;br /&gt;
The optimization problem which is solved repetitively is given by&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{llclr}&lt;br /&gt;
	\displaystyle \min_{\bar{u}, \bar{v}} &amp;amp; J &amp;amp;=&amp;amp; J(x(t_k),\bar{e}, \bar{u}, \bar{z}, \bar{v})  \\[1.5ex]&lt;br /&gt;
	\mbox{s.t.}&lt;br /&gt;
	&amp;amp; \dot{\bar{x}} &amp;amp; = &amp;amp; f(\bar{x},\bar{u}), \\&lt;br /&gt;
	&amp;amp; \dot{\bar{z}} &amp;amp; = &amp;amp; l(\bar{z},\bar{v}),  \\&lt;br /&gt;
	&amp;amp; \bar{e} &amp;amp; = &amp;amp; h(\bar{x}) - p(\bar{z}_1),  \\[1ex]&lt;br /&gt;
	&amp;amp; \bar{x}(t_k) &amp;amp; = &amp;amp; x(t_k), \\&lt;br /&gt;
	&amp;amp; \bar{z}(t_k) &amp;amp; = &amp;amp; z(t_k), \\[1ex]&lt;br /&gt;
	&amp;amp; \bar{x} &amp;amp; \in &amp;amp; \mathcal{X}, \\&lt;br /&gt;
	&amp;amp; \bar{u} &amp;amp; \in &amp;amp; \mathcal{U}, \\&lt;br /&gt;
	&amp;amp; \bar{z} &amp;amp; \in &amp;amp; \mathcal{Z}, \\&lt;br /&gt;
	&amp;amp; \bar{v} &amp;amp; \in &amp;amp; \mathcal{V}. \\&lt;br /&gt;
\end{array} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Parameters ==&lt;br /&gt;
&lt;br /&gt;
The matlab script which implements the implicit formulation for &amp;lt;math&amp;gt; f &amp;lt;/math&amp;gt;, i.e. &amp;lt;math&amp;gt; F(x) = E \dot{x} - f(x) &amp;lt;/math&amp;gt; can be found on [[Parameters for Industrial Robot]].&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
	|+Robot-specific constants&lt;br /&gt;
	|-&lt;br /&gt;
	|Symbol&lt;br /&gt;
	|Value&lt;br /&gt;
        |Unit&lt;br /&gt;
	|-&lt;br /&gt;
	|&amp;lt;math&amp;gt; d_1 &amp;lt;/math&amp;gt;&lt;br /&gt;
	|&amp;lt;math&amp;gt; 0.31&amp;lt;/math&amp;gt;&lt;br /&gt;
        | &amp;lt;math&amp;gt; m &amp;lt;/math&amp;gt;&lt;br /&gt;
	|-&lt;br /&gt;
	|&amp;lt;math&amp;gt; d_3 &amp;lt;/math&amp;gt;&lt;br /&gt;
	|&amp;lt;math&amp;gt; 0.40&amp;lt;/math&amp;gt;&lt;br /&gt;
        | &amp;lt;math&amp;gt; m &amp;lt;/math&amp;gt;&lt;br /&gt;
	|-&lt;br /&gt;
	|&amp;lt;math&amp;gt; d_5 &amp;lt;/math&amp;gt;&lt;br /&gt;
	|&amp;lt;math&amp;gt; 0.39&amp;lt;/math&amp;gt;&lt;br /&gt;
        | &amp;lt;math&amp;gt; m &amp;lt;/math&amp;gt;&lt;br /&gt;
	|-&lt;br /&gt;
	|&amp;lt;math&amp;gt; d_{tool} &amp;lt;/math&amp;gt;&lt;br /&gt;
	|&amp;lt;math&amp;gt; 0.08&amp;lt;/math&amp;gt;&lt;br /&gt;
        | &amp;lt;math&amp;gt; m &amp;lt;/math&amp;gt;&lt;br /&gt;
	|}&lt;br /&gt;
&lt;br /&gt;
== Reference Solutions ==&lt;br /&gt;
coming soon&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;biblist /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--List of all categories this page is part of. List characterization of solution behavior, model properties, ore presence of implementation details (e.g., AMPL for AMPL model) here --&amp;gt;&lt;br /&gt;
[[Category:MIOCP]]&lt;br /&gt;
[[Category:ODE model]]&lt;br /&gt;
[[Category:Path-constrained arcs]]&lt;/div&gt;</summary>
		<author><name>TobiasWeber</name></author>
	</entry>
	<entry>
		<id>https://mintoc.de/index.php?title=Industrial_robot&amp;diff=2124</id>
		<title>Industrial robot</title>
		<link rel="alternate" type="text/html" href="https://mintoc.de/index.php?title=Industrial_robot&amp;diff=2124"/>
		<updated>2016-07-27T11:01:49Z</updated>

		<summary type="html">&lt;p&gt;TobiasWeber: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Dimensions&lt;br /&gt;
		|nd        = 1&lt;br /&gt;
		|nx        = 2&lt;br /&gt;
		|nu        = 2&lt;br /&gt;
		|nc        = 4&lt;br /&gt;
		|nre       = 2&lt;br /&gt;
	}}&amp;lt;!-- Do not insert line break here or Dimensions Box moves up in the layout...&lt;br /&gt;
	&lt;br /&gt;
	--&amp;gt;The Industrial robot problem focuses on the KUKA LWR IV drawing a pre-defined curve on a white board, which results in a path-following problem. This means that a system should be steered along a given path while there are no constraints regarding the position at a specific time &amp;lt;math&amp;gt; t &amp;gt; t_0 &amp;lt;/math&amp;gt;. This concept arises often where autonomous vehicles or steering of robots are involved. The source for this model can be found online on [https://arxiv.org/abs/1506.09084 arXiv &amp;quot;Implementation of Nonlinear Model Predictive Path-Following Control for an Industrial Robot&amp;quot;].&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
== Path-following problems ==&lt;br /&gt;
	&lt;br /&gt;
As the robot should follow a geometric curve but is not constrained as to when it has to be where, a path-following problem arises. The path is given by &lt;br /&gt;
&amp;lt;math&amp;gt; \mathcal{P} = \{ y \in \mathcal{R}^n: \theta \in [ \theta_0, \theta_1 ] \mapsto y = p(\theta)\} &amp;lt;/math&amp;gt;&lt;br /&gt;
where “&amp;lt;math&amp;gt; \theta &amp;lt;/math&amp;gt; is called path parameter and &amp;lt;math&amp;gt; p(\theta) &amp;lt;/math&amp;gt; is a parametrization of &amp;lt;math&amp;gt; \mathcal{P} &amp;lt;/math&amp;gt;”. The path parameter does depend on the time however the exact timing is not known beforehand but rather integrated into the optimization problem by making use of a virtual system. &lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
== Virtual system ==&lt;br /&gt;
	&lt;br /&gt;
A virtual system is introduced to take care of the timing of the robot. This is an additional degree of freedom which is used here as an input into an integrator. This additional optimization variable &amp;lt;math&amp;gt; v &amp;lt;/math&amp;gt; is integrated twice to produce &amp;lt;math&amp;gt; z &amp;lt;/math&amp;gt; which is used as the time parameter for the path (i.e. &amp;lt;math&amp;gt; p(z) &amp;lt;/math&amp;gt;).&lt;br /&gt;
	&lt;br /&gt;
&amp;lt;math&amp;gt; \left(&lt;br /&gt;
\begin{array}{c}&lt;br /&gt;
	\dot{z_1}\\&lt;br /&gt;
	\dot{z_2}\\&lt;br /&gt;
\end{array}&lt;br /&gt;
\right)&lt;br /&gt;
=&lt;br /&gt;
\dot{z}&lt;br /&gt;
=&lt;br /&gt;
l(z, v)&lt;br /&gt;
=&lt;br /&gt;
\left(&lt;br /&gt;
\begin{array}{c}&lt;br /&gt;
	z_2\\&lt;br /&gt;
	v\\&lt;br /&gt;
\end{array}&lt;br /&gt;
\right)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Model ==&lt;br /&gt;
The system for the motions of the robot are given by the function &amp;lt;math&amp;gt; f &amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; f(x) = E^{-1} &lt;br /&gt;
\left(&lt;br /&gt;
\begin{array}{c}&lt;br /&gt;
	x_2\\&lt;br /&gt;
	u - C(x_1,x_2) x_2 - g(x_1) - \tau_F(x_2)\\&lt;br /&gt;
\end{array}&lt;br /&gt;
\right)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
with&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E = diag(I, B(x_1)) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt; B, C, E, g, \tau_F &amp;lt;/math&amp;gt; are given in the Parameters section.&lt;br /&gt;
&lt;br /&gt;
The objective function &amp;lt;math&amp;gt; J &amp;lt;/math&amp;gt; will be the integral over the so-called cost function &amp;lt;math&amp;gt; F: \mathbb{R}^{n_u} \times \mathbb{R} \times \mathcal{U} \times \mathcal{V} \mapsto \mathbb{R}_0^{+} &amp;lt;/math&amp;gt;, i.e.&lt;br /&gt;
&amp;lt;math&amp;gt; J(x(t_k),\bar{e}, \bar{u}, \bar{z}, \bar{v}) = \displaystyle \int_{t_k}^{t_k+T} F(\bar{e}, \bar{z}, \bar{u}, \bar{v}) d \tau &amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math&amp;gt; T \in (\delta, \infty) &amp;lt;/math&amp;gt; is the prediction horizon and the function &amp;lt;math&amp;gt; F &amp;lt;/math&amp;gt; is given by &amp;lt;math&amp;gt; F(e,z,u,v) = || (e,z_1-\theta_1, z_2 - \dot{\theta}_{ref})^T||_Q^2 + ||(u,v)^T||_R^2 &amp;lt;/math&amp;gt; with positive semi definite matrix &amp;lt;math&amp;gt; Q &amp;lt;/math&amp;gt; and positive definite matrix &amp;lt;math&amp;gt; R &amp;lt;/math&amp;gt;, which can be found in the original paper cited above.&lt;br /&gt;
	&lt;br /&gt;
&lt;br /&gt;
The path-following is introduced into the problem by optimizing the error &amp;lt;math&amp;gt; e &amp;lt;/math&amp;gt; measuring the deviation of the robot from the path:  &lt;br /&gt;
	&lt;br /&gt;
&amp;lt;math&amp;gt; e(x, z) = h(x) - p(z_1) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt; p &amp;lt;/math&amp;gt; is the parametrization of &amp;lt;math&amp;gt; \mathcal{P} &amp;lt;/math&amp;gt; as above and &amp;lt;math&amp;gt; h &amp;lt;/math&amp;gt; is the position of the robot given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
h(x_1)&lt;br /&gt;
=&lt;br /&gt;
\left(&lt;br /&gt;
\begin{array}{c}&lt;br /&gt;
	-\cos(q_1)(d_3 \sin(q_2) + \bar{d}_5 + \sin(q_2-q_3))\\&lt;br /&gt;
	-\sin(q_1)(d_3 \sin(q_2) + \bar{d}_5 + \sin(q_2-q_3))\\&lt;br /&gt;
	d_1 + d_3 \cos(q_2) + \bar{d}_5 \cos(q_2-q_3)\\ &lt;br /&gt;
\end{array}&lt;br /&gt;
\right)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt; q = x_1 &amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt; \bar{d}_5 = d_5 + d_{tool} &amp;lt;/math&amp;gt; with &amp;lt;math&amp;gt; d_i, i \in \{ 1,3,5 \}  &amp;lt;/math&amp;gt; being the lengths of the link of the robot and &amp;lt;math&amp;gt; d_{tool} &amp;lt;/math&amp;gt; is the length of the pen and tool. These values can be found in the Parameters section as well.&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
== OCP ==&lt;br /&gt;
The optimization problem which is solved repetitively is given by&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{llclr}&lt;br /&gt;
	\displaystyle \min_{\bar{u}, \bar{v}} &amp;amp; J &amp;amp;=&amp;amp; J(x(t_k),\bar{e}, \bar{u}, \bar{z}, \bar{v})  \\[1.5ex]&lt;br /&gt;
	\mbox{s.t.}&lt;br /&gt;
	&amp;amp; \dot{\bar{x}} &amp;amp; = &amp;amp; f(\bar{x},\bar{u}), \\&lt;br /&gt;
	&amp;amp; \dot{\bar{z}} &amp;amp; = &amp;amp; l(\bar{z},\bar{v}),  \\&lt;br /&gt;
	&amp;amp; \bar{e} &amp;amp; = &amp;amp; h(\bar{x}) - p(\bar{z}_1),  \\[1ex]&lt;br /&gt;
	&amp;amp; \bar{x}(t_k) &amp;amp; = &amp;amp; x(t_k), \\&lt;br /&gt;
	&amp;amp; \bar{z}(t_k) &amp;amp; = &amp;amp; z(t_k), \\[1ex]&lt;br /&gt;
	&amp;amp; \bar{x} &amp;amp; \in &amp;amp; \mathcal{X}, \\&lt;br /&gt;
	&amp;amp; \bar{u} &amp;amp; \in &amp;amp; \mathcal{U}, \\&lt;br /&gt;
	&amp;amp; \bar{z} &amp;amp; \in &amp;amp; \mathcal{Z}, \\&lt;br /&gt;
	&amp;amp; \bar{v} &amp;amp; \in &amp;amp; \mathcal{V}. \\&lt;br /&gt;
\end{array} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Parameters ==&lt;br /&gt;
&lt;br /&gt;
The matlab script which implements the implicit formulation for &amp;lt;math&amp;gt; f &amp;lt;/math&amp;gt;, i.e. &amp;lt;math&amp;gt; F(x) = E \dot{x} - f(x) &amp;lt;/math&amp;gt; can be found on [[Parameters for Industrial Robot]].&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
	|+Robot-specific constants&lt;br /&gt;
	|-&lt;br /&gt;
	|Symbol&lt;br /&gt;
	|Value&lt;br /&gt;
        |Unit&lt;br /&gt;
	|-&lt;br /&gt;
	|&amp;lt;math&amp;gt; d_1 &amp;lt;/math&amp;gt;&lt;br /&gt;
	|&amp;lt;math&amp;gt; 0.31&amp;lt;/math&amp;gt;&lt;br /&gt;
        | &amp;lt;math&amp;gt; m &amp;lt;/math&amp;gt;&lt;br /&gt;
	|-&lt;br /&gt;
	|&amp;lt;math&amp;gt; d_3 &amp;lt;/math&amp;gt;&lt;br /&gt;
	|&amp;lt;math&amp;gt; 0.40&amp;lt;/math&amp;gt;&lt;br /&gt;
        | &amp;lt;math&amp;gt; m &amp;lt;/math&amp;gt;&lt;br /&gt;
	|-&lt;br /&gt;
	|&amp;lt;math&amp;gt; d_5 &amp;lt;/math&amp;gt;&lt;br /&gt;
	|&amp;lt;math&amp;gt; 0.39&amp;lt;/math&amp;gt;&lt;br /&gt;
        | &amp;lt;math&amp;gt; m &amp;lt;/math&amp;gt;&lt;br /&gt;
	|-&lt;br /&gt;
	|&amp;lt;math&amp;gt; d_{tool} &amp;lt;/math&amp;gt;&lt;br /&gt;
	|&amp;lt;math&amp;gt; 0.08&amp;lt;/math&amp;gt;&lt;br /&gt;
        | &amp;lt;math&amp;gt; m &amp;lt;/math&amp;gt;&lt;br /&gt;
	|}&lt;br /&gt;
&lt;br /&gt;
== Reference Solutions ==&lt;br /&gt;
coming soon&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;biblist /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--List of all categories this page is part of. List characterization of solution behavior, model properties, ore presence of implementation details (e.g., AMPL for AMPL model) here --&amp;gt;&lt;br /&gt;
[[Category:MIOCP]]&lt;br /&gt;
[[Category:ODE model]]&lt;br /&gt;
[[Category:Path-constrained arcs]]&lt;/div&gt;</summary>
		<author><name>TobiasWeber</name></author>
	</entry>
	<entry>
		<id>https://mintoc.de/index.php?title=Parameters_for_Industrial_Robot&amp;diff=2107</id>
		<title>Parameters for Industrial Robot</title>
		<link rel="alternate" type="text/html" href="https://mintoc.de/index.php?title=Parameters_for_Industrial_Robot&amp;diff=2107"/>
		<updated>2016-07-27T08:28:50Z</updated>

		<summary type="html">&lt;p&gt;TobiasWeber: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page contains a matlab script for the implicit formulation of the parameters for the [[Industrial robot]] problem.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;Matlab&amp;quot;&amp;gt;&lt;br /&gt;
    % Initialization&lt;br /&gt;
	&lt;br /&gt;
    dq=zeros(3,1);&lt;br /&gt;
    dotq=zeros(3,1);&lt;br /&gt;
    ddq=zeros(3,1);&lt;br /&gt;
    &lt;br /&gt;
    q=y(1:3);&lt;br /&gt;
    dq(1:3,1)=y(4:6);&lt;br /&gt;
    dotq(1:3,1)=dy(1:3);&lt;br /&gt;
    ddq(1:3,1)=dy(4:6);&lt;br /&gt;
    &lt;br /&gt;
    % Intermediate states&lt;br /&gt;
&lt;br /&gt;
    cosq=zeros(3,1);&lt;br /&gt;
&lt;br /&gt;
    cosq(1,1) =   cos(q(1));&lt;br /&gt;
    cosq(2,1) =   cos(q(2));&lt;br /&gt;
    cosq(3,1) =   cos(q(3));&lt;br /&gt;
    &lt;br /&gt;
    sinq=zeros(3,1);&lt;br /&gt;
    &lt;br /&gt;
    sinq(1,1) =   sin(q(1));&lt;br /&gt;
    sinq(2,1) =   sin(q(2));&lt;br /&gt;
    sinq(3,1) =   sin(q(3));&lt;br /&gt;
    &lt;br /&gt;
    cosq2q3 =   cos(q(2) - q(3));&lt;br /&gt;
    &lt;br /&gt;
    sinq1q2=   sin(q(1) - q(2));&lt;br /&gt;
    sinq2q3=   sin(q(2) - q(3));&lt;br /&gt;
    &lt;br /&gt;
    sin2q2=     sin(2*q(2));&lt;br /&gt;
    &lt;br /&gt;
    sin2q22q3=  sin(2*q(2) - 2*q(3));&lt;br /&gt;
    sin2q2q3=   sin(2*q(2) - q(3));&lt;br /&gt;
    &lt;br /&gt;
    cos2q2=     cos(2*q(2));&lt;br /&gt;
    &lt;br /&gt;
    % Modell parameters&lt;br /&gt;
&lt;br /&gt;
    b_1 =  2.6491674286195;&lt;br /&gt;
    b_2 =  0.0168799610481578;&lt;br /&gt;
    b_3 =  1.43009916890323;&lt;br /&gt;
    b_4 =  0.53524835732352;&lt;br /&gt;
    b_5 =  0.791116620901176;&lt;br /&gt;
    b_6 =  0.626240578068518;&lt;br /&gt;
    b_7 =  1.57199673626875;&lt;br /&gt;
    b_8 =  0.0175195488386143;&lt;br /&gt;
    b_9 =  0.0204978721411787;&lt;br /&gt;
    b_10=  1.07049671464704;&lt;br /&gt;
    b_11=  1.81771647041588;&lt;br /&gt;
    b_12=  0.422954084243519;&lt;br /&gt;
    &lt;br /&gt;
    b=zeros(3,3);	% Inerta Matrix of Robot Modell (3DOF)&lt;br /&gt;
    &lt;br /&gt;
    b(1,1) =  b_1*(sinq(2)^2) - b_2*sin2q2 + b_3*(cosq(2)^2) + b_4*cosq(3) + b_5*(cosq2q3^2) - b_6*cos(2*q(2) - 2*q(3)) - b_4*cos(2*q(2) - q(3)) - b_7;&lt;br /&gt;
    b(2,1) =  b_8*cosq(2) + b_9*cosq2q3;&lt;br /&gt;
    b(3,1) = -b_9*cosq2q3;&lt;br /&gt;
    b(1,2) =  b_8*cosq(2) + b_9*cosq2q3;&lt;br /&gt;
    b(2,2) =  b_10*cosq(3) + b_11;&lt;br /&gt;
    b(3,2) = -b_4*cosq(3) - b_12;&lt;br /&gt;
    b(1,3) = -b_9*cosq2q3;&lt;br /&gt;
    b(2,3) = -b_4*cosq(3) - b_12;&lt;br /&gt;
    b(3,3) =  b_12;&lt;br /&gt;
    &lt;br /&gt;
    g=zeros(3,1);       % gravity torque vector&lt;br /&gt;
    &lt;br /&gt;
    g_1 =   32.4854155934467;&lt;br /&gt;
    g_2 =   13.1269659633593;&lt;br /&gt;
    g_3 =   0.41398104470607;&lt;br /&gt;
        &lt;br /&gt;
    g(1) = 0;&lt;br /&gt;
    g(2) =-g_1*sinq(2) - g_2*sinq2q3 + g_3*cosq(2);&lt;br /&gt;
    g(3) = g_2*sinq2q3;&lt;br /&gt;
    &lt;br /&gt;
    f=zeros(3,1);       % friction torque vector&lt;br /&gt;
    &lt;br /&gt;
    f(1) = 0.186461043875677*atan(100*dq(1));&lt;br /&gt;
    f(2) = 0.184489618216264*atan(100*dq(2));&lt;br /&gt;
    f(3) = 0.156066608371045*atan(100*dq(3));&lt;br /&gt;
            &lt;br /&gt;
    c=zeros(3,3);   % coriolis matrix&lt;br /&gt;
    &lt;br /&gt;
    c_1 =   0.609534129858137;&lt;br /&gt;
    c_2 =   0.23068226761793;&lt;br /&gt;
    c_3 =   b_4;&lt;br /&gt;
    c_4 =   b_2;&lt;br /&gt;
    c_5 =   0.26762417866176;&lt;br /&gt;
    c_6 =   152.383532464534;&lt;br /&gt;
    c_7 =   57.6705669044826;&lt;br /&gt;
    c_8 =   133.81208933088;&lt;br /&gt;
    c_9 =   4.21999026203945;&lt;br /&gt;
    c_10=   66.90604466544;&lt;br /&gt;
    c_11=   b_8;&lt;br /&gt;
    c_12=   b_9;&lt;br /&gt;
    c_13=   1.3381208933088;&lt;br /&gt;
    &lt;br /&gt;
    c(1,1) = c_1*dq(2)*sin2q2 + c_2*dq(2)*sin2q22q3 + c_3*dq(2)*sin2q2q3 - c_4*dq(2)*cos2q2 - c_5*dq(3)*sinq(3) - c_2*dq(3)*sin2q22q3 - c_5*dq(3)*sin2q2q3;&lt;br /&gt;
    c(2,1) = -(-1)*dq(1)*(-c_6*sin2q2 - c_7*sin2q22q3 - c_8*sin2q2q3 + c_9*cos2q2)/250;&lt;br /&gt;
    c(3,1) = -(-1)*(-1)*dq(1)*(-c_10*sinq(3) - c_7*sin2q22q3 - c_10*sin2q2q3)/250;&lt;br /&gt;
    c(1,2) = -(-1)*(-1)*dq(1)*(-c_6*sin2q2 - c_7*sin2q22q3 - c_8*sin2q2q3 + c_9*cos2q2)/250 + dq(2)*(-c_11*sinq(2) - c_12*sinq2q3) + c_12*dq(3)*sinq2q3;&lt;br /&gt;
    c(2,2) = -c_3*dq(3)*sinq(3);&lt;br /&gt;
    c(3,2) = c_3*dq(2)*sinq(3);&lt;br /&gt;
    c(1,3) = -c_5*dq(1)*sinq(3) - c_2*dq(1)*sin2q22q3 - c_5*dq(1)*sin2q2q3 + c_12*dq(2)*sinq2q3 - c_12*dq(3)*sinq2q3;&lt;br /&gt;
    c(2,3) = c_13*(-(-1)*(-2)*dq(2)/5 - (-1)*2*dq(3)/5)*sinq(3);&lt;br /&gt;
    c(3,3) = 0; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>TobiasWeber</name></author>
	</entry>
	<entry>
		<id>https://mintoc.de/index.php?title=Optimal_Control_Problem&amp;diff=1974</id>
		<title>Optimal Control Problem</title>
		<link rel="alternate" type="text/html" href="https://mintoc.de/index.php?title=Optimal_Control_Problem&amp;diff=1974"/>
		<updated>2016-05-17T15:30:15Z</updated>

		<summary type="html">&lt;p&gt;TobiasWeber: /* Constraints */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a template page to show how a general Optimal Control Problem should be described on this website. In this first paragraph a short description of the problem is given. What is the [[:Category:Application|practical]] or mathematical context that motivates to solve the problem. What do the free and dependent variables of the optimization problem describe. What kind of model (equality constraints) fix the dependent variables (ODE, RDE, DAE, ...). What is the objective? Also one can cite a paper that introduced or solved this problem just by saying:&lt;br /&gt;
&lt;br /&gt;
 Max Mustermann, &amp;quot;This paper doesn&#039;t exist!&amp;quot;, &lt;br /&gt;
 Jornal of myths and tails, Eds. Nobody and No-one, -1919, pp. -1-11.&lt;br /&gt;
&lt;br /&gt;
== Model Formulation ==&lt;br /&gt;
&lt;br /&gt;
In this section the [[:Category:Model characterization|dynamic model]], that describes the physical or technical process of interest, should be described. First the differential equation should be written down. Then the states, inputs, and parameters should be declared (Dimension, Type (integer, real, binary, ...)). Finally the parameters that are not free in the optimization and the coefficients should be stated in an extra table or list. All equations and functions are defined over an interval &amp;lt;math&amp;gt;I \subset \R&amp;lt;/math&amp;gt;. Initial values and free parameters are taken into account later in the Optimal Control Problem.&lt;br /&gt;
&lt;br /&gt;
=== Ordinary Differential Equation (ODE) ===&lt;br /&gt;
&lt;br /&gt;
For a simple scalar [[:Category:ODE model|ODE model]] this would look like the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\frac{dx(t)}{dt} = \dot{x}(t)=px(t)+u(t),\; \forall \, t \in I;\; x: I \rightarrow \R,\; u: I \rightarrow \R, \; p \in \R.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The parameter (coefficient) &amp;lt;math&amp;gt; p &amp;lt;/math&amp;gt; could be stated in a table, if it is fixed.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+Parameter(s)&lt;br /&gt;
|-&lt;br /&gt;
|Name&lt;br /&gt;
|Symbol&lt;br /&gt;
|Value&lt;br /&gt;
|Unit&lt;br /&gt;
|-&lt;br /&gt;
|Parameter&lt;br /&gt;
|&amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;&lt;br /&gt;
|23&lt;br /&gt;
|[-]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
This would result in an right hand side function &amp;lt;math&amp;gt;f(x,u)&amp;lt;/math&amp;gt; in this case, because there are no free parameters. Of course one could also specify an [[:Category:DAE model|implicit DAE]] system (&amp;lt;math&amp;gt;F(\dot{x},x,u,p,t)=0&amp;lt;/math&amp;gt;), where it just has to be said which states are differential and which are algebraic.&lt;br /&gt;
The states and inputs can also be vector valued functions requiring matrix valued coefficients.&lt;br /&gt;
&lt;br /&gt;
=== Matrix Differential Equation (MDE) ===&lt;br /&gt;
&lt;br /&gt;
For an Lyapunov differential equation (with constant coefficient) one could write:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\dot{X}(t)=AX(t)+X(t)A^T, \forall \, t \in I; \; X: I \rightarrow \R^{n \times n}, A \in \R^{n \times n}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here one also has to specify the matrix &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; (e.g. in a list - fixing the dimensions of all matrices).&lt;br /&gt;
&lt;br /&gt;
; Coefficients of &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt; a_{11} = 2, \; a_{12} = 6 &amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;a_{21} = 1, \; a_{22} = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Variational Differential Equation (VDE) ===&lt;br /&gt;
&lt;br /&gt;
For a VDE with respect to the parameters the equations would be:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\dot{G}_{p}(t)=f_x(x,p)G_{p}(t)+f_p(x,p), \forall \, t \in I; \; G_{p}: I \rightarrow \R^{n_x \times n_p}, \; x: I \rightarrow \R^{n_x}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this case one has to specify the [[:Category:ODE model|ODE model]] as done above, as well as the partial derivatives (which fixes all problem dimensions):&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+&amp;lt;math&amp;gt;f_x(x,p)&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;-p&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;4x_2&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;0&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;-3x_2^2&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
either in a table or as a list:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt; f_{p1} = -x_1&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt; f_{p2} = 1.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The nominal parameter values can be given as above in the ODE case, if they are fixed.&lt;br /&gt;
&lt;br /&gt;
== Optimal Control Problem ==&lt;br /&gt;
&lt;br /&gt;
In this section the Optimal Control Problem (OCP) with the dynamic model as equality constraint is specified. In general every OCP has either a Lagrange or Mayer type objective or both.&lt;br /&gt;
First the general structure of the OCP is given to show the type of objective (linear, quadratic, ...) and constraints (equality and/or inequality, linear or nonlinear) as well as the variables that are free to optimize.&lt;br /&gt;
All of the above dynamic models can be used, in the following we just write for all:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\dot{x}(t)=f(x(t),u(t),p,t) \forall \, t \in I.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Implicit systems would be treated similarly. Then the general OCP is writte as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{cl}&lt;br /&gt;
 \displaystyle \min_{x, u, p} &amp;amp; J(x,u,t)\\[1.5ex]&lt;br /&gt;
 \mbox{s.t.} &amp;amp; \dot{x}  =  f(x,u,p,t), \forall \, t \in I\\&lt;br /&gt;
 &amp;amp; 0 = g(x(t_o),x(t_f),p) \\&lt;br /&gt;
 &amp;amp; 0  \ge  c(x,u,p), \forall \, t \in I\\&lt;br /&gt;
 &amp;amp; 0  =  h(x,u,p), \forall \, t \in I \\&lt;br /&gt;
 &amp;amp; x \in \mathcal{X},\,u \in \mathcal{U},\, p \in P.&lt;br /&gt;
\end{array} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the most general formulation, where the initial value, parameters, and inputs are free. The states and inputs are vectors (or matrices) of functions while the parameters are just a vector of variables. If the initial (or final) state is fixed, one just adds a constraint &amp;lt;math&amp;gt;x(t_0)=x_0&amp;lt;/math&amp;gt; and specifies the value(s) of &amp;lt;math&amp;gt;x_0&amp;lt;/math&amp;gt; in a list or table.&lt;br /&gt;
If the parameters are fixed, then one just removes them from the list of optimization variables and states their values in a list (same for point conditions inside of the interval &amp;lt;math&amp;gt;I&amp;lt;/math&amp;gt;). If the OCP is a parameter estimation problem without inputs,&lt;br /&gt;
the inputs just dont appear in the problem above at all, neither as optimization variable nor as part of the constraints. In contrast if they are just fixed this is done by the equality constraints. In this setup the above problem is very general and by&lt;br /&gt;
stating the different objective functions and constraint functions one can cover a wide range of OCPs.&lt;br /&gt;
&lt;br /&gt;
=== Objective ===&lt;br /&gt;
&lt;br /&gt;
To specify the [[:Category:Objective characterization|objective]] the Mayer and/or Lagrange term has to be described. For a parameter estimation problem the objective would be a finite sum over the squared difference between the measurements and the model response:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
J(x,u,t)=\sum_{i=0}^{K}(y_i - h(x(t_i),u(t_i),t_i))^2.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output function &amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt; has to be specified as above in the model section. An objective with a matrix valued state could look like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
J(X)=\int_{I}\det(X(t)^TSX(t)) dt.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here the weighting matrix &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt; has to be given. For an [[:Category:Tracking objective|tracking type objective]] with vector valued state and inputs an quadratic objective would be:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
J(x,u,t)=\int_{I}((x(t)-x_{ref})^TQ(x(t)-x_{ref}) + (u(t)-u_{ref})^T R (u(t)-u_{ref}) dt.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Surely demanding the specification of &amp;lt;math&amp;gt;Q&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;R&amp;lt;/math&amp;gt; in a list or table. Also one can specify a Mayer term:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
J(x,u,t)=x_1^2(t_f)+x_2(t_f)x_3(t_f).&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This all is quite general and has to be adapted to the needs for the special OCP of interest.&lt;br /&gt;
&lt;br /&gt;
=== Constraints ===&lt;br /&gt;
&lt;br /&gt;
The dynamic constraints have to be given in the model section, however the initial (or final) state constraint &amp;lt;math&amp;gt;g&amp;lt;/math&amp;gt; has to be specified. It can have a simple form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
g(x(t_0),x(t_f),p)=x(t_0)-x_0,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where one hast to state &amp;lt;math&amp;gt;x_0&amp;lt;/math&amp;gt;. More complicated expressions like [[:Category:Periodic|periodic constraints]]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
g(x(t_0),x(t_f),p)=x(t_0)-x(t_f),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
free initial states (as parameters):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
g(x(t_0),x(t_f),p)=x(t_0)-p,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and restricting hyperplanes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
g(x(t_0),x(t_f),p)=g^T x(t_0),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
are also possible. General expressions could also be used. Constraints working on the whole interval &amp;lt;math&amp;gt;I&amp;lt;/math&amp;gt; can be also very general or just box constraints.&lt;br /&gt;
&lt;br /&gt;
The set for inputs and states should be used to define the function spaces these functions live in and other set constraints that can not be expressed as nonlinear functions. One could say that the inputs should be piecewise constant or piecewise linear continuous functions and the states should then be &amp;lt;math&amp;gt;\mathcal{C}^1&amp;lt;/math&amp;gt; or &amp;lt;math&amp;gt;\mathcal{C}^2&amp;lt;/math&amp;gt;. The set constraint on the parameters should be used to define all constraints on the parameters, if they are free to the optimization, otherwise it doesn&#039;t appear. This could look like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
P=\{p \in \R^{n_p} | p_{min} \leq p \leq p_{max}\}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Reference Solution ==&lt;br /&gt;
&lt;br /&gt;
In this section one should provide reference solutions. First the discretization, the initial guess, the solution algorithm and the used hardware should be stated, as well as the solving time. Then the optimal solution should be given, at least as a PNG of the plots for the optimal trajectories.&lt;br /&gt;
One should provide the optimal objective value.&lt;br /&gt;
&lt;br /&gt;
== Source Code ==&lt;br /&gt;
&lt;br /&gt;
In this section one can provide the source code of the implementation, that solved the problem and produced the reference solution. This should be done by providing source files.&lt;br /&gt;
&lt;br /&gt;
== Nonlinear Model Predictive Control ==&lt;br /&gt;
&lt;br /&gt;
If the OCP is solved repeatedly in a Nonlinear Model Predictive Control scheme here one can specify this outer loop configuration (sampling rate, observer, measurement error, measurement funktion, ...). Also reference solutions and code for this can be given to make the context the OCP comes from more clear.&lt;br /&gt;
Robustness and other control specific matters like real-time requirements or model plant mismatch should also be described.&lt;/div&gt;</summary>
		<author><name>TobiasWeber</name></author>
	</entry>
	<entry>
		<id>https://mintoc.de/index.php?title=Optimal_Control_Problem&amp;diff=1973</id>
		<title>Optimal Control Problem</title>
		<link rel="alternate" type="text/html" href="https://mintoc.de/index.php?title=Optimal_Control_Problem&amp;diff=1973"/>
		<updated>2016-05-17T15:27:38Z</updated>

		<summary type="html">&lt;p&gt;TobiasWeber: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a template page to show how a general Optimal Control Problem should be described on this website. In this first paragraph a short description of the problem is given. What is the [[:Category:Application|practical]] or mathematical context that motivates to solve the problem. What do the free and dependent variables of the optimization problem describe. What kind of model (equality constraints) fix the dependent variables (ODE, RDE, DAE, ...). What is the objective? Also one can cite a paper that introduced or solved this problem just by saying:&lt;br /&gt;
&lt;br /&gt;
 Max Mustermann, &amp;quot;This paper doesn&#039;t exist!&amp;quot;, &lt;br /&gt;
 Jornal of myths and tails, Eds. Nobody and No-one, -1919, pp. -1-11.&lt;br /&gt;
&lt;br /&gt;
== Model Formulation ==&lt;br /&gt;
&lt;br /&gt;
In this section the [[:Category:Model characterization|dynamic model]], that describes the physical or technical process of interest, should be described. First the differential equation should be written down. Then the states, inputs, and parameters should be declared (Dimension, Type (integer, real, binary, ...)). Finally the parameters that are not free in the optimization and the coefficients should be stated in an extra table or list. All equations and functions are defined over an interval &amp;lt;math&amp;gt;I \subset \R&amp;lt;/math&amp;gt;. Initial values and free parameters are taken into account later in the Optimal Control Problem.&lt;br /&gt;
&lt;br /&gt;
=== Ordinary Differential Equation (ODE) ===&lt;br /&gt;
&lt;br /&gt;
For a simple scalar [[:Category:ODE model|ODE model]] this would look like the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\frac{dx(t)}{dt} = \dot{x}(t)=px(t)+u(t),\; \forall \, t \in I;\; x: I \rightarrow \R,\; u: I \rightarrow \R, \; p \in \R.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The parameter (coefficient) &amp;lt;math&amp;gt; p &amp;lt;/math&amp;gt; could be stated in a table, if it is fixed.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+Parameter(s)&lt;br /&gt;
|-&lt;br /&gt;
|Name&lt;br /&gt;
|Symbol&lt;br /&gt;
|Value&lt;br /&gt;
|Unit&lt;br /&gt;
|-&lt;br /&gt;
|Parameter&lt;br /&gt;
|&amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;&lt;br /&gt;
|23&lt;br /&gt;
|[-]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
This would result in an right hand side function &amp;lt;math&amp;gt;f(x,u)&amp;lt;/math&amp;gt; in this case, because there are no free parameters. Of course one could also specify an [[:Category:DAE model|implicit DAE]] system (&amp;lt;math&amp;gt;F(\dot{x},x,u,p,t)=0&amp;lt;/math&amp;gt;), where it just has to be said which states are differential and which are algebraic.&lt;br /&gt;
The states and inputs can also be vector valued functions requiring matrix valued coefficients.&lt;br /&gt;
&lt;br /&gt;
=== Matrix Differential Equation (MDE) ===&lt;br /&gt;
&lt;br /&gt;
For an Lyapunov differential equation (with constant coefficient) one could write:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\dot{X}(t)=AX(t)+X(t)A^T, \forall \, t \in I; \; X: I \rightarrow \R^{n \times n}, A \in \R^{n \times n}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here one also has to specify the matrix &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; (e.g. in a list - fixing the dimensions of all matrices).&lt;br /&gt;
&lt;br /&gt;
; Coefficients of &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt; a_{11} = 2, \; a_{12} = 6 &amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;a_{21} = 1, \; a_{22} = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Variational Differential Equation (VDE) ===&lt;br /&gt;
&lt;br /&gt;
For a VDE with respect to the parameters the equations would be:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\dot{G}_{p}(t)=f_x(x,p)G_{p}(t)+f_p(x,p), \forall \, t \in I; \; G_{p}: I \rightarrow \R^{n_x \times n_p}, \; x: I \rightarrow \R^{n_x}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this case one has to specify the [[:Category:ODE model|ODE model]] as done above, as well as the partial derivatives (which fixes all problem dimensions):&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+&amp;lt;math&amp;gt;f_x(x,p)&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;-p&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;4x_2&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;0&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;-3x_2^2&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
either in a table or as a list:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt; f_{p1} = -x_1&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt; f_{p2} = 1.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The nominal parameter values can be given as above in the ODE case, if they are fixed.&lt;br /&gt;
&lt;br /&gt;
== Optimal Control Problem ==&lt;br /&gt;
&lt;br /&gt;
In this section the Optimal Control Problem (OCP) with the dynamic model as equality constraint is specified. In general every OCP has either a Lagrange or Mayer type objective or both.&lt;br /&gt;
First the general structure of the OCP is given to show the type of objective (linear, quadratic, ...) and constraints (equality and/or inequality, linear or nonlinear) as well as the variables that are free to optimize.&lt;br /&gt;
All of the above dynamic models can be used, in the following we just write for all:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\dot{x}(t)=f(x(t),u(t),p,t) \forall \, t \in I.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Implicit systems would be treated similarly. Then the general OCP is writte as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{cl}&lt;br /&gt;
 \displaystyle \min_{x, u, p} &amp;amp; J(x,u,t)\\[1.5ex]&lt;br /&gt;
 \mbox{s.t.} &amp;amp; \dot{x}  =  f(x,u,p,t), \forall \, t \in I\\&lt;br /&gt;
 &amp;amp; 0 = g(x(t_o),x(t_f),p) \\&lt;br /&gt;
 &amp;amp; 0  \ge  c(x,u,p), \forall \, t \in I\\&lt;br /&gt;
 &amp;amp; 0  =  h(x,u,p), \forall \, t \in I \\&lt;br /&gt;
 &amp;amp; x \in \mathcal{X},\,u \in \mathcal{U},\, p \in P.&lt;br /&gt;
\end{array} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the most general formulation, where the initial value, parameters, and inputs are free. The states and inputs are vectors (or matrices) of functions while the parameters are just a vector of variables. If the initial (or final) state is fixed, one just adds a constraint &amp;lt;math&amp;gt;x(t_0)=x_0&amp;lt;/math&amp;gt; and specifies the value(s) of &amp;lt;math&amp;gt;x_0&amp;lt;/math&amp;gt; in a list or table.&lt;br /&gt;
If the parameters are fixed, then one just removes them from the list of optimization variables and states their values in a list (same for point conditions inside of the interval &amp;lt;math&amp;gt;I&amp;lt;/math&amp;gt;). If the OCP is a parameter estimation problem without inputs,&lt;br /&gt;
the inputs just dont appear in the problem above at all, neither as optimization variable nor as part of the constraints. In contrast if they are just fixed this is done by the equality constraints. In this setup the above problem is very general and by&lt;br /&gt;
stating the different objective functions and constraint functions one can cover a wide range of OCPs.&lt;br /&gt;
&lt;br /&gt;
=== Objective ===&lt;br /&gt;
&lt;br /&gt;
To specify the [[:Category:Objective characterization|objective]] the Mayer and/or Lagrange term has to be described. For a parameter estimation problem the objective would be a finite sum over the squared difference between the measurements and the model response:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
J(x,u,t)=\sum_{i=0}^{K}(y_i - h(x(t_i),u(t_i),t_i))^2.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output function &amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt; has to be specified as above in the model section. An objective with a matrix valued state could look like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
J(X)=\int_{I}\det(X(t)^TSX(t)) dt.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here the weighting matrix &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt; has to be given. For an [[:Category:Tracking objective|tracking type objective]] with vector valued state and inputs an quadratic objective would be:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
J(x,u,t)=\int_{I}((x(t)-x_{ref})^TQ(x(t)-x_{ref}) + (u(t)-u_{ref})^T R (u(t)-u_{ref}) dt.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Surely demanding the specification of &amp;lt;math&amp;gt;Q&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;R&amp;lt;/math&amp;gt; in a list or table. Also one can specify a Mayer term:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
J(x,u,t)=x_1^2(t_f)+x_2(t_f)x_3(t_f).&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This all is quite general and has to be adapted to the needs for the special OCP of interest.&lt;br /&gt;
&lt;br /&gt;
=== Constraints ===&lt;br /&gt;
&lt;br /&gt;
The dynamic constraints have to be given in the model section, however the initial (or final) state constraint &amp;lt;math&amp;gt;g&amp;lt;/math&amp;gt; has to be specified. It can have a simple form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
g(x(t_0),x(t_f),p)=x(t_0)-x_0,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where one hast to state &amp;lt;math&amp;gt;x_0&amp;lt;/math&amp;gt;. More complicated expressions like periodicity conditions:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
g(x(t_0),x(t_f),p)=x(t_0)-x(t_f),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
free initial states (as parameters):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
g(x(t_0),x(t_f),p)=x(t_0)-p,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
restricting hyperplanes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
g(x(t_0),x(t_f),p)=g^T x(t_0),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
are also possible. General expressions could also be used. Constraints working on the whole interval &amp;lt;math&amp;gt;I&amp;lt;/math&amp;gt; can be also very general or just box constraints.&lt;br /&gt;
&lt;br /&gt;
The set for inputs and states should be used to define the function spaces these functions live in and other set constraints that can not be expressed as nonlinear functions. One could say that the inputs should be piecewise constant or piecewise linear continuous functions and the states should then be &amp;lt;math&amp;gt;\mathcal{C}^1&amp;lt;/math&amp;gt; or &amp;lt;math&amp;gt;\mathcal{C}^2&amp;lt;/math&amp;gt;. The set constraint on the parameters should be used to define all constraints on the parameters, if they are free to the optimization, otherwise it doesn&#039;t appear. This could look like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
P=\{p \in \R^{n_p} | p_{min} \leq p \leq p_{max}\}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Reference Solution ==&lt;br /&gt;
&lt;br /&gt;
In this section one should provide reference solutions. First the discretization, the initial guess, the solution algorithm and the used hardware should be stated, as well as the solving time. Then the optimal solution should be given, at least as a PNG of the plots for the optimal trajectories.&lt;br /&gt;
One should provide the optimal objective value.&lt;br /&gt;
&lt;br /&gt;
== Source Code ==&lt;br /&gt;
&lt;br /&gt;
In this section one can provide the source code of the implementation, that solved the problem and produced the reference solution. This should be done by providing source files.&lt;br /&gt;
&lt;br /&gt;
== Nonlinear Model Predictive Control ==&lt;br /&gt;
&lt;br /&gt;
If the OCP is solved repeatedly in a Nonlinear Model Predictive Control scheme here one can specify this outer loop configuration (sampling rate, observer, measurement error, measurement funktion, ...). Also reference solutions and code for this can be given to make the context the OCP comes from more clear.&lt;br /&gt;
Robustness and other control specific matters like real-time requirements or model plant mismatch should also be described.&lt;/div&gt;</summary>
		<author><name>TobiasWeber</name></author>
	</entry>
	<entry>
		<id>https://mintoc.de/index.php?title=Optimal_Control_Problem&amp;diff=1972</id>
		<title>Optimal Control Problem</title>
		<link rel="alternate" type="text/html" href="https://mintoc.de/index.php?title=Optimal_Control_Problem&amp;diff=1972"/>
		<updated>2016-05-17T15:26:34Z</updated>

		<summary type="html">&lt;p&gt;TobiasWeber: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a template page to show how a general Optimal Control Problem should be described on this website. In this first paragraph a short description of the problem is given. What is the [[:Category:Application|practical]] or mathematical context that motivates to solve the problem. What do the free and dependent variables of the optimization problem describe. What kind of model (equality constraints) fix the dependent variables (ODE, RDE, DAE, ...). What is the objective? Also one can cite a paper that introduced or solved this problem just by saying:&lt;br /&gt;
&lt;br /&gt;
 Max Mustermann, &amp;quot;This paper doesn&#039;t exist!&amp;quot;, &lt;br /&gt;
 Jornal of myths and tails, Eds. Nobody and No-one, -1919, pp. -1-11.&lt;br /&gt;
&lt;br /&gt;
== Model Formulation ==&lt;br /&gt;
&lt;br /&gt;
In this section the [[:Category:Model characterization|dynamic model]], that describes the physical or technical process of interest, should be described. First the differential equation should be written down. Then the states, inputs, and parameters should be declared (Dimension, Type (integer, real, binary, ...)). Finally the parameters that are not free in the optimization and the coefficients should be stated in an extra table or list. All equations and functions are defined over an interval &amp;lt;math&amp;gt;I \subset \R&amp;lt;/math&amp;gt;. Initial values and free parameters are taken into account later in the Optimal Control Problem.&lt;br /&gt;
&lt;br /&gt;
=== Ordinary Differential Equation (ODE) ===&lt;br /&gt;
&lt;br /&gt;
For a simple scalar [[:Category:ODE model|ODE model]] this would look like the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\frac{dx(t)}{dt} = \dot{x}(t)=px(t)+u(t),\; \forall \, t \in I;\; x: I \rightarrow \R,\; u: I \rightarrow \R, \; p \in \R.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The parameter (coefficient) &amp;lt;math&amp;gt; p &amp;lt;/math&amp;gt; could be stated in a table, if it is fixed.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+Parameter(s)&lt;br /&gt;
|-&lt;br /&gt;
|Name&lt;br /&gt;
|Symbol&lt;br /&gt;
|Value&lt;br /&gt;
|Unit&lt;br /&gt;
|-&lt;br /&gt;
|Parameter&lt;br /&gt;
|&amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;&lt;br /&gt;
|23&lt;br /&gt;
|[-]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
This would result in an right hand side function &amp;lt;math&amp;gt;f(x,u)&amp;lt;/math&amp;gt; in this case, because there are no free parameters. Of course one could also specify an [[:Category:DAE model|implicit DAE]] system (&amp;lt;math&amp;gt;F(\dot{x},x,u,p,t)=0&amp;lt;/math&amp;gt;), where it just has to be said which states are differential and which are algebraic.&lt;br /&gt;
The states and inputs can also be vector valued functions requiring matrix valued coefficients.&lt;br /&gt;
&lt;br /&gt;
=== Matrix Differential Equation (MDE) ===&lt;br /&gt;
&lt;br /&gt;
For an Lyapunov differential equation (with constant coefficient) one could write:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\dot{X}(t)=AX(t)+X(t)A^T, \forall \, t \in I; \; X: I \rightarrow \R^{n \times n}, A \in \R^{n \times n}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here one also has to specify the matrix &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; (e.g. in a list - fixing the dimensions of all matrices).&lt;br /&gt;
&lt;br /&gt;
; Coefficients of &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt; a_{11} = 2, \; a_{12} = 6 &amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;a_{21} = 1, \; a_{22} = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Variational Differential Equation (VDE) ===&lt;br /&gt;
&lt;br /&gt;
For a VDE with respect to the parameters the equations would be:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\dot{G}_{p}(t)=f_x(x,p)G_{p}(t)+f_p(x,p), \forall \, t \in I; \; G_{p}: I \rightarrow \R^{n_x \times n_p}, \; x: I \rightarrow \R^{n_x}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this case one has to specify the [[:Category:ODE model|ODE model]] as done above, as well as the partial derivatives (which fixes all problem dimensions):&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+&amp;lt;math&amp;gt;f_x(x,p)&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;-p&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;4x_2&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;0&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;-3x_2^2&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
either in a table or as a list:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt; f_{p1} = -x_1&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt; f_{p2} = 1.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The nominal parameter values can be given as above in the ODE case, if they are fixed.&lt;br /&gt;
&lt;br /&gt;
== Optimal Control Problem ==&lt;br /&gt;
&lt;br /&gt;
In this section the Optimal Control Problem (OCP) with the dynamic model as equality constraint is specified. In general every OCP has either a Lagrange or Mayer type objective or both.&lt;br /&gt;
First the general structure of the OCP is given to show the type of objective (linear, quadratic, ...) and constraints (equality and/or inequality, linear or nonlinear) as well as the variables that are free to optimize.&lt;br /&gt;
All of the above dynamic models can be used, in the following we just write for all:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\dot{x}(t)=f(x(t),u(t),p,t) \forall \, t \in I.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Implicit systems would be treated similarly. Then the general OCP is writte as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{cl}&lt;br /&gt;
 \displaystyle \min_{x, u, p} &amp;amp; J(x,u,t)\\[1.5ex]&lt;br /&gt;
 \mbox{s.t.} &amp;amp; \dot{x}  =  f(x,u,p,t), \forall \, t \in I\\&lt;br /&gt;
 &amp;amp; 0 = g(x(t_o),x(t_f),p) \\&lt;br /&gt;
 &amp;amp; 0  \ge  c(x,u,p), \forall \, t \in I\\&lt;br /&gt;
 &amp;amp; 0  =  h(x,u,p), \forall \, t \in I \\&lt;br /&gt;
 &amp;amp; x \in \mathcal{X},\,u \in \mathcal{U},\, p \in P.&lt;br /&gt;
\end{array} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the most general formulation, where the initial value, parameters, and inputs are free. The states and inputs are vectors (or matrices) of functions while the parameters are just a vector of variables. If the initial (or final) state is fixed, one just adds a constraint &amp;lt;math&amp;gt;x(t_0)=x_0&amp;lt;/math&amp;gt; and specifies the value(s) of &amp;lt;math&amp;gt;x_0&amp;lt;/math&amp;gt; in a list or table.&lt;br /&gt;
If the parameters are fixed, then one just removes them from the list of optimization variables and states their values in a list (same for point conditions inside of the interval &amp;lt;math&amp;gt;I&amp;lt;/math&amp;gt;). If the OCP is a parameter estimation problem without inputs,&lt;br /&gt;
the inputs just dont appear in the problem above at all, neither as optimization variable nor as part of the constraints. In contrast if they are just fixed this is done by the equality constraints. In this setup the above problem is very general and by&lt;br /&gt;
stating the different objective functions and constraint functions one can cover a wide range of OCPs.&lt;br /&gt;
&lt;br /&gt;
=== Objective ===&lt;br /&gt;
&lt;br /&gt;
To specify the [[:Category:Objective characterization|objective]] the Mayer and/or Lagrange term has to be described. For a parameter estimation problem the objective would be a finite sum over the squared difference between the measurements and the model response:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
J(x,u,t)=\sum_{i=0}^{K}(y_i - h(x(t_i),u(t_i),t_i))^2.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output function &amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt; has to be specified as above in the model section. An objective with a matrix valued state could look like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
J(X)=\int_{I}\det(X(t)^TSX(t)) dt.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here the weighting matrix &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt; has to be given. For an tracking type OCP with vector valued state and inputs an quadratic objective would be:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
J(x,u,t)=\int_{I}((x(t)-x_{ref})^TQ(x(t)-x_{ref}) + (u(t)-u_{ref})^T R (u(t)-u_{ref}) dt.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Surely demanding the specification of &amp;lt;math&amp;gt;Q&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;R&amp;lt;/math&amp;gt; in a list or table. Also one can specify a Mayer term:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
J(x,u,t)=x_1^2(t_f)+x_2(t_f)x_3(t_f).&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This all is quite general and has to be adapted to the needs for the special OCP of interest.&lt;br /&gt;
&lt;br /&gt;
=== Constraints ===&lt;br /&gt;
&lt;br /&gt;
The dynamic constraints have to be given in the model section, however the initial (or final) state constraint &amp;lt;math&amp;gt;g&amp;lt;/math&amp;gt; has to be specified. It can have a simple form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
g(x(t_0),x(t_f),p)=x(t_0)-x_0,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where one hast to state &amp;lt;math&amp;gt;x_0&amp;lt;/math&amp;gt;. More complicated expressions like periodicity conditions:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
g(x(t_0),x(t_f),p)=x(t_0)-x(t_f),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
free initial states (as parameters):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
g(x(t_0),x(t_f),p)=x(t_0)-p,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
restricting hyperplanes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
g(x(t_0),x(t_f),p)=g^T x(t_0),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
are also possible. General expressions could also be used. Constraints working on the whole interval &amp;lt;math&amp;gt;I&amp;lt;/math&amp;gt; can be also very general or just box constraints.&lt;br /&gt;
&lt;br /&gt;
The set for inputs and states should be used to define the function spaces these functions live in and other set constraints that can not be expressed as nonlinear functions. One could say that the inputs should be piecewise constant or piecewise linear continuous functions and the states should then be &amp;lt;math&amp;gt;\mathcal{C}^1&amp;lt;/math&amp;gt; or &amp;lt;math&amp;gt;\mathcal{C}^2&amp;lt;/math&amp;gt;. The set constraint on the parameters should be used to define all constraints on the parameters, if they are free to the optimization, otherwise it doesn&#039;t appear. This could look like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
P=\{p \in \R^{n_p} | p_{min} \leq p \leq p_{max}\}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Reference Solution ==&lt;br /&gt;
&lt;br /&gt;
In this section one should provide reference solutions. First the discretization, the initial guess, the solution algorithm and the used hardware should be stated, as well as the solving time. Then the optimal solution should be given, at least as a PNG of the plots for the optimal trajectories.&lt;br /&gt;
One should provide the optimal objective value.&lt;br /&gt;
&lt;br /&gt;
== Source Code ==&lt;br /&gt;
&lt;br /&gt;
In this section one can provide the source code of the implementation, that solved the problem and produced the reference solution. This should be done by providing source files.&lt;br /&gt;
&lt;br /&gt;
== Nonlinear Model Predictive Control ==&lt;br /&gt;
&lt;br /&gt;
If the OCP is solved repeatedly in a Nonlinear Model Predictive Control scheme here one can specify this outer loop configuration (sampling rate, observer, measurement error, measurement funktion, ...). Also reference solutions and code for this can be given to make the context the OCP comes from more clear.&lt;br /&gt;
Robustness and other control specific matters like real-time requirements or model plant mismatch should also be described.&lt;/div&gt;</summary>
		<author><name>TobiasWeber</name></author>
	</entry>
	<entry>
		<id>https://mintoc.de/index.php?title=Optimal_Control_Problem&amp;diff=1971</id>
		<title>Optimal Control Problem</title>
		<link rel="alternate" type="text/html" href="https://mintoc.de/index.php?title=Optimal_Control_Problem&amp;diff=1971"/>
		<updated>2016-05-17T15:25:03Z</updated>

		<summary type="html">&lt;p&gt;TobiasWeber: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a template page to show how a general Optimal Control Problem should be described on this website. In this first paragraph a short description of the problem is given. What is the [[:Category:Application|practical]] or mathematical context that motivates to solve the problem. What do the free and dependent variables of the optimization problem describe. What kind of model (equality constraints) fix the dependent variables (ODE, RDE, DAE, ...). What is the objective? Also one can cite a paper that introduced or solved this problem just by saying:&lt;br /&gt;
&lt;br /&gt;
 Max Mustermann, &amp;quot;This paper doesn&#039;t exist!&amp;quot;, &lt;br /&gt;
 Jornal of myths and tails, Eds. Nobody and No-one, -1919, pp. -1-11.&lt;br /&gt;
&lt;br /&gt;
== Model Formulation ==&lt;br /&gt;
&lt;br /&gt;
In this section the [[:Category:Model characterization|dynamic model]], that describes the physical or technical process of interest, should be described. First the differential equation should be written down. Then the states, inputs, and parameters should be declared (Dimension, Type (integer, real, binary, ...)). Finally the parameters that are not free in the optimization and the coefficients should be stated in an extra table or list. All equations and functions are defined over an interval &amp;lt;math&amp;gt;I \subset \R&amp;lt;/math&amp;gt;. Initial values and free parameters are taken into account later in the Optimal Control Problem.&lt;br /&gt;
&lt;br /&gt;
=== Ordinary Differential Equation (ODE) ===&lt;br /&gt;
&lt;br /&gt;
For a simple scalar [[:Category:ODE model|ODE model]] this would look like the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\frac{dx(t)}{dt} = \dot{x}(t)=px(t)+u(t),\; \forall \, t \in I;\; x: I \rightarrow \R,\; u: I \rightarrow \R, \; p \in \R.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The parameter (coefficient) &amp;lt;math&amp;gt; p &amp;lt;/math&amp;gt; could be stated in a table, if it is fixed.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+Parameter(s)&lt;br /&gt;
|-&lt;br /&gt;
|Name&lt;br /&gt;
|Symbol&lt;br /&gt;
|Value&lt;br /&gt;
|Unit&lt;br /&gt;
|-&lt;br /&gt;
|Parameter&lt;br /&gt;
|&amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;&lt;br /&gt;
|23&lt;br /&gt;
|[-]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
This would result in an right hand side function &amp;lt;math&amp;gt;f(x,u)&amp;lt;/math&amp;gt; in this case, because there are no free parameters. Of course one could also specify an [[:Category:DAE model|implicit DAE]] system (&amp;lt;math&amp;gt;F(\dot{x},x,u,p,t)=0&amp;lt;/math&amp;gt;), where it just has to be said which states are differential and which are algebraic.&lt;br /&gt;
The states and inputs can also be vector valued functions requiring matrix valued coefficients.&lt;br /&gt;
&lt;br /&gt;
=== Matrix Differential Equation (MDE) ===&lt;br /&gt;
&lt;br /&gt;
For an Lyapunov differential equation (with constant coefficient) one could write:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\dot{X}(t)=AX(t)+X(t)A^T, \forall \, t \in I; \; X: I \rightarrow \R^{n \times n}, A \in \R^{n \times n}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here one also has to specify the matrix &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; (e.g. in a list - fixing the dimensions of all matrices).&lt;br /&gt;
&lt;br /&gt;
; Coefficients of &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt; a_{11} = 2, \; a_{12} = 6 &amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;a_{21} = 1, \; a_{22} = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Variational Differential Equation (VDE) ===&lt;br /&gt;
&lt;br /&gt;
For a VDE with respect to the parameters the equations would be:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\dot{G}_{p}(t)=f_x(x,p)G_{p}(t)+f_p(x,p), \forall \, t \in I; \; G_{p}: I \rightarrow \R^{n_x \times n_p}, \; x: I \rightarrow \R^{n_x}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this case one has to specify the [[:Category:ODE model|ODE model]] as done above, as well as the partial derivatives (which fixes all problem dimensions):&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+&amp;lt;math&amp;gt;f_x(x,p)&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;-p&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;4x_2&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;0&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;-3x_2^2&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
either in a table or as a list:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt; f_{p1} = -x_1&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt; f_{p2} = 1.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The nominal parameter values can be given as above in the ODE case, if they are fixed.&lt;br /&gt;
&lt;br /&gt;
== Optimal Control Problem ==&lt;br /&gt;
&lt;br /&gt;
In this section the Optimal Control Problem (OCP) with the dynamic model as equality constraint is specified. In general every OCP has either a Lagrange or Mayer type objective or both.&lt;br /&gt;
First the general structure of the OCP is given to show the type of objective (linear, quadratic, ...) and constraints (equality and/or inequality, linear or nonlinear) as well as the variables that are free to optimize.&lt;br /&gt;
All of the above dynamic models can be used, in the following we just write for all:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\dot{x}(t)=f(x(t),u(t),p,t) \forall \, t \in I.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Implicit systems would be treated similarly. Then the general OCP is writte as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{cl}&lt;br /&gt;
 \displaystyle \min_{x, u, p} &amp;amp; J(x,u,t)\\[1.5ex]&lt;br /&gt;
 \mbox{s.t.} &amp;amp; \dot{x}  =  f(x,u,p,t), \forall \, t \in I\\&lt;br /&gt;
 &amp;amp; 0 = g(x(t_o),x(t_f),p) \\&lt;br /&gt;
 &amp;amp; 0  \ge  c(x,u,p), \forall \, t \in I\\&lt;br /&gt;
 &amp;amp; 0  =  h(x,u,p), \forall \, t \in I \\&lt;br /&gt;
 &amp;amp; x \in \mathcal{X},\,u \in \mathcal{U},\, p \in P.&lt;br /&gt;
\end{array} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the most general formulation, where the initial value, parameters, and inputs are free. The states and inputs are vectors (or matrices) of functions while the parameters are just a vector of variables. If the initial (or final) state is fixed, one just adds a constraint &amp;lt;math&amp;gt;x(t_0)=x_0&amp;lt;/math&amp;gt; and specifies the value(s) of &amp;lt;math&amp;gt;x_0&amp;lt;/math&amp;gt; in a list or table.&lt;br /&gt;
If the parameters are fixed, then one just removes them from the list of optimization variables and states their values in a list (same for point conditions inside of the interval &amp;lt;math&amp;gt;I&amp;lt;/math&amp;gt;). If the OCP is a parameter estimation problem without inputs,&lt;br /&gt;
the inputs just dont appear in the problem above at all, neither as optimization variable nor as part of the constraints. In contrast if they are just fixed this is done by the equality constraints. In this setup the above problem is very general and by&lt;br /&gt;
stating the different objective functions and constraint functions one can cover a wide range of OCPs.&lt;br /&gt;
&lt;br /&gt;
=== Objective ===&lt;br /&gt;
&lt;br /&gt;
To specify the [[:Category:Objective characterization|objective}} the Mayer and/or Lagrange term has to be described. For a parameter estimation problem the objective would be a finite sum over the squared difference between the measurements and the model response:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
J(x,u,t)=\sum_{i=0}^{K}(y_i - h(x(t_i),u(t_i),t_i))^2.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output function &amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt; has to be specified as above in the model section. An objective with a matrix valued state could look like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
J(X)=\int_{I}\det(X(t)^TSX(t)) dt.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here the weighting matrix &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt; has to be given. For an tracking type OCP with vector valued state and inputs an quadratic objective would be:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
J(x,u,t)=\int_{I}((x(t)-x_{ref})^TQ(x(t)-x_{ref}) + (u(t)-u_{ref})^T R (u(t)-u_{ref}) dt.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Surely demanding the specification of &amp;lt;math&amp;gt;Q&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;R&amp;lt;/math&amp;gt; in a list or table. Also one can specify a Mayer term:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
J(x,u,t)=x_1^2(t_f)+x_2(t_f)x_3(t_f).&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This all is quite general and has to be adapted to the needs for the special OCP of interest.&lt;br /&gt;
&lt;br /&gt;
=== Constraints ===&lt;br /&gt;
&lt;br /&gt;
The dynamic constraints have to be given in the model section, however the initial (or final) state constraint &amp;lt;math&amp;gt;g&amp;lt;/math&amp;gt; has to be specified. It can have a simple form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
g(x(t_0),x(t_f),p)=x(t_0)-x_0,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where one hast to state &amp;lt;math&amp;gt;x_0&amp;lt;/math&amp;gt;. More complicated expressions like periodicity conditions:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
g(x(t_0),x(t_f),p)=x(t_0)-x(t_f),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
free initial states (as parameters):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
g(x(t_0),x(t_f),p)=x(t_0)-p,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
restricting hyperplanes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
g(x(t_0),x(t_f),p)=g^T x(t_0),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
are also possible. General expressions could also be used. Constraints working on the whole interval &amp;lt;math&amp;gt;I&amp;lt;/math&amp;gt; can be also very general or just box constraints.&lt;br /&gt;
&lt;br /&gt;
The set for inputs and states should be used to define the function spaces these functions live in and other set constraints that can not be expressed as nonlinear functions. One could say that the inputs should be piecewise constant or piecewise linear continuous functions and the states should then be &amp;lt;math&amp;gt;\mathcal{C}^1&amp;lt;/math&amp;gt; or &amp;lt;math&amp;gt;\mathcal{C}^2&amp;lt;/math&amp;gt;. The set constraint on the parameters should be used to define all constraints on the parameters, if they are free to the optimization, otherwise it doesn&#039;t appear. This could look like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
P=\{p \in \R^{n_p} | p_{min} \leq p \leq p_{max}\}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Reference Solution ==&lt;br /&gt;
&lt;br /&gt;
In this section one should provide reference solutions. First the discretization, the initial guess, the solution algorithm and the used hardware should be stated, as well as the solving time. Then the optimal solution should be given, at least as a PNG of the plots for the optimal trajectories.&lt;br /&gt;
One should provide the optimal objective value.&lt;br /&gt;
&lt;br /&gt;
== Source Code ==&lt;br /&gt;
&lt;br /&gt;
In this section one can provide the source code of the implementation, that solved the problem and produced the reference solution. This should be done by providing source files.&lt;br /&gt;
&lt;br /&gt;
== Nonlinear Model Predictive Control ==&lt;br /&gt;
&lt;br /&gt;
If the OCP is solved repeatedly in a Nonlinear Model Predictive Control scheme here one can specify this outer loop configuration (sampling rate, observer, measurement error, measurement funktion, ...). Also reference solutions and code for this can be given to make the context the OCP comes from more clear.&lt;br /&gt;
Robustness and other control specific matters like real-time requirements or model plant mismatch should also be described.&lt;/div&gt;</summary>
		<author><name>TobiasWeber</name></author>
	</entry>
	<entry>
		<id>https://mintoc.de/index.php?title=Optimal_Control_Problem&amp;diff=1970</id>
		<title>Optimal Control Problem</title>
		<link rel="alternate" type="text/html" href="https://mintoc.de/index.php?title=Optimal_Control_Problem&amp;diff=1970"/>
		<updated>2016-05-17T15:21:43Z</updated>

		<summary type="html">&lt;p&gt;TobiasWeber: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a template page to show how a general Optimal Control Problem should be described on this website. In this first paragraph a short description of the problem is given. What is the [[:Category:Application|practical]] or mathematical context that motivates to solve the problem. What do the free and dependent variables of the optimization problem describe. What kind of model (equality constraints) fix the dependent variables (ODE, RDE, DAE, ...). What is the objective? Also one can cite a paper that introduced or solved this problem just by saying:&lt;br /&gt;
&lt;br /&gt;
 Max Mustermann, &amp;quot;This paper doesn&#039;t exist!&amp;quot;, &lt;br /&gt;
 Jornal of myths and tails, Eds. Nobody and No-one, -1919, pp. -1-11.&lt;br /&gt;
&lt;br /&gt;
== Model Formulation ==&lt;br /&gt;
&lt;br /&gt;
In this section the [[:Category:Model characterization|dynamic model]], that describes the physical or technical process of interest, should be described. First the differential equation should be written down. Then the states, inputs, and parameters should be declared (Dimension, Type (integer, real, binary, ...)). Finally the parameters that are not free in the optimization and the coefficients should be stated in an extra table or list. All equations and functions are defined over an interval &amp;lt;math&amp;gt;I \subset \R&amp;lt;/math&amp;gt;. Initial values and free parameters are taken into account later in the Optimal Control Problem.&lt;br /&gt;
&lt;br /&gt;
=== Ordinary Differential Equation (ODE) ===&lt;br /&gt;
&lt;br /&gt;
For a simple scalar [[:Category:ODE model|ODE model]] this would look like the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\frac{dx(t)}{dt} = \dot{x}(t)=px(t)+u(t),\; \forall \, t \in I;\; x: I \rightarrow \R,\; u: I \rightarrow \R, \; p \in \R.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The parameter (coefficient) &amp;lt;math&amp;gt; p &amp;lt;/math&amp;gt; could be stated in a table, if it is fixed.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+Parameter(s)&lt;br /&gt;
|-&lt;br /&gt;
|Name&lt;br /&gt;
|Symbol&lt;br /&gt;
|Value&lt;br /&gt;
|Unit&lt;br /&gt;
|-&lt;br /&gt;
|Parameter&lt;br /&gt;
|&amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;&lt;br /&gt;
|23&lt;br /&gt;
|[-]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
This would result in an right hand side function &amp;lt;math&amp;gt;f(x,u)&amp;lt;/math&amp;gt; in this case, because there are no free parameters. Of course one could also specify an [[:Category:DAE model|implicit DAE]] system (&amp;lt;math&amp;gt;F(\dot{x},x,u,p,t)=0&amp;lt;/math&amp;gt;), where it just has to be said which states are differential and which are algebraic.&lt;br /&gt;
The states and inputs can also be vector valued functions requiring matrix valued coefficients.&lt;br /&gt;
&lt;br /&gt;
=== Matrix Differential Equation (MDE) ===&lt;br /&gt;
&lt;br /&gt;
For an Lyapunov differential equation (with constant coefficient) one could write:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\dot{X}(t)=AX(t)+X(t)A^T, \forall \, t \in I; \; X: I \rightarrow \R^{n \times n}, A \in \R^{n \times n}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here one also has to specify the matrix &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; (e.g. in a list - fixing the dimensions of all matrices).&lt;br /&gt;
&lt;br /&gt;
; Coefficients of &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt; a_{11} = 2, \; a_{12} = 6 &amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;a_{21} = 1, \; a_{22} = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Variational Differential Equation (VDE) ===&lt;br /&gt;
&lt;br /&gt;
For a VDE with respect to the parameters the equations would be:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\dot{G}_{p}(t)=f_x(x,p)G_{p}(t)+f_p(x,p), \forall \, t \in I; \; G_{p}: I \rightarrow \R^{n_x \times n_p}, \; x: I \rightarrow \R^{n_x}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this case one has to specify the [[:Category:ODE model|ODE model]] as done above, as well as the partial derivatives (which fixes all problem dimensions):&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+&amp;lt;math&amp;gt;f_x(x,p)&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;-p&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;4x_2&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;0&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;-3x_2^2&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
either in a table or as a list:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt; f_{p1} = -x_1&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt; f_{p2} = 1.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The nominal parameter values can be given as above in the ODE case, if they are fixed.&lt;br /&gt;
&lt;br /&gt;
== Optimal Control Problem ==&lt;br /&gt;
&lt;br /&gt;
In this section the Optimal Control Problem (OCP) with the dynamic model as equality constraint is specified. In general every OCP has either a Lagrange or Mayer type objective or both.&lt;br /&gt;
First the general structure of the OCP is given to show the type of objective (linear, quadratic, ...) and constraints (equality and/or inequality, linear or nonlinear) as well as the variables that are free to optimize.&lt;br /&gt;
All of the above dynamic models can be used, in the following we just write for all:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\dot{x}(t)=f(x(t),u(t),p,t) \forall \, t \in I.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Implicit systems would be treated similarly. Then the general OCP is writte as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{cl}&lt;br /&gt;
 \displaystyle \min_{x, u, p} &amp;amp; J(x,u,t)\\[1.5ex]&lt;br /&gt;
 \mbox{s.t.} &amp;amp; \dot{x}  =  f(x,u,p,t), \forall \, t \in I\\&lt;br /&gt;
 &amp;amp; 0 = g(x(t_o),x(t_f),p) \\&lt;br /&gt;
 &amp;amp; 0  \ge  c(x,u,p), \forall \, t \in I\\&lt;br /&gt;
 &amp;amp; 0  =  h(x,u,p), \forall \, t \in I \\&lt;br /&gt;
 &amp;amp; x \in \mathcal{X},\,u \in \mathcal{U},\, p \in P.&lt;br /&gt;
\end{array} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the most general formulation, where the initial value, parameters, and inputs are free. The states and inputs are vectors (or matrices) of functions while the parameters are just a vector of variables. If the initial (or final) state is fixed, one just adds a constraint &amp;lt;math&amp;gt;x(t_0)=x_0&amp;lt;/math&amp;gt; and specifies the value(s) of &amp;lt;math&amp;gt;x_0&amp;lt;/math&amp;gt; in a list or table.&lt;br /&gt;
If the parameters are fixed, then one just removes them from the list of optimization variables and states their values in a list (same for point conditions inside of the interval &amp;lt;math&amp;gt;I&amp;lt;/math&amp;gt;). If the OCP is a parameter estimation problem without inputs,&lt;br /&gt;
the inputs just dont appear in the problem above at all, neither as optimization variable nor as part of the constraints. In contrast if they are just fixed this is done by the equality constraints. In this setup the above problem is very general and by&lt;br /&gt;
stating the different objective functions and constraint functions one can cover a wide range of OCPs.&lt;br /&gt;
&lt;br /&gt;
=== Objective ===&lt;br /&gt;
&lt;br /&gt;
To specify the objective the Mayer and/or Lagrange term has to be described. For a parameter estimation problem the objective would be a finite sum over the squared difference between the measurements and the model response:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
J(x,u,t)=\sum_{i=0}^{K}(y_i - h(x(t_i),u(t_i),t_i))^2.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output function &amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt; has to be specified as above in the model section. An objective with a matrix valued state could look like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
J(X)=\int_{I}\det(X(t)^TSX(t)) dt.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here the weighting matrix &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt; has to be given. For an tracking type OCP with vector valued state and inputs an quadratic objective would be:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
J(x,u,t)=\int_{I}((x(t)-x_{ref})^TQ(x(t)-x_{ref}) + (u(t)-u_{ref})^T R (u(t)-u_{ref}) dt.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Surely demanding the specification of &amp;lt;math&amp;gt;Q&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;R&amp;lt;/math&amp;gt; in a list or table. Also one can specify a Mayer term:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
J(x,u,t)=x_1^2(t_f)+x_2(t_f)x_3(t_f).&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This all is quite general and has to be adapted to the needs for the special OCP of interest.&lt;br /&gt;
&lt;br /&gt;
=== Constraints ===&lt;br /&gt;
&lt;br /&gt;
The dynamic constraints have to be given in the model section, however the initial (or final) state constraint &amp;lt;math&amp;gt;g&amp;lt;/math&amp;gt; has to be specified. It can have a simple form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
g(x(t_0),x(t_f),p)=x(t_0)-x_0,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where one hast to state &amp;lt;math&amp;gt;x_0&amp;lt;/math&amp;gt;. More complicated expressions like periodicity conditions:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
g(x(t_0),x(t_f),p)=x(t_0)-x(t_f),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
free initial states (as parameters):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
g(x(t_0),x(t_f),p)=x(t_0)-p,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
restricting hyperplanes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
g(x(t_0),x(t_f),p)=g^T x(t_0),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
are also possible. General expressions could also be used. Constraints working on the whole interval &amp;lt;math&amp;gt;I&amp;lt;/math&amp;gt; can be also very general or just box constraints.&lt;br /&gt;
&lt;br /&gt;
The set for inputs and states should be used to define the function spaces these functions live in and other set constraints that can not be expressed as nonlinear functions. One could say that the inputs should be piecewise constant or piecewise linear continuous functions and the states should then be &amp;lt;math&amp;gt;\mathcal{C}^1&amp;lt;/math&amp;gt; or &amp;lt;math&amp;gt;\mathcal{C}^2&amp;lt;/math&amp;gt;. The set constraint on the parameters should be used to define all constraints on the parameters, if they are free to the optimization, otherwise it doesn&#039;t appear. This could look like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
P=\{p \in \R^{n_p} | p_{min} \leq p \leq p_{max}\}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Reference Solution ==&lt;br /&gt;
&lt;br /&gt;
In this section one should provide reference solutions. First the discretization, the initial guess, the solution algorithm and the used hardware should be stated, as well as the solving time. Then the optimal solution should be given, at least as a PNG of the plots for the optimal trajectories.&lt;br /&gt;
One should provide the optimal objective value.&lt;br /&gt;
&lt;br /&gt;
== Source Code ==&lt;br /&gt;
&lt;br /&gt;
In this section one can provide the source code of the implementation, that solved the problem and produced the reference solution. This should be done by providing source files.&lt;br /&gt;
&lt;br /&gt;
== Nonlinear Model Predictive Control ==&lt;br /&gt;
&lt;br /&gt;
If the OCP is solved repeatedly in a Nonlinear Model Predictive Control scheme here one can specify this outer loop configuration (sampling rate, observer, measurement error, measurement funktion, ...). Also reference solutions and code for this can be given to make the context the OCP comes from more clear.&lt;br /&gt;
Robustness and other control specific matters like real-time requirements or model plant mismatch should also be described.&lt;/div&gt;</summary>
		<author><name>TobiasWeber</name></author>
	</entry>
	<entry>
		<id>https://mintoc.de/index.php?title=Optimal_Control_Problem&amp;diff=1969</id>
		<title>Optimal Control Problem</title>
		<link rel="alternate" type="text/html" href="https://mintoc.de/index.php?title=Optimal_Control_Problem&amp;diff=1969"/>
		<updated>2016-05-17T14:41:20Z</updated>

		<summary type="html">&lt;p&gt;TobiasWeber: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a template page to show how a general Optimal Control Problem should be described on this website. In this first paragraph a short description of the problem is given. What is the practical or mathematical context that motivates to solve the problem. What do the free and dependent variables of the optimization problem describe. What kind of model (equality constraints) fix the dependent variables (ODE, RDE, DAE, ...). What is the objective? Also one can cite a paper that introduced or solved this problem just by saying:&lt;br /&gt;
&lt;br /&gt;
 Max Mustermann, &amp;quot;This paper doesn&#039;t exist!&amp;quot;, &lt;br /&gt;
 Jornal of myths and tails, Eds. Nobody and No-one, -1919, pp. -1-11.&lt;br /&gt;
&lt;br /&gt;
== Model Formulation ==&lt;br /&gt;
&lt;br /&gt;
In this section the dynamic model, that describes the physical or technical process of interest, should be described. First the differential equation should be written down. Then the states, inputs, and parameters should be declared (Dimension, Type (integer, real, binary, ...)). Finally the parameters that are not free in the optimization and the coefficients should be stated in an extra table or list. All equations and functions are defined over an interval &amp;lt;math&amp;gt;I \subset \R&amp;lt;/math&amp;gt;. Initial values and free parameters are taken into account later in the Optimal Control Problem.&lt;br /&gt;
&lt;br /&gt;
=== Ordinary Differential Equation (ODE) ===&lt;br /&gt;
&lt;br /&gt;
For a simple scalar [[:Category:ODE model|ODE model]] this would look like the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\frac{dx(t)}{dt} = \dot{x}(t)=px(t)+u(t),\; \forall \, t \in I;\; x: I \rightarrow \R,\; u: I \rightarrow \R, \; p \in \R.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The parameter (coefficient) &amp;lt;math&amp;gt; p &amp;lt;/math&amp;gt; could be stated in a table, if it is fixed.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+Parameter(s)&lt;br /&gt;
|-&lt;br /&gt;
|Name&lt;br /&gt;
|Symbol&lt;br /&gt;
|Value&lt;br /&gt;
|Unit&lt;br /&gt;
|-&lt;br /&gt;
|Parameter&lt;br /&gt;
|&amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;&lt;br /&gt;
|23&lt;br /&gt;
|[-]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
This would result in an right hand side function &amp;lt;math&amp;gt;f(x,u)&amp;lt;/math&amp;gt; in this case, because there are no free parameters. Of course one could also specify an implicit DAE system (&amp;lt;math&amp;gt;F(\dot{x},x,u,p,t)=0&amp;lt;/math&amp;gt;), where it just has to be said which states are differential and which are algebraic.&lt;br /&gt;
The states and inputs can also be vector valued functions requiring matrix valued coefficients.&lt;br /&gt;
&lt;br /&gt;
=== Matrix Differential Equation (MDE) ===&lt;br /&gt;
&lt;br /&gt;
For an Lyapunov differential equation (with constant coefficient) one could write:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\dot{X}(t)=AX(t)+X(t)A^T, \forall \, t \in I; \; X: I \rightarrow \R^{n \times n}, A \in \R^{n \times n}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here one also has to specify the matrix &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; (e.g. in a list - fixing the dimensions of all matrices).&lt;br /&gt;
&lt;br /&gt;
; Coefficients of &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt; a_{11} = 2, \; a_{12} = 6 &amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;a_{21} = 1, \; a_{22} = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Variational Differential Equation (VDE) ===&lt;br /&gt;
&lt;br /&gt;
For a VDE with respect to the parameters the equations would be:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\dot{G}_{p}(t)=f_x(x,p)G_{p}(t)+f_p(x,p), \forall \, t \in I; \; G_{p}: I \rightarrow \R^{n_x \times n_p}, \; x: I \rightarrow \R^{n_x}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this case one has to specify the [[:Category:ODE model|ODE model]] as done above, as well as the partial derivatives (which fixes all problem dimensions):&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+&amp;lt;math&amp;gt;f_x(x,p)&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;-p&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;4x_2&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;0&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;-3x_2^2&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
either in a table or as a list:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt; f_{p1} = -x_1&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt; f_{p2} = 1.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The nominal parameter values can be given as above in the ODE case, if they are fixed.&lt;br /&gt;
&lt;br /&gt;
== Optimal Control Problem ==&lt;br /&gt;
&lt;br /&gt;
In this section the Optimal Control Problem (OCP) with the dynamic model as equality constraint is specified. In general every OCP has either a Lagrange or Mayer type objective or both.&lt;br /&gt;
First the general structure of the OCP is given to show the type of objective (linear, quadratic, ...) and constraints (equality and/or inequality, linear or nonlinear) as well as the variables that are free to optimize.&lt;br /&gt;
All of the above dynamic models can be used, in the following we just write for all:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\dot{x}(t)=f(x(t),u(t),p,t) \forall \, t \in I.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Implicit systems would be treated similarly. Then the general OCP is writte as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{cl}&lt;br /&gt;
 \displaystyle \min_{x, u, p} &amp;amp; J(x,u,t)\\[1.5ex]&lt;br /&gt;
 \mbox{s.t.} &amp;amp; \dot{x}  =  f(x,u,p,t), \forall \, t \in I\\&lt;br /&gt;
 &amp;amp; 0 = g(x(t_o),x(t_f),p) \\&lt;br /&gt;
 &amp;amp; 0  \ge  c(x,u,p), \forall \, t \in I\\&lt;br /&gt;
 &amp;amp; 0  =  h(x,u,p), \forall \, t \in I \\&lt;br /&gt;
 &amp;amp; x \in \mathcal{X},\,u \in \mathcal{U},\, p \in P.&lt;br /&gt;
\end{array} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the most general formulation, where the initial value, parameters, and inputs are free. The states and inputs are vectors (or matrices) of functions while the parameters are just a vector of variables. If the initial (or final) state is fixed, one just adds a constraint &amp;lt;math&amp;gt;x(t_0)=x_0&amp;lt;/math&amp;gt; and specifies the value(s) of &amp;lt;math&amp;gt;x_0&amp;lt;/math&amp;gt; in a list or table.&lt;br /&gt;
If the parameters are fixed, then one just removes them from the list of optimization variables and states their values in a list (same for point conditions inside of the interval &amp;lt;math&amp;gt;I&amp;lt;/math&amp;gt;). If the OCP is a parameter estimation problem without inputs,&lt;br /&gt;
the inputs just dont appear in the problem above at all, neither as optimization variable nor as part of the constraints. In contrast if they are just fixed this is done by the equality constraints. In this setup the above problem is very general and by&lt;br /&gt;
stating the different objective functions and constraint functions one can cover a wide range of OCPs.&lt;br /&gt;
&lt;br /&gt;
=== Objective ===&lt;br /&gt;
&lt;br /&gt;
To specify the objective the Mayer and/or Lagrange term has to be described. For a parameter estimation problem the objective would be a finite sum over the squared difference between the measurements and the model response:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
J(x,u,t)=\sum_{i=0}^{K}(y_i - h(x(t_i),u(t_i),t_i))^2.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output function &amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt; has to be specified as above in the model section. An objective with a matrix valued state could look like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
J(X)=\int_{I}\det(X(t)^TSX(t)) dt.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here the weighting matrix &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt; has to be given. For an tracking type OCP with vector valued state and inputs an quadratic objective would be:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
J(x,u,t)=\int_{I}((x(t)-x_{ref})^TQ(x(t)-x_{ref}) + (u(t)-u_{ref})^T R (u(t)-u_{ref}) dt.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Surely demanding the specification of &amp;lt;math&amp;gt;Q&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;R&amp;lt;/math&amp;gt; in a list or table. Also one can specify a Mayer term:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
J(x,u,t)=x_1^2(t_f)+x_2(t_f)x_3(t_f).&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This all is quite general and has to be adapted to the needs for the special OCP of interest.&lt;br /&gt;
&lt;br /&gt;
=== Constraints ===&lt;br /&gt;
&lt;br /&gt;
The dynamic constraints have to be given in the model section, however the initial (or final) state constraint &amp;lt;math&amp;gt;g&amp;lt;/math&amp;gt; has to be specified. It can have a simple form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
g(x(t_0),x(t_f),p)=x(t_0)-x_0,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where one hast to state &amp;lt;math&amp;gt;x_0&amp;lt;/math&amp;gt;. More complicated expressions like periodicity conditions:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
g(x(t_0),x(t_f),p)=x(t_0)-x(t_f),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
free initial states (as parameters):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
g(x(t_0),x(t_f),p)=x(t_0)-p,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
restricting hyperplanes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
g(x(t_0),x(t_f),p)=g^T x(t_0),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
are also possible. General expressions could also be used. Constraints working on the whole interval &amp;lt;math&amp;gt;I&amp;lt;/math&amp;gt; can be also very general or just box constraints.&lt;br /&gt;
&lt;br /&gt;
The set for inputs and states should be used to define the function spaces these functions live in and other set constraints that can not be expressed as nonlinear functions. One could say that the inputs should be piecewise constant or piecewise linear continuous functions and the states should then be &amp;lt;math&amp;gt;\mathcal{C}^1&amp;lt;/math&amp;gt; or &amp;lt;math&amp;gt;\mathcal{C}^2&amp;lt;/math&amp;gt;. The set constraint on the parameters should be used to define all constraints on the parameters, if they are free to the optimization, otherwise it doesn&#039;t appear. This could look like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
P=\{p \in \R^{n_p} | p_{min} \leq p \leq p_{max}\}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Reference Solution ==&lt;br /&gt;
&lt;br /&gt;
In this section one should provide reference solutions. First the discretization, the initial guess, the solution algorithm and the used hardware should be stated, as well as the solving time. Then the optimal solution should be given, at least as a PNG of the plots for the optimal trajectories.&lt;br /&gt;
One should provide the optimal objective value.&lt;br /&gt;
&lt;br /&gt;
== Source Code ==&lt;br /&gt;
&lt;br /&gt;
In this section one can provide the source code of the implementation, that solved the problem and produced the reference solution. This should be done by providing source files.&lt;br /&gt;
&lt;br /&gt;
== Nonlinear Model Predictive Control ==&lt;br /&gt;
&lt;br /&gt;
If the OCP is solved repeatedly in a Nonlinear Model Predictive Control scheme here one can specify this outer loop configuration (sampling rate, observer, measurement error, measurement funktion, ...). Also reference solutions and code for this can be given to make the context the OCP comes from more clear.&lt;br /&gt;
Robustness and other control specific matters like real-time requirements or model plant mismatch should also be described.&lt;/div&gt;</summary>
		<author><name>TobiasWeber</name></author>
	</entry>
	<entry>
		<id>https://mintoc.de/index.php?title=Lotka_Volterra_fishing_problem_(ACADO)&amp;diff=1595</id>
		<title>Lotka Volterra fishing problem (ACADO)</title>
		<link rel="alternate" type="text/html" href="https://mintoc.de/index.php?title=Lotka_Volterra_fishing_problem_(ACADO)&amp;diff=1595"/>
		<updated>2016-01-28T10:21:08Z</updated>

		<summary type="html">&lt;p&gt;TobiasWeber: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This pages states the code to solve the (ralaxed) Lotka Volterra fishing problem with the code generation fo the ACADO Toolkit from Matlab (via Matlab interface). Hence one needs Matlab and ACADO.&lt;br /&gt;
The m-file should be located in the matlab interface of ACADO and the path &amp;lt;ACADOROOT&amp;gt;/interfaces/matlab/examples/codegeneratio/nmpc/. While we use the NMPC more precisely the RTI capability of&lt;br /&gt;
the ACADO codegeneration, this features are misused to implement a 20 step SQP solver without stopping criteria.&lt;br /&gt;
&lt;br /&gt;
== ACADO (Matlab) ==&lt;br /&gt;
&lt;br /&gt;
The source code for a fixed grid discretisation with fixed stepsize integrator. This is an m-file that should be called from Matlab AFTER&lt;br /&gt;
calling make from matlab in the matlab interface of ACADO.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;Matlab&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
% implements the lotka volterra fishing problem on mintoc.de&lt;br /&gt;
&lt;br /&gt;
clc;&lt;br /&gt;
clear all;&lt;br /&gt;
close all;&lt;br /&gt;
&lt;br /&gt;
Ts = 0.1;&lt;br /&gt;
EXPORT = 1;&lt;br /&gt;
&lt;br /&gt;
%% Variables&lt;br /&gt;
DifferentialState x0 x1;&lt;br /&gt;
Control w;&lt;br /&gt;
&lt;br /&gt;
n_XD = length(diffStates);&lt;br /&gt;
n_U = length(controls);&lt;br /&gt;
&lt;br /&gt;
% Constants&lt;br /&gt;
c0 = 0.4;&lt;br /&gt;
c1 = 0.2;&lt;br /&gt;
&lt;br /&gt;
%% Differential Equation&lt;br /&gt;
&lt;br /&gt;
f = dot([x0; x1]) == [ x0-x0*x1-c0*x0*w; ...&lt;br /&gt;
    -x1 + x0*x1-c1*x1*w];&lt;br /&gt;
&lt;br /&gt;
h = [diffStates];&lt;br /&gt;
hN = [diffStates];&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
%% MPCexport&lt;br /&gt;
acadoSet(&#039;problemname&#039;, &#039;mpc&#039;);&lt;br /&gt;
&lt;br /&gt;
N = 200;&lt;br /&gt;
ocp = acado.OCP( 0.0, 12, N );&lt;br /&gt;
&lt;br /&gt;
W_mat = eye(n_XD,n_XD);&lt;br /&gt;
WN_mat = eye(n_XD,n_XD);&lt;br /&gt;
W = acado.BMatrix(W_mat);&lt;br /&gt;
WN = acado.BMatrix(WN_mat);&lt;br /&gt;
&lt;br /&gt;
ocp.minimizeLSQ( W, h );&lt;br /&gt;
ocp.minimizeLSQEndTerm( WN, hN );&lt;br /&gt;
&lt;br /&gt;
ocp.subjectTo( 0 &amp;lt;= w &amp;lt;= 1 );&lt;br /&gt;
ocp.setModel(f);&lt;br /&gt;
&lt;br /&gt;
mpc = acado.OCPexport( ocp );&lt;br /&gt;
mpc.set( &#039;HESSIAN_APPROXIMATION&#039;,       &#039;GAUSS_NEWTON&#039;      );&lt;br /&gt;
mpc.set( &#039;DISCRETIZATION_TYPE&#039;,         &#039;MULTIPLE_SHOOTING&#039; );&lt;br /&gt;
mpc.set( &#039;SPARSE_QP_SOLUTION&#039;,          &#039;FULL_CONDENSING_N2&#039;);&lt;br /&gt;
mpc.set( &#039;INTEGRATOR_TYPE&#039;,             &#039;INT_IRK_GL4&#039;       );&lt;br /&gt;
mpc.set( &#039;NUM_INTEGRATOR_STEPS&#039;,        N                 );&lt;br /&gt;
mpc.set( &#039;QP_SOLVER&#039;,                   &#039;QP_QPOASES&#039;    	);&lt;br /&gt;
mpc.set( &#039;HOTSTART_QP&#039;,                 &#039;NO&#039;             	);&lt;br /&gt;
mpc.set( &#039;LEVENBERG_MARQUARDT&#039;, 		 1e-10				);&lt;br /&gt;
&lt;br /&gt;
if EXPORT&lt;br /&gt;
    mpc.exportCode( &#039;export_MPC&#039; );&lt;br /&gt;
    copyfile(&#039;../../../../../../external_packages/qpoases&#039;, &#039;export_MPC/qpoases&#039;)&lt;br /&gt;
    &lt;br /&gt;
    cd export_MPC&lt;br /&gt;
    make_acado_solver(&#039;../acado_MPCstep&#039;)&lt;br /&gt;
    cd ..&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
%% PARAMETERS OPTIMIZATION&lt;br /&gt;
X0 = [0.5 0.7];&lt;br /&gt;
input.x0=X0&#039;;&lt;br /&gt;
Xref = [1 1];&lt;br /&gt;
input.x = repmat(Xref,N+1,1);&lt;br /&gt;
Xref = repmat(Xref,N,1);&lt;br /&gt;
input.od = [];&lt;br /&gt;
&lt;br /&gt;
Uref = zeros(N,n_U);&lt;br /&gt;
input.u = Uref;&lt;br /&gt;
&lt;br /&gt;
input.y = [Xref(1:N,:)];&lt;br /&gt;
input.yN = Xref(N,:).&#039;;&lt;br /&gt;
&lt;br /&gt;
input.W = diag([1 1]);&lt;br /&gt;
input.WN = diag([1 1]);&lt;br /&gt;
&lt;br /&gt;
%% SOLVER LOOP&lt;br /&gt;
display(&#039;------------------------------------------------------------------&#039;)&lt;br /&gt;
display(&#039;               SOLVER Loop&#039;                                    )&lt;br /&gt;
display(&#039;------------------------------------------------------------------&#039;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
for i=1:20&lt;br /&gt;
    tic&lt;br /&gt;
    % Solve NMPC OCP&lt;br /&gt;
    output = acado_MPCstep(input);&lt;br /&gt;
    &lt;br /&gt;
    input.x=output.x;&lt;br /&gt;
    input.u=output.u;&lt;br /&gt;
&lt;br /&gt;
    disp([&#039; (RTI step: &#039; num2str(output.info.cpuTime*1e6) &#039; µs)&#039;])&lt;br /&gt;
&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
%% PLOT RESULTS&lt;br /&gt;
&lt;br /&gt;
t_end = 12;&lt;br /&gt;
&lt;br /&gt;
% States&lt;br /&gt;
figure(1)&lt;br /&gt;
plot([0:t_end/N:t_end],output.x)&lt;br /&gt;
ylabel(&#039;States&#039;)&lt;br /&gt;
xlabel(&#039;Time&#039;)&lt;br /&gt;
legend(&#039;x1&#039;,&#039;x2&#039;)&lt;br /&gt;
&lt;br /&gt;
% Control&lt;br /&gt;
figure(2)&lt;br /&gt;
plot([0:t_end/N:t_end-t_end/N],output.u)&lt;br /&gt;
ylabel(&#039;Control (u)&#039;)&lt;br /&gt;
xlabel(&#039;Time&#039;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[Category:ACADO]]&lt;/div&gt;</summary>
		<author><name>TobiasWeber</name></author>
	</entry>
	<entry>
		<id>https://mintoc.de/index.php?title=Category:ACADO&amp;diff=1594</id>
		<title>Category:ACADO</title>
		<link rel="alternate" type="text/html" href="https://mintoc.de/index.php?title=Category:ACADO&amp;diff=1594"/>
		<updated>2016-01-28T10:17:22Z</updated>

		<summary type="html">&lt;p&gt;TobiasWeber: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The ACADO manual&lt;br /&gt;
&lt;br /&gt;
 Houska, Boris, et al. &amp;quot;ACADO toolkit user’s manual.&amp;quot; (2009): 3.&lt;br /&gt;
&lt;br /&gt;
describes the toolkit as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;quot;&lt;br /&gt;
ACADO Toolkit is a software environment and algorithm collection written in C++ for automatic control and dynamic optimization. It provides a general framework for using a great variety of algorithms for direct optimal control, including model predictive control as well as state and parameter estimation. It also provides (stand-alone) efficiently implemented Runge-Kutta and BDF integrators for the simulation of ODE’s and DAE’s.&lt;br /&gt;
&amp;quot;&lt;br /&gt;
&lt;br /&gt;
There a list of key properties is also given. The toolkit is open source and should be user-friendly. The code should be easy to extend (i.e. linking to it is simple) and self contained (no external software is required). Due to this properties the ACADO toolkit has become quite popular in research with Optimal Control Problems.&lt;br /&gt;
&lt;br /&gt;
[[Category: Implementation]]&lt;/div&gt;</summary>
		<author><name>TobiasWeber</name></author>
	</entry>
	<entry>
		<id>https://mintoc.de/index.php?title=Category:ACADO&amp;diff=1593</id>
		<title>Category:ACADO</title>
		<link rel="alternate" type="text/html" href="https://mintoc.de/index.php?title=Category:ACADO&amp;diff=1593"/>
		<updated>2016-01-28T10:16:52Z</updated>

		<summary type="html">&lt;p&gt;TobiasWeber: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The ACADO manual&lt;br /&gt;
&lt;br /&gt;
 Houska, Boris, et al. &amp;quot;ACADO toolkit user’s manual.&amp;quot; (2009): 3.&lt;br /&gt;
&lt;br /&gt;
describes the toolkit as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;quot;&lt;br /&gt;
ACADO Toolkit is a software environment and algorithm collection written in C++ for automatic control and dynamic optimization. It provides a general framework for using a great variety of algorithms for direct optimal control, including model predictive control as well as state and parameter estimation. It also provides (stand-alone) efficiently implemented Runge-Kutta and BDF integrators for the simulation of ODE’s and DAE’s.&lt;br /&gt;
&amp;quot;&lt;br /&gt;
&lt;br /&gt;
There a list of key properties is also given. The toolkit is open source, should be user-friendly. The code should be easy to extend (i.e. linking to it is simple) and self contained (no external software is required). Due to this properties the ACADO toolkit has become quite popular in research with Optimal Control Problems.&lt;br /&gt;
&lt;br /&gt;
[[Category: Implementation]]&lt;/div&gt;</summary>
		<author><name>TobiasWeber</name></author>
	</entry>
	<entry>
		<id>https://mintoc.de/index.php?title=Category:ACADO&amp;diff=1592</id>
		<title>Category:ACADO</title>
		<link rel="alternate" type="text/html" href="https://mintoc.de/index.php?title=Category:ACADO&amp;diff=1592"/>
		<updated>2016-01-28T10:12:22Z</updated>

		<summary type="html">&lt;p&gt;TobiasWeber: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The ACADO manual&lt;br /&gt;
&lt;br /&gt;
 Houska, Boris, et al. &amp;quot;ACADO toolkit user’s manual.&amp;quot; (2009): 3.&lt;br /&gt;
&lt;br /&gt;
describes the toolkit as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;quot;&lt;br /&gt;
ACADO Toolkit is a software environment and algorithm collection written in C++ for automatic control and dynamic optimization. It provides a general framework for using a great variety of algorithms for direct optimal control, including model predictive control as well as state and parameter estimation. It also provides (stand-alone) efficiently implemented Runge-Kutta and BDF integrators for the simulation of ODE’s and DAE’s.&lt;br /&gt;
&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Category: Implementation]]&lt;/div&gt;</summary>
		<author><name>TobiasWeber</name></author>
	</entry>
	<entry>
		<id>https://mintoc.de/index.php?title=Lotka_Volterra_fishing_problem_(ACADO)&amp;diff=1351</id>
		<title>Lotka Volterra fishing problem (ACADO)</title>
		<link rel="alternate" type="text/html" href="https://mintoc.de/index.php?title=Lotka_Volterra_fishing_problem_(ACADO)&amp;diff=1351"/>
		<updated>2016-01-20T09:22:41Z</updated>

		<summary type="html">&lt;p&gt;TobiasWeber: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This pages states the code to solve the (ralaxed) Lotka Volterra fishing problem with the code generation fo the ACADO Toolkit from Matlab (via Matlab interface). Hence one needs Matlab and ACADO.&lt;br /&gt;
The m-file should be located in the matlab interface of ACADO and the path &amp;lt;ACADOROOT&amp;gt;/interfaces/matlab/examples/codegeneratio/nmpc/. While we use the NMPC more precisely the RTI capability of&lt;br /&gt;
the ACADO codegeneration, this features are misused to implement a 20 step SQP solver without stopping criteria.&lt;br /&gt;
&lt;br /&gt;
== ACADO (Matlab) ==&lt;br /&gt;
&lt;br /&gt;
The source code for a fixed grid discretisation with fixed stepsize integrator. This is an m-file that should be called from Matlab AFTER&lt;br /&gt;
calling make from matlab in the matlab interface of ACADO.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;Matlab&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
% implements the lotka volterra fishing problem on mintoc.de&lt;br /&gt;
&lt;br /&gt;
clc;&lt;br /&gt;
clear all;&lt;br /&gt;
close all;&lt;br /&gt;
&lt;br /&gt;
Ts = 0.1;&lt;br /&gt;
EXPORT = 1;&lt;br /&gt;
&lt;br /&gt;
%% Variables&lt;br /&gt;
DifferentialState x0 x1;&lt;br /&gt;
Control w;&lt;br /&gt;
&lt;br /&gt;
n_XD = length(diffStates);&lt;br /&gt;
n_U = length(controls);&lt;br /&gt;
&lt;br /&gt;
% Constants&lt;br /&gt;
c0 = 0.4;&lt;br /&gt;
c1 = 0.2;&lt;br /&gt;
&lt;br /&gt;
%% Differential Equation&lt;br /&gt;
&lt;br /&gt;
f = dot([x0; x1]) == [ x0-x0*x1-c0*x0*w; ...&lt;br /&gt;
    -x1 + x0*x1-c1*x1*w];&lt;br /&gt;
&lt;br /&gt;
h = [diffStates];&lt;br /&gt;
hN = [diffStates];&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
%% MPCexport&lt;br /&gt;
acadoSet(&#039;problemname&#039;, &#039;mpc&#039;);&lt;br /&gt;
&lt;br /&gt;
N = 200;&lt;br /&gt;
ocp = acado.OCP( 0.0, 12, N );&lt;br /&gt;
&lt;br /&gt;
W_mat = eye(n_XD,n_XD);&lt;br /&gt;
WN_mat = eye(n_XD,n_XD);&lt;br /&gt;
W = acado.BMatrix(W_mat);&lt;br /&gt;
WN = acado.BMatrix(WN_mat);&lt;br /&gt;
&lt;br /&gt;
ocp.minimizeLSQ( W, h );&lt;br /&gt;
ocp.minimizeLSQEndTerm( WN, hN );&lt;br /&gt;
&lt;br /&gt;
ocp.subjectTo( 0 &amp;lt;= w &amp;lt;= 1 );&lt;br /&gt;
ocp.setModel(f);&lt;br /&gt;
&lt;br /&gt;
mpc = acado.OCPexport( ocp );&lt;br /&gt;
mpc.set( &#039;HESSIAN_APPROXIMATION&#039;,       &#039;GAUSS_NEWTON&#039;      );&lt;br /&gt;
mpc.set( &#039;DISCRETIZATION_TYPE&#039;,         &#039;MULTIPLE_SHOOTING&#039; );&lt;br /&gt;
mpc.set( &#039;SPARSE_QP_SOLUTION&#039;,          &#039;FULL_CONDENSING_N2&#039;);&lt;br /&gt;
mpc.set( &#039;INTEGRATOR_TYPE&#039;,             &#039;INT_IRK_GL4&#039;       );&lt;br /&gt;
mpc.set( &#039;NUM_INTEGRATOR_STEPS&#039;,        N                 );&lt;br /&gt;
mpc.set( &#039;QP_SOLVER&#039;,                   &#039;QP_QPOASES&#039;    	);&lt;br /&gt;
mpc.set( &#039;HOTSTART_QP&#039;,                 &#039;NO&#039;             	);&lt;br /&gt;
mpc.set( &#039;LEVENBERG_MARQUARDT&#039;, 		 1e-10				);&lt;br /&gt;
&lt;br /&gt;
if EXPORT&lt;br /&gt;
    mpc.exportCode( &#039;export_MPC&#039; );&lt;br /&gt;
    copyfile(&#039;../../../../../../external_packages/qpoases&#039;, &#039;export_MPC/qpoases&#039;)&lt;br /&gt;
    &lt;br /&gt;
    cd export_MPC&lt;br /&gt;
    make_acado_solver(&#039;../acado_MPCstep&#039;)&lt;br /&gt;
    cd ..&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
%% PARAMETERS OPTIMIZATION&lt;br /&gt;
X0 = [0.5 0.7];&lt;br /&gt;
input.x0=X0&#039;;&lt;br /&gt;
Xref = [1 1];&lt;br /&gt;
input.x = repmat(Xref,N+1,1);&lt;br /&gt;
Xref = repmat(Xref,N,1);&lt;br /&gt;
input.od = [];&lt;br /&gt;
&lt;br /&gt;
Uref = zeros(N,n_U);&lt;br /&gt;
input.u = Uref;&lt;br /&gt;
&lt;br /&gt;
input.y = [Xref(1:N,:)];&lt;br /&gt;
input.yN = Xref(N,:).&#039;;&lt;br /&gt;
&lt;br /&gt;
input.W = diag([1 1]);&lt;br /&gt;
input.WN = diag([1 1]);&lt;br /&gt;
&lt;br /&gt;
%% SOLVER LOOP&lt;br /&gt;
display(&#039;------------------------------------------------------------------&#039;)&lt;br /&gt;
display(&#039;               SOLVER Loop&#039;                                    )&lt;br /&gt;
display(&#039;------------------------------------------------------------------&#039;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
for i=1:20&lt;br /&gt;
    tic&lt;br /&gt;
    % Solve NMPC OCP&lt;br /&gt;
    output = acado_MPCstep(input);&lt;br /&gt;
    &lt;br /&gt;
    input.x=output.x;&lt;br /&gt;
    input.u=output.u;&lt;br /&gt;
&lt;br /&gt;
    disp([&#039; (RTI step: &#039; num2str(output.info.cpuTime*1e6) &#039; µs)&#039;])&lt;br /&gt;
&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
%% PLOT RESULTS&lt;br /&gt;
&lt;br /&gt;
t_end = 12;&lt;br /&gt;
&lt;br /&gt;
% States&lt;br /&gt;
figure(1)&lt;br /&gt;
plot([0:t_end/N:t_end],output.x)&lt;br /&gt;
ylabel(&#039;States&#039;)&lt;br /&gt;
xlabel(&#039;Time&#039;)&lt;br /&gt;
legend(&#039;x1&#039;,&#039;x2&#039;)&lt;br /&gt;
&lt;br /&gt;
% Control&lt;br /&gt;
figure(2)&lt;br /&gt;
plot([0:t_end/N:t_end-t_end/N],output.u)&lt;br /&gt;
ylabel(&#039;Control (u)&#039;)&lt;br /&gt;
xlabel(&#039;Time&#039;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>TobiasWeber</name></author>
	</entry>
	<entry>
		<id>https://mintoc.de/index.php?title=Lotka_Volterra_fishing_problem_(ACADO)&amp;diff=1350</id>
		<title>Lotka Volterra fishing problem (ACADO)</title>
		<link rel="alternate" type="text/html" href="https://mintoc.de/index.php?title=Lotka_Volterra_fishing_problem_(ACADO)&amp;diff=1350"/>
		<updated>2016-01-20T09:20:55Z</updated>

		<summary type="html">&lt;p&gt;TobiasWeber: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This pages states the code to solve the (ralaxed) Lotka Volterra fishing problem with the code generation fo the ACADO Toolkit from Matlab (via Matlab interface). Hence one needs Matlab and ACADO.&lt;br /&gt;
The m-file should be located in the matlab interface of ACADO and the path &amp;lt;ACADOROOT&amp;gt;/interfaces/matlab/examples/codegeneratio/nmpc/. While we use the NMPC more precisely the RTI capability of&lt;br /&gt;
the ACADO codegeneration, this features are misused to implement a 20 step SQP solver without stopping criteria.&lt;br /&gt;
&lt;br /&gt;
== ACADO ==&lt;br /&gt;
&lt;br /&gt;
The source code for a fixed grid discretisation with fixed stepsize integrator.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;Matlab&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
% implements the lotka volterra fishing problem on mintoc.de&lt;br /&gt;
&lt;br /&gt;
clc;&lt;br /&gt;
clear all;&lt;br /&gt;
close all;&lt;br /&gt;
&lt;br /&gt;
Ts = 0.1;&lt;br /&gt;
EXPORT = 1;&lt;br /&gt;
&lt;br /&gt;
%% Variables&lt;br /&gt;
DifferentialState x0 x1;&lt;br /&gt;
Control w;&lt;br /&gt;
&lt;br /&gt;
n_XD = length(diffStates);&lt;br /&gt;
n_U = length(controls);&lt;br /&gt;
&lt;br /&gt;
% Constants&lt;br /&gt;
c0 = 0.4;&lt;br /&gt;
c1 = 0.2;&lt;br /&gt;
&lt;br /&gt;
%% Differential Equation&lt;br /&gt;
&lt;br /&gt;
f = dot([x0; x1]) == [ x0-x0*x1-c0*x0*w; ...&lt;br /&gt;
    -x1 + x0*x1-c1*x1*w];&lt;br /&gt;
&lt;br /&gt;
h = [diffStates];&lt;br /&gt;
hN = [diffStates];&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
%% MPCexport&lt;br /&gt;
acadoSet(&#039;problemname&#039;, &#039;mpc&#039;);&lt;br /&gt;
&lt;br /&gt;
N = 200;&lt;br /&gt;
ocp = acado.OCP( 0.0, 12, N );&lt;br /&gt;
&lt;br /&gt;
W_mat = eye(n_XD,n_XD);&lt;br /&gt;
WN_mat = eye(n_XD,n_XD);&lt;br /&gt;
W = acado.BMatrix(W_mat);&lt;br /&gt;
WN = acado.BMatrix(WN_mat);&lt;br /&gt;
&lt;br /&gt;
ocp.minimizeLSQ( W, h );&lt;br /&gt;
ocp.minimizeLSQEndTerm( WN, hN );&lt;br /&gt;
&lt;br /&gt;
ocp.subjectTo( 0 &amp;lt;= w &amp;lt;= 1 );&lt;br /&gt;
ocp.setModel(f);&lt;br /&gt;
&lt;br /&gt;
mpc = acado.OCPexport( ocp );&lt;br /&gt;
mpc.set( &#039;HESSIAN_APPROXIMATION&#039;,       &#039;GAUSS_NEWTON&#039;      );&lt;br /&gt;
mpc.set( &#039;DISCRETIZATION_TYPE&#039;,         &#039;MULTIPLE_SHOOTING&#039; );&lt;br /&gt;
mpc.set( &#039;SPARSE_QP_SOLUTION&#039;,          &#039;FULL_CONDENSING_N2&#039;);&lt;br /&gt;
mpc.set( &#039;INTEGRATOR_TYPE&#039;,             &#039;INT_IRK_GL4&#039;       );&lt;br /&gt;
mpc.set( &#039;NUM_INTEGRATOR_STEPS&#039;,        N                 );&lt;br /&gt;
mpc.set( &#039;QP_SOLVER&#039;,                   &#039;QP_QPOASES&#039;    	);&lt;br /&gt;
mpc.set( &#039;HOTSTART_QP&#039;,                 &#039;NO&#039;             	);&lt;br /&gt;
mpc.set( &#039;LEVENBERG_MARQUARDT&#039;, 		 1e-10				);&lt;br /&gt;
&lt;br /&gt;
if EXPORT&lt;br /&gt;
    mpc.exportCode( &#039;export_MPC&#039; );&lt;br /&gt;
    copyfile(&#039;../../../../../../external_packages/qpoases&#039;, &#039;export_MPC/qpoases&#039;)&lt;br /&gt;
    &lt;br /&gt;
    cd export_MPC&lt;br /&gt;
    make_acado_solver(&#039;../acado_MPCstep&#039;)&lt;br /&gt;
    cd ..&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
%% PARAMETERS OPTIMIZATION&lt;br /&gt;
X0 = [0.5 0.7];&lt;br /&gt;
input.x0=X0&#039;;&lt;br /&gt;
Xref = [1 1];&lt;br /&gt;
input.x = repmat(Xref,N+1,1);&lt;br /&gt;
Xref = repmat(Xref,N,1);&lt;br /&gt;
input.od = [];&lt;br /&gt;
&lt;br /&gt;
Uref = zeros(N,n_U);&lt;br /&gt;
input.u = Uref;&lt;br /&gt;
&lt;br /&gt;
input.y = [Xref(1:N,:)];&lt;br /&gt;
input.yN = Xref(N,:).&#039;;&lt;br /&gt;
&lt;br /&gt;
input.W = diag([1 1]);&lt;br /&gt;
input.WN = diag([1 1]);&lt;br /&gt;
&lt;br /&gt;
%% SOLVER LOOP&lt;br /&gt;
display(&#039;------------------------------------------------------------------&#039;)&lt;br /&gt;
display(&#039;               SOLVER Loop&#039;                                    )&lt;br /&gt;
display(&#039;------------------------------------------------------------------&#039;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
for i=1:20&lt;br /&gt;
    tic&lt;br /&gt;
    % Solve NMPC OCP&lt;br /&gt;
    output = acado_MPCstep(input);&lt;br /&gt;
    &lt;br /&gt;
    input.x=output.x;&lt;br /&gt;
    input.u=output.u;&lt;br /&gt;
&lt;br /&gt;
    disp([&#039; (RTI step: &#039; num2str(output.info.cpuTime*1e6) &#039; µs)&#039;])&lt;br /&gt;
&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
%% PLOT RESULTS&lt;br /&gt;
&lt;br /&gt;
t_end = 12;&lt;br /&gt;
&lt;br /&gt;
% States&lt;br /&gt;
figure(1)&lt;br /&gt;
plot([0:t_end/N:t_end],output.x)&lt;br /&gt;
ylabel(&#039;States&#039;)&lt;br /&gt;
xlabel(&#039;Time&#039;)&lt;br /&gt;
legend(&#039;x1&#039;,&#039;x2&#039;)&lt;br /&gt;
&lt;br /&gt;
% Control&lt;br /&gt;
figure(2)&lt;br /&gt;
plot([0:t_end/N:t_end-t_end/N],output.u)&lt;br /&gt;
ylabel(&#039;Control (u)&#039;)&lt;br /&gt;
xlabel(&#039;Time&#039;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>TobiasWeber</name></author>
	</entry>
	<entry>
		<id>https://mintoc.de/index.php?title=Lotka_Volterra_fishing_problem_(ACADO)&amp;diff=1349</id>
		<title>Lotka Volterra fishing problem (ACADO)</title>
		<link rel="alternate" type="text/html" href="https://mintoc.de/index.php?title=Lotka_Volterra_fishing_problem_(ACADO)&amp;diff=1349"/>
		<updated>2016-01-20T09:20:34Z</updated>

		<summary type="html">&lt;p&gt;TobiasWeber: Created page with &amp;quot;This pages states the code to solve the (ralaxed) Lotka Volterra fishing problem with the code generation fo the ACADO Toolkit from Matlab (via Matlab interface). Hence one ne...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This pages states the code to solve the (ralaxed) Lotka Volterra fishing problem with the code generation fo the ACADO Toolkit from Matlab (via Matlab interface). Hence one needs Matlab and ACADO.&lt;br /&gt;
The m-file should be located in the matlab interface of ACADO and the path &amp;lt;ACADOROOT&amp;gt;/interfaces/matlab/examples/codegeneratio/nmpc/. While we use the NMPC more precisely the RTI capability of&lt;br /&gt;
the ACADO Code generation, this features are misused to implement a 20 step SQP solver without stopping criteria.&lt;br /&gt;
&lt;br /&gt;
== ACADO ==&lt;br /&gt;
&lt;br /&gt;
The source code for a fixed grid discretisation with fixed stepsize integrator.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;Matlab&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
% implements the lotka volterra fishing problem on mintoc.de&lt;br /&gt;
&lt;br /&gt;
clc;&lt;br /&gt;
clear all;&lt;br /&gt;
close all;&lt;br /&gt;
&lt;br /&gt;
Ts = 0.1;&lt;br /&gt;
EXPORT = 1;&lt;br /&gt;
&lt;br /&gt;
%% Variables&lt;br /&gt;
DifferentialState x0 x1;&lt;br /&gt;
Control w;&lt;br /&gt;
&lt;br /&gt;
n_XD = length(diffStates);&lt;br /&gt;
n_U = length(controls);&lt;br /&gt;
&lt;br /&gt;
% Constants&lt;br /&gt;
c0 = 0.4;&lt;br /&gt;
c1 = 0.2;&lt;br /&gt;
&lt;br /&gt;
%% Differential Equation&lt;br /&gt;
&lt;br /&gt;
f = dot([x0; x1]) == [ x0-x0*x1-c0*x0*w; ...&lt;br /&gt;
    -x1 + x0*x1-c1*x1*w];&lt;br /&gt;
&lt;br /&gt;
h = [diffStates];&lt;br /&gt;
hN = [diffStates];&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
%% MPCexport&lt;br /&gt;
acadoSet(&#039;problemname&#039;, &#039;mpc&#039;);&lt;br /&gt;
&lt;br /&gt;
N = 200;&lt;br /&gt;
ocp = acado.OCP( 0.0, 12, N );&lt;br /&gt;
&lt;br /&gt;
W_mat = eye(n_XD,n_XD);&lt;br /&gt;
WN_mat = eye(n_XD,n_XD);&lt;br /&gt;
W = acado.BMatrix(W_mat);&lt;br /&gt;
WN = acado.BMatrix(WN_mat);&lt;br /&gt;
&lt;br /&gt;
ocp.minimizeLSQ( W, h );&lt;br /&gt;
ocp.minimizeLSQEndTerm( WN, hN );&lt;br /&gt;
&lt;br /&gt;
ocp.subjectTo( 0 &amp;lt;= w &amp;lt;= 1 );&lt;br /&gt;
ocp.setModel(f);&lt;br /&gt;
&lt;br /&gt;
mpc = acado.OCPexport( ocp );&lt;br /&gt;
mpc.set( &#039;HESSIAN_APPROXIMATION&#039;,       &#039;GAUSS_NEWTON&#039;      );&lt;br /&gt;
mpc.set( &#039;DISCRETIZATION_TYPE&#039;,         &#039;MULTIPLE_SHOOTING&#039; );&lt;br /&gt;
mpc.set( &#039;SPARSE_QP_SOLUTION&#039;,          &#039;FULL_CONDENSING_N2&#039;);&lt;br /&gt;
mpc.set( &#039;INTEGRATOR_TYPE&#039;,             &#039;INT_IRK_GL4&#039;       );&lt;br /&gt;
mpc.set( &#039;NUM_INTEGRATOR_STEPS&#039;,        N                 );&lt;br /&gt;
mpc.set( &#039;QP_SOLVER&#039;,                   &#039;QP_QPOASES&#039;    	);&lt;br /&gt;
mpc.set( &#039;HOTSTART_QP&#039;,                 &#039;NO&#039;             	);&lt;br /&gt;
mpc.set( &#039;LEVENBERG_MARQUARDT&#039;, 		 1e-10				);&lt;br /&gt;
&lt;br /&gt;
if EXPORT&lt;br /&gt;
    mpc.exportCode( &#039;export_MPC&#039; );&lt;br /&gt;
    copyfile(&#039;../../../../../../external_packages/qpoases&#039;, &#039;export_MPC/qpoases&#039;)&lt;br /&gt;
    &lt;br /&gt;
    cd export_MPC&lt;br /&gt;
    make_acado_solver(&#039;../acado_MPCstep&#039;)&lt;br /&gt;
    cd ..&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
%% PARAMETERS OPTIMIZATION&lt;br /&gt;
X0 = [0.5 0.7];&lt;br /&gt;
input.x0=X0&#039;;&lt;br /&gt;
Xref = [1 1];&lt;br /&gt;
input.x = repmat(Xref,N+1,1);&lt;br /&gt;
Xref = repmat(Xref,N,1);&lt;br /&gt;
input.od = [];&lt;br /&gt;
&lt;br /&gt;
Uref = zeros(N,n_U);&lt;br /&gt;
input.u = Uref;&lt;br /&gt;
&lt;br /&gt;
input.y = [Xref(1:N,:)];&lt;br /&gt;
input.yN = Xref(N,:).&#039;;&lt;br /&gt;
&lt;br /&gt;
input.W = diag([1 1]);&lt;br /&gt;
input.WN = diag([1 1]);&lt;br /&gt;
&lt;br /&gt;
%% SOLVER LOOP&lt;br /&gt;
display(&#039;------------------------------------------------------------------&#039;)&lt;br /&gt;
display(&#039;               SOLVER Loop&#039;                                    )&lt;br /&gt;
display(&#039;------------------------------------------------------------------&#039;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
for i=1:20&lt;br /&gt;
    tic&lt;br /&gt;
    % Solve NMPC OCP&lt;br /&gt;
    output = acado_MPCstep(input);&lt;br /&gt;
    &lt;br /&gt;
    input.x=output.x;&lt;br /&gt;
    input.u=output.u;&lt;br /&gt;
&lt;br /&gt;
    disp([&#039; (RTI step: &#039; num2str(output.info.cpuTime*1e6) &#039; µs)&#039;])&lt;br /&gt;
&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
%% PLOT RESULTS&lt;br /&gt;
&lt;br /&gt;
t_end = 12;&lt;br /&gt;
&lt;br /&gt;
% States&lt;br /&gt;
figure(1)&lt;br /&gt;
plot([0:t_end/N:t_end],output.x)&lt;br /&gt;
ylabel(&#039;States&#039;)&lt;br /&gt;
xlabel(&#039;Time&#039;)&lt;br /&gt;
legend(&#039;x1&#039;,&#039;x2&#039;)&lt;br /&gt;
&lt;br /&gt;
% Control&lt;br /&gt;
figure(2)&lt;br /&gt;
plot([0:t_end/N:t_end-t_end/N],output.u)&lt;br /&gt;
ylabel(&#039;Control (u)&#039;)&lt;br /&gt;
xlabel(&#039;Time&#039;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>TobiasWeber</name></author>
	</entry>
	<entry>
		<id>https://mintoc.de/index.php?title=Bioreactor&amp;diff=1071</id>
		<title>Bioreactor</title>
		<link rel="alternate" type="text/html" href="https://mintoc.de/index.php?title=Bioreactor&amp;diff=1071"/>
		<updated>2015-12-16T08:23:44Z</updated>

		<summary type="html">&lt;p&gt;TobiasWeber: /* Source Code */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The bioreactor problem describes an substrate that is converted to a product by the biomass in the reactor. It has three states and a control that is describing the feed concentration of the substrate. The problem is taken from the examples folder of the ACADO toolkit described in:&lt;br /&gt;
&lt;br /&gt;
 Houska, Boris, Hans Joachim Ferreau, and Moritz Diehl. &amp;quot;ACADO toolkit—An open‐source framework for automatic control and dynamic optimization.&amp;quot;&lt;br /&gt;
 Optimal Control Applications and Methods 32.3 (2011): 298-312.&lt;br /&gt;
&lt;br /&gt;
Originally the problem seems to be motivated by:&lt;br /&gt;
&lt;br /&gt;
 VERSYCK, KARINA J., and JAN F. VAN IMPE. &amp;quot;Feed rate optimization for fed-batch bioreactors: From optimal process performance to optimal parameter estimation.&amp;quot;&lt;br /&gt;
 Chemical Engineering Communications 172.1 (1999): 107-124.&lt;br /&gt;
&lt;br /&gt;
== Model Formulation ==&lt;br /&gt;
&lt;br /&gt;
The dynamic model is an [[:Category:ODE model|ODE model]]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{rcl}&lt;br /&gt;
\dot{X}&amp;amp;=&amp;amp;-DX+\mu X \\&lt;br /&gt;
\dot{S}&amp;amp;=&amp;amp; D(S_{f}-S)-\mu /Y_{xs} X \\&lt;br /&gt;
\dot{P}&amp;amp;=&amp;amp;-DP+ (\alpha \mu +\beta) X.&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The three states describe the concentration of the biomass (&amp;lt;math&amp;gt;X&amp;lt;/math&amp;gt;), the substrate (&amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt;), and the product (&amp;lt;math&amp;gt;P&amp;lt;/math&amp;gt;) in the reactor. In steady state the feed and outlet are equal and dilute all three concentrations with a ratio &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;. The biomass grows with a rate&lt;br /&gt;
&amp;lt;math&amp;gt;\mu&amp;lt;/math&amp;gt;, while it eats up the substrate with the rate &amp;lt;math&amp;gt;\mu/Y_{xs}&amp;lt;/math&amp;gt; and produces product at a rate &amp;lt;math&amp;gt;(\alpha \mu +\beta)&amp;lt;/math&amp;gt;. The rate &amp;lt;math&amp;gt;\mu&amp;lt;/math&amp;gt; is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mu = \mu_{m}*(1-P/P_{m})*S/(K_m+S+S^2/K_i)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The fixed parameters (constants) of the model are as follows.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+Parameters&lt;br /&gt;
|-&lt;br /&gt;
|Name&lt;br /&gt;
|Symbol&lt;br /&gt;
|Value&lt;br /&gt;
|Unit&lt;br /&gt;
|-&lt;br /&gt;
|Dilution&lt;br /&gt;
|&amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.15&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Rate coefficient&lt;br /&gt;
|&amp;lt;math&amp;gt;K_i&amp;lt;/math&amp;gt;&lt;br /&gt;
|22&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Rate coefficient&lt;br /&gt;
|&amp;lt;math&amp;gt;K_m&amp;lt;/math&amp;gt;&lt;br /&gt;
|1.2&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Rate coefficient&lt;br /&gt;
|&amp;lt;math&amp;gt;P_m&amp;lt;/math&amp;gt;&lt;br /&gt;
|50&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Substrate to Biomass rate&lt;br /&gt;
|&amp;lt;math&amp;gt;Y_{xs}&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.4&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Linear slope&lt;br /&gt;
|&amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt;&lt;br /&gt;
|2.2&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Linear intercept&lt;br /&gt;
|&amp;lt;math&amp;gt;\beta&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.2&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Maximal growth rate&lt;br /&gt;
|&amp;lt;math&amp;gt;\mu_m&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.48&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Optimal Control Problem ==&lt;br /&gt;
&lt;br /&gt;
Writing shortly for the states in vector notation &amp;lt;math&amp;gt;x=(X,S,P)^T&amp;lt;/math&amp;gt; the OCP reads:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{cl}&lt;br /&gt;
 \displaystyle \min_{x,S_f} &amp;amp; J(x,S_f)\\[1.5ex]&lt;br /&gt;
 \mbox{s.t.} &amp;amp; \dot{x}  =  f(x,S_f), \forall \, t \in [0,48]\\&lt;br /&gt;
 &amp;amp; x(0) = (6.5,12,22)^T \\&lt;br /&gt;
 &amp;amp; x \in \R^3,\,S_f \in [28.7,40].&lt;br /&gt;
\end{array} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Objective ===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
J(x,S_f)=\int_0^{48}D(S_f-P)^2dt&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Reference Solution ==&lt;br /&gt;
&lt;br /&gt;
Here we present the reference solution of the reimplemented example in the ACADO code generation with matlab. The source code is given in the next section.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;Reference solution&amp;quot; widths=&amp;quot;551px&amp;quot; heights=&amp;quot;390px&amp;quot; perrow=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
 Image:ACADO_bioreactor.png| Optimal solution for the ACADO example.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Source Code ==&lt;br /&gt;
&lt;br /&gt;
This is the implementation of the ACADO bioreactor example with the matlab interface and the code generation of ACADO.&lt;br /&gt;
&lt;br /&gt;
 % implements the bioreactor example of ACADO for the matlab interface and&lt;br /&gt;
 % the code generation&lt;br /&gt;
 &lt;br /&gt;
 clc;&lt;br /&gt;
 clear all;&lt;br /&gt;
 close all;&lt;br /&gt;
 &lt;br /&gt;
 Ts = 0.1;&lt;br /&gt;
 EXPORT = 1;&lt;br /&gt;
 &lt;br /&gt;
 %% Variables&lt;br /&gt;
 DifferentialState X S P;&lt;br /&gt;
 Control Sf;&lt;br /&gt;
 &lt;br /&gt;
 n_XD = length(diffStates);&lt;br /&gt;
 n_U = length(controls);&lt;br /&gt;
 &lt;br /&gt;
 %% Constants&lt;br /&gt;
 D       = 0.15;&lt;br /&gt;
 Ki      = 22.0;&lt;br /&gt;
 Km      = 1.2 ; &lt;br /&gt;
 Pm      = 50.0;&lt;br /&gt;
 Yxs     = 0.4 ;&lt;br /&gt;
 alpha   = 2.2 ;&lt;br /&gt;
 beta    = 0.2 ;&lt;br /&gt;
 mum     = 0.48;&lt;br /&gt;
 Sfmin   = 28.7;&lt;br /&gt;
 Sfmax   = 40.0;&lt;br /&gt;
 t_start =  0.0;&lt;br /&gt;
 t_end   = 48.0;&lt;br /&gt;
 N = 20;&lt;br /&gt;
 &lt;br /&gt;
 %% Differential Equation&lt;br /&gt;
 mu = mum*(1-P/Pm)*S/(Km+S+S^2/Ki);&lt;br /&gt;
 &lt;br /&gt;
 f = dot([X;S;P]) == [-D*X+mu*X;...&lt;br /&gt;
                       D*(Sf-S)-(mu/Yxs)*X;...&lt;br /&gt;
 		             -D*P+(alpha*mu+beta)*X];&lt;br /&gt;
 &lt;br /&gt;
 % output&lt;br /&gt;
 h = P-Sf;&lt;br /&gt;
 hN = P;&lt;br /&gt;
 &lt;br /&gt;
 %% MPCexport&lt;br /&gt;
 acadoSet(&#039;problemname&#039;, &#039;mpc&#039;);&lt;br /&gt;
 &lt;br /&gt;
 ocp = acado.OCP( t_start, t_end, N );&lt;br /&gt;
 &lt;br /&gt;
 W_mat = D;&lt;br /&gt;
 WN_mat = D;&lt;br /&gt;
 W = acado.BMatrix(W_mat);&lt;br /&gt;
 WN = acado.BMatrix(WN_mat);&lt;br /&gt;
 &lt;br /&gt;
 ocp.minimizeLSQ( W, h );&lt;br /&gt;
 ocp.minimizeLSQEndTerm( WN, hN );&lt;br /&gt;
 &lt;br /&gt;
 ocp.subjectTo( Sfmin &amp;lt;= Sf &amp;lt;= Sfmax );&lt;br /&gt;
 ocp.setModel(f);&lt;br /&gt;
 &lt;br /&gt;
 mpc = acado.OCPexport( ocp );&lt;br /&gt;
 mpc.set( &#039;HESSIAN_APPROXIMATION&#039;,       &#039;GAUSS_NEWTON&#039;      );&lt;br /&gt;
 mpc.set( &#039;DISCRETIZATION_TYPE&#039;,         &#039;MULTIPLE_SHOOTING&#039; );&lt;br /&gt;
 mpc.set( &#039;SPARSE_QP_SOLUTION&#039;,          &#039;FULL_CONDENSING_N2&#039;);&lt;br /&gt;
 mpc.set( &#039;INTEGRATOR_TYPE&#039;,             &#039;INT_IRK_GL4&#039;       );&lt;br /&gt;
 mpc.set( &#039;NUM_INTEGRATOR_STEPS&#039;,        10*N                 );&lt;br /&gt;
 mpc.set( &#039;QP_SOLVER&#039;,                   &#039;QP_QPOASES&#039;    	);&lt;br /&gt;
 mpc.set( &#039;HOTSTART_QP&#039;,                 &#039;NO&#039;             	);&lt;br /&gt;
 mpc.set( &#039;LEVENBERG_MARQUARDT&#039;, 		 1e-10				);&lt;br /&gt;
 &lt;br /&gt;
 if EXPORT&lt;br /&gt;
     mpc.exportCode( &#039;export_MPC&#039; );&lt;br /&gt;
     copyfile(&#039;../../../../../../external_packages/qpoases&#039;, &#039;export_MPC/qpoases&#039;)&lt;br /&gt;
     &lt;br /&gt;
     cd export_MPC&lt;br /&gt;
     make_acado_solver(&#039;../acado_MPCstep&#039;)&lt;br /&gt;
     cd ..&lt;br /&gt;
 end&lt;br /&gt;
 &lt;br /&gt;
 %% CONSTANTS FOR OPTIMIZATION&lt;br /&gt;
 X0 = [6.5 12.0 22.0];&lt;br /&gt;
 input.x0=X0&#039;;&lt;br /&gt;
 Xref = [0 0 0];&lt;br /&gt;
 input.x = repmat(Xref,N+1,1);&lt;br /&gt;
 Xref = repmat(Xref,N,1);&lt;br /&gt;
 input.od = [];&lt;br /&gt;
 &lt;br /&gt;
 Uref = zeros(N,n_U);&lt;br /&gt;
 input.u = Uref;&lt;br /&gt;
 &lt;br /&gt;
 input.y = 0*ones(N,1);&lt;br /&gt;
 input.yN = 0;&lt;br /&gt;
 &lt;br /&gt;
 input.W = D;&lt;br /&gt;
 input.WN = D;&lt;br /&gt;
 &lt;br /&gt;
 %% SOLVER LOOP (SQP - Gauss newton)&lt;br /&gt;
 display(&#039;------------------------------------------------------------------&#039;)&lt;br /&gt;
 display(&#039;               SOLVER Loop&#039;                                    )&lt;br /&gt;
 display(&#039;------------------------------------------------------------------&#039;)&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 for i=1:20&lt;br /&gt;
     tic&lt;br /&gt;
     % Solve NMPC OCP&lt;br /&gt;
     output = acado_MPCstep(input);&lt;br /&gt;
     &lt;br /&gt;
     input.x=output.x;&lt;br /&gt;
     input.u=output.u;&lt;br /&gt;
 &lt;br /&gt;
     disp([&#039; (RTI step: &#039; num2str(output.info.cpuTime*1e6) &#039; µs)&#039;])&lt;br /&gt;
 &lt;br /&gt;
 end&lt;br /&gt;
 &lt;br /&gt;
 %% PLOT RESULTS&lt;br /&gt;
 &lt;br /&gt;
 % States&lt;br /&gt;
 figure(1)&lt;br /&gt;
 plot([t_start:t_end/N:t_end],output.x)&lt;br /&gt;
 ylabel(&#039;States&#039;)&lt;br /&gt;
 xlabel(&#039;Time&#039;)&lt;br /&gt;
 legend(&#039;X&#039;,&#039;S&#039;,&#039;P&#039;)&lt;br /&gt;
 &lt;br /&gt;
 % Control&lt;br /&gt;
 figure(2)&lt;br /&gt;
 plot([t_start:t_end/N:t_end-t_end/N],output.u)&lt;br /&gt;
 ylabel(&#039;Control (Sf)&#039;)&lt;br /&gt;
 xlabel(&#039;Time&#039;)&lt;br /&gt;
 &lt;br /&gt;
 % one figure for all&lt;br /&gt;
 figure(3)&lt;br /&gt;
 subplot(2,2,1)&lt;br /&gt;
 plot([t_start:t_end/N:t_end],output.x(:,1))&lt;br /&gt;
 ylabel(&#039;X&#039;)&lt;br /&gt;
 xlabel(&#039;Time&#039;)&lt;br /&gt;
 subplot(2,2,2)&lt;br /&gt;
 plot([t_start:t_end/N:t_end],output.x(:,2))&lt;br /&gt;
 ylabel(&#039;S&#039;)&lt;br /&gt;
 xlabel(&#039;Time&#039;)&lt;br /&gt;
 subplot(2,2,3)&lt;br /&gt;
 plot([t_start:t_end/N:t_end],output.x(:,3))&lt;br /&gt;
 ylabel(&#039;P&#039;)&lt;br /&gt;
 xlabel(&#039;Time&#039;)&lt;br /&gt;
 subplot(2,2,4)&lt;br /&gt;
 plot([t_start:t_end/N:t_end-t_end/N],output.u)&lt;br /&gt;
 ylabel(&#039;Sf&#039;)&lt;br /&gt;
 xlabel(&#039;Time&#039;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--List of all categories this page is part of. List characterization of solution behavior, model properties, ore presence of implementation details (e.g., AMPL for AMPL model) here --&amp;gt;&lt;br /&gt;
[[Category:ACADO]]&lt;/div&gt;</summary>
		<author><name>TobiasWeber</name></author>
	</entry>
	<entry>
		<id>https://mintoc.de/index.php?title=Bioreactor&amp;diff=1070</id>
		<title>Bioreactor</title>
		<link rel="alternate" type="text/html" href="https://mintoc.de/index.php?title=Bioreactor&amp;diff=1070"/>
		<updated>2015-12-16T08:23:05Z</updated>

		<summary type="html">&lt;p&gt;TobiasWeber: /* Reference Solution */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The bioreactor problem describes an substrate that is converted to a product by the biomass in the reactor. It has three states and a control that is describing the feed concentration of the substrate. The problem is taken from the examples folder of the ACADO toolkit described in:&lt;br /&gt;
&lt;br /&gt;
 Houska, Boris, Hans Joachim Ferreau, and Moritz Diehl. &amp;quot;ACADO toolkit—An open‐source framework for automatic control and dynamic optimization.&amp;quot;&lt;br /&gt;
 Optimal Control Applications and Methods 32.3 (2011): 298-312.&lt;br /&gt;
&lt;br /&gt;
Originally the problem seems to be motivated by:&lt;br /&gt;
&lt;br /&gt;
 VERSYCK, KARINA J., and JAN F. VAN IMPE. &amp;quot;Feed rate optimization for fed-batch bioreactors: From optimal process performance to optimal parameter estimation.&amp;quot;&lt;br /&gt;
 Chemical Engineering Communications 172.1 (1999): 107-124.&lt;br /&gt;
&lt;br /&gt;
== Model Formulation ==&lt;br /&gt;
&lt;br /&gt;
The dynamic model is an [[:Category:ODE model|ODE model]]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{rcl}&lt;br /&gt;
\dot{X}&amp;amp;=&amp;amp;-DX+\mu X \\&lt;br /&gt;
\dot{S}&amp;amp;=&amp;amp; D(S_{f}-S)-\mu /Y_{xs} X \\&lt;br /&gt;
\dot{P}&amp;amp;=&amp;amp;-DP+ (\alpha \mu +\beta) X.&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The three states describe the concentration of the biomass (&amp;lt;math&amp;gt;X&amp;lt;/math&amp;gt;), the substrate (&amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt;), and the product (&amp;lt;math&amp;gt;P&amp;lt;/math&amp;gt;) in the reactor. In steady state the feed and outlet are equal and dilute all three concentrations with a ratio &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;. The biomass grows with a rate&lt;br /&gt;
&amp;lt;math&amp;gt;\mu&amp;lt;/math&amp;gt;, while it eats up the substrate with the rate &amp;lt;math&amp;gt;\mu/Y_{xs}&amp;lt;/math&amp;gt; and produces product at a rate &amp;lt;math&amp;gt;(\alpha \mu +\beta)&amp;lt;/math&amp;gt;. The rate &amp;lt;math&amp;gt;\mu&amp;lt;/math&amp;gt; is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mu = \mu_{m}*(1-P/P_{m})*S/(K_m+S+S^2/K_i)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The fixed parameters (constants) of the model are as follows.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+Parameters&lt;br /&gt;
|-&lt;br /&gt;
|Name&lt;br /&gt;
|Symbol&lt;br /&gt;
|Value&lt;br /&gt;
|Unit&lt;br /&gt;
|-&lt;br /&gt;
|Dilution&lt;br /&gt;
|&amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.15&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Rate coefficient&lt;br /&gt;
|&amp;lt;math&amp;gt;K_i&amp;lt;/math&amp;gt;&lt;br /&gt;
|22&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Rate coefficient&lt;br /&gt;
|&amp;lt;math&amp;gt;K_m&amp;lt;/math&amp;gt;&lt;br /&gt;
|1.2&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Rate coefficient&lt;br /&gt;
|&amp;lt;math&amp;gt;P_m&amp;lt;/math&amp;gt;&lt;br /&gt;
|50&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Substrate to Biomass rate&lt;br /&gt;
|&amp;lt;math&amp;gt;Y_{xs}&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.4&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Linear slope&lt;br /&gt;
|&amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt;&lt;br /&gt;
|2.2&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Linear intercept&lt;br /&gt;
|&amp;lt;math&amp;gt;\beta&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.2&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Maximal growth rate&lt;br /&gt;
|&amp;lt;math&amp;gt;\mu_m&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.48&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Optimal Control Problem ==&lt;br /&gt;
&lt;br /&gt;
Writing shortly for the states in vector notation &amp;lt;math&amp;gt;x=(X,S,P)^T&amp;lt;/math&amp;gt; the OCP reads:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{cl}&lt;br /&gt;
 \displaystyle \min_{x,S_f} &amp;amp; J(x,S_f)\\[1.5ex]&lt;br /&gt;
 \mbox{s.t.} &amp;amp; \dot{x}  =  f(x,S_f), \forall \, t \in [0,48]\\&lt;br /&gt;
 &amp;amp; x(0) = (6.5,12,22)^T \\&lt;br /&gt;
 &amp;amp; x \in \R^3,\,S_f \in [28.7,40].&lt;br /&gt;
\end{array} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Objective ===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
J(x,S_f)=\int_0^{48}D(S_f-P)^2dt&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Reference Solution ==&lt;br /&gt;
&lt;br /&gt;
Here we present the reference solution of the reimplemented example in the ACADO code generation with matlab. The source code is given in the next section.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;Reference solution&amp;quot; widths=&amp;quot;551px&amp;quot; heights=&amp;quot;390px&amp;quot; perrow=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
 Image:ACADO_bioreactor.png| Optimal solution for the ACADO example.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Source Code ==&lt;br /&gt;
&lt;br /&gt;
This is the implementation of the ACADO bioreactor example with the matlab interface and the code generation of ACADO.&lt;br /&gt;
&lt;br /&gt;
 % implements the bioreactor example of ACADO for the matlab interface and&lt;br /&gt;
 % the code generation&lt;br /&gt;
 &lt;br /&gt;
 clc;&lt;br /&gt;
 clear all;&lt;br /&gt;
 close all;&lt;br /&gt;
 &lt;br /&gt;
 Ts = 0.1;&lt;br /&gt;
 EXPORT = 1;&lt;br /&gt;
 &lt;br /&gt;
 %% Variables&lt;br /&gt;
 DifferentialState X S P;&lt;br /&gt;
 Control Sf;&lt;br /&gt;
 &lt;br /&gt;
 n_XD = length(diffStates);&lt;br /&gt;
 n_U = length(controls);&lt;br /&gt;
 &lt;br /&gt;
 %% Constants&lt;br /&gt;
 D       = 0.15;&lt;br /&gt;
 Ki      = 22.0;&lt;br /&gt;
 Km      = 1.2 ; &lt;br /&gt;
 Pm      = 50.0;&lt;br /&gt;
 Yxs     = 0.4 ;&lt;br /&gt;
 alpha   = 2.2 ;&lt;br /&gt;
 beta    = 0.2 ;&lt;br /&gt;
 mum     = 0.48;&lt;br /&gt;
 Sfmin   = 28.7;&lt;br /&gt;
 Sfmax   = 40.0;&lt;br /&gt;
 t_start =  0.0;&lt;br /&gt;
 t_end   = 48.0;&lt;br /&gt;
 N = 20;&lt;br /&gt;
 &lt;br /&gt;
 %% Differential Equation&lt;br /&gt;
 mu = mum*(1-P/Pm)*S/(Km+S+S^2/Ki);&lt;br /&gt;
 &lt;br /&gt;
 f = dot([X;S;P]) == [-D*X+mu*X;...&lt;br /&gt;
                       D*(Sf-S)-(mu/Yxs)*X;...&lt;br /&gt;
 		             -D*P+(alpha*mu+beta)*X];&lt;br /&gt;
 &lt;br /&gt;
 % output&lt;br /&gt;
 h = P-Sf;&lt;br /&gt;
 hN = P;&lt;br /&gt;
 &lt;br /&gt;
 %% MPCexport&lt;br /&gt;
 acadoSet(&#039;problemname&#039;, &#039;mpc&#039;);&lt;br /&gt;
 &lt;br /&gt;
 ocp = acado.OCP( t_start, t_end, N );&lt;br /&gt;
 &lt;br /&gt;
 W_mat = D;&lt;br /&gt;
 WN_mat = D;&lt;br /&gt;
 W = acado.BMatrix(W_mat);&lt;br /&gt;
 WN = acado.BMatrix(WN_mat);&lt;br /&gt;
 &lt;br /&gt;
 ocp.minimizeLSQ( W, h );&lt;br /&gt;
 ocp.minimizeLSQEndTerm( WN, hN );&lt;br /&gt;
 &lt;br /&gt;
 ocp.subjectTo( Sfmin &amp;lt;= Sf &amp;lt;= Sfmax );&lt;br /&gt;
 ocp.setModel(f);&lt;br /&gt;
 &lt;br /&gt;
 mpc = acado.OCPexport( ocp );&lt;br /&gt;
 mpc.set( &#039;HESSIAN_APPROXIMATION&#039;,       &#039;GAUSS_NEWTON&#039;      );&lt;br /&gt;
 mpc.set( &#039;DISCRETIZATION_TYPE&#039;,         &#039;MULTIPLE_SHOOTING&#039; );&lt;br /&gt;
 mpc.set( &#039;SPARSE_QP_SOLUTION&#039;,          &#039;FULL_CONDENSING_N2&#039;);&lt;br /&gt;
 mpc.set( &#039;INTEGRATOR_TYPE&#039;,             &#039;INT_IRK_GL4&#039;       );&lt;br /&gt;
 mpc.set( &#039;NUM_INTEGRATOR_STEPS&#039;,        10*N                 );&lt;br /&gt;
 mpc.set( &#039;QP_SOLVER&#039;,                   &#039;QP_QPOASES&#039;    	);&lt;br /&gt;
 mpc.set( &#039;HOTSTART_QP&#039;,                 &#039;NO&#039;             	);&lt;br /&gt;
 mpc.set( &#039;LEVENBERG_MARQUARDT&#039;, 		 1e-10				);&lt;br /&gt;
 &lt;br /&gt;
 if EXPORT&lt;br /&gt;
     mpc.exportCode( &#039;export_MPC&#039; );&lt;br /&gt;
     copyfile(&#039;../../../../../../external_packages/qpoases&#039;, &#039;export_MPC/qpoases&#039;)&lt;br /&gt;
     &lt;br /&gt;
     cd export_MPC&lt;br /&gt;
     make_acado_solver(&#039;../acado_MPCstep&#039;)&lt;br /&gt;
     cd ..&lt;br /&gt;
 end&lt;br /&gt;
 &lt;br /&gt;
 %% CONSTANTS FOR OPTIMIZATION&lt;br /&gt;
 X0 = [6.5 12.0 22.0];&lt;br /&gt;
 input.x0=X0&#039;;&lt;br /&gt;
 Xref = [0 0 0];&lt;br /&gt;
 input.x = repmat(Xref,N+1,1);&lt;br /&gt;
 Xref = repmat(Xref,N,1);&lt;br /&gt;
 input.od = [];&lt;br /&gt;
 &lt;br /&gt;
 Uref = zeros(N,n_U);&lt;br /&gt;
 input.u = Uref;&lt;br /&gt;
 &lt;br /&gt;
 input.y = Sfmin*ones(N,1);&lt;br /&gt;
 input.yN = Sfmin;&lt;br /&gt;
 &lt;br /&gt;
 input.W = 1;&lt;br /&gt;
 input.WN = 1;&lt;br /&gt;
 &lt;br /&gt;
 %% SOLVER LOOP (SQP - Gauss newton)&lt;br /&gt;
 display(&#039;------------------------------------------------------------------&#039;)&lt;br /&gt;
 display(&#039;               SOLVER Loop&#039;                                    )&lt;br /&gt;
 display(&#039;------------------------------------------------------------------&#039;)&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 for i=1:20&lt;br /&gt;
     tic&lt;br /&gt;
     % Solve NMPC OCP&lt;br /&gt;
     output = acado_MPCstep(input);&lt;br /&gt;
     &lt;br /&gt;
     input.x=output.x;&lt;br /&gt;
     input.u=output.u;&lt;br /&gt;
 &lt;br /&gt;
     disp([&#039; (RTI step: &#039; num2str(output.info.cpuTime*1e6) &#039; µs)&#039;])&lt;br /&gt;
 &lt;br /&gt;
 end&lt;br /&gt;
 &lt;br /&gt;
 %% PLOT RESULTS&lt;br /&gt;
 &lt;br /&gt;
 % States&lt;br /&gt;
 figure(1)&lt;br /&gt;
 plot([t_start:t_end/N:t_end],output.x)&lt;br /&gt;
 ylabel(&#039;States&#039;)&lt;br /&gt;
 xlabel(&#039;Time&#039;)&lt;br /&gt;
 legend(&#039;X&#039;,&#039;S&#039;,&#039;P&#039;)&lt;br /&gt;
 &lt;br /&gt;
 % Control&lt;br /&gt;
 figure(2)&lt;br /&gt;
 plot([t_start:t_end/N:t_end-t_end/N],output.u)&lt;br /&gt;
 ylabel(&#039;Control (Sf)&#039;)&lt;br /&gt;
 xlabel(&#039;Time&#039;)&lt;br /&gt;
 &lt;br /&gt;
 % one figure for all&lt;br /&gt;
 figure(3)&lt;br /&gt;
 subplot(2,2,1)&lt;br /&gt;
 plot([t_start:t_end/N:t_end],output.x(:,1))&lt;br /&gt;
 ylabel(&#039;X&#039;)&lt;br /&gt;
 xlabel(&#039;Time&#039;)&lt;br /&gt;
 subplot(2,2,2)&lt;br /&gt;
 plot([t_start:t_end/N:t_end],output.x(:,2))&lt;br /&gt;
 ylabel(&#039;S&#039;)&lt;br /&gt;
 xlabel(&#039;Time&#039;)&lt;br /&gt;
 subplot(2,2,3)&lt;br /&gt;
 plot([t_start:t_end/N:t_end],output.x(:,3))&lt;br /&gt;
 ylabel(&#039;P&#039;)&lt;br /&gt;
 xlabel(&#039;Time&#039;)&lt;br /&gt;
 subplot(2,2,4)&lt;br /&gt;
 plot([t_start:t_end/N:t_end-t_end/N],output.u)&lt;br /&gt;
 ylabel(&#039;Sf&#039;)&lt;br /&gt;
 xlabel(&#039;Time&#039;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--List of all categories this page is part of. List characterization of solution behavior, model properties, ore presence of implementation details (e.g., AMPL for AMPL model) here --&amp;gt;&lt;br /&gt;
[[Category:ACADO]]&lt;/div&gt;</summary>
		<author><name>TobiasWeber</name></author>
	</entry>
	<entry>
		<id>https://mintoc.de/index.php?title=Bioreactor&amp;diff=1069</id>
		<title>Bioreactor</title>
		<link rel="alternate" type="text/html" href="https://mintoc.de/index.php?title=Bioreactor&amp;diff=1069"/>
		<updated>2015-12-16T08:21:51Z</updated>

		<summary type="html">&lt;p&gt;TobiasWeber: /* Reference Solution */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The bioreactor problem describes an substrate that is converted to a product by the biomass in the reactor. It has three states and a control that is describing the feed concentration of the substrate. The problem is taken from the examples folder of the ACADO toolkit described in:&lt;br /&gt;
&lt;br /&gt;
 Houska, Boris, Hans Joachim Ferreau, and Moritz Diehl. &amp;quot;ACADO toolkit—An open‐source framework for automatic control and dynamic optimization.&amp;quot;&lt;br /&gt;
 Optimal Control Applications and Methods 32.3 (2011): 298-312.&lt;br /&gt;
&lt;br /&gt;
Originally the problem seems to be motivated by:&lt;br /&gt;
&lt;br /&gt;
 VERSYCK, KARINA J., and JAN F. VAN IMPE. &amp;quot;Feed rate optimization for fed-batch bioreactors: From optimal process performance to optimal parameter estimation.&amp;quot;&lt;br /&gt;
 Chemical Engineering Communications 172.1 (1999): 107-124.&lt;br /&gt;
&lt;br /&gt;
== Model Formulation ==&lt;br /&gt;
&lt;br /&gt;
The dynamic model is an [[:Category:ODE model|ODE model]]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{rcl}&lt;br /&gt;
\dot{X}&amp;amp;=&amp;amp;-DX+\mu X \\&lt;br /&gt;
\dot{S}&amp;amp;=&amp;amp; D(S_{f}-S)-\mu /Y_{xs} X \\&lt;br /&gt;
\dot{P}&amp;amp;=&amp;amp;-DP+ (\alpha \mu +\beta) X.&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The three states describe the concentration of the biomass (&amp;lt;math&amp;gt;X&amp;lt;/math&amp;gt;), the substrate (&amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt;), and the product (&amp;lt;math&amp;gt;P&amp;lt;/math&amp;gt;) in the reactor. In steady state the feed and outlet are equal and dilute all three concentrations with a ratio &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;. The biomass grows with a rate&lt;br /&gt;
&amp;lt;math&amp;gt;\mu&amp;lt;/math&amp;gt;, while it eats up the substrate with the rate &amp;lt;math&amp;gt;\mu/Y_{xs}&amp;lt;/math&amp;gt; and produces product at a rate &amp;lt;math&amp;gt;(\alpha \mu +\beta)&amp;lt;/math&amp;gt;. The rate &amp;lt;math&amp;gt;\mu&amp;lt;/math&amp;gt; is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mu = \mu_{m}*(1-P/P_{m})*S/(K_m+S+S^2/K_i)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The fixed parameters (constants) of the model are as follows.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+Parameters&lt;br /&gt;
|-&lt;br /&gt;
|Name&lt;br /&gt;
|Symbol&lt;br /&gt;
|Value&lt;br /&gt;
|Unit&lt;br /&gt;
|-&lt;br /&gt;
|Dilution&lt;br /&gt;
|&amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.15&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Rate coefficient&lt;br /&gt;
|&amp;lt;math&amp;gt;K_i&amp;lt;/math&amp;gt;&lt;br /&gt;
|22&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Rate coefficient&lt;br /&gt;
|&amp;lt;math&amp;gt;K_m&amp;lt;/math&amp;gt;&lt;br /&gt;
|1.2&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Rate coefficient&lt;br /&gt;
|&amp;lt;math&amp;gt;P_m&amp;lt;/math&amp;gt;&lt;br /&gt;
|50&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Substrate to Biomass rate&lt;br /&gt;
|&amp;lt;math&amp;gt;Y_{xs}&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.4&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Linear slope&lt;br /&gt;
|&amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt;&lt;br /&gt;
|2.2&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Linear intercept&lt;br /&gt;
|&amp;lt;math&amp;gt;\beta&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.2&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Maximal growth rate&lt;br /&gt;
|&amp;lt;math&amp;gt;\mu_m&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.48&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Optimal Control Problem ==&lt;br /&gt;
&lt;br /&gt;
Writing shortly for the states in vector notation &amp;lt;math&amp;gt;x=(X,S,P)^T&amp;lt;/math&amp;gt; the OCP reads:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{cl}&lt;br /&gt;
 \displaystyle \min_{x,S_f} &amp;amp; J(x,S_f)\\[1.5ex]&lt;br /&gt;
 \mbox{s.t.} &amp;amp; \dot{x}  =  f(x,S_f), \forall \, t \in [0,48]\\&lt;br /&gt;
 &amp;amp; x(0) = (6.5,12,22)^T \\&lt;br /&gt;
 &amp;amp; x \in \R^3,\,S_f \in [28.7,40].&lt;br /&gt;
\end{array} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Objective ===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
J(x,S_f)=\int_0^{48}D(S_f-P)^2dt&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Reference Solution ==&lt;br /&gt;
&lt;br /&gt;
Here we present the reference solution of the reimplemented example in the ACADO code generation with matlab. The source code is given in the next section. The system was a 64-bit&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;Reference solution&amp;quot; widths=&amp;quot;551px&amp;quot; heights=&amp;quot;390px&amp;quot; perrow=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
 Image:ACADO_bioreactor.png| Optimal solution for the ACADO example.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Source Code ==&lt;br /&gt;
&lt;br /&gt;
This is the implementation of the ACADO bioreactor example with the matlab interface and the code generation of ACADO.&lt;br /&gt;
&lt;br /&gt;
 % implements the bioreactor example of ACADO for the matlab interface and&lt;br /&gt;
 % the code generation&lt;br /&gt;
 &lt;br /&gt;
 clc;&lt;br /&gt;
 clear all;&lt;br /&gt;
 close all;&lt;br /&gt;
 &lt;br /&gt;
 Ts = 0.1;&lt;br /&gt;
 EXPORT = 1;&lt;br /&gt;
 &lt;br /&gt;
 %% Variables&lt;br /&gt;
 DifferentialState X S P;&lt;br /&gt;
 Control Sf;&lt;br /&gt;
 &lt;br /&gt;
 n_XD = length(diffStates);&lt;br /&gt;
 n_U = length(controls);&lt;br /&gt;
 &lt;br /&gt;
 %% Constants&lt;br /&gt;
 D       = 0.15;&lt;br /&gt;
 Ki      = 22.0;&lt;br /&gt;
 Km      = 1.2 ; &lt;br /&gt;
 Pm      = 50.0;&lt;br /&gt;
 Yxs     = 0.4 ;&lt;br /&gt;
 alpha   = 2.2 ;&lt;br /&gt;
 beta    = 0.2 ;&lt;br /&gt;
 mum     = 0.48;&lt;br /&gt;
 Sfmin   = 28.7;&lt;br /&gt;
 Sfmax   = 40.0;&lt;br /&gt;
 t_start =  0.0;&lt;br /&gt;
 t_end   = 48.0;&lt;br /&gt;
 N = 20;&lt;br /&gt;
 &lt;br /&gt;
 %% Differential Equation&lt;br /&gt;
 mu = mum*(1-P/Pm)*S/(Km+S+S^2/Ki);&lt;br /&gt;
 &lt;br /&gt;
 f = dot([X;S;P]) == [-D*X+mu*X;...&lt;br /&gt;
                       D*(Sf-S)-(mu/Yxs)*X;...&lt;br /&gt;
 		             -D*P+(alpha*mu+beta)*X];&lt;br /&gt;
 &lt;br /&gt;
 % output&lt;br /&gt;
 h = P-Sf;&lt;br /&gt;
 hN = P;&lt;br /&gt;
 &lt;br /&gt;
 %% MPCexport&lt;br /&gt;
 acadoSet(&#039;problemname&#039;, &#039;mpc&#039;);&lt;br /&gt;
 &lt;br /&gt;
 ocp = acado.OCP( t_start, t_end, N );&lt;br /&gt;
 &lt;br /&gt;
 W_mat = D;&lt;br /&gt;
 WN_mat = D;&lt;br /&gt;
 W = acado.BMatrix(W_mat);&lt;br /&gt;
 WN = acado.BMatrix(WN_mat);&lt;br /&gt;
 &lt;br /&gt;
 ocp.minimizeLSQ( W, h );&lt;br /&gt;
 ocp.minimizeLSQEndTerm( WN, hN );&lt;br /&gt;
 &lt;br /&gt;
 ocp.subjectTo( Sfmin &amp;lt;= Sf &amp;lt;= Sfmax );&lt;br /&gt;
 ocp.setModel(f);&lt;br /&gt;
 &lt;br /&gt;
 mpc = acado.OCPexport( ocp );&lt;br /&gt;
 mpc.set( &#039;HESSIAN_APPROXIMATION&#039;,       &#039;GAUSS_NEWTON&#039;      );&lt;br /&gt;
 mpc.set( &#039;DISCRETIZATION_TYPE&#039;,         &#039;MULTIPLE_SHOOTING&#039; );&lt;br /&gt;
 mpc.set( &#039;SPARSE_QP_SOLUTION&#039;,          &#039;FULL_CONDENSING_N2&#039;);&lt;br /&gt;
 mpc.set( &#039;INTEGRATOR_TYPE&#039;,             &#039;INT_IRK_GL4&#039;       );&lt;br /&gt;
 mpc.set( &#039;NUM_INTEGRATOR_STEPS&#039;,        10*N                 );&lt;br /&gt;
 mpc.set( &#039;QP_SOLVER&#039;,                   &#039;QP_QPOASES&#039;    	);&lt;br /&gt;
 mpc.set( &#039;HOTSTART_QP&#039;,                 &#039;NO&#039;             	);&lt;br /&gt;
 mpc.set( &#039;LEVENBERG_MARQUARDT&#039;, 		 1e-10				);&lt;br /&gt;
 &lt;br /&gt;
 if EXPORT&lt;br /&gt;
     mpc.exportCode( &#039;export_MPC&#039; );&lt;br /&gt;
     copyfile(&#039;../../../../../../external_packages/qpoases&#039;, &#039;export_MPC/qpoases&#039;)&lt;br /&gt;
     &lt;br /&gt;
     cd export_MPC&lt;br /&gt;
     make_acado_solver(&#039;../acado_MPCstep&#039;)&lt;br /&gt;
     cd ..&lt;br /&gt;
 end&lt;br /&gt;
 &lt;br /&gt;
 %% CONSTANTS FOR OPTIMIZATION&lt;br /&gt;
 X0 = [6.5 12.0 22.0];&lt;br /&gt;
 input.x0=X0&#039;;&lt;br /&gt;
 Xref = [0 0 0];&lt;br /&gt;
 input.x = repmat(Xref,N+1,1);&lt;br /&gt;
 Xref = repmat(Xref,N,1);&lt;br /&gt;
 input.od = [];&lt;br /&gt;
 &lt;br /&gt;
 Uref = zeros(N,n_U);&lt;br /&gt;
 input.u = Uref;&lt;br /&gt;
 &lt;br /&gt;
 input.y = Sfmin*ones(N,1);&lt;br /&gt;
 input.yN = Sfmin;&lt;br /&gt;
 &lt;br /&gt;
 input.W = 1;&lt;br /&gt;
 input.WN = 1;&lt;br /&gt;
 &lt;br /&gt;
 %% SOLVER LOOP (SQP - Gauss newton)&lt;br /&gt;
 display(&#039;------------------------------------------------------------------&#039;)&lt;br /&gt;
 display(&#039;               SOLVER Loop&#039;                                    )&lt;br /&gt;
 display(&#039;------------------------------------------------------------------&#039;)&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 for i=1:20&lt;br /&gt;
     tic&lt;br /&gt;
     % Solve NMPC OCP&lt;br /&gt;
     output = acado_MPCstep(input);&lt;br /&gt;
     &lt;br /&gt;
     input.x=output.x;&lt;br /&gt;
     input.u=output.u;&lt;br /&gt;
 &lt;br /&gt;
     disp([&#039; (RTI step: &#039; num2str(output.info.cpuTime*1e6) &#039; µs)&#039;])&lt;br /&gt;
 &lt;br /&gt;
 end&lt;br /&gt;
 &lt;br /&gt;
 %% PLOT RESULTS&lt;br /&gt;
 &lt;br /&gt;
 % States&lt;br /&gt;
 figure(1)&lt;br /&gt;
 plot([t_start:t_end/N:t_end],output.x)&lt;br /&gt;
 ylabel(&#039;States&#039;)&lt;br /&gt;
 xlabel(&#039;Time&#039;)&lt;br /&gt;
 legend(&#039;X&#039;,&#039;S&#039;,&#039;P&#039;)&lt;br /&gt;
 &lt;br /&gt;
 % Control&lt;br /&gt;
 figure(2)&lt;br /&gt;
 plot([t_start:t_end/N:t_end-t_end/N],output.u)&lt;br /&gt;
 ylabel(&#039;Control (Sf)&#039;)&lt;br /&gt;
 xlabel(&#039;Time&#039;)&lt;br /&gt;
 &lt;br /&gt;
 % one figure for all&lt;br /&gt;
 figure(3)&lt;br /&gt;
 subplot(2,2,1)&lt;br /&gt;
 plot([t_start:t_end/N:t_end],output.x(:,1))&lt;br /&gt;
 ylabel(&#039;X&#039;)&lt;br /&gt;
 xlabel(&#039;Time&#039;)&lt;br /&gt;
 subplot(2,2,2)&lt;br /&gt;
 plot([t_start:t_end/N:t_end],output.x(:,2))&lt;br /&gt;
 ylabel(&#039;S&#039;)&lt;br /&gt;
 xlabel(&#039;Time&#039;)&lt;br /&gt;
 subplot(2,2,3)&lt;br /&gt;
 plot([t_start:t_end/N:t_end],output.x(:,3))&lt;br /&gt;
 ylabel(&#039;P&#039;)&lt;br /&gt;
 xlabel(&#039;Time&#039;)&lt;br /&gt;
 subplot(2,2,4)&lt;br /&gt;
 plot([t_start:t_end/N:t_end-t_end/N],output.u)&lt;br /&gt;
 ylabel(&#039;Sf&#039;)&lt;br /&gt;
 xlabel(&#039;Time&#039;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--List of all categories this page is part of. List characterization of solution behavior, model properties, ore presence of implementation details (e.g., AMPL for AMPL model) here --&amp;gt;&lt;br /&gt;
[[Category:ACADO]]&lt;/div&gt;</summary>
		<author><name>TobiasWeber</name></author>
	</entry>
	<entry>
		<id>https://mintoc.de/index.php?title=Bioreactor&amp;diff=1068</id>
		<title>Bioreactor</title>
		<link rel="alternate" type="text/html" href="https://mintoc.de/index.php?title=Bioreactor&amp;diff=1068"/>
		<updated>2015-12-16T08:19:58Z</updated>

		<summary type="html">&lt;p&gt;TobiasWeber: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The bioreactor problem describes an substrate that is converted to a product by the biomass in the reactor. It has three states and a control that is describing the feed concentration of the substrate. The problem is taken from the examples folder of the ACADO toolkit described in:&lt;br /&gt;
&lt;br /&gt;
 Houska, Boris, Hans Joachim Ferreau, and Moritz Diehl. &amp;quot;ACADO toolkit—An open‐source framework for automatic control and dynamic optimization.&amp;quot;&lt;br /&gt;
 Optimal Control Applications and Methods 32.3 (2011): 298-312.&lt;br /&gt;
&lt;br /&gt;
Originally the problem seems to be motivated by:&lt;br /&gt;
&lt;br /&gt;
 VERSYCK, KARINA J., and JAN F. VAN IMPE. &amp;quot;Feed rate optimization for fed-batch bioreactors: From optimal process performance to optimal parameter estimation.&amp;quot;&lt;br /&gt;
 Chemical Engineering Communications 172.1 (1999): 107-124.&lt;br /&gt;
&lt;br /&gt;
== Model Formulation ==&lt;br /&gt;
&lt;br /&gt;
The dynamic model is an [[:Category:ODE model|ODE model]]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{rcl}&lt;br /&gt;
\dot{X}&amp;amp;=&amp;amp;-DX+\mu X \\&lt;br /&gt;
\dot{S}&amp;amp;=&amp;amp; D(S_{f}-S)-\mu /Y_{xs} X \\&lt;br /&gt;
\dot{P}&amp;amp;=&amp;amp;-DP+ (\alpha \mu +\beta) X.&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The three states describe the concentration of the biomass (&amp;lt;math&amp;gt;X&amp;lt;/math&amp;gt;), the substrate (&amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt;), and the product (&amp;lt;math&amp;gt;P&amp;lt;/math&amp;gt;) in the reactor. In steady state the feed and outlet are equal and dilute all three concentrations with a ratio &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;. The biomass grows with a rate&lt;br /&gt;
&amp;lt;math&amp;gt;\mu&amp;lt;/math&amp;gt;, while it eats up the substrate with the rate &amp;lt;math&amp;gt;\mu/Y_{xs}&amp;lt;/math&amp;gt; and produces product at a rate &amp;lt;math&amp;gt;(\alpha \mu +\beta)&amp;lt;/math&amp;gt;. The rate &amp;lt;math&amp;gt;\mu&amp;lt;/math&amp;gt; is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mu = \mu_{m}*(1-P/P_{m})*S/(K_m+S+S^2/K_i)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The fixed parameters (constants) of the model are as follows.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+Parameters&lt;br /&gt;
|-&lt;br /&gt;
|Name&lt;br /&gt;
|Symbol&lt;br /&gt;
|Value&lt;br /&gt;
|Unit&lt;br /&gt;
|-&lt;br /&gt;
|Dilution&lt;br /&gt;
|&amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.15&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Rate coefficient&lt;br /&gt;
|&amp;lt;math&amp;gt;K_i&amp;lt;/math&amp;gt;&lt;br /&gt;
|22&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Rate coefficient&lt;br /&gt;
|&amp;lt;math&amp;gt;K_m&amp;lt;/math&amp;gt;&lt;br /&gt;
|1.2&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Rate coefficient&lt;br /&gt;
|&amp;lt;math&amp;gt;P_m&amp;lt;/math&amp;gt;&lt;br /&gt;
|50&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Substrate to Biomass rate&lt;br /&gt;
|&amp;lt;math&amp;gt;Y_{xs}&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.4&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Linear slope&lt;br /&gt;
|&amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt;&lt;br /&gt;
|2.2&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Linear intercept&lt;br /&gt;
|&amp;lt;math&amp;gt;\beta&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.2&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Maximal growth rate&lt;br /&gt;
|&amp;lt;math&amp;gt;\mu_m&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.48&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Optimal Control Problem ==&lt;br /&gt;
&lt;br /&gt;
Writing shortly for the states in vector notation &amp;lt;math&amp;gt;x=(X,S,P)^T&amp;lt;/math&amp;gt; the OCP reads:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{cl}&lt;br /&gt;
 \displaystyle \min_{x,S_f} &amp;amp; J(x,S_f)\\[1.5ex]&lt;br /&gt;
 \mbox{s.t.} &amp;amp; \dot{x}  =  f(x,S_f), \forall \, t \in [0,48]\\&lt;br /&gt;
 &amp;amp; x(0) = (6.5,12,22)^T \\&lt;br /&gt;
 &amp;amp; x \in \R^3,\,S_f \in [28.7,40].&lt;br /&gt;
\end{array} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Objective ===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
J(x,S_f)=\int_0^{48}D(S_f-P)^2dt&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Reference Solution ==&lt;br /&gt;
&lt;br /&gt;
Here we present the reference solution of the reimplemented example in the ACADO code generation with matlab. The source code is given in the next section.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;Reference solution&amp;quot; widths=&amp;quot;551px&amp;quot; heights=&amp;quot;390px&amp;quot; perrow=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
 Image:ACADO_bioreactor.png| Optimal solution for the ACADO example.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Source Code ==&lt;br /&gt;
&lt;br /&gt;
This is the implementation of the ACADO bioreactor example with the matlab interface and the code generation of ACADO.&lt;br /&gt;
&lt;br /&gt;
 % implements the bioreactor example of ACADO for the matlab interface and&lt;br /&gt;
 % the code generation&lt;br /&gt;
 &lt;br /&gt;
 clc;&lt;br /&gt;
 clear all;&lt;br /&gt;
 close all;&lt;br /&gt;
 &lt;br /&gt;
 Ts = 0.1;&lt;br /&gt;
 EXPORT = 1;&lt;br /&gt;
 &lt;br /&gt;
 %% Variables&lt;br /&gt;
 DifferentialState X S P;&lt;br /&gt;
 Control Sf;&lt;br /&gt;
 &lt;br /&gt;
 n_XD = length(diffStates);&lt;br /&gt;
 n_U = length(controls);&lt;br /&gt;
 &lt;br /&gt;
 %% Constants&lt;br /&gt;
 D       = 0.15;&lt;br /&gt;
 Ki      = 22.0;&lt;br /&gt;
 Km      = 1.2 ; &lt;br /&gt;
 Pm      = 50.0;&lt;br /&gt;
 Yxs     = 0.4 ;&lt;br /&gt;
 alpha   = 2.2 ;&lt;br /&gt;
 beta    = 0.2 ;&lt;br /&gt;
 mum     = 0.48;&lt;br /&gt;
 Sfmin   = 28.7;&lt;br /&gt;
 Sfmax   = 40.0;&lt;br /&gt;
 t_start =  0.0;&lt;br /&gt;
 t_end   = 48.0;&lt;br /&gt;
 N = 20;&lt;br /&gt;
 &lt;br /&gt;
 %% Differential Equation&lt;br /&gt;
 mu = mum*(1-P/Pm)*S/(Km+S+S^2/Ki);&lt;br /&gt;
 &lt;br /&gt;
 f = dot([X;S;P]) == [-D*X+mu*X;...&lt;br /&gt;
                       D*(Sf-S)-(mu/Yxs)*X;...&lt;br /&gt;
 		             -D*P+(alpha*mu+beta)*X];&lt;br /&gt;
 &lt;br /&gt;
 % output&lt;br /&gt;
 h = P-Sf;&lt;br /&gt;
 hN = P;&lt;br /&gt;
 &lt;br /&gt;
 %% MPCexport&lt;br /&gt;
 acadoSet(&#039;problemname&#039;, &#039;mpc&#039;);&lt;br /&gt;
 &lt;br /&gt;
 ocp = acado.OCP( t_start, t_end, N );&lt;br /&gt;
 &lt;br /&gt;
 W_mat = D;&lt;br /&gt;
 WN_mat = D;&lt;br /&gt;
 W = acado.BMatrix(W_mat);&lt;br /&gt;
 WN = acado.BMatrix(WN_mat);&lt;br /&gt;
 &lt;br /&gt;
 ocp.minimizeLSQ( W, h );&lt;br /&gt;
 ocp.minimizeLSQEndTerm( WN, hN );&lt;br /&gt;
 &lt;br /&gt;
 ocp.subjectTo( Sfmin &amp;lt;= Sf &amp;lt;= Sfmax );&lt;br /&gt;
 ocp.setModel(f);&lt;br /&gt;
 &lt;br /&gt;
 mpc = acado.OCPexport( ocp );&lt;br /&gt;
 mpc.set( &#039;HESSIAN_APPROXIMATION&#039;,       &#039;GAUSS_NEWTON&#039;      );&lt;br /&gt;
 mpc.set( &#039;DISCRETIZATION_TYPE&#039;,         &#039;MULTIPLE_SHOOTING&#039; );&lt;br /&gt;
 mpc.set( &#039;SPARSE_QP_SOLUTION&#039;,          &#039;FULL_CONDENSING_N2&#039;);&lt;br /&gt;
 mpc.set( &#039;INTEGRATOR_TYPE&#039;,             &#039;INT_IRK_GL4&#039;       );&lt;br /&gt;
 mpc.set( &#039;NUM_INTEGRATOR_STEPS&#039;,        10*N                 );&lt;br /&gt;
 mpc.set( &#039;QP_SOLVER&#039;,                   &#039;QP_QPOASES&#039;    	);&lt;br /&gt;
 mpc.set( &#039;HOTSTART_QP&#039;,                 &#039;NO&#039;             	);&lt;br /&gt;
 mpc.set( &#039;LEVENBERG_MARQUARDT&#039;, 		 1e-10				);&lt;br /&gt;
 &lt;br /&gt;
 if EXPORT&lt;br /&gt;
     mpc.exportCode( &#039;export_MPC&#039; );&lt;br /&gt;
     copyfile(&#039;../../../../../../external_packages/qpoases&#039;, &#039;export_MPC/qpoases&#039;)&lt;br /&gt;
     &lt;br /&gt;
     cd export_MPC&lt;br /&gt;
     make_acado_solver(&#039;../acado_MPCstep&#039;)&lt;br /&gt;
     cd ..&lt;br /&gt;
 end&lt;br /&gt;
 &lt;br /&gt;
 %% CONSTANTS FOR OPTIMIZATION&lt;br /&gt;
 X0 = [6.5 12.0 22.0];&lt;br /&gt;
 input.x0=X0&#039;;&lt;br /&gt;
 Xref = [0 0 0];&lt;br /&gt;
 input.x = repmat(Xref,N+1,1);&lt;br /&gt;
 Xref = repmat(Xref,N,1);&lt;br /&gt;
 input.od = [];&lt;br /&gt;
 &lt;br /&gt;
 Uref = zeros(N,n_U);&lt;br /&gt;
 input.u = Uref;&lt;br /&gt;
 &lt;br /&gt;
 input.y = Sfmin*ones(N,1);&lt;br /&gt;
 input.yN = Sfmin;&lt;br /&gt;
 &lt;br /&gt;
 input.W = 1;&lt;br /&gt;
 input.WN = 1;&lt;br /&gt;
 &lt;br /&gt;
 %% SOLVER LOOP (SQP - Gauss newton)&lt;br /&gt;
 display(&#039;------------------------------------------------------------------&#039;)&lt;br /&gt;
 display(&#039;               SOLVER Loop&#039;                                    )&lt;br /&gt;
 display(&#039;------------------------------------------------------------------&#039;)&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 for i=1:20&lt;br /&gt;
     tic&lt;br /&gt;
     % Solve NMPC OCP&lt;br /&gt;
     output = acado_MPCstep(input);&lt;br /&gt;
     &lt;br /&gt;
     input.x=output.x;&lt;br /&gt;
     input.u=output.u;&lt;br /&gt;
 &lt;br /&gt;
     disp([&#039; (RTI step: &#039; num2str(output.info.cpuTime*1e6) &#039; µs)&#039;])&lt;br /&gt;
 &lt;br /&gt;
 end&lt;br /&gt;
 &lt;br /&gt;
 %% PLOT RESULTS&lt;br /&gt;
 &lt;br /&gt;
 % States&lt;br /&gt;
 figure(1)&lt;br /&gt;
 plot([t_start:t_end/N:t_end],output.x)&lt;br /&gt;
 ylabel(&#039;States&#039;)&lt;br /&gt;
 xlabel(&#039;Time&#039;)&lt;br /&gt;
 legend(&#039;X&#039;,&#039;S&#039;,&#039;P&#039;)&lt;br /&gt;
 &lt;br /&gt;
 % Control&lt;br /&gt;
 figure(2)&lt;br /&gt;
 plot([t_start:t_end/N:t_end-t_end/N],output.u)&lt;br /&gt;
 ylabel(&#039;Control (Sf)&#039;)&lt;br /&gt;
 xlabel(&#039;Time&#039;)&lt;br /&gt;
 &lt;br /&gt;
 % one figure for all&lt;br /&gt;
 figure(3)&lt;br /&gt;
 subplot(2,2,1)&lt;br /&gt;
 plot([t_start:t_end/N:t_end],output.x(:,1))&lt;br /&gt;
 ylabel(&#039;X&#039;)&lt;br /&gt;
 xlabel(&#039;Time&#039;)&lt;br /&gt;
 subplot(2,2,2)&lt;br /&gt;
 plot([t_start:t_end/N:t_end],output.x(:,2))&lt;br /&gt;
 ylabel(&#039;S&#039;)&lt;br /&gt;
 xlabel(&#039;Time&#039;)&lt;br /&gt;
 subplot(2,2,3)&lt;br /&gt;
 plot([t_start:t_end/N:t_end],output.x(:,3))&lt;br /&gt;
 ylabel(&#039;P&#039;)&lt;br /&gt;
 xlabel(&#039;Time&#039;)&lt;br /&gt;
 subplot(2,2,4)&lt;br /&gt;
 plot([t_start:t_end/N:t_end-t_end/N],output.u)&lt;br /&gt;
 ylabel(&#039;Sf&#039;)&lt;br /&gt;
 xlabel(&#039;Time&#039;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--List of all categories this page is part of. List characterization of solution behavior, model properties, ore presence of implementation details (e.g., AMPL for AMPL model) here --&amp;gt;&lt;br /&gt;
[[Category:ACADO]]&lt;/div&gt;</summary>
		<author><name>TobiasWeber</name></author>
	</entry>
	<entry>
		<id>https://mintoc.de/index.php?title=Main_Page&amp;diff=998</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="https://mintoc.de/index.php?title=Main_Page&amp;diff=998"/>
		<updated>2015-12-09T15:33:01Z</updated>

		<summary type="html">&lt;p&gt;TobiasWeber: /* Problems (add) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
This wiki contains a &#039;&#039;&#039;benchmark library&#039;&#039;&#039; of &#039;&#039;&#039;mixed-integer optimal control problems&#039;&#039;&#039;. The main intention is to provide algorithm developers with a set of challenging problems to evaluate their numerical optimization methods. An important focus is given on &#039;&#039;&#039;reproducibility&#039;&#039;&#039; of optimal solutions.&lt;br /&gt;
As, in contrast to say linear programming, there are no standard formats for the formulation of such problems, and they often show completely different characteristics, these pages dedicate some space for a thorough description of problem and solutions.&lt;br /&gt;
&lt;br /&gt;
A more detailed description of the underlying concepts of this library can be found in the article &amp;lt;bibref&amp;gt;Sager2011b&amp;lt;/bibref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 Sager, S., &#039;A benchmark library of mixed-integer optimal control problems&#039;, &lt;br /&gt;
 Mixed Integer Nonlinear Programming, Eds. J. Lee and S. Leyffer, 2012, pp. 631-670.&lt;br /&gt;
&lt;br /&gt;
A [http://mathopt.de/PUBLICATIONS/Sager2012b.pdf preprint] pdf is available.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- TOP TABLE WITH NEWS  --&amp;gt;&lt;br /&gt;
&amp;lt;table bgcolor=&amp;quot;#EEEEFF&amp;quot; width=&amp;quot;100%&amp;quot; cellspacing=&amp;quot;10px&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;td width=&amp;quot;80%&amp;quot; bgcolor=&amp;quot;#EEEEFF&amp;quot;&amp;gt;&lt;br /&gt;
==[[:Category:News|News]] &amp;lt;span style=&amp;quot;font-variant:small-caps&amp;quot; style=&amp;quot;font-size:10px&amp;quot;&amp;gt;[[Current News|(add)]]&amp;lt;/span&amp;gt;==&lt;br /&gt;
&amp;lt;!-- The actual news are being included from the page Current News with the following line. --&amp;gt;&lt;br /&gt;
{{Current News}}&lt;br /&gt;
&amp;lt;!-- Do not edit between this comment and the next &#039;&amp;lt;td&amp;gt;&#039; tag! --&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table width=&amp;quot;100%&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- CATEGORY FIELD--&amp;gt;&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;td width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
==[[:Category:Problem characterization|Problem characterization]] &amp;lt;span style=&amp;quot;font-variant:small-caps&amp;quot; style=&amp;quot;font-size:10px&amp;quot;&amp;gt;[[Help:Adding a problem characterization|(add)]]&amp;lt;/span&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
via &#039;&#039;[[:Category:Model characterization|mathematical model]]&#039;&#039; - via &#039;&#039;[[:Category:Solution characterization|optimal solution]]&#039;&#039; - via &#039;&#039;[[:Category:Application|application area]]&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;[[:Category:ODE model|ODE model]]&#039;&#039; - &#039;&#039;[[:Category:Bang bang|Bang bang]]&#039;&#039; - &#039;&#039;[[:Category:Chattering|Chattering]]&#039;&#039; - &#039;&#039;[[:Category:AMPL|AMPL]]&#039;&#039; - &lt;br /&gt;
&#039;&#039;[[:Category:AMPL/TACO|AMPL using TACO]]&#039;&#039; - &#039;&#039;[[:Category:C|C code]]&#039;&#039; - &#039;&#039;[[:Category:Optimica|optimica]]&#039;&#039; - &#039;&#039;[[:Category:Periodic|Periodicity]]&#039;&#039;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- PROBLEM FIELD--&amp;gt;&lt;br /&gt;
&amp;lt;td width=&amp;quot;50%&amp;quot; &amp;gt;&lt;br /&gt;
&lt;br /&gt;
==[[:Category:MIOCP|Problems]] &amp;lt;span style=&amp;quot;font-variant:small-caps&amp;quot; style=&amp;quot;font-size:10px&amp;quot;&amp;gt;[[Help:Adding a Problem|(add)]]&amp;lt;/span&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;[[Lotka Volterra fishing problem]] - [[Lotka Experimental Design]] - [[F-8 aircraft]] - [[Annihilation of calcium oscillations | Calcium]] - [[Annihilation of calcium oscillations with PLC activation inhibition| Calcium 2]] - [[Diels-Alder Reaction Experimental Design]] - [[Gravity Turn Maneuver]]&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;[[Supermarket refrigeration system]] - [[Car testdrive]] - [[Fuller&#039;s problem]] - [[Bang-bang approximation of a traveling wave | 1D wave]] - [[Subway ride | Subway]] - [[Truck cruise control]] - [[Bioreactor example]]&#039;&#039;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- HELP FIELD--&amp;gt;&lt;br /&gt;
&amp;lt;td width=&amp;quot;50%&amp;quot; &amp;gt;&lt;br /&gt;
&lt;br /&gt;
==[[:Category:Help|Help]] &amp;lt;span style=&amp;quot;font-variant:small-caps&amp;quot; style=&amp;quot;font-size:10px&amp;quot;&amp;gt;[[User:SebastianSager|(contact)]]&amp;lt;/span&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;[[Help:How to contribute|How to contribute]]&#039;&#039; - &#039;&#039;[[Help:How to cite|How to cite]]&#039;&#039; - &#039;&#039;[[Help:Using LaTeX|LaTeX]]&#039;&#039; - &#039;&#039;[[Help:Description guidelines | Guidelines]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- COMMUNITY FIELD--&amp;gt;&lt;br /&gt;
&amp;lt;td width=&amp;quot;50%&amp;quot; &amp;gt;&lt;br /&gt;
&lt;br /&gt;
==[[:Category:Community|Community]] &amp;lt;span style=&amp;quot;font-variant:small-caps&amp;quot; style=&amp;quot;font-size:10px&amp;quot;&amp;gt;[[Help:Adding a User|(add)]]&amp;lt;/span&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
[[:Category:Community|Contributors]] - &#039;&#039;[[External Links]]&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Feel encouraged to participate!&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Main]]&lt;/div&gt;</summary>
		<author><name>TobiasWeber</name></author>
	</entry>
	<entry>
		<id>https://mintoc.de/index.php?title=Bioreactor&amp;diff=989</id>
		<title>Bioreactor</title>
		<link rel="alternate" type="text/html" href="https://mintoc.de/index.php?title=Bioreactor&amp;diff=989"/>
		<updated>2015-12-09T14:53:09Z</updated>

		<summary type="html">&lt;p&gt;TobiasWeber: /* Source Code */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The bioreactor example is an easy bioreactor with an substrate that is converted to a product by the biomass in the reactor. It has three states and a control that is describing the feed concentration of substrate. It is taken from the examples folder of the ACADO toolkit described in:&lt;br /&gt;
&lt;br /&gt;
 Houska, Boris, Hans Joachim Ferreau, and Moritz Diehl. &amp;quot;ACADO toolkit—An open‐source framework for automatic control and dynamic optimization.&amp;quot;&lt;br /&gt;
 Optimal Control Applications and Methods 32.3 (2011): 298-312.&lt;br /&gt;
&lt;br /&gt;
Originally the problem seems to be motivated by:&lt;br /&gt;
&lt;br /&gt;
 VERSYCK, KARINA J., and JAN F. VAN IMPE. &amp;quot;Feed rate optimization for fed-batch bioreactors: From optimal process performance to optimal parameter estimation.&amp;quot;&lt;br /&gt;
 Chemical Engineering Communications 172.1 (1999): 107-124.&lt;br /&gt;
&lt;br /&gt;
== Model Formulation ==&lt;br /&gt;
&lt;br /&gt;
The dynamic model is an [[:Category:ODE model|ODE model]]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{rcl}&lt;br /&gt;
\dot{X}&amp;amp;=&amp;amp;-DX+\mu X \\&lt;br /&gt;
\dot{S}&amp;amp;=&amp;amp; D(S_{f}-S)-\mu /Y_{xs} X \\&lt;br /&gt;
\dot{P}&amp;amp;=&amp;amp;-DP+ (\alpha \mu +\beta) X.&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The three states describe the concentration of the biomass (&amp;lt;math&amp;gt;X&amp;lt;/math&amp;gt;), the substrate (&amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt;), and the product (&amp;lt;math&amp;gt;P&amp;lt;/math&amp;gt;) in the reactor. In steady state the feed and outlet are equal and dilute all three concentrations with a ratio &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;. The biomass grows with a rate&lt;br /&gt;
&amp;lt;math&amp;gt;\mu&amp;lt;/math&amp;gt;, while it eats up the substrate with the rate &amp;lt;math&amp;gt;\mu/Y_{xs}&amp;lt;/math&amp;gt; and produces product at a rate &amp;lt;math&amp;gt;(\alpha \mu +\beta)&amp;lt;/math&amp;gt;. The rate &amp;lt;math&amp;gt;\mu&amp;lt;/math&amp;gt; is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mu = \mu_{m}*(1-P/P_{m})*S/(K_m+S+S^2/K_i)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The fixed parameters (constants) of the model are as follows.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+Parameters&lt;br /&gt;
|-&lt;br /&gt;
|Name&lt;br /&gt;
|Symbol&lt;br /&gt;
|Value&lt;br /&gt;
|Unit&lt;br /&gt;
|-&lt;br /&gt;
|Dilution&lt;br /&gt;
|&amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.15&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Rate coefficient&lt;br /&gt;
|&amp;lt;math&amp;gt;K_i&amp;lt;/math&amp;gt;&lt;br /&gt;
|22&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Rate coefficient&lt;br /&gt;
|&amp;lt;math&amp;gt;K_m&amp;lt;/math&amp;gt;&lt;br /&gt;
|1.2&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Rate coefficient&lt;br /&gt;
|&amp;lt;math&amp;gt;P_m&amp;lt;/math&amp;gt;&lt;br /&gt;
|50&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Substrate to Biomass rate&lt;br /&gt;
|&amp;lt;math&amp;gt;Y_{xs}&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.4&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Linear slope&lt;br /&gt;
|&amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt;&lt;br /&gt;
|2.2&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Linear intercept&lt;br /&gt;
|&amp;lt;math&amp;gt;\beta&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.2&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Maximal growth rate&lt;br /&gt;
|&amp;lt;math&amp;gt;\mu_m&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.48&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Optimal Control Problem ==&lt;br /&gt;
&lt;br /&gt;
Writing shortly for the states in vector notation &amp;lt;math&amp;gt;x=(X,S,P)^T&amp;lt;/math&amp;gt; the OCP reads:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{cl}&lt;br /&gt;
 \displaystyle \min_{x,S_f} &amp;amp; J(x,S_f)\\[1.5ex]&lt;br /&gt;
 \mbox{s.t.} &amp;amp; \dot{x}  =  f(x,S_f), \forall \, t \in [0,48]\\&lt;br /&gt;
 &amp;amp; x(0) = (6.5,12,22)^T \\&lt;br /&gt;
 &amp;amp; x \in \R^3,\,S_f \in [28.7,40].&lt;br /&gt;
\end{array} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Objective ===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
J(x,S_f)=\int_0^{48}D(S_f-P)^2dt&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Reference Solution ==&lt;br /&gt;
&lt;br /&gt;
Here we present the reference solution of the reimplemented example in the ACADO code generation with matlab. The source code is given in the next section.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;Reference solution&amp;quot; widths=&amp;quot;551px&amp;quot; heights=&amp;quot;390px&amp;quot; perrow=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
 Image:ACADO_bioreactor.png| Optimal solution for the ACADO example.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Source Code ==&lt;br /&gt;
&lt;br /&gt;
This is the implementation of the ACADO bioreactor example with the matlab interface and the code generation of ACADO.&lt;br /&gt;
&lt;br /&gt;
 % implements the bioreactor example of ACADO for the matlab interface and&lt;br /&gt;
 % the code generation&lt;br /&gt;
 &lt;br /&gt;
 clc;&lt;br /&gt;
 clear all;&lt;br /&gt;
 close all;&lt;br /&gt;
 &lt;br /&gt;
 Ts = 0.1;&lt;br /&gt;
 EXPORT = 1;&lt;br /&gt;
 &lt;br /&gt;
 %% Variables&lt;br /&gt;
 DifferentialState X S P;&lt;br /&gt;
 Control Sf;&lt;br /&gt;
 &lt;br /&gt;
 n_XD = length(diffStates);&lt;br /&gt;
 n_U = length(controls);&lt;br /&gt;
 &lt;br /&gt;
 %% Constants&lt;br /&gt;
 D       = 0.15;&lt;br /&gt;
 Ki      = 22.0;&lt;br /&gt;
 Km      = 1.2 ; &lt;br /&gt;
 Pm      = 50.0;&lt;br /&gt;
 Yxs     = 0.4 ;&lt;br /&gt;
 alpha   = 2.2 ;&lt;br /&gt;
 beta    = 0.2 ;&lt;br /&gt;
 mum     = 0.48;&lt;br /&gt;
 Sfmin   = 28.7;&lt;br /&gt;
 Sfmax   = 40.0;&lt;br /&gt;
 t_start =  0.0;&lt;br /&gt;
 t_end   = 48.0;&lt;br /&gt;
 N = 20;&lt;br /&gt;
 &lt;br /&gt;
 %% Differential Equation&lt;br /&gt;
 mu = mum*(1-P/Pm)*S/(Km+S+S^2/Ki);&lt;br /&gt;
 &lt;br /&gt;
 f = dot([X;S;P]) == [-D*X+mu*X;...&lt;br /&gt;
                       D*(Sf-S)-(mu/Yxs)*X;...&lt;br /&gt;
 		             -D*P+(alpha*mu+beta)*X];&lt;br /&gt;
 &lt;br /&gt;
 % output&lt;br /&gt;
 h = P-Sf;&lt;br /&gt;
 hN = P;&lt;br /&gt;
 &lt;br /&gt;
 %% MPCexport&lt;br /&gt;
 acadoSet(&#039;problemname&#039;, &#039;mpc&#039;);&lt;br /&gt;
 &lt;br /&gt;
 ocp = acado.OCP( t_start, t_end, N );&lt;br /&gt;
 &lt;br /&gt;
 W_mat = D;&lt;br /&gt;
 WN_mat = D;&lt;br /&gt;
 W = acado.BMatrix(W_mat);&lt;br /&gt;
 WN = acado.BMatrix(WN_mat);&lt;br /&gt;
 &lt;br /&gt;
 ocp.minimizeLSQ( W, h );&lt;br /&gt;
 ocp.minimizeLSQEndTerm( WN, hN );&lt;br /&gt;
 &lt;br /&gt;
 ocp.subjectTo( Sfmin &amp;lt;= Sf &amp;lt;= Sfmax );&lt;br /&gt;
 ocp.setModel(f);&lt;br /&gt;
 &lt;br /&gt;
 mpc = acado.OCPexport( ocp );&lt;br /&gt;
 mpc.set( &#039;HESSIAN_APPROXIMATION&#039;,       &#039;GAUSS_NEWTON&#039;      );&lt;br /&gt;
 mpc.set( &#039;DISCRETIZATION_TYPE&#039;,         &#039;MULTIPLE_SHOOTING&#039; );&lt;br /&gt;
 mpc.set( &#039;SPARSE_QP_SOLUTION&#039;,          &#039;FULL_CONDENSING_N2&#039;);&lt;br /&gt;
 mpc.set( &#039;INTEGRATOR_TYPE&#039;,             &#039;INT_IRK_GL4&#039;       );&lt;br /&gt;
 mpc.set( &#039;NUM_INTEGRATOR_STEPS&#039;,        10*N                 );&lt;br /&gt;
 mpc.set( &#039;QP_SOLVER&#039;,                   &#039;QP_QPOASES&#039;    	);&lt;br /&gt;
 mpc.set( &#039;HOTSTART_QP&#039;,                 &#039;NO&#039;             	);&lt;br /&gt;
 mpc.set( &#039;LEVENBERG_MARQUARDT&#039;, 		 1e-10				);&lt;br /&gt;
 &lt;br /&gt;
 if EXPORT&lt;br /&gt;
     mpc.exportCode( &#039;export_MPC&#039; );&lt;br /&gt;
     copyfile(&#039;../../../../../../external_packages/qpoases&#039;, &#039;export_MPC/qpoases&#039;)&lt;br /&gt;
     &lt;br /&gt;
     cd export_MPC&lt;br /&gt;
     make_acado_solver(&#039;../acado_MPCstep&#039;)&lt;br /&gt;
     cd ..&lt;br /&gt;
 end&lt;br /&gt;
 &lt;br /&gt;
 %% CONSTANTS FOR OPTIMIZATION&lt;br /&gt;
 X0 = [6.5 12.0 22.0];&lt;br /&gt;
 input.x0=X0&#039;;&lt;br /&gt;
 Xref = [0 0 0];&lt;br /&gt;
 input.x = repmat(Xref,N+1,1);&lt;br /&gt;
 Xref = repmat(Xref,N,1);&lt;br /&gt;
 input.od = [];&lt;br /&gt;
 &lt;br /&gt;
 Uref = zeros(N,n_U);&lt;br /&gt;
 input.u = Uref;&lt;br /&gt;
 &lt;br /&gt;
 input.y = Sfmin*ones(N,1);&lt;br /&gt;
 input.yN = Sfmin;&lt;br /&gt;
 &lt;br /&gt;
 input.W = 1;&lt;br /&gt;
 input.WN = 1;&lt;br /&gt;
 &lt;br /&gt;
 %% SOLVER LOOP (SQP - Gauss newton)&lt;br /&gt;
 display(&#039;------------------------------------------------------------------&#039;)&lt;br /&gt;
 display(&#039;               SOLVER Loop&#039;                                    )&lt;br /&gt;
 display(&#039;------------------------------------------------------------------&#039;)&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 for i=1:20&lt;br /&gt;
     tic&lt;br /&gt;
     % Solve NMPC OCP&lt;br /&gt;
     output = acado_MPCstep(input);&lt;br /&gt;
     &lt;br /&gt;
     input.x=output.x;&lt;br /&gt;
     input.u=output.u;&lt;br /&gt;
 &lt;br /&gt;
     disp([&#039; (RTI step: &#039; num2str(output.info.cpuTime*1e6) &#039; µs)&#039;])&lt;br /&gt;
 &lt;br /&gt;
 end&lt;br /&gt;
 &lt;br /&gt;
 %% PLOT RESULTS&lt;br /&gt;
 &lt;br /&gt;
 % States&lt;br /&gt;
 figure(1)&lt;br /&gt;
 plot([t_start:t_end/N:t_end],output.x)&lt;br /&gt;
 ylabel(&#039;States&#039;)&lt;br /&gt;
 xlabel(&#039;Time&#039;)&lt;br /&gt;
 legend(&#039;X&#039;,&#039;S&#039;,&#039;P&#039;)&lt;br /&gt;
 &lt;br /&gt;
 % Control&lt;br /&gt;
 figure(2)&lt;br /&gt;
 plot([t_start:t_end/N:t_end-t_end/N],output.u)&lt;br /&gt;
 ylabel(&#039;Control (Sf)&#039;)&lt;br /&gt;
 xlabel(&#039;Time&#039;)&lt;br /&gt;
 &lt;br /&gt;
 % one figure for all&lt;br /&gt;
 figure(3)&lt;br /&gt;
 subplot(2,2,1)&lt;br /&gt;
 plot([t_start:t_end/N:t_end],output.x(:,1))&lt;br /&gt;
 ylabel(&#039;X&#039;)&lt;br /&gt;
 xlabel(&#039;Time&#039;)&lt;br /&gt;
 subplot(2,2,2)&lt;br /&gt;
 plot([t_start:t_end/N:t_end],output.x(:,2))&lt;br /&gt;
 ylabel(&#039;S&#039;)&lt;br /&gt;
 xlabel(&#039;Time&#039;)&lt;br /&gt;
 subplot(2,2,3)&lt;br /&gt;
 plot([t_start:t_end/N:t_end],output.x(:,3))&lt;br /&gt;
 ylabel(&#039;P&#039;)&lt;br /&gt;
 xlabel(&#039;Time&#039;)&lt;br /&gt;
 subplot(2,2,4)&lt;br /&gt;
 plot([t_start:t_end/N:t_end-t_end/N],output.u)&lt;br /&gt;
 ylabel(&#039;Sf&#039;)&lt;br /&gt;
 xlabel(&#039;Time&#039;)&lt;/div&gt;</summary>
		<author><name>TobiasWeber</name></author>
	</entry>
	<entry>
		<id>https://mintoc.de/index.php?title=Bioreactor&amp;diff=988</id>
		<title>Bioreactor</title>
		<link rel="alternate" type="text/html" href="https://mintoc.de/index.php?title=Bioreactor&amp;diff=988"/>
		<updated>2015-12-09T14:47:11Z</updated>

		<summary type="html">&lt;p&gt;TobiasWeber: /* Source Code */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The bioreactor example is an easy bioreactor with an substrate that is converted to a product by the biomass in the reactor. It has three states and a control that is describing the feed concentration of substrate. It is taken from the examples folder of the ACADO toolkit described in:&lt;br /&gt;
&lt;br /&gt;
 Houska, Boris, Hans Joachim Ferreau, and Moritz Diehl. &amp;quot;ACADO toolkit—An open‐source framework for automatic control and dynamic optimization.&amp;quot;&lt;br /&gt;
 Optimal Control Applications and Methods 32.3 (2011): 298-312.&lt;br /&gt;
&lt;br /&gt;
Originally the problem seems to be motivated by:&lt;br /&gt;
&lt;br /&gt;
 VERSYCK, KARINA J., and JAN F. VAN IMPE. &amp;quot;Feed rate optimization for fed-batch bioreactors: From optimal process performance to optimal parameter estimation.&amp;quot;&lt;br /&gt;
 Chemical Engineering Communications 172.1 (1999): 107-124.&lt;br /&gt;
&lt;br /&gt;
== Model Formulation ==&lt;br /&gt;
&lt;br /&gt;
The dynamic model is an [[:Category:ODE model|ODE model]]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{rcl}&lt;br /&gt;
\dot{X}&amp;amp;=&amp;amp;-DX+\mu X \\&lt;br /&gt;
\dot{S}&amp;amp;=&amp;amp; D(S_{f}-S)-\mu /Y_{xs} X \\&lt;br /&gt;
\dot{P}&amp;amp;=&amp;amp;-DP+ (\alpha \mu +\beta) X.&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The three states describe the concentration of the biomass (&amp;lt;math&amp;gt;X&amp;lt;/math&amp;gt;), the substrate (&amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt;), and the product (&amp;lt;math&amp;gt;P&amp;lt;/math&amp;gt;) in the reactor. In steady state the feed and outlet are equal and dilute all three concentrations with a ratio &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;. The biomass grows with a rate&lt;br /&gt;
&amp;lt;math&amp;gt;\mu&amp;lt;/math&amp;gt;, while it eats up the substrate with the rate &amp;lt;math&amp;gt;\mu/Y_{xs}&amp;lt;/math&amp;gt; and produces product at a rate &amp;lt;math&amp;gt;(\alpha \mu +\beta)&amp;lt;/math&amp;gt;. The rate &amp;lt;math&amp;gt;\mu&amp;lt;/math&amp;gt; is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mu = \mu_{m}*(1-P/P_{m})*S/(K_m+S+S^2/K_i)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The fixed parameters (constants) of the model are as follows.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+Parameters&lt;br /&gt;
|-&lt;br /&gt;
|Name&lt;br /&gt;
|Symbol&lt;br /&gt;
|Value&lt;br /&gt;
|Unit&lt;br /&gt;
|-&lt;br /&gt;
|Dilution&lt;br /&gt;
|&amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.15&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Rate coefficient&lt;br /&gt;
|&amp;lt;math&amp;gt;K_i&amp;lt;/math&amp;gt;&lt;br /&gt;
|22&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Rate coefficient&lt;br /&gt;
|&amp;lt;math&amp;gt;K_m&amp;lt;/math&amp;gt;&lt;br /&gt;
|1.2&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Rate coefficient&lt;br /&gt;
|&amp;lt;math&amp;gt;P_m&amp;lt;/math&amp;gt;&lt;br /&gt;
|50&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Substrate to Biomass rate&lt;br /&gt;
|&amp;lt;math&amp;gt;Y_{xs}&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.4&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Linear slope&lt;br /&gt;
|&amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt;&lt;br /&gt;
|2.2&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Linear intercept&lt;br /&gt;
|&amp;lt;math&amp;gt;\beta&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.2&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Maximal growth rate&lt;br /&gt;
|&amp;lt;math&amp;gt;\mu_m&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.48&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Optimal Control Problem ==&lt;br /&gt;
&lt;br /&gt;
Writing shortly for the states in vector notation &amp;lt;math&amp;gt;x=(X,S,P)^T&amp;lt;/math&amp;gt; the OCP reads:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{cl}&lt;br /&gt;
 \displaystyle \min_{x,S_f} &amp;amp; J(x,S_f)\\[1.5ex]&lt;br /&gt;
 \mbox{s.t.} &amp;amp; \dot{x}  =  f(x,S_f), \forall \, t \in [0,48]\\&lt;br /&gt;
 &amp;amp; x(0) = (6.5,12,22)^T \\&lt;br /&gt;
 &amp;amp; x \in \R^3,\,S_f \in [28.7,40].&lt;br /&gt;
\end{array} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Objective ===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
J(x,S_f)=\int_0^{48}D(S_f-P)^2dt&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Reference Solution ==&lt;br /&gt;
&lt;br /&gt;
Here we present the reference solution of the reimplemented example in the ACADO code generation with matlab. The source code is given in the next section.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;Reference solution&amp;quot; widths=&amp;quot;551px&amp;quot; heights=&amp;quot;390px&amp;quot; perrow=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
 Image:ACADO_bioreactor.png| Optimal solution for the ACADO example.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Source Code ==&lt;br /&gt;
&lt;br /&gt;
This is the implementation of the ACADO bioreactor example with the matlab interface and the code generation of ACADO.&lt;br /&gt;
&lt;br /&gt;
[[Media:bioreactor.m]]&lt;/div&gt;</summary>
		<author><name>TobiasWeber</name></author>
	</entry>
	<entry>
		<id>https://mintoc.de/index.php?title=Bioreactor&amp;diff=987</id>
		<title>Bioreactor</title>
		<link rel="alternate" type="text/html" href="https://mintoc.de/index.php?title=Bioreactor&amp;diff=987"/>
		<updated>2015-12-09T14:45:39Z</updated>

		<summary type="html">&lt;p&gt;TobiasWeber: /* Reference Solution */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The bioreactor example is an easy bioreactor with an substrate that is converted to a product by the biomass in the reactor. It has three states and a control that is describing the feed concentration of substrate. It is taken from the examples folder of the ACADO toolkit described in:&lt;br /&gt;
&lt;br /&gt;
 Houska, Boris, Hans Joachim Ferreau, and Moritz Diehl. &amp;quot;ACADO toolkit—An open‐source framework for automatic control and dynamic optimization.&amp;quot;&lt;br /&gt;
 Optimal Control Applications and Methods 32.3 (2011): 298-312.&lt;br /&gt;
&lt;br /&gt;
Originally the problem seems to be motivated by:&lt;br /&gt;
&lt;br /&gt;
 VERSYCK, KARINA J., and JAN F. VAN IMPE. &amp;quot;Feed rate optimization for fed-batch bioreactors: From optimal process performance to optimal parameter estimation.&amp;quot;&lt;br /&gt;
 Chemical Engineering Communications 172.1 (1999): 107-124.&lt;br /&gt;
&lt;br /&gt;
== Model Formulation ==&lt;br /&gt;
&lt;br /&gt;
The dynamic model is an [[:Category:ODE model|ODE model]]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{rcl}&lt;br /&gt;
\dot{X}&amp;amp;=&amp;amp;-DX+\mu X \\&lt;br /&gt;
\dot{S}&amp;amp;=&amp;amp; D(S_{f}-S)-\mu /Y_{xs} X \\&lt;br /&gt;
\dot{P}&amp;amp;=&amp;amp;-DP+ (\alpha \mu +\beta) X.&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The three states describe the concentration of the biomass (&amp;lt;math&amp;gt;X&amp;lt;/math&amp;gt;), the substrate (&amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt;), and the product (&amp;lt;math&amp;gt;P&amp;lt;/math&amp;gt;) in the reactor. In steady state the feed and outlet are equal and dilute all three concentrations with a ratio &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;. The biomass grows with a rate&lt;br /&gt;
&amp;lt;math&amp;gt;\mu&amp;lt;/math&amp;gt;, while it eats up the substrate with the rate &amp;lt;math&amp;gt;\mu/Y_{xs}&amp;lt;/math&amp;gt; and produces product at a rate &amp;lt;math&amp;gt;(\alpha \mu +\beta)&amp;lt;/math&amp;gt;. The rate &amp;lt;math&amp;gt;\mu&amp;lt;/math&amp;gt; is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mu = \mu_{m}*(1-P/P_{m})*S/(K_m+S+S^2/K_i)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The fixed parameters (constants) of the model are as follows.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+Parameters&lt;br /&gt;
|-&lt;br /&gt;
|Name&lt;br /&gt;
|Symbol&lt;br /&gt;
|Value&lt;br /&gt;
|Unit&lt;br /&gt;
|-&lt;br /&gt;
|Dilution&lt;br /&gt;
|&amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.15&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Rate coefficient&lt;br /&gt;
|&amp;lt;math&amp;gt;K_i&amp;lt;/math&amp;gt;&lt;br /&gt;
|22&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Rate coefficient&lt;br /&gt;
|&amp;lt;math&amp;gt;K_m&amp;lt;/math&amp;gt;&lt;br /&gt;
|1.2&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Rate coefficient&lt;br /&gt;
|&amp;lt;math&amp;gt;P_m&amp;lt;/math&amp;gt;&lt;br /&gt;
|50&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Substrate to Biomass rate&lt;br /&gt;
|&amp;lt;math&amp;gt;Y_{xs}&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.4&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Linear slope&lt;br /&gt;
|&amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt;&lt;br /&gt;
|2.2&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Linear intercept&lt;br /&gt;
|&amp;lt;math&amp;gt;\beta&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.2&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Maximal growth rate&lt;br /&gt;
|&amp;lt;math&amp;gt;\mu_m&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.48&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Optimal Control Problem ==&lt;br /&gt;
&lt;br /&gt;
Writing shortly for the states in vector notation &amp;lt;math&amp;gt;x=(X,S,P)^T&amp;lt;/math&amp;gt; the OCP reads:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{cl}&lt;br /&gt;
 \displaystyle \min_{x,S_f} &amp;amp; J(x,S_f)\\[1.5ex]&lt;br /&gt;
 \mbox{s.t.} &amp;amp; \dot{x}  =  f(x,S_f), \forall \, t \in [0,48]\\&lt;br /&gt;
 &amp;amp; x(0) = (6.5,12,22)^T \\&lt;br /&gt;
 &amp;amp; x \in \R^3,\,S_f \in [28.7,40].&lt;br /&gt;
\end{array} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Objective ===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
J(x,S_f)=\int_0^{48}D(S_f-P)^2dt&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Reference Solution ==&lt;br /&gt;
&lt;br /&gt;
Here we present the reference solution of the reimplemented example in the ACADO code generation with matlab. The source code is given in the next section.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;Reference solution&amp;quot; widths=&amp;quot;551px&amp;quot; heights=&amp;quot;390px&amp;quot; perrow=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
 Image:ACADO_bioreactor.png| Optimal solution for the ACADO example.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Source Code ==&lt;br /&gt;
&lt;br /&gt;
In this section one can provide the source code of the implementation, that solved the problem and produced the reference solution. This should be done by providing source files.&lt;/div&gt;</summary>
		<author><name>TobiasWeber</name></author>
	</entry>
	<entry>
		<id>https://mintoc.de/index.php?title=Bioreactor&amp;diff=986</id>
		<title>Bioreactor</title>
		<link rel="alternate" type="text/html" href="https://mintoc.de/index.php?title=Bioreactor&amp;diff=986"/>
		<updated>2015-12-09T14:44:43Z</updated>

		<summary type="html">&lt;p&gt;TobiasWeber: /* Reference Solution */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The bioreactor example is an easy bioreactor with an substrate that is converted to a product by the biomass in the reactor. It has three states and a control that is describing the feed concentration of substrate. It is taken from the examples folder of the ACADO toolkit described in:&lt;br /&gt;
&lt;br /&gt;
 Houska, Boris, Hans Joachim Ferreau, and Moritz Diehl. &amp;quot;ACADO toolkit—An open‐source framework for automatic control and dynamic optimization.&amp;quot;&lt;br /&gt;
 Optimal Control Applications and Methods 32.3 (2011): 298-312.&lt;br /&gt;
&lt;br /&gt;
Originally the problem seems to be motivated by:&lt;br /&gt;
&lt;br /&gt;
 VERSYCK, KARINA J., and JAN F. VAN IMPE. &amp;quot;Feed rate optimization for fed-batch bioreactors: From optimal process performance to optimal parameter estimation.&amp;quot;&lt;br /&gt;
 Chemical Engineering Communications 172.1 (1999): 107-124.&lt;br /&gt;
&lt;br /&gt;
== Model Formulation ==&lt;br /&gt;
&lt;br /&gt;
The dynamic model is an [[:Category:ODE model|ODE model]]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{rcl}&lt;br /&gt;
\dot{X}&amp;amp;=&amp;amp;-DX+\mu X \\&lt;br /&gt;
\dot{S}&amp;amp;=&amp;amp; D(S_{f}-S)-\mu /Y_{xs} X \\&lt;br /&gt;
\dot{P}&amp;amp;=&amp;amp;-DP+ (\alpha \mu +\beta) X.&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The three states describe the concentration of the biomass (&amp;lt;math&amp;gt;X&amp;lt;/math&amp;gt;), the substrate (&amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt;), and the product (&amp;lt;math&amp;gt;P&amp;lt;/math&amp;gt;) in the reactor. In steady state the feed and outlet are equal and dilute all three concentrations with a ratio &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;. The biomass grows with a rate&lt;br /&gt;
&amp;lt;math&amp;gt;\mu&amp;lt;/math&amp;gt;, while it eats up the substrate with the rate &amp;lt;math&amp;gt;\mu/Y_{xs}&amp;lt;/math&amp;gt; and produces product at a rate &amp;lt;math&amp;gt;(\alpha \mu +\beta)&amp;lt;/math&amp;gt;. The rate &amp;lt;math&amp;gt;\mu&amp;lt;/math&amp;gt; is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mu = \mu_{m}*(1-P/P_{m})*S/(K_m+S+S^2/K_i)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The fixed parameters (constants) of the model are as follows.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+Parameters&lt;br /&gt;
|-&lt;br /&gt;
|Name&lt;br /&gt;
|Symbol&lt;br /&gt;
|Value&lt;br /&gt;
|Unit&lt;br /&gt;
|-&lt;br /&gt;
|Dilution&lt;br /&gt;
|&amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.15&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Rate coefficient&lt;br /&gt;
|&amp;lt;math&amp;gt;K_i&amp;lt;/math&amp;gt;&lt;br /&gt;
|22&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Rate coefficient&lt;br /&gt;
|&amp;lt;math&amp;gt;K_m&amp;lt;/math&amp;gt;&lt;br /&gt;
|1.2&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Rate coefficient&lt;br /&gt;
|&amp;lt;math&amp;gt;P_m&amp;lt;/math&amp;gt;&lt;br /&gt;
|50&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Substrate to Biomass rate&lt;br /&gt;
|&amp;lt;math&amp;gt;Y_{xs}&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.4&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Linear slope&lt;br /&gt;
|&amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt;&lt;br /&gt;
|2.2&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Linear intercept&lt;br /&gt;
|&amp;lt;math&amp;gt;\beta&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.2&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Maximal growth rate&lt;br /&gt;
|&amp;lt;math&amp;gt;\mu_m&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.48&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Optimal Control Problem ==&lt;br /&gt;
&lt;br /&gt;
Writing shortly for the states in vector notation &amp;lt;math&amp;gt;x=(X,S,P)^T&amp;lt;/math&amp;gt; the OCP reads:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{cl}&lt;br /&gt;
 \displaystyle \min_{x,S_f} &amp;amp; J(x,S_f)\\[1.5ex]&lt;br /&gt;
 \mbox{s.t.} &amp;amp; \dot{x}  =  f(x,S_f), \forall \, t \in [0,48]\\&lt;br /&gt;
 &amp;amp; x(0) = (6.5,12,22)^T \\&lt;br /&gt;
 &amp;amp; x \in \R^3,\,S_f \in [28.7,40].&lt;br /&gt;
\end{array} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Objective ===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
J(x,S_f)=\int_0^{48}D(S_f-P)^2dt&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Reference Solution ==&lt;br /&gt;
&lt;br /&gt;
Here we present the reference solution of the reimplemented example in the ACADO code generation with matlab. The source code is given in the next section.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;Reference solution&amp;quot; widths=&amp;quot;271px&amp;quot; heights=&amp;quot;379px&amp;quot; perrow=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
 Image:ACADO_bioreactor.png| Optimal solution for the ACADO example.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Source Code ==&lt;br /&gt;
&lt;br /&gt;
In this section one can provide the source code of the implementation, that solved the problem and produced the reference solution. This should be done by providing source files.&lt;/div&gt;</summary>
		<author><name>TobiasWeber</name></author>
	</entry>
	<entry>
		<id>https://mintoc.de/index.php?title=File:ACADO_bioreactor.png&amp;diff=985</id>
		<title>File:ACADO bioreactor.png</title>
		<link rel="alternate" type="text/html" href="https://mintoc.de/index.php?title=File:ACADO_bioreactor.png&amp;diff=985"/>
		<updated>2015-12-09T14:44:27Z</updated>

		<summary type="html">&lt;p&gt;TobiasWeber: Reference solution for the ACADO bioreactor example&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Reference solution for the ACADO bioreactor example&lt;/div&gt;</summary>
		<author><name>TobiasWeber</name></author>
	</entry>
	<entry>
		<id>https://mintoc.de/index.php?title=Bioreactor&amp;diff=984</id>
		<title>Bioreactor</title>
		<link rel="alternate" type="text/html" href="https://mintoc.de/index.php?title=Bioreactor&amp;diff=984"/>
		<updated>2015-12-09T14:43:44Z</updated>

		<summary type="html">&lt;p&gt;TobiasWeber: /* Reference Solution */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The bioreactor example is an easy bioreactor with an substrate that is converted to a product by the biomass in the reactor. It has three states and a control that is describing the feed concentration of substrate. It is taken from the examples folder of the ACADO toolkit described in:&lt;br /&gt;
&lt;br /&gt;
 Houska, Boris, Hans Joachim Ferreau, and Moritz Diehl. &amp;quot;ACADO toolkit—An open‐source framework for automatic control and dynamic optimization.&amp;quot;&lt;br /&gt;
 Optimal Control Applications and Methods 32.3 (2011): 298-312.&lt;br /&gt;
&lt;br /&gt;
Originally the problem seems to be motivated by:&lt;br /&gt;
&lt;br /&gt;
 VERSYCK, KARINA J., and JAN F. VAN IMPE. &amp;quot;Feed rate optimization for fed-batch bioreactors: From optimal process performance to optimal parameter estimation.&amp;quot;&lt;br /&gt;
 Chemical Engineering Communications 172.1 (1999): 107-124.&lt;br /&gt;
&lt;br /&gt;
== Model Formulation ==&lt;br /&gt;
&lt;br /&gt;
The dynamic model is an [[:Category:ODE model|ODE model]]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{rcl}&lt;br /&gt;
\dot{X}&amp;amp;=&amp;amp;-DX+\mu X \\&lt;br /&gt;
\dot{S}&amp;amp;=&amp;amp; D(S_{f}-S)-\mu /Y_{xs} X \\&lt;br /&gt;
\dot{P}&amp;amp;=&amp;amp;-DP+ (\alpha \mu +\beta) X.&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The three states describe the concentration of the biomass (&amp;lt;math&amp;gt;X&amp;lt;/math&amp;gt;), the substrate (&amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt;), and the product (&amp;lt;math&amp;gt;P&amp;lt;/math&amp;gt;) in the reactor. In steady state the feed and outlet are equal and dilute all three concentrations with a ratio &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;. The biomass grows with a rate&lt;br /&gt;
&amp;lt;math&amp;gt;\mu&amp;lt;/math&amp;gt;, while it eats up the substrate with the rate &amp;lt;math&amp;gt;\mu/Y_{xs}&amp;lt;/math&amp;gt; and produces product at a rate &amp;lt;math&amp;gt;(\alpha \mu +\beta)&amp;lt;/math&amp;gt;. The rate &amp;lt;math&amp;gt;\mu&amp;lt;/math&amp;gt; is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mu = \mu_{m}*(1-P/P_{m})*S/(K_m+S+S^2/K_i)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The fixed parameters (constants) of the model are as follows.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+Parameters&lt;br /&gt;
|-&lt;br /&gt;
|Name&lt;br /&gt;
|Symbol&lt;br /&gt;
|Value&lt;br /&gt;
|Unit&lt;br /&gt;
|-&lt;br /&gt;
|Dilution&lt;br /&gt;
|&amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.15&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Rate coefficient&lt;br /&gt;
|&amp;lt;math&amp;gt;K_i&amp;lt;/math&amp;gt;&lt;br /&gt;
|22&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Rate coefficient&lt;br /&gt;
|&amp;lt;math&amp;gt;K_m&amp;lt;/math&amp;gt;&lt;br /&gt;
|1.2&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Rate coefficient&lt;br /&gt;
|&amp;lt;math&amp;gt;P_m&amp;lt;/math&amp;gt;&lt;br /&gt;
|50&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Substrate to Biomass rate&lt;br /&gt;
|&amp;lt;math&amp;gt;Y_{xs}&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.4&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Linear slope&lt;br /&gt;
|&amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt;&lt;br /&gt;
|2.2&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Linear intercept&lt;br /&gt;
|&amp;lt;math&amp;gt;\beta&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.2&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Maximal growth rate&lt;br /&gt;
|&amp;lt;math&amp;gt;\mu_m&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.48&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Optimal Control Problem ==&lt;br /&gt;
&lt;br /&gt;
Writing shortly for the states in vector notation &amp;lt;math&amp;gt;x=(X,S,P)^T&amp;lt;/math&amp;gt; the OCP reads:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{cl}&lt;br /&gt;
 \displaystyle \min_{x,S_f} &amp;amp; J(x,S_f)\\[1.5ex]&lt;br /&gt;
 \mbox{s.t.} &amp;amp; \dot{x}  =  f(x,S_f), \forall \, t \in [0,48]\\&lt;br /&gt;
 &amp;amp; x(0) = (6.5,12,22)^T \\&lt;br /&gt;
 &amp;amp; x \in \R^3,\,S_f \in [28.7,40].&lt;br /&gt;
\end{array} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Objective ===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
J(x,S_f)=\int_0^{48}D(S_f-P)^2dt&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Reference Solution ==&lt;br /&gt;
[[Media:ACADO_bioreactor.png]]&lt;br /&gt;
Here we present the reference solution of the reimplemented example in the ACADO code generation with matlab. The source code is given in the next section.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;Reference solution&amp;quot; widths=&amp;quot;271px&amp;quot; heights=&amp;quot;379px&amp;quot; perrow=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
 Image:ACADO_bioreactor.png| Optimal solution for the ACADO example.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Source Code ==&lt;br /&gt;
&lt;br /&gt;
In this section one can provide the source code of the implementation, that solved the problem and produced the reference solution. This should be done by providing source files.&lt;/div&gt;</summary>
		<author><name>TobiasWeber</name></author>
	</entry>
	<entry>
		<id>https://mintoc.de/index.php?title=Bioreactor&amp;diff=983</id>
		<title>Bioreactor</title>
		<link rel="alternate" type="text/html" href="https://mintoc.de/index.php?title=Bioreactor&amp;diff=983"/>
		<updated>2015-12-09T14:42:10Z</updated>

		<summary type="html">&lt;p&gt;TobiasWeber: /* Reference Solution */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The bioreactor example is an easy bioreactor with an substrate that is converted to a product by the biomass in the reactor. It has three states and a control that is describing the feed concentration of substrate. It is taken from the examples folder of the ACADO toolkit described in:&lt;br /&gt;
&lt;br /&gt;
 Houska, Boris, Hans Joachim Ferreau, and Moritz Diehl. &amp;quot;ACADO toolkit—An open‐source framework for automatic control and dynamic optimization.&amp;quot;&lt;br /&gt;
 Optimal Control Applications and Methods 32.3 (2011): 298-312.&lt;br /&gt;
&lt;br /&gt;
Originally the problem seems to be motivated by:&lt;br /&gt;
&lt;br /&gt;
 VERSYCK, KARINA J., and JAN F. VAN IMPE. &amp;quot;Feed rate optimization for fed-batch bioreactors: From optimal process performance to optimal parameter estimation.&amp;quot;&lt;br /&gt;
 Chemical Engineering Communications 172.1 (1999): 107-124.&lt;br /&gt;
&lt;br /&gt;
== Model Formulation ==&lt;br /&gt;
&lt;br /&gt;
The dynamic model is an [[:Category:ODE model|ODE model]]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{rcl}&lt;br /&gt;
\dot{X}&amp;amp;=&amp;amp;-DX+\mu X \\&lt;br /&gt;
\dot{S}&amp;amp;=&amp;amp; D(S_{f}-S)-\mu /Y_{xs} X \\&lt;br /&gt;
\dot{P}&amp;amp;=&amp;amp;-DP+ (\alpha \mu +\beta) X.&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The three states describe the concentration of the biomass (&amp;lt;math&amp;gt;X&amp;lt;/math&amp;gt;), the substrate (&amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt;), and the product (&amp;lt;math&amp;gt;P&amp;lt;/math&amp;gt;) in the reactor. In steady state the feed and outlet are equal and dilute all three concentrations with a ratio &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;. The biomass grows with a rate&lt;br /&gt;
&amp;lt;math&amp;gt;\mu&amp;lt;/math&amp;gt;, while it eats up the substrate with the rate &amp;lt;math&amp;gt;\mu/Y_{xs}&amp;lt;/math&amp;gt; and produces product at a rate &amp;lt;math&amp;gt;(\alpha \mu +\beta)&amp;lt;/math&amp;gt;. The rate &amp;lt;math&amp;gt;\mu&amp;lt;/math&amp;gt; is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mu = \mu_{m}*(1-P/P_{m})*S/(K_m+S+S^2/K_i)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The fixed parameters (constants) of the model are as follows.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+Parameters&lt;br /&gt;
|-&lt;br /&gt;
|Name&lt;br /&gt;
|Symbol&lt;br /&gt;
|Value&lt;br /&gt;
|Unit&lt;br /&gt;
|-&lt;br /&gt;
|Dilution&lt;br /&gt;
|&amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.15&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Rate coefficient&lt;br /&gt;
|&amp;lt;math&amp;gt;K_i&amp;lt;/math&amp;gt;&lt;br /&gt;
|22&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Rate coefficient&lt;br /&gt;
|&amp;lt;math&amp;gt;K_m&amp;lt;/math&amp;gt;&lt;br /&gt;
|1.2&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Rate coefficient&lt;br /&gt;
|&amp;lt;math&amp;gt;P_m&amp;lt;/math&amp;gt;&lt;br /&gt;
|50&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Substrate to Biomass rate&lt;br /&gt;
|&amp;lt;math&amp;gt;Y_{xs}&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.4&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Linear slope&lt;br /&gt;
|&amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt;&lt;br /&gt;
|2.2&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Linear intercept&lt;br /&gt;
|&amp;lt;math&amp;gt;\beta&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.2&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Maximal growth rate&lt;br /&gt;
|&amp;lt;math&amp;gt;\mu_m&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.48&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Optimal Control Problem ==&lt;br /&gt;
&lt;br /&gt;
Writing shortly for the states in vector notation &amp;lt;math&amp;gt;x=(X,S,P)^T&amp;lt;/math&amp;gt; the OCP reads:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{cl}&lt;br /&gt;
 \displaystyle \min_{x,S_f} &amp;amp; J(x,S_f)\\[1.5ex]&lt;br /&gt;
 \mbox{s.t.} &amp;amp; \dot{x}  =  f(x,S_f), \forall \, t \in [0,48]\\&lt;br /&gt;
 &amp;amp; x(0) = (6.5,12,22)^T \\&lt;br /&gt;
 &amp;amp; x \in \R^3,\,S_f \in [28.7,40].&lt;br /&gt;
\end{array} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Objective ===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
J(x,S_f)=\int_0^{48}D(S_f-P)^2dt&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Reference Solution ==&lt;br /&gt;
&lt;br /&gt;
Here we present the reference solution of the reimplemented example in the ACADO code generation with matlab. The source code is given in the next section.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;Reference solution&amp;quot; widths=&amp;quot;271px&amp;quot; heights=&amp;quot;379px&amp;quot; perrow=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
 Image:ACADO_bioreactor.png| Optimal solution for the ACADO example.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Source Code ==&lt;br /&gt;
&lt;br /&gt;
In this section one can provide the source code of the implementation, that solved the problem and produced the reference solution. This should be done by providing source files.&lt;/div&gt;</summary>
		<author><name>TobiasWeber</name></author>
	</entry>
	<entry>
		<id>https://mintoc.de/index.php?title=Bioreactor&amp;diff=982</id>
		<title>Bioreactor</title>
		<link rel="alternate" type="text/html" href="https://mintoc.de/index.php?title=Bioreactor&amp;diff=982"/>
		<updated>2015-12-09T14:28:54Z</updated>

		<summary type="html">&lt;p&gt;TobiasWeber: /* Reference Solution */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The bioreactor example is an easy bioreactor with an substrate that is converted to a product by the biomass in the reactor. It has three states and a control that is describing the feed concentration of substrate. It is taken from the examples folder of the ACADO toolkit described in:&lt;br /&gt;
&lt;br /&gt;
 Houska, Boris, Hans Joachim Ferreau, and Moritz Diehl. &amp;quot;ACADO toolkit—An open‐source framework for automatic control and dynamic optimization.&amp;quot;&lt;br /&gt;
 Optimal Control Applications and Methods 32.3 (2011): 298-312.&lt;br /&gt;
&lt;br /&gt;
Originally the problem seems to be motivated by:&lt;br /&gt;
&lt;br /&gt;
 VERSYCK, KARINA J., and JAN F. VAN IMPE. &amp;quot;Feed rate optimization for fed-batch bioreactors: From optimal process performance to optimal parameter estimation.&amp;quot;&lt;br /&gt;
 Chemical Engineering Communications 172.1 (1999): 107-124.&lt;br /&gt;
&lt;br /&gt;
== Model Formulation ==&lt;br /&gt;
&lt;br /&gt;
The dynamic model is an [[:Category:ODE model|ODE model]]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{rcl}&lt;br /&gt;
\dot{X}&amp;amp;=&amp;amp;-DX+\mu X \\&lt;br /&gt;
\dot{S}&amp;amp;=&amp;amp; D(S_{f}-S)-\mu /Y_{xs} X \\&lt;br /&gt;
\dot{P}&amp;amp;=&amp;amp;-DP+ (\alpha \mu +\beta) X.&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The three states describe the concentration of the biomass (&amp;lt;math&amp;gt;X&amp;lt;/math&amp;gt;), the substrate (&amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt;), and the product (&amp;lt;math&amp;gt;P&amp;lt;/math&amp;gt;) in the reactor. In steady state the feed and outlet are equal and dilute all three concentrations with a ratio &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;. The biomass grows with a rate&lt;br /&gt;
&amp;lt;math&amp;gt;\mu&amp;lt;/math&amp;gt;, while it eats up the substrate with the rate &amp;lt;math&amp;gt;\mu/Y_{xs}&amp;lt;/math&amp;gt; and produces product at a rate &amp;lt;math&amp;gt;(\alpha \mu +\beta)&amp;lt;/math&amp;gt;. The rate &amp;lt;math&amp;gt;\mu&amp;lt;/math&amp;gt; is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mu = \mu_{m}*(1-P/P_{m})*S/(K_m+S+S^2/K_i)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The fixed parameters (constants) of the model are as follows.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+Parameters&lt;br /&gt;
|-&lt;br /&gt;
|Name&lt;br /&gt;
|Symbol&lt;br /&gt;
|Value&lt;br /&gt;
|Unit&lt;br /&gt;
|-&lt;br /&gt;
|Dilution&lt;br /&gt;
|&amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.15&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Rate coefficient&lt;br /&gt;
|&amp;lt;math&amp;gt;K_i&amp;lt;/math&amp;gt;&lt;br /&gt;
|22&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Rate coefficient&lt;br /&gt;
|&amp;lt;math&amp;gt;K_m&amp;lt;/math&amp;gt;&lt;br /&gt;
|1.2&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Rate coefficient&lt;br /&gt;
|&amp;lt;math&amp;gt;P_m&amp;lt;/math&amp;gt;&lt;br /&gt;
|50&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Substrate to Biomass rate&lt;br /&gt;
|&amp;lt;math&amp;gt;Y_{xs}&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.4&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Linear slope&lt;br /&gt;
|&amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt;&lt;br /&gt;
|2.2&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Linear intercept&lt;br /&gt;
|&amp;lt;math&amp;gt;\beta&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.2&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Maximal growth rate&lt;br /&gt;
|&amp;lt;math&amp;gt;\mu_m&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.48&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Optimal Control Problem ==&lt;br /&gt;
&lt;br /&gt;
Writing shortly for the states in vector notation &amp;lt;math&amp;gt;x=(X,S,P)^T&amp;lt;/math&amp;gt; the OCP reads:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{cl}&lt;br /&gt;
 \displaystyle \min_{x,S_f} &amp;amp; J(x,S_f)\\[1.5ex]&lt;br /&gt;
 \mbox{s.t.} &amp;amp; \dot{x}  =  f(x,S_f), \forall \, t \in [0,48]\\&lt;br /&gt;
 &amp;amp; x(0) = (6.5,12,22)^T \\&lt;br /&gt;
 &amp;amp; x \in \R^3,\,S_f \in [28.7,40].&lt;br /&gt;
\end{array} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Objective ===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
J(x,S_f)=\int_0^{48}D(S_f-P)^2dt&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Reference Solution ==&lt;br /&gt;
&lt;br /&gt;
Here we first give the reference solution according to the ACADO example. In the next section the C++ source code for this solution is given.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;Reference solution&amp;quot; widths=&amp;quot;271px&amp;quot; heights=&amp;quot;379px&amp;quot; perrow=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 Image:test.png| Optimal solution for the ACADO example.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Source Code ==&lt;br /&gt;
&lt;br /&gt;
In this section one can provide the source code of the implementation, that solved the problem and produced the reference solution. This should be done by providing source files.&lt;/div&gt;</summary>
		<author><name>TobiasWeber</name></author>
	</entry>
	<entry>
		<id>https://mintoc.de/index.php?title=Bioreactor&amp;diff=981</id>
		<title>Bioreactor</title>
		<link rel="alternate" type="text/html" href="https://mintoc.de/index.php?title=Bioreactor&amp;diff=981"/>
		<updated>2015-12-09T14:27:54Z</updated>

		<summary type="html">&lt;p&gt;TobiasWeber: /* Reference Solution */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The bioreactor example is an easy bioreactor with an substrate that is converted to a product by the biomass in the reactor. It has three states and a control that is describing the feed concentration of substrate. It is taken from the examples folder of the ACADO toolkit described in:&lt;br /&gt;
&lt;br /&gt;
 Houska, Boris, Hans Joachim Ferreau, and Moritz Diehl. &amp;quot;ACADO toolkit—An open‐source framework for automatic control and dynamic optimization.&amp;quot;&lt;br /&gt;
 Optimal Control Applications and Methods 32.3 (2011): 298-312.&lt;br /&gt;
&lt;br /&gt;
Originally the problem seems to be motivated by:&lt;br /&gt;
&lt;br /&gt;
 VERSYCK, KARINA J., and JAN F. VAN IMPE. &amp;quot;Feed rate optimization for fed-batch bioreactors: From optimal process performance to optimal parameter estimation.&amp;quot;&lt;br /&gt;
 Chemical Engineering Communications 172.1 (1999): 107-124.&lt;br /&gt;
&lt;br /&gt;
== Model Formulation ==&lt;br /&gt;
&lt;br /&gt;
The dynamic model is an [[:Category:ODE model|ODE model]]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{rcl}&lt;br /&gt;
\dot{X}&amp;amp;=&amp;amp;-DX+\mu X \\&lt;br /&gt;
\dot{S}&amp;amp;=&amp;amp; D(S_{f}-S)-\mu /Y_{xs} X \\&lt;br /&gt;
\dot{P}&amp;amp;=&amp;amp;-DP+ (\alpha \mu +\beta) X.&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The three states describe the concentration of the biomass (&amp;lt;math&amp;gt;X&amp;lt;/math&amp;gt;), the substrate (&amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt;), and the product (&amp;lt;math&amp;gt;P&amp;lt;/math&amp;gt;) in the reactor. In steady state the feed and outlet are equal and dilute all three concentrations with a ratio &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;. The biomass grows with a rate&lt;br /&gt;
&amp;lt;math&amp;gt;\mu&amp;lt;/math&amp;gt;, while it eats up the substrate with the rate &amp;lt;math&amp;gt;\mu/Y_{xs}&amp;lt;/math&amp;gt; and produces product at a rate &amp;lt;math&amp;gt;(\alpha \mu +\beta)&amp;lt;/math&amp;gt;. The rate &amp;lt;math&amp;gt;\mu&amp;lt;/math&amp;gt; is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mu = \mu_{m}*(1-P/P_{m})*S/(K_m+S+S^2/K_i)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The fixed parameters (constants) of the model are as follows.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+Parameters&lt;br /&gt;
|-&lt;br /&gt;
|Name&lt;br /&gt;
|Symbol&lt;br /&gt;
|Value&lt;br /&gt;
|Unit&lt;br /&gt;
|-&lt;br /&gt;
|Dilution&lt;br /&gt;
|&amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.15&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Rate coefficient&lt;br /&gt;
|&amp;lt;math&amp;gt;K_i&amp;lt;/math&amp;gt;&lt;br /&gt;
|22&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Rate coefficient&lt;br /&gt;
|&amp;lt;math&amp;gt;K_m&amp;lt;/math&amp;gt;&lt;br /&gt;
|1.2&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Rate coefficient&lt;br /&gt;
|&amp;lt;math&amp;gt;P_m&amp;lt;/math&amp;gt;&lt;br /&gt;
|50&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Substrate to Biomass rate&lt;br /&gt;
|&amp;lt;math&amp;gt;Y_{xs}&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.4&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Linear slope&lt;br /&gt;
|&amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt;&lt;br /&gt;
|2.2&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Linear intercept&lt;br /&gt;
|&amp;lt;math&amp;gt;\beta&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.2&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Maximal growth rate&lt;br /&gt;
|&amp;lt;math&amp;gt;\mu_m&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.48&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Optimal Control Problem ==&lt;br /&gt;
&lt;br /&gt;
Writing shortly for the states in vector notation &amp;lt;math&amp;gt;x=(X,S,P)^T&amp;lt;/math&amp;gt; the OCP reads:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{cl}&lt;br /&gt;
 \displaystyle \min_{x,S_f} &amp;amp; J(x,S_f)\\[1.5ex]&lt;br /&gt;
 \mbox{s.t.} &amp;amp; \dot{x}  =  f(x,S_f), \forall \, t \in [0,48]\\&lt;br /&gt;
 &amp;amp; x(0) = (6.5,12,22)^T \\&lt;br /&gt;
 &amp;amp; x \in \R^3,\,S_f \in [28.7,40].&lt;br /&gt;
\end{array} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Objective ===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
J(x,S_f)=\int_0^{48}D(S_f-P)^2dt&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Reference Solution ==&lt;br /&gt;
&lt;br /&gt;
Here we first give the reference solution according to the ACADO example. In the next section the C++ source code for this solution is given.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;Reference solution&amp;quot; widths=&amp;quot;271px&amp;quot; heights=&amp;quot;379px&amp;quot; perrow=&amp;quot;2&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 Image:test.png| Optimal solution for the ACADO example.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Source Code ==&lt;br /&gt;
&lt;br /&gt;
In this section one can provide the source code of the implementation, that solved the problem and produced the reference solution. This should be done by providing source files.&lt;/div&gt;</summary>
		<author><name>TobiasWeber</name></author>
	</entry>
	<entry>
		<id>https://mintoc.de/index.php?title=Bioreactor&amp;diff=980</id>
		<title>Bioreactor</title>
		<link rel="alternate" type="text/html" href="https://mintoc.de/index.php?title=Bioreactor&amp;diff=980"/>
		<updated>2015-12-09T14:27:37Z</updated>

		<summary type="html">&lt;p&gt;TobiasWeber: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The bioreactor example is an easy bioreactor with an substrate that is converted to a product by the biomass in the reactor. It has three states and a control that is describing the feed concentration of substrate. It is taken from the examples folder of the ACADO toolkit described in:&lt;br /&gt;
&lt;br /&gt;
 Houska, Boris, Hans Joachim Ferreau, and Moritz Diehl. &amp;quot;ACADO toolkit—An open‐source framework for automatic control and dynamic optimization.&amp;quot;&lt;br /&gt;
 Optimal Control Applications and Methods 32.3 (2011): 298-312.&lt;br /&gt;
&lt;br /&gt;
Originally the problem seems to be motivated by:&lt;br /&gt;
&lt;br /&gt;
 VERSYCK, KARINA J., and JAN F. VAN IMPE. &amp;quot;Feed rate optimization for fed-batch bioreactors: From optimal process performance to optimal parameter estimation.&amp;quot;&lt;br /&gt;
 Chemical Engineering Communications 172.1 (1999): 107-124.&lt;br /&gt;
&lt;br /&gt;
== Model Formulation ==&lt;br /&gt;
&lt;br /&gt;
The dynamic model is an [[:Category:ODE model|ODE model]]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{rcl}&lt;br /&gt;
\dot{X}&amp;amp;=&amp;amp;-DX+\mu X \\&lt;br /&gt;
\dot{S}&amp;amp;=&amp;amp; D(S_{f}-S)-\mu /Y_{xs} X \\&lt;br /&gt;
\dot{P}&amp;amp;=&amp;amp;-DP+ (\alpha \mu +\beta) X.&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The three states describe the concentration of the biomass (&amp;lt;math&amp;gt;X&amp;lt;/math&amp;gt;), the substrate (&amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt;), and the product (&amp;lt;math&amp;gt;P&amp;lt;/math&amp;gt;) in the reactor. In steady state the feed and outlet are equal and dilute all three concentrations with a ratio &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;. The biomass grows with a rate&lt;br /&gt;
&amp;lt;math&amp;gt;\mu&amp;lt;/math&amp;gt;, while it eats up the substrate with the rate &amp;lt;math&amp;gt;\mu/Y_{xs}&amp;lt;/math&amp;gt; and produces product at a rate &amp;lt;math&amp;gt;(\alpha \mu +\beta)&amp;lt;/math&amp;gt;. The rate &amp;lt;math&amp;gt;\mu&amp;lt;/math&amp;gt; is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mu = \mu_{m}*(1-P/P_{m})*S/(K_m+S+S^2/K_i)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The fixed parameters (constants) of the model are as follows.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+Parameters&lt;br /&gt;
|-&lt;br /&gt;
|Name&lt;br /&gt;
|Symbol&lt;br /&gt;
|Value&lt;br /&gt;
|Unit&lt;br /&gt;
|-&lt;br /&gt;
|Dilution&lt;br /&gt;
|&amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.15&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Rate coefficient&lt;br /&gt;
|&amp;lt;math&amp;gt;K_i&amp;lt;/math&amp;gt;&lt;br /&gt;
|22&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Rate coefficient&lt;br /&gt;
|&amp;lt;math&amp;gt;K_m&amp;lt;/math&amp;gt;&lt;br /&gt;
|1.2&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Rate coefficient&lt;br /&gt;
|&amp;lt;math&amp;gt;P_m&amp;lt;/math&amp;gt;&lt;br /&gt;
|50&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Substrate to Biomass rate&lt;br /&gt;
|&amp;lt;math&amp;gt;Y_{xs}&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.4&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Linear slope&lt;br /&gt;
|&amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt;&lt;br /&gt;
|2.2&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Linear intercept&lt;br /&gt;
|&amp;lt;math&amp;gt;\beta&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.2&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Maximal growth rate&lt;br /&gt;
|&amp;lt;math&amp;gt;\mu_m&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.48&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Optimal Control Problem ==&lt;br /&gt;
&lt;br /&gt;
Writing shortly for the states in vector notation &amp;lt;math&amp;gt;x=(X,S,P)^T&amp;lt;/math&amp;gt; the OCP reads:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{cl}&lt;br /&gt;
 \displaystyle \min_{x,S_f} &amp;amp; J(x,S_f)\\[1.5ex]&lt;br /&gt;
 \mbox{s.t.} &amp;amp; \dot{x}  =  f(x,S_f), \forall \, t \in [0,48]\\&lt;br /&gt;
 &amp;amp; x(0) = (6.5,12,22)^T \\&lt;br /&gt;
 &amp;amp; x \in \R^3,\,S_f \in [28.7,40].&lt;br /&gt;
\end{array} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Objective ===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
J(x,S_f)=\int_0^{48}D(S_f-P)^2dt&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Reference Solution ==&lt;br /&gt;
&lt;br /&gt;
Here we first give the reference solution according to the ACADO example. In the next section the C++ source code for this solution is given.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;Reference solution&amp;quot; widths=&amp;quot;271px&amp;quot; heights=&amp;quot;379px&amp;quot; perrow=&amp;quot;2&amp;quot;&amp;gt;&lt;br /&gt;
[[File:Example.jpg]]&lt;br /&gt;
 Image:| Optimal solution for the ACADO example.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Source Code ==&lt;br /&gt;
&lt;br /&gt;
In this section one can provide the source code of the implementation, that solved the problem and produced the reference solution. This should be done by providing source files.&lt;/div&gt;</summary>
		<author><name>TobiasWeber</name></author>
	</entry>
	<entry>
		<id>https://mintoc.de/index.php?title=Bioreactor&amp;diff=979</id>
		<title>Bioreactor</title>
		<link rel="alternate" type="text/html" href="https://mintoc.de/index.php?title=Bioreactor&amp;diff=979"/>
		<updated>2015-12-09T14:26:18Z</updated>

		<summary type="html">&lt;p&gt;TobiasWeber: /* Reference Solution */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The bioreactor example is an easy bioreactor with an substrate that is converted to a product by the biomass in the reactor. It has three states and a control that is describing the feed concentration of substrate. It is taken from the examples folder of the ACADO toolkit described in:&lt;br /&gt;
&lt;br /&gt;
 Houska, Boris, Hans Joachim Ferreau, and Moritz Diehl. &amp;quot;ACADO toolkit—An open‐source framework for automatic control and dynamic optimization.&amp;quot;&lt;br /&gt;
 Optimal Control Applications and Methods 32.3 (2011): 298-312.&lt;br /&gt;
&lt;br /&gt;
Originally the problem seems to be motivated by:&lt;br /&gt;
&lt;br /&gt;
 VERSYCK, KARINA J., and JAN F. VAN IMPE. &amp;quot;Feed rate optimization for fed-batch bioreactors: From optimal process performance to optimal parameter estimation.&amp;quot;&lt;br /&gt;
 Chemical Engineering Communications 172.1 (1999): 107-124.&lt;br /&gt;
&lt;br /&gt;
== Model Formulation ==&lt;br /&gt;
&lt;br /&gt;
The dynamic model is an [[:Category:ODE model|ODE model]]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{rcl}&lt;br /&gt;
\dot{X}&amp;amp;=&amp;amp;-DX+\mu X \\&lt;br /&gt;
\dot{S}&amp;amp;=&amp;amp; D(S_{f}-S)-\mu /Y_{xs} X \\&lt;br /&gt;
\dot{P}&amp;amp;=&amp;amp;-DP+ (\alpha \mu +\beta) X.&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The three states describe the concentration of the biomass (&amp;lt;math&amp;gt;X&amp;lt;/math&amp;gt;), the substrate (&amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt;), and the product (&amp;lt;math&amp;gt;P&amp;lt;/math&amp;gt;) in the reactor. In steady state the feed and outlet are equal and dilute all three concentrations with a ratio &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;. The biomass grows with a rate&lt;br /&gt;
&amp;lt;math&amp;gt;\mu&amp;lt;/math&amp;gt;, while it eats up the substrate with the rate &amp;lt;math&amp;gt;\mu/Y_{xs}&amp;lt;/math&amp;gt; and produces product at a rate &amp;lt;math&amp;gt;(\alpha \mu +\beta)&amp;lt;/math&amp;gt;. The rate &amp;lt;math&amp;gt;\mu&amp;lt;/math&amp;gt; is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mu = \mu_{m}*(1-P/P_{m})*S/(K_m+S+S^2/K_i)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The fixed parameters (constants) of the model are as follows.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+Parameters&lt;br /&gt;
|-&lt;br /&gt;
|Name&lt;br /&gt;
|Symbol&lt;br /&gt;
|Value&lt;br /&gt;
|Unit&lt;br /&gt;
|-&lt;br /&gt;
|Dilution&lt;br /&gt;
|&amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.15&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Rate coefficient&lt;br /&gt;
|&amp;lt;math&amp;gt;K_i&amp;lt;/math&amp;gt;&lt;br /&gt;
|22&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Rate coefficient&lt;br /&gt;
|&amp;lt;math&amp;gt;K_m&amp;lt;/math&amp;gt;&lt;br /&gt;
|1.2&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Rate coefficient&lt;br /&gt;
|&amp;lt;math&amp;gt;P_m&amp;lt;/math&amp;gt;&lt;br /&gt;
|50&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Substrate to Biomass rate&lt;br /&gt;
|&amp;lt;math&amp;gt;Y_{xs}&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.4&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Linear slope&lt;br /&gt;
|&amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt;&lt;br /&gt;
|2.2&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Linear intercept&lt;br /&gt;
|&amp;lt;math&amp;gt;\beta&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.2&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Maximal growth rate&lt;br /&gt;
|&amp;lt;math&amp;gt;\mu_m&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.48&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Optimal Control Problem ==&lt;br /&gt;
&lt;br /&gt;
Writing shortly for the states in vector notation &amp;lt;math&amp;gt;x=(X,S,P)^T&amp;lt;/math&amp;gt; the OCP reads:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{cl}&lt;br /&gt;
 \displaystyle \min_{x,S_f} &amp;amp; J(x,S_f)\\[1.5ex]&lt;br /&gt;
 \mbox{s.t.} &amp;amp; \dot{x}  =  f(x,S_f), \forall \, t \in [0,48]\\&lt;br /&gt;
 &amp;amp; x(0) = (6.5,12,22)^T \\&lt;br /&gt;
 &amp;amp; x \in \R^3,\,S_f \in [28.7,40].&lt;br /&gt;
\end{array} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Objective ===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
J(x,S_f)=\int_0^{48}D(S_f-P)^2dt&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Reference Solution ==&lt;br /&gt;
&lt;br /&gt;
Here we first give the reference solution according to the ACADO example. In the next section the C++ source code for this solution is given.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;Reference solution&amp;quot; widths=&amp;quot;271px&amp;quot; heights=&amp;quot;379px&amp;quot; perrow=&amp;quot;2&amp;quot;&amp;gt;&lt;br /&gt;
 Image:| Optimal solution for the ACADO example.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Source Code ==&lt;br /&gt;
&lt;br /&gt;
In this section one can provide the source code of the implementation, that solved the problem and produced the reference solution. This should be done by providing source files.&lt;/div&gt;</summary>
		<author><name>TobiasWeber</name></author>
	</entry>
	<entry>
		<id>https://mintoc.de/index.php?title=Bioreactor&amp;diff=978</id>
		<title>Bioreactor</title>
		<link rel="alternate" type="text/html" href="https://mintoc.de/index.php?title=Bioreactor&amp;diff=978"/>
		<updated>2015-12-09T14:24:57Z</updated>

		<summary type="html">&lt;p&gt;TobiasWeber: /* Reference Solution */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The bioreactor example is an easy bioreactor with an substrate that is converted to a product by the biomass in the reactor. It has three states and a control that is describing the feed concentration of substrate. It is taken from the examples folder of the ACADO toolkit described in:&lt;br /&gt;
&lt;br /&gt;
 Houska, Boris, Hans Joachim Ferreau, and Moritz Diehl. &amp;quot;ACADO toolkit—An open‐source framework for automatic control and dynamic optimization.&amp;quot;&lt;br /&gt;
 Optimal Control Applications and Methods 32.3 (2011): 298-312.&lt;br /&gt;
&lt;br /&gt;
Originally the problem seems to be motivated by:&lt;br /&gt;
&lt;br /&gt;
 VERSYCK, KARINA J., and JAN F. VAN IMPE. &amp;quot;Feed rate optimization for fed-batch bioreactors: From optimal process performance to optimal parameter estimation.&amp;quot;&lt;br /&gt;
 Chemical Engineering Communications 172.1 (1999): 107-124.&lt;br /&gt;
&lt;br /&gt;
== Model Formulation ==&lt;br /&gt;
&lt;br /&gt;
The dynamic model is an [[:Category:ODE model|ODE model]]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{rcl}&lt;br /&gt;
\dot{X}&amp;amp;=&amp;amp;-DX+\mu X \\&lt;br /&gt;
\dot{S}&amp;amp;=&amp;amp; D(S_{f}-S)-\mu /Y_{xs} X \\&lt;br /&gt;
\dot{P}&amp;amp;=&amp;amp;-DP+ (\alpha \mu +\beta) X.&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The three states describe the concentration of the biomass (&amp;lt;math&amp;gt;X&amp;lt;/math&amp;gt;), the substrate (&amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt;), and the product (&amp;lt;math&amp;gt;P&amp;lt;/math&amp;gt;) in the reactor. In steady state the feed and outlet are equal and dilute all three concentrations with a ratio &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;. The biomass grows with a rate&lt;br /&gt;
&amp;lt;math&amp;gt;\mu&amp;lt;/math&amp;gt;, while it eats up the substrate with the rate &amp;lt;math&amp;gt;\mu/Y_{xs}&amp;lt;/math&amp;gt; and produces product at a rate &amp;lt;math&amp;gt;(\alpha \mu +\beta)&amp;lt;/math&amp;gt;. The rate &amp;lt;math&amp;gt;\mu&amp;lt;/math&amp;gt; is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mu = \mu_{m}*(1-P/P_{m})*S/(K_m+S+S^2/K_i)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The fixed parameters (constants) of the model are as follows.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+Parameters&lt;br /&gt;
|-&lt;br /&gt;
|Name&lt;br /&gt;
|Symbol&lt;br /&gt;
|Value&lt;br /&gt;
|Unit&lt;br /&gt;
|-&lt;br /&gt;
|Dilution&lt;br /&gt;
|&amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.15&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Rate coefficient&lt;br /&gt;
|&amp;lt;math&amp;gt;K_i&amp;lt;/math&amp;gt;&lt;br /&gt;
|22&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Rate coefficient&lt;br /&gt;
|&amp;lt;math&amp;gt;K_m&amp;lt;/math&amp;gt;&lt;br /&gt;
|1.2&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Rate coefficient&lt;br /&gt;
|&amp;lt;math&amp;gt;P_m&amp;lt;/math&amp;gt;&lt;br /&gt;
|50&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Substrate to Biomass rate&lt;br /&gt;
|&amp;lt;math&amp;gt;Y_{xs}&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.4&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Linear slope&lt;br /&gt;
|&amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt;&lt;br /&gt;
|2.2&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Linear intercept&lt;br /&gt;
|&amp;lt;math&amp;gt;\beta&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.2&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Maximal growth rate&lt;br /&gt;
|&amp;lt;math&amp;gt;\mu_m&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.48&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Optimal Control Problem ==&lt;br /&gt;
&lt;br /&gt;
Writing shortly for the states in vector notation &amp;lt;math&amp;gt;x=(X,S,P)^T&amp;lt;/math&amp;gt; the OCP reads:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{cl}&lt;br /&gt;
 \displaystyle \min_{x,S_f} &amp;amp; J(x,S_f)\\[1.5ex]&lt;br /&gt;
 \mbox{s.t.} &amp;amp; \dot{x}  =  f(x,S_f), \forall \, t \in [0,48]\\&lt;br /&gt;
 &amp;amp; x(0) = (6.5,12,22)^T \\&lt;br /&gt;
 &amp;amp; x \in \R^3,\,S_f \in [28.7,40].&lt;br /&gt;
\end{array} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Objective ===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
J(x,S_f)=\int_0^{48}D(S_f-P)^2dt&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Reference Solution ==&lt;br /&gt;
&lt;br /&gt;
Here we first give the reference solution according to the ACADO example. In the next section the C++ source code for this solution is given.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;Reference solution plots&amp;quot; widths=&amp;quot;271px&amp;quot; heights=&amp;quot;379px&amp;quot; perrow=&amp;quot;2&amp;quot;&amp;gt;&lt;br /&gt;
 Image:subway78000PathConstraint1600-24Opt1.png| Optimal solution for the ACADO example.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Source Code ==&lt;br /&gt;
&lt;br /&gt;
In this section one can provide the source code of the implementation, that solved the problem and produced the reference solution. This should be done by providing source files.&lt;/div&gt;</summary>
		<author><name>TobiasWeber</name></author>
	</entry>
	<entry>
		<id>https://mintoc.de/index.php?title=Bioreactor&amp;diff=977</id>
		<title>Bioreactor</title>
		<link rel="alternate" type="text/html" href="https://mintoc.de/index.php?title=Bioreactor&amp;diff=977"/>
		<updated>2015-12-09T14:24:33Z</updated>

		<summary type="html">&lt;p&gt;TobiasWeber: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The bioreactor example is an easy bioreactor with an substrate that is converted to a product by the biomass in the reactor. It has three states and a control that is describing the feed concentration of substrate. It is taken from the examples folder of the ACADO toolkit described in:&lt;br /&gt;
&lt;br /&gt;
 Houska, Boris, Hans Joachim Ferreau, and Moritz Diehl. &amp;quot;ACADO toolkit—An open‐source framework for automatic control and dynamic optimization.&amp;quot;&lt;br /&gt;
 Optimal Control Applications and Methods 32.3 (2011): 298-312.&lt;br /&gt;
&lt;br /&gt;
Originally the problem seems to be motivated by:&lt;br /&gt;
&lt;br /&gt;
 VERSYCK, KARINA J., and JAN F. VAN IMPE. &amp;quot;Feed rate optimization for fed-batch bioreactors: From optimal process performance to optimal parameter estimation.&amp;quot;&lt;br /&gt;
 Chemical Engineering Communications 172.1 (1999): 107-124.&lt;br /&gt;
&lt;br /&gt;
== Model Formulation ==&lt;br /&gt;
&lt;br /&gt;
The dynamic model is an [[:Category:ODE model|ODE model]]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{rcl}&lt;br /&gt;
\dot{X}&amp;amp;=&amp;amp;-DX+\mu X \\&lt;br /&gt;
\dot{S}&amp;amp;=&amp;amp; D(S_{f}-S)-\mu /Y_{xs} X \\&lt;br /&gt;
\dot{P}&amp;amp;=&amp;amp;-DP+ (\alpha \mu +\beta) X.&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The three states describe the concentration of the biomass (&amp;lt;math&amp;gt;X&amp;lt;/math&amp;gt;), the substrate (&amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt;), and the product (&amp;lt;math&amp;gt;P&amp;lt;/math&amp;gt;) in the reactor. In steady state the feed and outlet are equal and dilute all three concentrations with a ratio &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;. The biomass grows with a rate&lt;br /&gt;
&amp;lt;math&amp;gt;\mu&amp;lt;/math&amp;gt;, while it eats up the substrate with the rate &amp;lt;math&amp;gt;\mu/Y_{xs}&amp;lt;/math&amp;gt; and produces product at a rate &amp;lt;math&amp;gt;(\alpha \mu +\beta)&amp;lt;/math&amp;gt;. The rate &amp;lt;math&amp;gt;\mu&amp;lt;/math&amp;gt; is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mu = \mu_{m}*(1-P/P_{m})*S/(K_m+S+S^2/K_i)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The fixed parameters (constants) of the model are as follows.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+Parameters&lt;br /&gt;
|-&lt;br /&gt;
|Name&lt;br /&gt;
|Symbol&lt;br /&gt;
|Value&lt;br /&gt;
|Unit&lt;br /&gt;
|-&lt;br /&gt;
|Dilution&lt;br /&gt;
|&amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.15&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Rate coefficient&lt;br /&gt;
|&amp;lt;math&amp;gt;K_i&amp;lt;/math&amp;gt;&lt;br /&gt;
|22&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Rate coefficient&lt;br /&gt;
|&amp;lt;math&amp;gt;K_m&amp;lt;/math&amp;gt;&lt;br /&gt;
|1.2&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Rate coefficient&lt;br /&gt;
|&amp;lt;math&amp;gt;P_m&amp;lt;/math&amp;gt;&lt;br /&gt;
|50&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Substrate to Biomass rate&lt;br /&gt;
|&amp;lt;math&amp;gt;Y_{xs}&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.4&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Linear slope&lt;br /&gt;
|&amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt;&lt;br /&gt;
|2.2&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Linear intercept&lt;br /&gt;
|&amp;lt;math&amp;gt;\beta&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.2&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Maximal growth rate&lt;br /&gt;
|&amp;lt;math&amp;gt;\mu_m&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.48&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Optimal Control Problem ==&lt;br /&gt;
&lt;br /&gt;
Writing shortly for the states in vector notation &amp;lt;math&amp;gt;x=(X,S,P)^T&amp;lt;/math&amp;gt; the OCP reads:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{cl}&lt;br /&gt;
 \displaystyle \min_{x,S_f} &amp;amp; J(x,S_f)\\[1.5ex]&lt;br /&gt;
 \mbox{s.t.} &amp;amp; \dot{x}  =  f(x,S_f), \forall \, t \in [0,48]\\&lt;br /&gt;
 &amp;amp; x(0) = (6.5,12,22)^T \\&lt;br /&gt;
 &amp;amp; x \in \R^3,\,S_f \in [28.7,40].&lt;br /&gt;
\end{array} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Objective ===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
J(x,S_f)=\int_0^{48}D(S_f-P)^2dt&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Reference Solution ==&lt;br /&gt;
&lt;br /&gt;
Here we first give the reference solution according to the ACADO example. In the next section the C++ source code for this solution is given.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;Reference solution plots&amp;quot; widths=&amp;quot;271px&amp;quot; heights=&amp;quot;379px&amp;quot; perrow=&amp;quot;2&amp;quot;&amp;gt;&lt;br /&gt;
| Optimal solution for the ACADO example.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Source Code ==&lt;br /&gt;
&lt;br /&gt;
In this section one can provide the source code of the implementation, that solved the problem and produced the reference solution. This should be done by providing source files.&lt;/div&gt;</summary>
		<author><name>TobiasWeber</name></author>
	</entry>
	<entry>
		<id>https://mintoc.de/index.php?title=Bioreactor&amp;diff=893</id>
		<title>Bioreactor</title>
		<link rel="alternate" type="text/html" href="https://mintoc.de/index.php?title=Bioreactor&amp;diff=893"/>
		<updated>2015-12-08T15:06:31Z</updated>

		<summary type="html">&lt;p&gt;TobiasWeber: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The bioreactor example is an easy bioreactor with an substrate that is converted to a product by the biomass in the reactor. It has three states and a control that is describing the feed concentration of substrate. It is taken from the examples folder of the ACADO toolkit described in:&lt;br /&gt;
&lt;br /&gt;
 Houska, Boris, Hans Joachim Ferreau, and Moritz Diehl. &amp;quot;ACADO toolkit—An open‐source framework for automatic control and dynamic optimization.&amp;quot;&lt;br /&gt;
 Optimal Control Applications and Methods 32.3 (2011): 298-312.&lt;br /&gt;
&lt;br /&gt;
Originally the problem seems to be motivated by:&lt;br /&gt;
&lt;br /&gt;
 VERSYCK, KARINA J., and JAN F. VAN IMPE. &amp;quot;Feed rate optimization for fed-batch bioreactors: From optimal process performance to optimal parameter estimation.&amp;quot;&lt;br /&gt;
 Chemical Engineering Communications 172.1 (1999): 107-124.&lt;br /&gt;
&lt;br /&gt;
== Model Formulation ==&lt;br /&gt;
&lt;br /&gt;
The dynamic model is an [[:Category:ODE model|ODE model]]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{rcl}&lt;br /&gt;
\dot{X}&amp;amp;=&amp;amp;-DX+\mu X \\&lt;br /&gt;
\dot{S}&amp;amp;=&amp;amp; D(S_{f}-S)-\mu /Y_{xs} X \\&lt;br /&gt;
\dot{P}&amp;amp;=&amp;amp;-DP+ (\alpha \mu +\beta) X.&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The three states describe the concentration of the biomass (&amp;lt;math&amp;gt;X&amp;lt;/math&amp;gt;), the substrate (&amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt;), and the product (&amp;lt;math&amp;gt;P&amp;lt;/math&amp;gt;) in the reactor. In steady state the feed and outlet are equal and dilute all three concentrations with a ratio &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;. The biomass grows with a rate&lt;br /&gt;
&amp;lt;math&amp;gt;\mu&amp;lt;/math&amp;gt;, while it eats up the substrate with the rate &amp;lt;math&amp;gt;\mu/Y_{xs}&amp;lt;/math&amp;gt; and produces product at a rate &amp;lt;math&amp;gt;(\alpha \mu +\beta)&amp;lt;/math&amp;gt;. The rate &amp;lt;math&amp;gt;\mu&amp;lt;/math&amp;gt; is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mu = \mu_{m}*(1-P/P_{m})*S/(K_m+S+S^2/K_i)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The fixed parameters (constants) of the model are as follows.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+Parameters&lt;br /&gt;
|-&lt;br /&gt;
|Name&lt;br /&gt;
|Symbol&lt;br /&gt;
|Value&lt;br /&gt;
|Unit&lt;br /&gt;
|-&lt;br /&gt;
|Dilution&lt;br /&gt;
|&amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.15&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Rate coefficient&lt;br /&gt;
|&amp;lt;math&amp;gt;K_i&amp;lt;/math&amp;gt;&lt;br /&gt;
|22&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Rate coefficient&lt;br /&gt;
|&amp;lt;math&amp;gt;K_m&amp;lt;/math&amp;gt;&lt;br /&gt;
|1.2&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Rate coefficient&lt;br /&gt;
|&amp;lt;math&amp;gt;P_m&amp;lt;/math&amp;gt;&lt;br /&gt;
|50&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Substrate to Biomass rate&lt;br /&gt;
|&amp;lt;math&amp;gt;Y_{xs}&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.4&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Linear slope&lt;br /&gt;
|&amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt;&lt;br /&gt;
|2.2&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Linear intercept&lt;br /&gt;
|&amp;lt;math&amp;gt;\beta&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.2&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Maximal growth rate&lt;br /&gt;
|&amp;lt;math&amp;gt;\mu_m&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.48&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Optimal Control Problem ==&lt;br /&gt;
&lt;br /&gt;
Writing shortly for the states in vector notation &amp;lt;math&amp;gt;x=(X,S,P)^T&amp;lt;/math&amp;gt; the OCP reads:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{cl}&lt;br /&gt;
 \displaystyle \min_{x,S_f} &amp;amp; J(x,S_f)\\[1.5ex]&lt;br /&gt;
 \mbox{s.t.} &amp;amp; \dot{x}  =  f(x,S_f), \forall \, t \in [0,48]\\&lt;br /&gt;
 &amp;amp; x(0) = (6.5,12,22)^T \\&lt;br /&gt;
 &amp;amp; x \in \R^3,\,S_f \in [28.7,40].&lt;br /&gt;
\end{array} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Objective ===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
J(x,S_f)=\int_0^{48}D(S_f-P)^2dt&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;/div&gt;</summary>
		<author><name>TobiasWeber</name></author>
	</entry>
	<entry>
		<id>https://mintoc.de/index.php?title=Bioreactor&amp;diff=892</id>
		<title>Bioreactor</title>
		<link rel="alternate" type="text/html" href="https://mintoc.de/index.php?title=Bioreactor&amp;diff=892"/>
		<updated>2015-12-08T15:04:35Z</updated>

		<summary type="html">&lt;p&gt;TobiasWeber: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The bioreactor example is an easy bioreactor with an substrate that is converted to a product by the biomass in the reactor. It has three states and a control that is describing the feed concentration of substrate. It is taken from the examples folder of the ACADO toolkit described in:&lt;br /&gt;
&lt;br /&gt;
 Houska, Boris, Hans Joachim Ferreau, and Moritz Diehl. &amp;quot;ACADO toolkit—An open‐source framework for automatic control and dynamic optimization.&amp;quot;&lt;br /&gt;
 Optimal Control Applications and Methods 32.3 (2011): 298-312.&lt;br /&gt;
&lt;br /&gt;
Originally the problem seems to be motivated by:&lt;br /&gt;
&lt;br /&gt;
 VERSYCK, KARINA J., and JAN F. VAN IMPE. &amp;quot;Feed rate optimization for fed-batch bioreactors: From optimal process performance to optimal parameter estimation.&amp;quot;&lt;br /&gt;
 Chemical Engineering Communications 172.1 (1999): 107-124.&lt;br /&gt;
&lt;br /&gt;
== Model Formulation ==&lt;br /&gt;
&lt;br /&gt;
The dynamic model is an [[:Category:ODE model|ODE model]]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{rcl}&lt;br /&gt;
\dot{X}&amp;amp;=&amp;amp;-DX+\mu X \\&lt;br /&gt;
\dot{S}&amp;amp;=&amp;amp; D(S_{f}-S)-\mu /Y_{xs} X \\&lt;br /&gt;
\dot{P}&amp;amp;=&amp;amp;-DP+ (\alpha \mu +\beta) X.&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The three states describe the concentration of the biomass (&amp;lt;math&amp;gt;X&amp;lt;/math&amp;gt;), the substrate (&amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt;), and the product (&amp;lt;math&amp;gt;P&amp;lt;/math&amp;gt;) in the reactor. In steady state the feed and outlet are equal and dilute all three concentrations with a ratio &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;. The biomass grows with a rate&lt;br /&gt;
&amp;lt;math&amp;gt;\mu&amp;lt;/math&amp;gt;, while it eats up the substrate with the rate &amp;lt;math&amp;gt;\mu/Y_{xs}&amp;lt;/math&amp;gt; and produces product at a rate &amp;lt;math&amp;gt;(\alpha \mu +\beta)&amp;lt;/math&amp;gt;. The rate &amp;lt;math&amp;gt;\mu&amp;lt;/math&amp;gt; is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mu = \mu_{m}*(1-P/P_{m})*S/(K_m+S+S^2/K_i)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The fixed parameters (constants) of the model are as follows.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+Parameters&lt;br /&gt;
|-&lt;br /&gt;
|Name&lt;br /&gt;
|Symbol&lt;br /&gt;
|Value&lt;br /&gt;
|Unit&lt;br /&gt;
|-&lt;br /&gt;
|Dilution&lt;br /&gt;
|&amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.15&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Rate coefficient&lt;br /&gt;
|&amp;lt;math&amp;gt;K_i&amp;lt;/math&amp;gt;&lt;br /&gt;
|22&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Rate coefficient&lt;br /&gt;
|&amp;lt;math&amp;gt;K_m&amp;lt;/math&amp;gt;&lt;br /&gt;
|1.2&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Rate coefficient&lt;br /&gt;
|&amp;lt;math&amp;gt;P_m&amp;lt;/math&amp;gt;&lt;br /&gt;
|50&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Substrate to Biomass rate&lt;br /&gt;
|&amp;lt;math&amp;gt;Y_{xs}&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.4&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Linear slope&lt;br /&gt;
|&amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt;&lt;br /&gt;
|2.2&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Linear intercept&lt;br /&gt;
|&amp;lt;math&amp;gt;\beta&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.2&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Maximal growth rate&lt;br /&gt;
|&amp;lt;math&amp;gt;\mu_m&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.48&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Optimal Control Problem ==&lt;br /&gt;
&lt;br /&gt;
Writing shortly for the states in vector notation &amp;lt;math&amp;gt;x=(X,S,P)^T&amp;lt;/math&amp;gt; the OCP reads:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{cl}&lt;br /&gt;
 \displaystyle \min_{x,S_f} &amp;amp; J(x,S_f)\\[1.5ex]&lt;br /&gt;
 \mbox{s.t.} &amp;amp; \dot{x}  =  f(x,S_f), \forall \, t \in [0,48]\\&lt;br /&gt;
 &amp;amp; x(0) = [6.5,12,22]^T \\&lt;br /&gt;
 &amp;amp; x \in \R^3,\,S_f \in [28.7,40].&lt;br /&gt;
\end{array} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the most general formulation, where the initial value, parameters, and inputs are free. The states and inputs are vectors (or matrices) of functions while the parameters are just a vector of variables. If the initial (or final) state is fixed, one just adds a constraint &amp;lt;math&amp;gt;x(t_0)=x_0&amp;lt;/math&amp;gt; and specifies the value(s) of &amp;lt;math&amp;gt;x_0&amp;lt;/math&amp;gt; in a list or table.&lt;br /&gt;
If the parameters are fixed, then one just removes them from the list of optimization variables and states their values in a list (same for point conditions inside of the interval &amp;lt;math&amp;gt;I&amp;lt;/math&amp;gt;). If the OCP is a parameter estimation problem without inputs,&lt;br /&gt;
the inputs just dont appear in the problem above at all, neither as optimization variable nor as part of the constraints. In contrast if they are just fixed this is done by the equality constraints. In this setup the above problem is very general and by&lt;br /&gt;
stating the different objective functions and constraint functions one can cover a wide range of OCPs.&lt;/div&gt;</summary>
		<author><name>TobiasWeber</name></author>
	</entry>
	<entry>
		<id>https://mintoc.de/index.php?title=Bioreactor&amp;diff=891</id>
		<title>Bioreactor</title>
		<link rel="alternate" type="text/html" href="https://mintoc.de/index.php?title=Bioreactor&amp;diff=891"/>
		<updated>2015-12-08T15:03:39Z</updated>

		<summary type="html">&lt;p&gt;TobiasWeber: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The bioreactor example is an easy bioreactor with an substrate that is converted to a product by the biomass in the reactor. It has three states and a control that is describing the feed concentration of substrate. It is taken from the examples folder of the ACADO toolkit described in:&lt;br /&gt;
&lt;br /&gt;
 Houska, Boris, Hans Joachim Ferreau, and Moritz Diehl. &amp;quot;ACADO toolkit—An open‐source framework for automatic control and dynamic optimization.&amp;quot;&lt;br /&gt;
 Optimal Control Applications and Methods 32.3 (2011): 298-312.&lt;br /&gt;
&lt;br /&gt;
Originally the problem seems to be motivated by:&lt;br /&gt;
&lt;br /&gt;
 VERSYCK, KARINA J., and JAN F. VAN IMPE. &amp;quot;Feed rate optimization for fed-batch bioreactors: From optimal process performance to optimal parameter estimation.&amp;quot;&lt;br /&gt;
 Chemical Engineering Communications 172.1 (1999): 107-124.&lt;br /&gt;
&lt;br /&gt;
== Model Formulation ==&lt;br /&gt;
&lt;br /&gt;
The dynamic model is an [[:Category:ODE model|ODE model]]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{rcl}&lt;br /&gt;
\dot{X}&amp;amp;=&amp;amp;-DX+\mu X \\&lt;br /&gt;
\dot{S}&amp;amp;=&amp;amp; D(S_{f}-S)-\mu /Y_{xs} X \\&lt;br /&gt;
\dot{P}&amp;amp;=&amp;amp;-DP+ (\alpha \mu +\beta) X.&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The three states describe the concentration of the biomass (&amp;lt;math&amp;gt;X&amp;lt;/math&amp;gt;), the substrate (&amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt;), and the product (&amp;lt;math&amp;gt;P&amp;lt;/math&amp;gt;) in the reactor. In steady state the feed and outlet are equal and dilute all three concentrations with a ratio &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;. The biomass grows with a rate&lt;br /&gt;
&amp;lt;math&amp;gt;\mu&amp;lt;/math&amp;gt;, while it eats up the substrate with the rate &amp;lt;math&amp;gt;\mu/Y_{xs}&amp;lt;/math&amp;gt; and produces product at a rate &amp;lt;math&amp;gt;(\alpha \mu +\beta)&amp;lt;/math&amp;gt;. The rate &amp;lt;math&amp;gt;\mu&amp;lt;/math&amp;gt; is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mu = \mu_{m}*(1-P/P_{m})*S/(K_m+S+S^2/K_i)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The fixed parameters (constants) of the model are as follows.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+Parameters&lt;br /&gt;
|-&lt;br /&gt;
|Name&lt;br /&gt;
|Symbol&lt;br /&gt;
|Value&lt;br /&gt;
|Unit&lt;br /&gt;
|-&lt;br /&gt;
|Dilution&lt;br /&gt;
|&amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.15&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Rate coefficient&lt;br /&gt;
|&amp;lt;math&amp;gt;K_i&amp;lt;/math&amp;gt;&lt;br /&gt;
|22&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Rate coefficient&lt;br /&gt;
|&amp;lt;math&amp;gt;K_m&amp;lt;/math&amp;gt;&lt;br /&gt;
|1.2&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Rate coefficient&lt;br /&gt;
|&amp;lt;math&amp;gt;P_m&amp;lt;/math&amp;gt;&lt;br /&gt;
|50&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Substrate to Biomass rate&lt;br /&gt;
|&amp;lt;math&amp;gt;Y_{xs}&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.4&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Linear slope&lt;br /&gt;
|&amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt;&lt;br /&gt;
|2.2&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Linear intercept&lt;br /&gt;
|&amp;lt;math&amp;gt;\beta&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.2&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Maximal growth rate&lt;br /&gt;
|&amp;lt;math&amp;gt;\mu_m&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.48&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Optimal Control Problem ==&lt;br /&gt;
&lt;br /&gt;
Writing shortly for the states in vector notation &amp;lt;math&amp;gt;x=(X,S,P)^T&amp;lt;/math&amp;gt; the OCP reads:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{cl}&lt;br /&gt;
 \displaystyle \min_{x,S_f} &amp;amp; J(x,S_f)\\[1.5ex]&lt;br /&gt;
 \mbox{s.t.} &amp;amp; \dot{x}  =  f(x,S_f), \forall \, t \in [0,48]\\&lt;br /&gt;
 &amp;amp; 0 = g(x(t_o)) \\&lt;br /&gt;
 &amp;amp; x \in \R^3,\,S_f \in [28.7,40].&lt;br /&gt;
\end{array} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the most general formulation, where the initial value, parameters, and inputs are free. The states and inputs are vectors (or matrices) of functions while the parameters are just a vector of variables. If the initial (or final) state is fixed, one just adds a constraint &amp;lt;math&amp;gt;x(t_0)=x_0&amp;lt;/math&amp;gt; and specifies the value(s) of &amp;lt;math&amp;gt;x_0&amp;lt;/math&amp;gt; in a list or table.&lt;br /&gt;
If the parameters are fixed, then one just removes them from the list of optimization variables and states their values in a list (same for point conditions inside of the interval &amp;lt;math&amp;gt;I&amp;lt;/math&amp;gt;). If the OCP is a parameter estimation problem without inputs,&lt;br /&gt;
the inputs just dont appear in the problem above at all, neither as optimization variable nor as part of the constraints. In contrast if they are just fixed this is done by the equality constraints. In this setup the above problem is very general and by&lt;br /&gt;
stating the different objective functions and constraint functions one can cover a wide range of OCPs.&lt;/div&gt;</summary>
		<author><name>TobiasWeber</name></author>
	</entry>
	<entry>
		<id>https://mintoc.de/index.php?title=Bioreactor&amp;diff=890</id>
		<title>Bioreactor</title>
		<link rel="alternate" type="text/html" href="https://mintoc.de/index.php?title=Bioreactor&amp;diff=890"/>
		<updated>2015-12-08T15:03:11Z</updated>

		<summary type="html">&lt;p&gt;TobiasWeber: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The bioreactor example is an easy bioreactor with an substrate that is converted to a product by the biomass in the reactor. It has three states and a control that is describing the feed concentration of substrate. It is taken from the examples folder of the ACADO toolkit described in:&lt;br /&gt;
&lt;br /&gt;
 Houska, Boris, Hans Joachim Ferreau, and Moritz Diehl. &amp;quot;ACADO toolkit—An open‐source framework for automatic control and dynamic optimization.&amp;quot;&lt;br /&gt;
 Optimal Control Applications and Methods 32.3 (2011): 298-312.&lt;br /&gt;
&lt;br /&gt;
Originally the problem seems to be motivated by:&lt;br /&gt;
&lt;br /&gt;
 VERSYCK, KARINA J., and JAN F. VAN IMPE. &amp;quot;Feed rate optimization for fed-batch bioreactors: From optimal process performance to optimal parameter estimation.&amp;quot;&lt;br /&gt;
 Chemical Engineering Communications 172.1 (1999): 107-124.&lt;br /&gt;
&lt;br /&gt;
== Model Formulation ==&lt;br /&gt;
&lt;br /&gt;
The dynamic model is an [[:Category:ODE model|ODE model]]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{rcl}&lt;br /&gt;
\dot{X}&amp;amp;=&amp;amp;-DX+\mu X \\&lt;br /&gt;
\dot{S}&amp;amp;=&amp;amp; D(S_{f}-S)-\mu /Y_{xs} X \\&lt;br /&gt;
\dot{P}&amp;amp;=&amp;amp;-DP+ (\alpha \mu +\beta) X.&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The three states describe the concentration of the biomass (&amp;lt;math&amp;gt;X&amp;lt;/math&amp;gt;), the substrate (&amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt;), and the product (&amp;lt;math&amp;gt;P&amp;lt;/math&amp;gt;) in the reactor. In steady state the feed and outlet are equal and dilute all three concentrations with a ratio &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;. The biomass grows with a rate&lt;br /&gt;
&amp;lt;math&amp;gt;\mu&amp;lt;/math&amp;gt;, while it eats up the substrate with the rate &amp;lt;math&amp;gt;\mu/Y_{xs}&amp;lt;/math&amp;gt; and produces product at a rate &amp;lt;math&amp;gt;(\alpha \mu +\beta)&amp;lt;/math&amp;gt;. The rate &amp;lt;math&amp;gt;\mu&amp;lt;/math&amp;gt; is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mu = \mu_{m}*(1-P/P_{m})*S/(K_m+S+S^2/K_i)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The fixed parameters (constants) of the model are as follows.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+Parameters&lt;br /&gt;
|-&lt;br /&gt;
|Name&lt;br /&gt;
|Symbol&lt;br /&gt;
|Value&lt;br /&gt;
|Unit&lt;br /&gt;
|-&lt;br /&gt;
|Dilution&lt;br /&gt;
|&amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.15&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Rate coefficient&lt;br /&gt;
|&amp;lt;math&amp;gt;K_i&amp;lt;/math&amp;gt;&lt;br /&gt;
|22&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Rate coefficient&lt;br /&gt;
|&amp;lt;math&amp;gt;K_m&amp;lt;/math&amp;gt;&lt;br /&gt;
|1.2&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Rate coefficient&lt;br /&gt;
|&amp;lt;math&amp;gt;P_m&amp;lt;/math&amp;gt;&lt;br /&gt;
|50&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Substrate to Biomass rate&lt;br /&gt;
|&amp;lt;math&amp;gt;Y_{xs}&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.4&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Linear slope&lt;br /&gt;
|&amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt;&lt;br /&gt;
|2.2&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Linear intercept&lt;br /&gt;
|&amp;lt;math&amp;gt;\beta&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.2&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Maximal growth rate&lt;br /&gt;
|&amp;lt;math&amp;gt;\mu_m&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.48&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Optimal Control Problem ==&lt;br /&gt;
&lt;br /&gt;
Writing shortly for the states in vector notation &amp;lt;math&amp;gt;x=(X,S,P)^T&amp;lt;/math&amp;gt; the OCP reads:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{cl}&lt;br /&gt;
 \displaystyle \min_{x,Sf} &amp;amp; J(x,Sf)\\[1.5ex]&lt;br /&gt;
 \mbox{s.t.} &amp;amp; \dot{x}  =  f(x,Sf), \forall \, t \in [0,48]\\&lt;br /&gt;
 &amp;amp; 0 = g(x(t_o)) \\&lt;br /&gt;
 &amp;amp; x \in \R^3,\,Sf \in [28.7,40].&lt;br /&gt;
\end{array} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the most general formulation, where the initial value, parameters, and inputs are free. The states and inputs are vectors (or matrices) of functions while the parameters are just a vector of variables. If the initial (or final) state is fixed, one just adds a constraint &amp;lt;math&amp;gt;x(t_0)=x_0&amp;lt;/math&amp;gt; and specifies the value(s) of &amp;lt;math&amp;gt;x_0&amp;lt;/math&amp;gt; in a list or table.&lt;br /&gt;
If the parameters are fixed, then one just removes them from the list of optimization variables and states their values in a list (same for point conditions inside of the interval &amp;lt;math&amp;gt;I&amp;lt;/math&amp;gt;). If the OCP is a parameter estimation problem without inputs,&lt;br /&gt;
the inputs just dont appear in the problem above at all, neither as optimization variable nor as part of the constraints. In contrast if they are just fixed this is done by the equality constraints. In this setup the above problem is very general and by&lt;br /&gt;
stating the different objective functions and constraint functions one can cover a wide range of OCPs.&lt;/div&gt;</summary>
		<author><name>TobiasWeber</name></author>
	</entry>
	<entry>
		<id>https://mintoc.de/index.php?title=Bioreactor&amp;diff=889</id>
		<title>Bioreactor</title>
		<link rel="alternate" type="text/html" href="https://mintoc.de/index.php?title=Bioreactor&amp;diff=889"/>
		<updated>2015-12-08T15:02:02Z</updated>

		<summary type="html">&lt;p&gt;TobiasWeber: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The bioreactor example is an easy bioreactor with an substrate that is converted to a product by the biomass in the reactor. It has three states and a control that is describing the feed concentration of substrate. It is taken from the examples folder of the ACADO toolkit described in:&lt;br /&gt;
&lt;br /&gt;
 Houska, Boris, Hans Joachim Ferreau, and Moritz Diehl. &amp;quot;ACADO toolkit—An open‐source framework for automatic control and dynamic optimization.&amp;quot;&lt;br /&gt;
 Optimal Control Applications and Methods 32.3 (2011): 298-312.&lt;br /&gt;
&lt;br /&gt;
Originally the problem seems to be motivated by:&lt;br /&gt;
&lt;br /&gt;
 VERSYCK, KARINA J., and JAN F. VAN IMPE. &amp;quot;Feed rate optimization for fed-batch bioreactors: From optimal process performance to optimal parameter estimation.&amp;quot;&lt;br /&gt;
 Chemical Engineering Communications 172.1 (1999): 107-124.&lt;br /&gt;
&lt;br /&gt;
== Model Formulation ==&lt;br /&gt;
&lt;br /&gt;
The dynamic model is an [[:Category:ODE model|ODE model]]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{rcl}&lt;br /&gt;
\dot{X}&amp;amp;=&amp;amp;-DX+\mu X \\&lt;br /&gt;
\dot{S}&amp;amp;=&amp;amp; D(S_{f}-S)-\mu /Y_{xs} X \\&lt;br /&gt;
\dot{P}&amp;amp;=&amp;amp;-DP+ (\alpha \mu +\beta) X.&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The three states describe the concentration of the biomass (&amp;lt;math&amp;gt;X&amp;lt;/math&amp;gt;), the substrate (&amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt;), and the product (&amp;lt;math&amp;gt;P&amp;lt;/math&amp;gt;) in the reactor. In steady state the feed and outlet are equal and dilute all three concentrations with a ratio &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;. The biomass grows with a rate&lt;br /&gt;
&amp;lt;math&amp;gt;\mu&amp;lt;/math&amp;gt;, while it eats up the substrate with the rate &amp;lt;math&amp;gt;\mu/Y_{xs}&amp;lt;/math&amp;gt; and produces product at a rate &amp;lt;math&amp;gt;(\alpha \mu +\beta)&amp;lt;/math&amp;gt;. The rate &amp;lt;math&amp;gt;\mu&amp;lt;/math&amp;gt; is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mu = \mu_{m}*(1-P/P_{m})*S/(K_m+S+S^2/K_i)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The fixed parameters (constants) of the model are as follows.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+Parameters&lt;br /&gt;
|-&lt;br /&gt;
|Name&lt;br /&gt;
|Symbol&lt;br /&gt;
|Value&lt;br /&gt;
|Unit&lt;br /&gt;
|-&lt;br /&gt;
|Dilution&lt;br /&gt;
|&amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.15&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Rate coefficient&lt;br /&gt;
|&amp;lt;math&amp;gt;K_i&amp;lt;/math&amp;gt;&lt;br /&gt;
|22&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Rate coefficient&lt;br /&gt;
|&amp;lt;math&amp;gt;K_m&amp;lt;/math&amp;gt;&lt;br /&gt;
|1.2&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Rate coefficient&lt;br /&gt;
|&amp;lt;math&amp;gt;P_m&amp;lt;/math&amp;gt;&lt;br /&gt;
|50&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Substrate to Biomass rate&lt;br /&gt;
|&amp;lt;math&amp;gt;Y_{xs}&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.4&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Linear slope&lt;br /&gt;
|&amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt;&lt;br /&gt;
|2.2&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Linear intercept&lt;br /&gt;
|&amp;lt;math&amp;gt;\beta&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.2&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Maximal growth rate&lt;br /&gt;
|&amp;lt;math&amp;gt;\mu_m&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.48&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Optimal Control Problem ==&lt;br /&gt;
&lt;br /&gt;
Writing shortly for the states in vector notation &amp;lt;math&amp;gt;x=(X,S,P)^T&amp;lt;/math&amp;gt; the OCP reads:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{cl}&lt;br /&gt;
 \displaystyle \min_{x,Sf} &amp;amp; J(x,Sf)\\[1.5ex]&lt;br /&gt;
 \mbox{s.t.} &amp;amp; \dot{x}  =  f(x,Sf), \forall \, t \in I\\&lt;br /&gt;
 &amp;amp; 0 = g(x(t_o)) \\&lt;br /&gt;
 &amp;amp; x \in \R^3,\,u \in \mathcal{U}.&lt;br /&gt;
\end{array} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the most general formulation, where the initial value, parameters, and inputs are free. The states and inputs are vectors (or matrices) of functions while the parameters are just a vector of variables. If the initial (or final) state is fixed, one just adds a constraint &amp;lt;math&amp;gt;x(t_0)=x_0&amp;lt;/math&amp;gt; and specifies the value(s) of &amp;lt;math&amp;gt;x_0&amp;lt;/math&amp;gt; in a list or table.&lt;br /&gt;
If the parameters are fixed, then one just removes them from the list of optimization variables and states their values in a list (same for point conditions inside of the interval &amp;lt;math&amp;gt;I&amp;lt;/math&amp;gt;). If the OCP is a parameter estimation problem without inputs,&lt;br /&gt;
the inputs just dont appear in the problem above at all, neither as optimization variable nor as part of the constraints. In contrast if they are just fixed this is done by the equality constraints. In this setup the above problem is very general and by&lt;br /&gt;
stating the different objective functions and constraint functions one can cover a wide range of OCPs.&lt;/div&gt;</summary>
		<author><name>TobiasWeber</name></author>
	</entry>
	<entry>
		<id>https://mintoc.de/index.php?title=Bioreactor&amp;diff=880</id>
		<title>Bioreactor</title>
		<link rel="alternate" type="text/html" href="https://mintoc.de/index.php?title=Bioreactor&amp;diff=880"/>
		<updated>2015-12-08T14:49:04Z</updated>

		<summary type="html">&lt;p&gt;TobiasWeber: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The bioreactor example is an easy bioreactor with an substrate that is converted to a product by the biomass in the reactor. It has three states and a control that is describing the feed concentration of substrate. It is taken from the examples folder of the ACADO toolkit described in:&lt;br /&gt;
&lt;br /&gt;
 Houska, Boris, Hans Joachim Ferreau, and Moritz Diehl. &amp;quot;ACADO toolkit—An open‐source framework for automatic control and dynamic optimization.&amp;quot;&lt;br /&gt;
 Optimal Control Applications and Methods 32.3 (2011): 298-312.&lt;br /&gt;
&lt;br /&gt;
Originally the problem seems to be motivated by:&lt;br /&gt;
&lt;br /&gt;
 VERSYCK, KARINA J., and JAN F. VAN IMPE. &amp;quot;Feed rate optimization for fed-batch bioreactors: From optimal process performance to optimal parameter estimation.&amp;quot;&lt;br /&gt;
 Chemical Engineering Communications 172.1 (1999): 107-124.&lt;br /&gt;
&lt;br /&gt;
== Model Formulation ==&lt;br /&gt;
&lt;br /&gt;
The dynamic model is an [[:Category:ODE model|ODE model]]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{rcl}&lt;br /&gt;
\dot{X}&amp;amp;=&amp;amp;-DX+\mu X \\&lt;br /&gt;
\dot{S}&amp;amp;=&amp;amp; D(S_{f}-S)-\mu /Y_{xs} X \\&lt;br /&gt;
\dot{P}&amp;amp;=&amp;amp;-DP+ (\alpha \mu +\beta) X.&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The three states describe the concentration of the biomass (&amp;lt;math&amp;gt;X&amp;lt;/math&amp;gt;), the substrate (&amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt;), and the product (&amp;lt;math&amp;gt;P&amp;lt;/math&amp;gt;) in the reactor. In steady state the feed and outlet are equal and dilute all three concentrations with a ratio &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;. The biomass grows with a rate&lt;br /&gt;
&amp;lt;math&amp;gt;\mu&amp;lt;/math&amp;gt;, while it eats up the substrate with the rate &amp;lt;math&amp;gt;\mu/Y_{xs}&amp;lt;/math&amp;gt; and produces product at a rate &amp;lt;math&amp;gt;(\alpha \mu +\beta)&amp;lt;/math&amp;gt;. The rate &amp;lt;math&amp;gt;\mu&amp;lt;/math&amp;gt; is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mu = \mu_{m}*(1-P/P_{m})*S/(K_m+S+S^2/K_i)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The fixed parameters (constants) of the model are as follows.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+Parameters&lt;br /&gt;
|-&lt;br /&gt;
|Name&lt;br /&gt;
|Symbol&lt;br /&gt;
|Value&lt;br /&gt;
|Unit&lt;br /&gt;
|-&lt;br /&gt;
|Dilution&lt;br /&gt;
|&amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.15&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Rate coefficient&lt;br /&gt;
|&amp;lt;math&amp;gt;K_i&amp;lt;/math&amp;gt;&lt;br /&gt;
|22&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Rate coefficient&lt;br /&gt;
|&amp;lt;math&amp;gt;K_m&amp;lt;/math&amp;gt;&lt;br /&gt;
|1.2&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Rate coefficient&lt;br /&gt;
|&amp;lt;math&amp;gt;P_m&amp;lt;/math&amp;gt;&lt;br /&gt;
|50&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Substrate to Biomass rate&lt;br /&gt;
|&amp;lt;math&amp;gt;Y_{xs}&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.4&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Linear slope&lt;br /&gt;
|&amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt;&lt;br /&gt;
|2.2&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Linear intercept&lt;br /&gt;
|&amp;lt;math&amp;gt;\beta&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.2&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Maximal growth rate&lt;br /&gt;
|&amp;lt;math&amp;gt;\mu_m&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.48&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Optimal Control Problem ==&lt;br /&gt;
&lt;br /&gt;
In this section the Optimal Control Problem (OCP) with the dynamic model as equality constraint is specified. In general every OCP has either a Lagrange or Mayer type objective or both.&lt;br /&gt;
First the general structure of the OCP is given to show the type of objective (linear, quadratic, ...) and constraints (equality and/or inequality, linear or nonlinear) as well as the variables that are free to optimize.&lt;br /&gt;
All of the above dynamic models can be used, in the following we just write for all:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\dot{x}=f(x,u,p,t) \forall \, t \in I.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Implicit systems would be treated similarly. Then the general OCP is writte as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{cl}&lt;br /&gt;
 \displaystyle \min_{x, u, p} &amp;amp; J(x,u,t)\\[1.5ex]&lt;br /&gt;
 \mbox{s.t.} &amp;amp; \dot{x}  =  f(x,u,p,t), \forall \, t \in I\\&lt;br /&gt;
 &amp;amp; 0 = g(x(t_o),x(t_f),p) \\&lt;br /&gt;
 &amp;amp; 0  \ge  c(x,u,p), \forall \, t \in I\\&lt;br /&gt;
 &amp;amp; 0  =  h(x,u,p), \forall \, t \in I \\&lt;br /&gt;
 &amp;amp; x \in \mathcal{X},\,u \in \mathcal{U},\, p \in P.&lt;br /&gt;
\end{array} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the most general formulation, where the initial value, parameters, and inputs are free. The states and inputs are vectors (or matrices) of functions while the parameters are just a vector of variables. If the initial (or final) state is fixed, one just adds a constraint &amp;lt;math&amp;gt;x(t_0)=x_0&amp;lt;/math&amp;gt; and specifies the value(s) of &amp;lt;math&amp;gt;x_0&amp;lt;/math&amp;gt; in a list or table.&lt;br /&gt;
If the parameters are fixed, then one just removes them from the list of optimization variables and states their values in a list (same for point conditions inside of the interval &amp;lt;math&amp;gt;I&amp;lt;/math&amp;gt;). If the OCP is a parameter estimation problem without inputs,&lt;br /&gt;
the inputs just dont appear in the problem above at all, neither as optimization variable nor as part of the constraints. In contrast if they are just fixed this is done by the equality constraints. In this setup the above problem is very general and by&lt;br /&gt;
stating the different objective functions and constraint functions one can cover a wide range of OCPs.&lt;/div&gt;</summary>
		<author><name>TobiasWeber</name></author>
	</entry>
	<entry>
		<id>https://mintoc.de/index.php?title=Bioreactor&amp;diff=877</id>
		<title>Bioreactor</title>
		<link rel="alternate" type="text/html" href="https://mintoc.de/index.php?title=Bioreactor&amp;diff=877"/>
		<updated>2015-12-08T14:48:13Z</updated>

		<summary type="html">&lt;p&gt;TobiasWeber: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The bioreactor example is an easy bioreactor with an substrate that is converted to a product by the biomass in the reactor. It has three states and a control that is describing the feed concentration of substrate. It is taken from the examples folder of the ACADO toolkit described in:&lt;br /&gt;
&lt;br /&gt;
 Houska, Boris, Hans Joachim Ferreau, and Moritz Diehl. &amp;quot;ACADO toolkit—An open‐source framework for automatic control and dynamic optimization.&amp;quot;&lt;br /&gt;
 Optimal Control Applications and Methods 32.3 (2011): 298-312.&lt;br /&gt;
&lt;br /&gt;
Originally the problem seems to be motivated by:&lt;br /&gt;
&lt;br /&gt;
 VERSYCK, KARINA J., and JAN F. VAN IMPE. &amp;quot;Feed rate optimization for fed-batch bioreactors: From optimal process performance to optimal parameter estimation.&amp;quot;&lt;br /&gt;
 Chemical Engineering Communications 172.1 (1999): 107-124.&lt;br /&gt;
&lt;br /&gt;
== Model Formulation ==&lt;br /&gt;
&lt;br /&gt;
The dynamic model is an [[:Category:ODE model|ODE model]]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{rcl}&lt;br /&gt;
\dot{X}&amp;amp;=&amp;amp;-DX+\mu X \\&lt;br /&gt;
\dot{S}&amp;amp;=&amp;amp; D(S_{f}-S)-\mu /Y_{xs} X \\&lt;br /&gt;
\dot{P}&amp;amp;=&amp;amp;-DP+ (\alpha \mu +\beta) X.&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The three states describe the concentration of the biomass (&amp;lt;math&amp;gt;X&amp;lt;/math&amp;gt;), the substrate (&amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt;), and the product (&amp;lt;math&amp;gt;P&amp;lt;/math&amp;gt;) in the reactor. In steady state the feed and outlet are equal and dilute all three concentrations with a ratio &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;. The biomass grows with a rate&lt;br /&gt;
&amp;lt;math&amp;gt;\mu&amp;lt;/math&amp;gt;, while it eats up the substrate with the rate &amp;lt;math&amp;gt;\mu/Y_{xs}&amp;lt;/math&amp;gt; and produces product at a rate &amp;lt;math&amp;gt;(\alpha \mu +\beta)&amp;lt;/math&amp;gt;. The rate &amp;lt;math&amp;gt;\mu&amp;lt;/math&amp;gt; is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mu = \mu_{m}*(1-P/P_{m})*S/(K_m+S+S^2/K_i)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The fixed parameters (constants) of the model are:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+Parameters&lt;br /&gt;
|-&lt;br /&gt;
|Name&lt;br /&gt;
|Symbol&lt;br /&gt;
|Value&lt;br /&gt;
|Unit&lt;br /&gt;
|-&lt;br /&gt;
|Dilution&lt;br /&gt;
|&amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.15&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Rate coefficient&lt;br /&gt;
|&amp;lt;math&amp;gt;K_i&amp;lt;/math&amp;gt;&lt;br /&gt;
|22&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Rate coefficient&lt;br /&gt;
|&amp;lt;math&amp;gt;K_m&amp;lt;/math&amp;gt;&lt;br /&gt;
|1.2&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Rate coefficient&lt;br /&gt;
|&amp;lt;math&amp;gt;P_m&amp;lt;/math&amp;gt;&lt;br /&gt;
|50&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Substrate to Biomass rate&lt;br /&gt;
|&amp;lt;math&amp;gt;Y_{xs}&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.4&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Linear slope&lt;br /&gt;
|&amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt;&lt;br /&gt;
|2.2&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Linear intercept&lt;br /&gt;
|&amp;lt;math&amp;gt;\beta&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.2&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Maximal growth rate&lt;br /&gt;
|&amp;lt;math&amp;gt;\mu_m&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.48&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
This would result in an right hand side function &amp;lt;math&amp;gt;f(x,u)&amp;lt;/math&amp;gt; in this case, because there are no free parameters. Of course one could also specify an implicit DAE system (&amp;lt;math&amp;gt;F(\dot{x},x,u,p,t)=0&amp;lt;/math&amp;gt;), where it just hast to be said which states are differential and which are algebraic.&lt;/div&gt;</summary>
		<author><name>TobiasWeber</name></author>
	</entry>
	<entry>
		<id>https://mintoc.de/index.php?title=Bioreactor&amp;diff=874</id>
		<title>Bioreactor</title>
		<link rel="alternate" type="text/html" href="https://mintoc.de/index.php?title=Bioreactor&amp;diff=874"/>
		<updated>2015-12-08T14:46:19Z</updated>

		<summary type="html">&lt;p&gt;TobiasWeber: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The bioreactor example is an easy bioreactor with an substrate that is converted to a product by the biomass in the reactor. It has three states and a control that is describing the feed concentration of substrate. It is taken from the examples folder of the ACADO toolkit described in:&lt;br /&gt;
&lt;br /&gt;
 Houska, Boris, Hans Joachim Ferreau, and Moritz Diehl. &amp;quot;ACADO toolkit—An open‐source framework for automatic control and dynamic optimization.&amp;quot;&lt;br /&gt;
 Optimal Control Applications and Methods 32.3 (2011): 298-312.&lt;br /&gt;
&lt;br /&gt;
Originally the problem seems to be motivated by:&lt;br /&gt;
&lt;br /&gt;
 VERSYCK, KARINA J., and JAN F. VAN IMPE. &amp;quot;Feed rate optimization for fed-batch bioreactors: From optimal process performance to optimal parameter estimation.&amp;quot;&lt;br /&gt;
 Chemical Engineering Communications 172.1 (1999): 107-124.&lt;br /&gt;
&lt;br /&gt;
== Model Formulation ==&lt;br /&gt;
&lt;br /&gt;
The dynamic model is an [[:Category:ODE model|ODE model]]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{rcl}&lt;br /&gt;
\dot{X}&amp;amp;=&amp;amp;-DX+\mu X \\&lt;br /&gt;
\dot{S}&amp;amp;=&amp;amp; D(S_{f}-S)-\mu /Y_{xs} X \\&lt;br /&gt;
\dot{P}&amp;amp;=&amp;amp;-DP+ (\alpha \mu +\beta) X.&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The three states describe the concentration of the biomass (&amp;lt;math&amp;gt;X&amp;lt;/math&amp;gt;), the substrate (&amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt;), and the product (&amp;lt;math&amp;gt;P&amp;lt;/math&amp;gt;) in the reactor. In steady state the feed and outlet are equal and dilute all three concentrations with a ratio &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;. The biomass grows with a rate&lt;br /&gt;
&amp;lt;math&amp;gt;\mu&amp;lt;/math&amp;gt;, while it eats up the substrate with the rate &amp;lt;math&amp;gt;\mu/Y_{xs}&amp;lt;/math&amp;gt; and produces product at a rate &amp;lt;math&amp;gt;(\alpha \mu +\beta)&amp;lt;/math&amp;gt;. The rate &amp;lt;math&amp;gt;\mu&amp;lt;/math&amp;gt; is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mu = \mu_{m}*(1-P/P_{m})*S/(K_m+S+S^2/K_i)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The fixed parameters (constants) of the model are:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+Parameters&lt;br /&gt;
|-&lt;br /&gt;
|Name&lt;br /&gt;
|Symbol&lt;br /&gt;
|Value&lt;br /&gt;
|Unit&lt;br /&gt;
|-&lt;br /&gt;
|Dilution&lt;br /&gt;
|&amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.15&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;K_m&amp;lt;/math&amp;gt;&lt;br /&gt;
|1.2&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;P_m&amp;lt;/math&amp;gt;&lt;br /&gt;
|50&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Substrate to Biomass rate&lt;br /&gt;
|&amp;lt;math&amp;gt;Y_{xs}&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.4&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Linear slope&lt;br /&gt;
|&amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt;&lt;br /&gt;
|2.2&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Linear intercept&lt;br /&gt;
|&amp;lt;math&amp;gt;\beta&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.2&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Maximal growth rate&lt;br /&gt;
|&amp;lt;math&amp;gt;\mu_m&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.48&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
This would result in an right hand side function &amp;lt;math&amp;gt;f(x,u)&amp;lt;/math&amp;gt; in this case, because there are no free parameters. Of course one could also specify an implicit DAE system (&amp;lt;math&amp;gt;F(\dot{x},x,u,p,t)=0&amp;lt;/math&amp;gt;), where it just hast to be said which states are differential and which are algebraic.&lt;/div&gt;</summary>
		<author><name>TobiasWeber</name></author>
	</entry>
	<entry>
		<id>https://mintoc.de/index.php?title=Bioreactor&amp;diff=873</id>
		<title>Bioreactor</title>
		<link rel="alternate" type="text/html" href="https://mintoc.de/index.php?title=Bioreactor&amp;diff=873"/>
		<updated>2015-12-08T14:42:44Z</updated>

		<summary type="html">&lt;p&gt;TobiasWeber: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The bioreactor example is an easy bioreactor with an substrate that is converted to a product by the biomass in the reactor. It has three states and a control that is describing the feed concentration of substrate. It is taken from the examples folder of the ACADO toolkit described in:&lt;br /&gt;
&lt;br /&gt;
 Houska, Boris, Hans Joachim Ferreau, and Moritz Diehl. &amp;quot;ACADO toolkit—An open‐source framework for automatic control and dynamic optimization.&amp;quot;&lt;br /&gt;
 Optimal Control Applications and Methods 32.3 (2011): 298-312.&lt;br /&gt;
&lt;br /&gt;
Originally the problem seems to be motivated by:&lt;br /&gt;
&lt;br /&gt;
 VERSYCK, KARINA J., and JAN F. VAN IMPE. &amp;quot;Feed rate optimization for fed-batch bioreactors: From optimal process performance to optimal parameter estimation.&amp;quot;&lt;br /&gt;
 Chemical Engineering Communications 172.1 (1999): 107-124.&lt;br /&gt;
&lt;br /&gt;
== Model Formulation ==&lt;br /&gt;
&lt;br /&gt;
The dynamic model is an [[:Category:ODE model|ODE model]]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{rcl}&lt;br /&gt;
\dot{X}&amp;amp;=&amp;amp;-DX+\mu X \\&lt;br /&gt;
\dot{S}&amp;amp;=&amp;amp; D(S_{f}-S)-\mu /Y_{xs} X \\&lt;br /&gt;
\dot{P}&amp;amp;=&amp;amp;-DP+ (\alpha \mu +\beta) X.&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The three states describe the concentration of the biomass (&amp;lt;math&amp;gt;X&amp;lt;/math&amp;gt;), the substrate (&amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt;), and the product (&amp;lt;math&amp;gt;P&amp;lt;/math&amp;gt;) in the reactor. In steady state the feed and outlet are equal and dilute all three concentrations with a ratio &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;. The biomass grows with a rate&lt;br /&gt;
&amp;lt;math&amp;gt;\mu&amp;lt;/math&amp;gt;, while it eats up the substrate with the rate &amp;lt;math&amp;gt;\mu/Y_{xs}&amp;lt;/math&amp;gt; and produces product at a rate &amp;lt;math&amp;gt;(\alpha \mu +\beta)&amp;lt;/math&amp;gt;. The rate &amp;lt;math&amp;gt;\mu&amp;lt;/math&amp;gt; is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mu = \mu_{m}*(1-P/P_{m})*S/(K_m+S+S^2/K_i)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The fixed parameters (constants) of the model are:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+Parameters&lt;br /&gt;
|-&lt;br /&gt;
|Name&lt;br /&gt;
|Symbol&lt;br /&gt;
|Value&lt;br /&gt;
|Unit&lt;br /&gt;
|-&lt;br /&gt;
|Dilution&lt;br /&gt;
|&amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.15&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Dilution&lt;br /&gt;
|&amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.15&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|Dilution&lt;br /&gt;
|&amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;&lt;br /&gt;
|0.15&lt;br /&gt;
|[-]&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
const double Ki      = 22.0;&lt;br /&gt;
    const double Km      = 1.2 ; &lt;br /&gt;
    const double Pm      = 50.0;&lt;br /&gt;
    const double Yxs     = 0.4 ;&lt;br /&gt;
    const double alpha   = 2.2 ;&lt;br /&gt;
    const double beta    = 0.2 ;&lt;br /&gt;
    const double mum     = 0.48;&lt;br /&gt;
&lt;br /&gt;
This would result in an right hand side function &amp;lt;math&amp;gt;f(x,u)&amp;lt;/math&amp;gt; in this case, because there are no free parameters. Of course one could also specify an implicit DAE system (&amp;lt;math&amp;gt;F(\dot{x},x,u,p,t)=0&amp;lt;/math&amp;gt;), where it just hast to be said which states are differential and which are algebraic.&lt;/div&gt;</summary>
		<author><name>TobiasWeber</name></author>
	</entry>
	<entry>
		<id>https://mintoc.de/index.php?title=Bioreactor&amp;diff=872</id>
		<title>Bioreactor</title>
		<link rel="alternate" type="text/html" href="https://mintoc.de/index.php?title=Bioreactor&amp;diff=872"/>
		<updated>2015-12-08T14:36:54Z</updated>

		<summary type="html">&lt;p&gt;TobiasWeber: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The bioreactor example is an easy bioreactor with an substrate that is converted to a product by the biomass in the reactor. It has three states and a control that is describing the feed concentration of substrate. It is taken from the examples folder of the ACADO toolkit described in:&lt;br /&gt;
&lt;br /&gt;
 Houska, Boris, Hans Joachim Ferreau, and Moritz Diehl. &amp;quot;ACADO toolkit—An open‐source framework for automatic control and dynamic optimization.&amp;quot;&lt;br /&gt;
 Optimal Control Applications and Methods 32.3 (2011): 298-312.&lt;br /&gt;
&lt;br /&gt;
Originally the problem seems to be motivated by:&lt;br /&gt;
&lt;br /&gt;
 VERSYCK, KARINA J., and JAN F. VAN IMPE. &amp;quot;Feed rate optimization for fed-batch bioreactors: From optimal process performance to optimal parameter estimation.&amp;quot;&lt;br /&gt;
 Chemical Engineering Communications 172.1 (1999): 107-124.&lt;br /&gt;
&lt;br /&gt;
== Model Formulation ==&lt;br /&gt;
&lt;br /&gt;
The dynamic model is an [[:Category:ODE model|ODE model]]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{rcl}&lt;br /&gt;
\dot{X}&amp;amp;=&amp;amp;-DX+\mu X \\&lt;br /&gt;
\dot{S}&amp;amp;=&amp;amp; D(S_{f}-S)-\mu /Y_{xs} X \\&lt;br /&gt;
\dot{P}&amp;amp;=&amp;amp;-DP+ (\alpha \mu +\beta) X.&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The three states describe the concentration of the biomass (&amp;lt;math&amp;gt;X&amp;lt;/math&amp;gt;), the substrate (&amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt;), and the product (&amp;lt;math&amp;gt;P&amp;lt;/math&amp;gt;) in the reactor. In steady state the feed and outlet are equal and dilute all three concentrations with a ratio &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;. The biomass grows with a rate&lt;br /&gt;
&amp;lt;math&amp;gt;\mu&amp;lt;/math&amp;gt;, while it eats up the substrate with the rate &amp;lt;math&amp;gt;\mu/Y_{xs}&amp;lt;/math&amp;gt; and produces product at a rate &amp;lt;math&amp;gt;(\alpha \mu +\beta)&amp;lt;/math&amp;gt;. The rate &amp;lt;math&amp;gt;\mu&amp;lt;/math&amp;gt; is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mu = \mu_{m}*(1-P/P_{m})*S/(K_m+S+S^2/K_i)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this section the dynamic model, that describes the physical or technical process of interest, should be described. First the differential equation should be written down. Then the states, inputs, and parameters should be declared (Dimension, Type (integer, real, binary, ...)). Finally the parameters that are not free in the optimization and the coefficients should be stated in an extra table or list. All equations and functions are defined over an interval &amp;lt;math&amp;gt;I \subset \R&amp;lt;/math&amp;gt;. Initial values and free parameters are taken into account later in the Optimal Control Problem.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The parameter (coefficient) &amp;lt;math&amp;gt; p &amp;lt;/math&amp;gt; could be stated in a table, if it is fixed.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+Parameter(s)&lt;br /&gt;
|-&lt;br /&gt;
|Name&lt;br /&gt;
|Symbol&lt;br /&gt;
|Value&lt;br /&gt;
|Unit&lt;br /&gt;
|-&lt;br /&gt;
|Parameter&lt;br /&gt;
|&amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;&lt;br /&gt;
|23&lt;br /&gt;
|[-]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
This would result in an right hand side function &amp;lt;math&amp;gt;f(x,u)&amp;lt;/math&amp;gt; in this case, because there are no free parameters. Of course one could also specify an implicit DAE system (&amp;lt;math&amp;gt;F(\dot{x},x,u,p,t)=0&amp;lt;/math&amp;gt;), where it just hast to be said which states are differential and which are algebraic.&lt;/div&gt;</summary>
		<author><name>TobiasWeber</name></author>
	</entry>
</feed>