<?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=MaxWolff</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=MaxWolff"/>
	<link rel="alternate" type="text/html" href="https://mintoc.de/index.php?title=Special:Contributions/MaxWolff"/>
	<updated>2026-06-09T07:57:28Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.1</generator>
	<entry>
		<id>https://mintoc.de/index.php?title=Category:TomDyn/PROPT&amp;diff=1668</id>
		<title>Category:TomDyn/PROPT</title>
		<link rel="alternate" type="text/html" href="https://mintoc.de/index.php?title=Category:TomDyn/PROPT&amp;diff=1668"/>
		<updated>2016-02-12T16:50:04Z</updated>

		<summary type="html">&lt;p&gt;MaxWolff: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;PROPT is an additional package for the [[:Category:TOMLAB | TOMLAB]] Optimization Environment, solving Optimal Control Problems (OCP) via direct collocation.&lt;br /&gt;
&lt;br /&gt;
== Environment ==&lt;br /&gt;
&lt;br /&gt;
TOMLAB mostly works through the MATLAB interface, in addition to accepting some in AMPL formulated problems.&lt;br /&gt;
&lt;br /&gt;
The Software, when purchased (or after obtaining a trial version), includes many examples which can be easily combined/reformulated to solve almost any type of OCP.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Algorithm ==&lt;br /&gt;
&lt;br /&gt;
The PROPT package transforms an Optimal Control Problem, formulated with the help of TomSym variables in a single MATLAB script, into a collocation (MI)NLP.&lt;br /&gt;
&lt;br /&gt;
Gaussian/Chebychef points are used as interpolation points by default but can be switched out for any given set of points on the optimization horizont (normed on the &amp;lt;math&amp;gt; [0,1] &amp;lt;/math&amp;gt; intervall).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The collocation NLP can then be solved by solvers found in the basic TOMLAB package, which includes LP, MILP, NLP, MINLP, QP and MIQP solvers. &lt;br /&gt;
&lt;br /&gt;
Additional solvers, which in most cases perform better than the solvers from the basic package, can be purchased as well. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Problem Types ==&lt;br /&gt;
&lt;br /&gt;
* Finite Horizon Control Problems&lt;br /&gt;
* Optimal Stopping Time Control Problems&lt;br /&gt;
* Switching Arc (e.g. Bang-Bang) Control Problems&lt;br /&gt;
* Binary/Integer Control Problems&lt;br /&gt;
* Parameter Estimation Problems&lt;br /&gt;
* Several Stage/Phase Optimal Control Problems&lt;br /&gt;
&lt;br /&gt;
== Availability ==&lt;br /&gt;
&lt;br /&gt;
After registering, a 21 day trial version can be obtained for new users. The trial version of TOMLAB gives access to all packages, including PROPT, and grants full functionality.&lt;br /&gt;
&lt;br /&gt;
Once the trial period is over, any needed package has to be purchased seperately. &lt;br /&gt;
For the use of PROPT, the basic package is needed to be installed and at least one additional &lt;br /&gt;
&lt;br /&gt;
MINLP solver package with better performance is recommended to be installed as well.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A list of products and prices can be found on the website (link below).&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* TomDyn Website (for PROPT package)&lt;br /&gt;
** http://tomdyn.com/index.html&lt;br /&gt;
* TOMLAB Website &lt;br /&gt;
** http://tomopt.com/tomlab/&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: Implementation]]&lt;/div&gt;</summary>
		<author><name>MaxWolff</name></author>
	</entry>
	<entry>
		<id>https://mintoc.de/index.php?title=Lotka_Volterra_fishing_problem_(TomDyn/PROPT)&amp;diff=1336</id>
		<title>Lotka Volterra fishing problem (TomDyn/PROPT)</title>
		<link rel="alternate" type="text/html" href="https://mintoc.de/index.php?title=Lotka_Volterra_fishing_problem_(TomDyn/PROPT)&amp;diff=1336"/>
		<updated>2016-01-19T15:50:49Z</updated>

		<summary type="html">&lt;p&gt;MaxWolff: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;source lang=&amp;quot;matlab&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
%% Lotka-Volterra fishing example (relaxed version)&lt;br /&gt;
%&lt;br /&gt;
% Implemented by: Maximilian von Wolff&lt;br /&gt;
%&lt;br /&gt;
%&lt;br /&gt;
%% Problem Description&lt;br /&gt;
%&lt;br /&gt;
% As on https://modest.math.uni-magdeburg.de/mintoc/index.php/Lotka_Volterra_fishing_problem&lt;br /&gt;
%&lt;br /&gt;
% \min\limits_{x,u}      x_3(t_f)&lt;br /&gt;
% &lt;br /&gt;
%  subject to:&lt;br /&gt;
% &lt;br /&gt;
%   dot(x)_1(t)   =      x_1(t) - x_1(t)*x_2(t) - c_0*x_1(t)*u(t),&lt;br /&gt;
%   dot(x)_2(t)   =      -x_2(t) + x_1(t)*x_2(t) - c_1*x_2(t)*u(t),&lt;br /&gt;
%   dot(x)_3(t)   =      (x_1(t) - 1)^2 + (x_2(t) - 1)^2,&lt;br /&gt;
% &lt;br /&gt;
% initial conditions:&lt;br /&gt;
%&lt;br /&gt;
% x(0)=[0.5, 0.7, 0]&#039;&lt;br /&gt;
% &lt;br /&gt;
% control constraints:&lt;br /&gt;
%&lt;br /&gt;
% u(t) \in \{0, 1\}              \forall t \in [t_0, t_f]&lt;br /&gt;
%&lt;br /&gt;
% Parameters&lt;br /&gt;
%&lt;br /&gt;
% [t_0, t_f]    =   [0, 12]&lt;br /&gt;
% [c_0, c_1]    =   [0.4, 0.2]&lt;br /&gt;
%&lt;br /&gt;
%&lt;br /&gt;
% &lt;br /&gt;
%&lt;br /&gt;
%&lt;br /&gt;
%% Problem setup&lt;br /&gt;
%&lt;br /&gt;
% Setup parameters:&lt;br /&gt;
% &lt;br /&gt;
n = 400;&lt;br /&gt;
%&lt;br /&gt;
&lt;br /&gt;
toms t&lt;br /&gt;
p = tomPhase(&#039;p&#039;, t, 0, 12, n);&lt;br /&gt;
setPhase(p);&lt;br /&gt;
tomStates x1 x2 x3&lt;br /&gt;
tomControls u    %or use integer u and set problem type as MINLP and solver as KNITRO as in annotation below&lt;br /&gt;
&lt;br /&gt;
%initial states&lt;br /&gt;
xi = [0.5, 0.7, 0];&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
%initial guess&lt;br /&gt;
x0 = {collocate(u == 0)&lt;br /&gt;
    icollocate({x1 == xi(1)&lt;br /&gt;
                x2 == xi(2)&lt;br /&gt;
                x3 == xi(3)&lt;br /&gt;
                })};&lt;br /&gt;
&lt;br /&gt;
%Box constraints&lt;br /&gt;
cbox = {(0 &amp;lt;= collocate(u) &amp;lt;= 1)};&lt;br /&gt;
&lt;br /&gt;
%Boundary constraints&lt;br /&gt;
cbnd = {initial({   x1 == xi(1); &lt;br /&gt;
                    x2 == xi(2);&lt;br /&gt;
                    x3 == xi(3);})};&lt;br /&gt;
&lt;br /&gt;
%Parameters for ODE&#039;s&lt;br /&gt;
c = [0.4, 0.2]&#039;;&lt;br /&gt;
c0 = c(1);&lt;br /&gt;
c1 = c(2);&lt;br /&gt;
&lt;br /&gt;
%ODE&#039;s&lt;br /&gt;
&lt;br /&gt;
dx1 = x1 - x1.*x2 -c0*x1.*u;&lt;br /&gt;
dx2 = -x2 + x1.*x2 - c1*x2.*u;&lt;br /&gt;
dx3 = (x1 - 1).^2 + (x2 - 1).^2;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ceq = collocate({&lt;br /&gt;
        dot(x1) == dx1&lt;br /&gt;
        dot(x2) == dx2&lt;br /&gt;
        dot(x3) == dx3});&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
%Objective&lt;br /&gt;
&lt;br /&gt;
objective = final(x3);&lt;br /&gt;
&lt;br /&gt;
%% Solve the problem&lt;br /&gt;
    options = struct;&lt;br /&gt;
    options.name = &#039;Lotka-Volterra&#039;;&lt;br /&gt;
    %options.type = &#039;minlp&#039;;&lt;br /&gt;
    %options.solver = &#039;knitro&#039;;&lt;br /&gt;
    solution = ezsolve(objective, {cbox, cbnd, ceq}, x0, options);&lt;br /&gt;
&lt;br /&gt;
    xopt1 = subs(x1,solution);&lt;br /&gt;
    xopt2 = subs(x2,solution);&lt;br /&gt;
    xopt3 = subs(x3,solution);&lt;br /&gt;
    uopt  = subs(u,solution);&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
%Plotting solution&lt;br /&gt;
&lt;br /&gt;
figure(1)&lt;br /&gt;
subplot(3,1,1);&lt;br /&gt;
ezplot([x1; x2]); legend(&#039;Prey&#039;,&#039;Predator&#039;);&lt;br /&gt;
xlabel(&#039;time&#039;);&lt;br /&gt;
ylabel(&#039;Biomass&#039;);&lt;br /&gt;
title(&#039;Biomasses&#039;);&lt;br /&gt;
&lt;br /&gt;
subplot(3,1,2);&lt;br /&gt;
ezplot(u); legend(&#039;u&#039;);&lt;br /&gt;
xlabel(&#039;time&#039;);&lt;br /&gt;
ylabel(&#039;Control&#039;);&lt;br /&gt;
title(&#039;Fishing control&#039;);&lt;br /&gt;
&lt;br /&gt;
subplot(3,1,3);&lt;br /&gt;
ezplot(x3); legend(&#039;Obj. Value&#039;);&lt;br /&gt;
xlabel(&#039;time&#039;);&lt;br /&gt;
title(&#039;Objective&#039;);&lt;br /&gt;
&lt;br /&gt;
disp(&#039;Objective Function Value&#039;);&lt;br /&gt;
disp(final(xopt3));&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:TomDyn/PROPT]]&lt;/div&gt;</summary>
		<author><name>MaxWolff</name></author>
	</entry>
	<entry>
		<id>https://mintoc.de/index.php?title=Lotka_Volterra_fishing_problem_(TomDyn/PROPT)&amp;diff=1335</id>
		<title>Lotka Volterra fishing problem (TomDyn/PROPT)</title>
		<link rel="alternate" type="text/html" href="https://mintoc.de/index.php?title=Lotka_Volterra_fishing_problem_(TomDyn/PROPT)&amp;diff=1335"/>
		<updated>2016-01-19T15:50:32Z</updated>

		<summary type="html">&lt;p&gt;MaxWolff: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;source lang=&amp;quot;matlab&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
%% Lotka-Volterra fishing example&lt;br /&gt;
%&lt;br /&gt;
% Implemented by: Maximilian von Wolff&lt;br /&gt;
%&lt;br /&gt;
%&lt;br /&gt;
%% Problem Description&lt;br /&gt;
%&lt;br /&gt;
% As on https://modest.math.uni-magdeburg.de/mintoc/index.php/Lotka_Volterra_fishing_problem&lt;br /&gt;
%&lt;br /&gt;
% \min\limits_{x,u}      x_3(t_f)&lt;br /&gt;
% &lt;br /&gt;
%  subject to:&lt;br /&gt;
% &lt;br /&gt;
%   dot(x)_1(t)   =      x_1(t) - x_1(t)*x_2(t) - c_0*x_1(t)*u(t),&lt;br /&gt;
%   dot(x)_2(t)   =      -x_2(t) + x_1(t)*x_2(t) - c_1*x_2(t)*u(t),&lt;br /&gt;
%   dot(x)_3(t)   =      (x_1(t) - 1)^2 + (x_2(t) - 1)^2,&lt;br /&gt;
% &lt;br /&gt;
% initial conditions:&lt;br /&gt;
%&lt;br /&gt;
% x(0)=[0.5, 0.7, 0]&#039;&lt;br /&gt;
% &lt;br /&gt;
% control constraints:&lt;br /&gt;
%&lt;br /&gt;
% u(t) \in \{0, 1\}              \forall t \in [t_0, t_f]&lt;br /&gt;
%&lt;br /&gt;
% Parameters&lt;br /&gt;
%&lt;br /&gt;
% [t_0, t_f]    =   [0, 12]&lt;br /&gt;
% [c_0, c_1]    =   [0.4, 0.2]&lt;br /&gt;
%&lt;br /&gt;
%&lt;br /&gt;
% &lt;br /&gt;
%&lt;br /&gt;
%&lt;br /&gt;
%% Problem setup&lt;br /&gt;
%&lt;br /&gt;
% Setup parameters:&lt;br /&gt;
% &lt;br /&gt;
n = 400;&lt;br /&gt;
%&lt;br /&gt;
&lt;br /&gt;
toms t&lt;br /&gt;
p = tomPhase(&#039;p&#039;, t, 0, 12, n);&lt;br /&gt;
setPhase(p);&lt;br /&gt;
tomStates x1 x2 x3&lt;br /&gt;
tomControls u    %or use integer u and set problem type as MINLP and solver as KNITRO as in annotation below&lt;br /&gt;
&lt;br /&gt;
%initial states&lt;br /&gt;
xi = [0.5, 0.7, 0];&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
%initial guess&lt;br /&gt;
x0 = {collocate(u == 0)&lt;br /&gt;
    icollocate({x1 == xi(1)&lt;br /&gt;
                x2 == xi(2)&lt;br /&gt;
                x3 == xi(3)&lt;br /&gt;
                })};&lt;br /&gt;
&lt;br /&gt;
%Box constraints&lt;br /&gt;
cbox = {(0 &amp;lt;= collocate(u) &amp;lt;= 1)};&lt;br /&gt;
&lt;br /&gt;
%Boundary constraints&lt;br /&gt;
cbnd = {initial({   x1 == xi(1); &lt;br /&gt;
                    x2 == xi(2);&lt;br /&gt;
                    x3 == xi(3);})};&lt;br /&gt;
&lt;br /&gt;
%Parameters for ODE&#039;s&lt;br /&gt;
c = [0.4, 0.2]&#039;;&lt;br /&gt;
c0 = c(1);&lt;br /&gt;
c1 = c(2);&lt;br /&gt;
&lt;br /&gt;
%ODE&#039;s&lt;br /&gt;
&lt;br /&gt;
dx1 = x1 - x1.*x2 -c0*x1.*u;&lt;br /&gt;
dx2 = -x2 + x1.*x2 - c1*x2.*u;&lt;br /&gt;
dx3 = (x1 - 1).^2 + (x2 - 1).^2;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ceq = collocate({&lt;br /&gt;
        dot(x1) == dx1&lt;br /&gt;
        dot(x2) == dx2&lt;br /&gt;
        dot(x3) == dx3});&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
%Objective&lt;br /&gt;
&lt;br /&gt;
objective = final(x3);&lt;br /&gt;
&lt;br /&gt;
%% Solve the problem&lt;br /&gt;
    options = struct;&lt;br /&gt;
    options.name = &#039;Lotka-Volterra&#039;;&lt;br /&gt;
    %options.type = &#039;minlp&#039;;&lt;br /&gt;
    %options.solver = &#039;knitro&#039;;&lt;br /&gt;
    solution = ezsolve(objective, {cbox, cbnd, ceq}, x0, options);&lt;br /&gt;
&lt;br /&gt;
    xopt1 = subs(x1,solution);&lt;br /&gt;
    xopt2 = subs(x2,solution);&lt;br /&gt;
    xopt3 = subs(x3,solution);&lt;br /&gt;
    uopt  = subs(u,solution);&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
%Plotting solution&lt;br /&gt;
&lt;br /&gt;
figure(1)&lt;br /&gt;
subplot(3,1,1);&lt;br /&gt;
ezplot([x1; x2]); legend(&#039;Prey&#039;,&#039;Predator&#039;);&lt;br /&gt;
xlabel(&#039;time&#039;);&lt;br /&gt;
ylabel(&#039;Biomass&#039;);&lt;br /&gt;
title(&#039;Biomasses&#039;);&lt;br /&gt;
&lt;br /&gt;
subplot(3,1,2);&lt;br /&gt;
ezplot(u); legend(&#039;u&#039;);&lt;br /&gt;
xlabel(&#039;time&#039;);&lt;br /&gt;
ylabel(&#039;Control&#039;);&lt;br /&gt;
title(&#039;Fishing control&#039;);&lt;br /&gt;
&lt;br /&gt;
subplot(3,1,3);&lt;br /&gt;
ezplot(x3); legend(&#039;Obj. Value&#039;);&lt;br /&gt;
xlabel(&#039;time&#039;);&lt;br /&gt;
title(&#039;Objective&#039;);&lt;br /&gt;
&lt;br /&gt;
disp(&#039;Objective Function Value&#039;);&lt;br /&gt;
disp(final(xopt3));&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:TomDyn/PROPT]]&lt;/div&gt;</summary>
		<author><name>MaxWolff</name></author>
	</entry>
	<entry>
		<id>https://mintoc.de/index.php?title=Lotka_Volterra_fishing_problem_(TomDyn/PROPT)&amp;diff=1332</id>
		<title>Lotka Volterra fishing problem (TomDyn/PROPT)</title>
		<link rel="alternate" type="text/html" href="https://mintoc.de/index.php?title=Lotka_Volterra_fishing_problem_(TomDyn/PROPT)&amp;diff=1332"/>
		<updated>2016-01-19T15:48:28Z</updated>

		<summary type="html">&lt;p&gt;MaxWolff: Created page with &amp;quot;&amp;lt;source lang=&amp;quot;matlab&amp;quot;&amp;gt;  %% Lotka-Volterra fishing example % % Implemented by: Maximilian von Wolff % % %% Problem Description % % As on https://modest.math.uni-magdeburg.de/mi...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;source lang=&amp;quot;matlab&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
%% Lotka-Volterra fishing example&lt;br /&gt;
%&lt;br /&gt;
% Implemented by: Maximilian von Wolff&lt;br /&gt;
%&lt;br /&gt;
%&lt;br /&gt;
%% Problem Description&lt;br /&gt;
%&lt;br /&gt;
% As on https://modest.math.uni-magdeburg.de/mintoc/index.php/Lotka_Volterra_fishing_problem&lt;br /&gt;
%&lt;br /&gt;
% \min\limits_{x,u}      x_3(t_f)&lt;br /&gt;
% &lt;br /&gt;
%  subject to:&lt;br /&gt;
% &lt;br /&gt;
%   dot(x)_1(t)   =      x_1(t) - x_1(t)*x_2(t) - c_0*x_1(t)*u(t),&lt;br /&gt;
%   dot(x)_2(t)   =      -x_2(t) + x_1(t)*x_2(t) - c_1*x_2(t)*u(t),&lt;br /&gt;
%   dot(x)_3(t)   =      (x_1(t) - 1)^2 + (x_2(t) - 1)^2,&lt;br /&gt;
% &lt;br /&gt;
% initial conditions:&lt;br /&gt;
%&lt;br /&gt;
% x(0)=[0.5, 0.7, 0]&#039;&lt;br /&gt;
% &lt;br /&gt;
% control constraints:&lt;br /&gt;
%&lt;br /&gt;
% u(t) \in \{0, 1\}              \forall t \in [t_0, t_f]&lt;br /&gt;
%&lt;br /&gt;
% Parameters&lt;br /&gt;
%&lt;br /&gt;
% [t_0, t_f]    =   [0, 12]&lt;br /&gt;
% [c_0, c_1]    =   [0.4, 0.2]&lt;br /&gt;
%&lt;br /&gt;
%&lt;br /&gt;
% &lt;br /&gt;
%&lt;br /&gt;
%&lt;br /&gt;
%% Problem setup&lt;br /&gt;
%&lt;br /&gt;
% Setup parameters:&lt;br /&gt;
% &lt;br /&gt;
n = 400;&lt;br /&gt;
%&lt;br /&gt;
&lt;br /&gt;
toms t&lt;br /&gt;
p = tomPhase(&#039;p&#039;, t, 0, 12, n);&lt;br /&gt;
setPhase(p);&lt;br /&gt;
tomStates x1 x2 x3&lt;br /&gt;
tomControls u%integer u  &lt;br /&gt;
&lt;br /&gt;
%initial states&lt;br /&gt;
xi = [0.5, 0.7, 0];&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
%initial guess&lt;br /&gt;
x0 = {collocate(u == 0)&lt;br /&gt;
    icollocate({x1 == xi(1)&lt;br /&gt;
                x2 == xi(2)&lt;br /&gt;
                x3 == xi(3)&lt;br /&gt;
                })};&lt;br /&gt;
&lt;br /&gt;
%Box constraints&lt;br /&gt;
cbox = {(0 &amp;lt;= collocate(u) &amp;lt;= 1)};&lt;br /&gt;
&lt;br /&gt;
%Boundary constraints&lt;br /&gt;
cbnd = {initial({   x1 == xi(1); &lt;br /&gt;
                    x2 == xi(2);&lt;br /&gt;
                    x3 == xi(3);})};&lt;br /&gt;
&lt;br /&gt;
%Parameters for ODE&#039;s&lt;br /&gt;
c = [0.4, 0.2]&#039;;&lt;br /&gt;
c0 = c(1);&lt;br /&gt;
c1 = c(2);&lt;br /&gt;
&lt;br /&gt;
%ODE&#039;s&lt;br /&gt;
&lt;br /&gt;
dx1 = x1 - x1.*x2 -c0*x1.*u;&lt;br /&gt;
dx2 = -x2 + x1.*x2 - c1*x2.*u;&lt;br /&gt;
dx3 = (x1 - 1).^2 + (x2 - 1).^2;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ceq = collocate({&lt;br /&gt;
        dot(x1) == dx1&lt;br /&gt;
        dot(x2) == dx2&lt;br /&gt;
        dot(x3) == dx3});&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
%Objective&lt;br /&gt;
&lt;br /&gt;
objective = final(x3);&lt;br /&gt;
&lt;br /&gt;
%% Solve the problem&lt;br /&gt;
    options = struct;&lt;br /&gt;
    options.name = &#039;Lotka-Volterra&#039;;&lt;br /&gt;
    %options.type = &#039;minlp&#039;;&lt;br /&gt;
    %options.solver = &#039;knitro&#039;;&lt;br /&gt;
    solution = ezsolve(objective, {cbox, cbnd, ceq}, x0, options);&lt;br /&gt;
&lt;br /&gt;
    xopt1 = subs(x1,solution);&lt;br /&gt;
    xopt2 = subs(x2,solution);&lt;br /&gt;
    xopt3 = subs(x3,solution);&lt;br /&gt;
    uopt  = subs(u,solution);&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
%Plotting solution&lt;br /&gt;
&lt;br /&gt;
figure(1)&lt;br /&gt;
subplot(3,1,1);&lt;br /&gt;
ezplot([x1; x2]); legend(&#039;Prey&#039;,&#039;Predator&#039;);&lt;br /&gt;
xlabel(&#039;time&#039;);&lt;br /&gt;
ylabel(&#039;Biomass&#039;);&lt;br /&gt;
title(&#039;Biomasses&#039;);&lt;br /&gt;
&lt;br /&gt;
subplot(3,1,2);&lt;br /&gt;
ezplot(u); legend(&#039;u&#039;);&lt;br /&gt;
xlabel(&#039;time&#039;);&lt;br /&gt;
ylabel(&#039;Control&#039;);&lt;br /&gt;
title(&#039;Fishing control&#039;);&lt;br /&gt;
&lt;br /&gt;
subplot(3,1,3);&lt;br /&gt;
ezplot(x3); legend(&#039;Obj. Value&#039;);&lt;br /&gt;
xlabel(&#039;time&#039;);&lt;br /&gt;
title(&#039;Objective&#039;);&lt;br /&gt;
&lt;br /&gt;
disp(&#039;Objective Function Value&#039;);&lt;br /&gt;
disp(final(xopt3));&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:TomDyn/PROPT]]&lt;/div&gt;</summary>
		<author><name>MaxWolff</name></author>
	</entry>
	<entry>
		<id>https://mintoc.de/index.php?title=Cushioned_Oscillation_(PROPT)&amp;diff=1321</id>
		<title>Cushioned Oscillation (PROPT)</title>
		<link rel="alternate" type="text/html" href="https://mintoc.de/index.php?title=Cushioned_Oscillation_(PROPT)&amp;diff=1321"/>
		<updated>2016-01-19T13:59:32Z</updated>

		<summary type="html">&lt;p&gt;MaxWolff: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Below you can find the MATLAB file that was used to create the reference solution and its plot.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;matlab&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
%% Cushioned Oscillation&lt;br /&gt;
% (c) Maximilian von Wolff&lt;br /&gt;
% &lt;br /&gt;
%% Problem Setup&lt;br /&gt;
%&lt;br /&gt;
%&lt;br /&gt;
%&lt;br /&gt;
%Problem Parameters&lt;br /&gt;
t_0  = 0;&lt;br /&gt;
&lt;br /&gt;
x_0 = 2;  %starting position&lt;br /&gt;
v_0 = 5;  %starting velocity in m/s&lt;br /&gt;
umm = 5;  %control constraint&lt;br /&gt;
m   = 5; %mass in kg&lt;br /&gt;
c   = 10;  %spring stiffness in N/m&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
n=80; %Number of collocation points&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
%Setup&lt;br /&gt;
&lt;br /&gt;
toms t t_f            %independent variables&lt;br /&gt;
p = tomPhase(&#039;p&#039;, t, t_0, t_f, n);&lt;br /&gt;
setPhase(p);&lt;br /&gt;
tomStates x v        &lt;br /&gt;
tomControls u&lt;br /&gt;
&lt;br /&gt;
%initial states&lt;br /&gt;
xi = [x_0; v_0];&lt;br /&gt;
&lt;br /&gt;
%initial guess&lt;br /&gt;
x0 = {t_f == 10&lt;br /&gt;
    collocate({u == 0&lt;br /&gt;
                 })&lt;br /&gt;
     icollocate({x == xi(1)&lt;br /&gt;
                 v == xi(2)&lt;br /&gt;
                 })};&lt;br /&gt;
&lt;br /&gt;
%Box constraints&lt;br /&gt;
cbox = {-umm &amp;lt;= collocate(u) &amp;lt;= umm&lt;br /&gt;
        };&lt;br /&gt;
&lt;br /&gt;
%Boundary constraints&lt;br /&gt;
cbnd = {initial({   x == xi(1); &lt;br /&gt;
                    v == xi(2);&lt;br /&gt;
                    })&lt;br /&gt;
        final({     x == 0;&lt;br /&gt;
                    v == 0;&lt;br /&gt;
                    })};&lt;br /&gt;
                &lt;br /&gt;
% ODE&#039;s&lt;br /&gt;
&lt;br /&gt;
dx  = v;&lt;br /&gt;
dv  = 1./m.*(u-c*x);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ceq = collocate({&lt;br /&gt;
        dot(x) == dx&lt;br /&gt;
        dot(v) == dv&lt;br /&gt;
        });&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
objective = t_f;    &lt;br /&gt;
    &lt;br /&gt;
%% Solve the problem&lt;br /&gt;
    options = struct;&lt;br /&gt;
    options.name = &#039;cushioned oscillation&#039;;&lt;br /&gt;
    solution = ezsolve(objective, {cbox, cbnd, ceq}, x0, options);&lt;br /&gt;
&lt;br /&gt;
    tfopt = subs(t_f,solution);&lt;br /&gt;
    xopt = subs(x,solution);&lt;br /&gt;
    vopt = subs(v,solution);&lt;br /&gt;
    uopt = subs(u,solution);&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
%Plotting solution&lt;br /&gt;
&lt;br /&gt;
figure(1)&lt;br /&gt;
subplot(3,1,1);&lt;br /&gt;
ezplot(x); legend(&#039;x&#039;);&lt;br /&gt;
xlabel(&#039;time&#039;);&lt;br /&gt;
ylabel(&#039;position in m&#039;);&lt;br /&gt;
title(&#039;Position&#039;);&lt;br /&gt;
&lt;br /&gt;
subplot(3,1,2);&lt;br /&gt;
ezplot(v); legend(&#039;v&#039;);&lt;br /&gt;
xlabel(&#039;time&#039;);&lt;br /&gt;
ylabel(&#039;velocity in m/s&#039;);&lt;br /&gt;
title(&#039;Velocity&#039;);&lt;br /&gt;
&lt;br /&gt;
subplot(3,1,3);&lt;br /&gt;
ezplot(u); legend(&#039;u&#039;);&lt;br /&gt;
xlabel(&#039;time&#039;);&lt;br /&gt;
title(&#039;Control&#039;);&lt;br /&gt;
&lt;br /&gt;
disp(&#039;Final Time&#039;);&lt;br /&gt;
disp(solution.t_f)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:TomDyn/PROPT]]&lt;/div&gt;</summary>
		<author><name>MaxWolff</name></author>
	</entry>
	<entry>
		<id>https://mintoc.de/index.php?title=Cushioned_Oscillation_(PROPT)&amp;diff=1280</id>
		<title>Cushioned Oscillation (PROPT)</title>
		<link rel="alternate" type="text/html" href="https://mintoc.de/index.php?title=Cushioned_Oscillation_(PROPT)&amp;diff=1280"/>
		<updated>2016-01-18T10:27:54Z</updated>

		<summary type="html">&lt;p&gt;MaxWolff: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Below you can find the MATLAB file that was used to create the reference solution and its plot.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;matlab&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
%% Cushioned Oscillation&lt;br /&gt;
% (c) Maximilian von Wolff&lt;br /&gt;
% &lt;br /&gt;
%% Problem Setup&lt;br /&gt;
%&lt;br /&gt;
%&lt;br /&gt;
%&lt;br /&gt;
%Problem Parameters&lt;br /&gt;
t_0  = 0;&lt;br /&gt;
&lt;br /&gt;
x_0 = 2;  %starting position&lt;br /&gt;
v_0 = 5;  %starting velocity in m/s&lt;br /&gt;
umm = 5;  %control constraint&lt;br /&gt;
m   = 5; %mass in kg&lt;br /&gt;
c   = 10;  %spring stiffness in N/m&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
n=80; %Number of collocation points&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
%Setup&lt;br /&gt;
&lt;br /&gt;
toms t t_f            %independent variables&lt;br /&gt;
p = tomPhase(&#039;p&#039;, t, t_0, t_f, n);&lt;br /&gt;
setPhase(p);&lt;br /&gt;
tomStates x v        &lt;br /&gt;
tomControls u&lt;br /&gt;
&lt;br /&gt;
%initial states&lt;br /&gt;
xi = [x_0; v_0];&lt;br /&gt;
&lt;br /&gt;
%initial guess&lt;br /&gt;
x0 = {t_f == 10&lt;br /&gt;
    collocate({u == 0&lt;br /&gt;
                 })&lt;br /&gt;
     icollocate({x1 == xi(1)&lt;br /&gt;
                 x2 == xi(2)&lt;br /&gt;
                 })};&lt;br /&gt;
&lt;br /&gt;
%Box constraints&lt;br /&gt;
cbox = {-umm &amp;lt;= collocate(u) &amp;lt;= umm&lt;br /&gt;
        };&lt;br /&gt;
&lt;br /&gt;
%Boundary constraints&lt;br /&gt;
cbnd = {initial({   x == xi(1); &lt;br /&gt;
                    v == xi(2);&lt;br /&gt;
                    })&lt;br /&gt;
        final({     x == 0;&lt;br /&gt;
                    v == 0;&lt;br /&gt;
                    })};&lt;br /&gt;
                &lt;br /&gt;
% ODE&#039;s&lt;br /&gt;
&lt;br /&gt;
dx  = v;&lt;br /&gt;
dv  = 1./m.*(u-c*x);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ceq = collocate({&lt;br /&gt;
        dot(x) == dx&lt;br /&gt;
        dot(v) == dv&lt;br /&gt;
        });&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
objective = t_f;    &lt;br /&gt;
    &lt;br /&gt;
%% Solve the problem&lt;br /&gt;
    options = struct;&lt;br /&gt;
    options.name = &#039;cushioned oscillation&#039;;&lt;br /&gt;
    solution = ezsolve(objective, {cbox, cbnd, ceq}, x0, options);&lt;br /&gt;
&lt;br /&gt;
    tfopt = subs(t_f,solution);&lt;br /&gt;
    xopt = subs(x1,solution);&lt;br /&gt;
    vopt = subs(v,solution);&lt;br /&gt;
    uopt = subs(u,solution);&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
%Plotting solution&lt;br /&gt;
&lt;br /&gt;
figure(1)&lt;br /&gt;
subplot(3,1,1);&lt;br /&gt;
ezplot(x); legend(&#039;x&#039;);&lt;br /&gt;
xlabel(&#039;time&#039;);&lt;br /&gt;
ylabel(&#039;position in m&#039;);&lt;br /&gt;
title(&#039;Position&#039;);&lt;br /&gt;
&lt;br /&gt;
subplot(3,1,2);&lt;br /&gt;
ezplot(v); legend(&#039;v&#039;);&lt;br /&gt;
xlabel(&#039;time&#039;);&lt;br /&gt;
ylabel(&#039;velocity in m/s&#039;);&lt;br /&gt;
title(&#039;Velocity&#039;);&lt;br /&gt;
&lt;br /&gt;
subplot(3,1,3);&lt;br /&gt;
ezplot(u); legend(&#039;u&#039;);&lt;br /&gt;
xlabel(&#039;time&#039;);&lt;br /&gt;
title(&#039;Control&#039;);&lt;br /&gt;
&lt;br /&gt;
disp(&#039;Final Time&#039;);&lt;br /&gt;
disp(solution.t_f)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:TomDyn/PROPT]]&lt;/div&gt;</summary>
		<author><name>MaxWolff</name></author>
	</entry>
	<entry>
		<id>https://mintoc.de/index.php?title=Cushioned_Oscillation&amp;diff=1279</id>
		<title>Cushioned Oscillation</title>
		<link rel="alternate" type="text/html" href="https://mintoc.de/index.php?title=Cushioned_Oscillation&amp;diff=1279"/>
		<updated>2016-01-18T10:26:42Z</updated>

		<summary type="html">&lt;p&gt;MaxWolff: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The Cushioned Oscillation is a simplified model of time optimal &amp;quot;stopping&amp;quot; of an oscillating object attached to a spring by applying a control and moving it back into the relaxed position and zero velocity.&lt;br /&gt;
&lt;br /&gt;
== Model formulation == &lt;br /&gt;
&lt;br /&gt;
An object with mass &amp;lt;math&amp;gt; m &amp;lt;/math&amp;gt; is attached to a spring with stiffness constant &amp;lt;math&amp;gt; c &amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If the resetting spring force is proportional to the deviation &amp;lt;math&amp;gt;x=x(t)&amp;lt;/math&amp;gt;, an oscillation, induced by an external force &amp;lt;math&amp;gt;u(t)&amp;lt;/math&amp;gt;, satisfies:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;               m\dot v (t) + cx(t) = u(t)&amp;lt;/math&amp;gt;   (which is equivalent to &amp;lt;math&amp;gt;\dot v (t) = \frac{1}{m}(u(t) - cx(t))&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;x(t)&amp;lt;/math&amp;gt; denotes the deviation to the relaxed position and &amp;lt;math&amp;gt; v(t)=\dot x (t) &amp;lt;/math&amp;gt; the velocity of the oscillating object.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Through external force, the object has been put into an initial state :&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;(x(0),v(0)) = (x_0,v_0)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The goal is to reset position and velocity of the object as fast as possible, meaning:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;(x(t_f),v(t_f)) = (0,0)&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
with the objective function:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\min\limits_{t_f} t_f&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Optimal Control Problem (OCP) Formulation ==&lt;br /&gt;
&lt;br /&gt;
The above results in the following OCP &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; 		\begin{array}{llr}&lt;br /&gt;
 		\min\limits_{x,v,u,t_f}  &amp;amp; t_f\\ &lt;br /&gt;
&lt;br /&gt;
			 		s.t. &amp;amp; 	 \dot x (t) = v(t), &amp;amp; \forall t \in [0,t_f]\\&lt;br /&gt;
&lt;br /&gt;
					 	 &amp;amp;	\dot v (t)= \frac{1}{m}(u(t) - cx(t)),  &amp;amp; \forall t \in [0,t_f]\\&lt;br /&gt;
\\&lt;br /&gt;
                                                     &lt;br /&gt;
&amp;amp; x(0)=x_0,\\&lt;br /&gt;
&lt;br /&gt;
&amp;amp; v(0)=v_0,\\&lt;br /&gt;
&lt;br /&gt;
&amp;amp; x(t_f)=0,\\&lt;br /&gt;
&lt;br /&gt;
&amp;amp; v(t_f)=0,\\&lt;br /&gt;
&lt;br /&gt;
\\&lt;br /&gt;
&amp;amp; -u_{mm} \le u(t) \le u_{mm},  &amp;amp; \forall t \in [0,t_f]\\&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
					 	&lt;br /&gt;
 		\end{array}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Parameters and Reference Solution ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The following parameters were used, to create the reference solution below, with an almost optimal final time &amp;lt;math&amp;gt; t_f = 8.98 s&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; m=5, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; c=10, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; x_0=2, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; v_0=5, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; u_{mm}=5&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Reference Solution ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;Reference solution plots&amp;quot; widths=&amp;quot;180px&amp;quot; heights=&amp;quot;140px&amp;quot; perrow=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
 Image:Ref_sol_plot_cushioned_oscillation_m5.png| States and Controls&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The OCP was solved within MATLAB R2015b, using the TOMLAB Optimization Package. PROPT reformulates such problems with the direct collocation approach (n=80 collocation points) and automatically finds a suiting solver included in the TOMLAB Optimization Package (in this case, SNOPT was used).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Source Code ==&lt;br /&gt;
&lt;br /&gt;
The MATLAB script can be found in:&lt;br /&gt;
&lt;br /&gt;
[[Category:TomDyn/PROPT]] [[Cushioned Oscillation (PROPT)]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
[[Category:MIOCP]]&lt;/div&gt;</summary>
		<author><name>MaxWolff</name></author>
	</entry>
	<entry>
		<id>https://mintoc.de/index.php?title=Lotka_Volterra_fishing_problem&amp;diff=1275</id>
		<title>Lotka Volterra fishing problem</title>
		<link rel="alternate" type="text/html" href="https://mintoc.de/index.php?title=Lotka_Volterra_fishing_problem&amp;diff=1275"/>
		<updated>2016-01-18T10:10:12Z</updated>

		<summary type="html">&lt;p&gt;MaxWolff: /* Source Code */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Dimensions&lt;br /&gt;
|nd        = 1&lt;br /&gt;
|nx        = 3&lt;br /&gt;
|nw        = 1&lt;br /&gt;
|nre       = 3&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;Lotka Volterra fishing problem&#039;&#039;&#039; looks for an optimal fishing strategy to be performed on a fixed time horizon to bring the biomasses of both predator as prey fish to a prescribed steady state. The problem was set up as a small-scale benchmark problem. &lt;br /&gt;
The well known [http://en.wikipedia.org/wiki/Lotka_volterra Lotka Volterra equations] for a predator-prey system have been augmented by an additional linear term, relating to fishing by man. The control can be regarded both in a relaxed, as in a discrete manner, corresponding to a part of the fleet, or the full fishing fleet.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The mathematical equations form a small-scale [[:Category:ODE model|ODE model]]. The interior point equality conditions fix the initial values of the differential states.&lt;br /&gt;
&lt;br /&gt;
The optimal integer control functions shows [[:Category:Chattering|chattering]] behavior, making the Lotka Volterra fishing problem an ideal candidate for benchmarking of algorithms.&lt;br /&gt;
&lt;br /&gt;
== Mathematical formulation ==&lt;br /&gt;
&lt;br /&gt;
For &amp;lt;math&amp;gt;t \in [t_0, t_f]&amp;lt;/math&amp;gt; almost everywhere the mixed-integer optimal control problem is given by&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{llcl}&lt;br /&gt;
 \displaystyle \min_{x, w} &amp;amp; x_2(t_f)   \\[1.5ex]&lt;br /&gt;
 \mbox{s.t.} &amp;amp; \dot{x}_0(t) &amp;amp; = &amp;amp; x_0(t) - x_0(t) x_1(t) - \; c_0 x_0(t) \; w(t), \\&lt;br /&gt;
 &amp;amp; \dot{x}_1(t) &amp;amp; = &amp;amp; - x_1(t) + x_0(t) x_1(t) - \; c_1 x_1(t) \; w(t),  \\&lt;br /&gt;
 &amp;amp; \dot{x}_2(t) &amp;amp; = &amp;amp; (x_0(t) - 1)^2 + (x_1(t) - 1)^2,  \\[1.5ex]&lt;br /&gt;
 &amp;amp; x(0) &amp;amp;=&amp;amp; (0.5, 0.7, 0)^T, \\&lt;br /&gt;
 &amp;amp; w(t) &amp;amp;\in&amp;amp;  \{0, 1\}.&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;
Here the differential states &amp;lt;math&amp;gt;(x_0, x_1)&amp;lt;/math&amp;gt; describe the biomasses of prey and predator, respectively. The third differential state is used here to transform the objective, an integrated deviation, into the Mayer formulation &amp;lt;math&amp;gt;\min \; x_2(t_f)&amp;lt;/math&amp;gt;. The decision, whether the fishing fleet is actually fishing at time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; is denoted by &amp;lt;math&amp;gt;w(t)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Parameters ==&lt;br /&gt;
&lt;br /&gt;
These fixed values are used within the model.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{rcl}&lt;br /&gt;
[t_0, t_f] &amp;amp;=&amp;amp; [0, 12],\\&lt;br /&gt;
(c_0, c_1) &amp;amp;=&amp;amp; (0.4, 0.2).&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Reference Solutions ==&lt;br /&gt;
&lt;br /&gt;
If the problem is relaxed, i.e., we demand that &amp;lt;math&amp;gt;w(t)&amp;lt;/math&amp;gt; be in the continuous interval &amp;lt;math&amp;gt;[0, 1]&amp;lt;/math&amp;gt; instead of the binary choice &amp;lt;math&amp;gt;\{0,1\}&amp;lt;/math&amp;gt;, the optimal solution can be determined by means of [http://en.wikipedia.org/wiki/Pontryagin%27s_minimum_principle Pontryagins maximum principle]. The optimal solution contains a singular arc, as can be seen in the plot of the optimal control. The two differential states and corresponding adjoint variables in the indirect approach are also displayed. A different approach to solving the relaxed problem is by using a direct method such as collocation or Bock&#039;s direct multiple shooting method. Optimal solutions for different control discretizations are also plotted in the leftmost figure.&lt;br /&gt;
&lt;br /&gt;
The optimal objective value of this relaxed problem is &amp;lt;math&amp;gt;x_2(t_f) = 1.34408&amp;lt;/math&amp;gt;. As follows from MIOC theory&amp;lt;bib id=&amp;quot;Sager2008&amp;quot; /&amp;gt; this is the best lower bound on the optimal value of the original problem with the integer restriction on the control function. In other words, this objective value can be approximated arbitrarily close, if the control only switches often enough between 0 and 1. As no optimal solution exists, two suboptimal ones are shown, one with only two switches and an objective function value of &amp;lt;math&amp;gt;x_2(t_f) = 1.38276&amp;lt;/math&amp;gt;, and one with 56 switches and &amp;lt;math&amp;gt;x_2(t_f) = 1.34416&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;Reference solution plots&amp;quot; widths=&amp;quot;180px&amp;quot; heights=&amp;quot;140px&amp;quot; perrow=&amp;quot;2&amp;quot;&amp;gt;&lt;br /&gt;
 Image:lotkaRelaxedControls.png| Optimal relaxed control determined by an indirect approach and by a direct approach on different control discretization grids.&lt;br /&gt;
 Image:lotkaindirektStates.png| Differential states and corresponding adjoint variables in the indirect approach.&lt;br /&gt;
 Image:lotka2Switches.png| Control and differential states with only two switches.&lt;br /&gt;
 Image:lotka56Switches.png| Control and differential states with 56 switches.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Source Code ==&lt;br /&gt;
&lt;br /&gt;
Model descriptions are available in&lt;br /&gt;
&lt;br /&gt;
* [[:Category:AMPL | AMPL code]] at [[Lotka Volterra fishing problem (AMPL)]]&lt;br /&gt;
* [[:Category:C | C code]] at [[Lotka Volterra fishing problem (C)]]&lt;br /&gt;
* [[:Category:optimica | optimica code]] at [[Lotka Volterra fishing problem (optimica)]]&lt;br /&gt;
* [[:Category: JuMP | JuMP code]] at [[Lotka Volterra fishing problem (JuMP)]]&lt;br /&gt;
* [[:Category: Muscod | Muscod code]] at [[Lotka Volterra fishing problem (Muscod)]]&lt;br /&gt;
* [[:Category: ACADO | ACADO code]] at [[Lotka Volterra fishing problem (ACADO)]]&lt;br /&gt;
* [[:Category: VPLAN | VPLAN code]] at [[Lotka Volterra fishing problem (VPLAN)]]&lt;br /&gt;
* [[:Category: Casadi | Casadi code]] at [[Lotka Volterra fishing problem (Casadi)]]&lt;br /&gt;
* [[:Category: GloOptCon | GloOptCon code]] at [[Lotka Volterra fishing problem (GloOptCon)]]&lt;br /&gt;
* [[:Category: switch | switch code]] at [[Lotka Volterra fishing problem (switch)]]&lt;br /&gt;
* [[:Category: JModelica | JModelica code]] at [[Lotka Volterra fishing problem (JModelica)]]&lt;br /&gt;
* [[:Category: TomDyn/PROPT | PROPT code]] at [[Lotka Volterra fishing problem (TomDyn/PROPT)]]&lt;br /&gt;
&lt;br /&gt;
== Variants ==&lt;br /&gt;
&lt;br /&gt;
There are several alternative formulations and variants of the above problem, in particular&lt;br /&gt;
&lt;br /&gt;
* a prescribed time grid for the control function &amp;lt;bib id=&amp;quot;Sager2006&amp;quot; /&amp;gt;, see also [[Lotka Volterra fishing problem (AMPL)]],&lt;br /&gt;
* a time-optimal formulation to get into a steady-state &amp;lt;bib id=&amp;quot;Sager2005&amp;quot; /&amp;gt;,&lt;br /&gt;
* the usage of a different target steady-state, as the one corresponding to &amp;lt;math&amp;gt; w(t) = 1&amp;lt;/math&amp;gt; which is &amp;lt;math&amp;gt;(1 + c_1, 1 - c_0)&amp;lt;/math&amp;gt;,&lt;br /&gt;
* different fishing control functions for the two species,&lt;br /&gt;
* different parameters and start values.&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous and Further Reading ==&lt;br /&gt;
The Lotka Volterra fishing problem was introduced by Sebastian Sager in a proceedings paper &amp;lt;bib id=&amp;quot;Sager2006&amp;quot; /&amp;gt; and revisited in his PhD thesis &amp;lt;bib id=&amp;quot;Sager2005&amp;quot; /&amp;gt;. These are also the references to look for more details.&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:Tracking objective]]&lt;br /&gt;
[[Category:Chattering]]&lt;br /&gt;
[[Category:Sensitivity-seeking arcs]]&lt;br /&gt;
[[Category:Population dynamics]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--Testing Graphviz&lt;br /&gt;
&amp;lt;graphviz border=&#039;frame&#039; format=&#039;svg&#039;&amp;gt;&lt;br /&gt;
digraph G {Hello-&amp;gt;World!}&lt;br /&gt;
&amp;lt;/graphviz&amp;gt;&lt;br /&gt;
--&amp;gt;&lt;/div&gt;</summary>
		<author><name>MaxWolff</name></author>
	</entry>
	<entry>
		<id>https://mintoc.de/index.php?title=Cushioned_Oscillation&amp;diff=1274</id>
		<title>Cushioned Oscillation</title>
		<link rel="alternate" type="text/html" href="https://mintoc.de/index.php?title=Cushioned_Oscillation&amp;diff=1274"/>
		<updated>2016-01-18T10:07:07Z</updated>

		<summary type="html">&lt;p&gt;MaxWolff: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The Cushioned Oscillation is a simplified model of time optimal &amp;quot;stopping&amp;quot; of an oscillating object attached to a spring by applying a control and moving it back into the relaxed position and zero velocity.&lt;br /&gt;
&lt;br /&gt;
== Model formulation == &lt;br /&gt;
&lt;br /&gt;
An object with mass &amp;lt;math&amp;gt; m &amp;lt;/math&amp;gt; is attached to a spring with stiffness constant &amp;lt;math&amp;gt; c &amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If the resetting spring force is proportional to the deviation &amp;lt;math&amp;gt;x=x(t)&amp;lt;/math&amp;gt;, an oscillation, induced by an external force &amp;lt;math&amp;gt;u(t)&amp;lt;/math&amp;gt;, satisfies:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;               m\dot v (t) + cx(t) = u(t)&amp;lt;/math&amp;gt;   (which is equivalent to &amp;lt;math&amp;gt;\dot v (t) = \frac{1}{m}(u(t) - cx(t))&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;x(t)&amp;lt;/math&amp;gt; denotes the deviation to the relaxed position and &amp;lt;math&amp;gt; v(t)=\dot x (t) &amp;lt;/math&amp;gt; the velocity of the oscillating object.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Through external force, the object has been put into an initial state :&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;(x(0),v(0)) = (x_0,v_0)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The goal is to reset position and velocity of the object as fast as possible, meaning:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;(x(t_f),v(t_f)) = (0,0)&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
with the objective function:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\min\limits_{t_f} t_f&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Optimal Control Problem (OCP) Formulation ==&lt;br /&gt;
&lt;br /&gt;
The above results in the following OCP &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; 		\begin{array}{llr}&lt;br /&gt;
 		\min\limits_{x,v,u,t_f}  &amp;amp; t_f\\ &lt;br /&gt;
&lt;br /&gt;
			 		s.t. &amp;amp; 	 \dot x (t) = v(t), &amp;amp; \forall t \in [0,t_f]\\&lt;br /&gt;
&lt;br /&gt;
					 	 &amp;amp;	\dot v (t)= \frac{1}{m}(u(t) - cx(t)),  &amp;amp; \forall t \in [0,t_f]\\&lt;br /&gt;
\\&lt;br /&gt;
                                                     &lt;br /&gt;
&amp;amp; x(0)=x_0,\\&lt;br /&gt;
&lt;br /&gt;
&amp;amp; v(0)=v_0,\\&lt;br /&gt;
&lt;br /&gt;
&amp;amp; x(t_f)=0,\\&lt;br /&gt;
&lt;br /&gt;
&amp;amp; v(t_f)=0,\\&lt;br /&gt;
&lt;br /&gt;
\\&lt;br /&gt;
&amp;amp; -u_{mm} \le u(t) \le u_{mm},  &amp;amp; \forall t \in [0,t_f]\\&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
					 	&lt;br /&gt;
 		\end{array}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Parameters and Reference Solution ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The following parameters were used, to create the reference solution below, with an almost optimal final time &amp;lt;math&amp;gt; t_f = 8.98 s&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; m=5, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; c=10, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; x_0=2, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; v_0=5, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; u_{mm}=5&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;Reference solution plots&amp;quot; widths=&amp;quot;180px&amp;quot; heights=&amp;quot;140px&amp;quot; perrow=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
 Image:Ref_sol_plot_cushioned_oscillation_m5.png| States and Controls&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The OCP was solved within MATLAB R2015b, using the TOMLAB Optimization Package. PROPT reformulates such problems with the direct collocation approach (n=80 collocation points) and automatically finds a suiting solver included in the TOMLAB Optimization Package (in this case, SNOPT was used).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Source Code ==&lt;br /&gt;
&lt;br /&gt;
The MATLAB script can be found in:&lt;br /&gt;
&lt;br /&gt;
[[Category:TomDyn/PROPT]] [[Cushioned Oscillation (PROPT)]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
[[Category:MIOCP]]&lt;/div&gt;</summary>
		<author><name>MaxWolff</name></author>
	</entry>
	<entry>
		<id>https://mintoc.de/index.php?title=Cushioned_Oscillation_(PROPT)&amp;diff=1273</id>
		<title>Cushioned Oscillation (PROPT)</title>
		<link rel="alternate" type="text/html" href="https://mintoc.de/index.php?title=Cushioned_Oscillation_(PROPT)&amp;diff=1273"/>
		<updated>2016-01-18T10:06:36Z</updated>

		<summary type="html">&lt;p&gt;MaxWolff: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Below you can find the MATLAB file that was used to create the reference solution and its plot.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;matlab&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
%% Cushioned Oscillation&lt;br /&gt;
% (c) Maximilian von Wolff&lt;br /&gt;
% &lt;br /&gt;
%% Problem Setup&lt;br /&gt;
%&lt;br /&gt;
%&lt;br /&gt;
%&lt;br /&gt;
%Problem Parameters&lt;br /&gt;
t_0  = 0;&lt;br /&gt;
&lt;br /&gt;
x_0 = 2;  %starting position&lt;br /&gt;
v_0 = 5;  %starting velocity in m/s&lt;br /&gt;
umm = 5;  %control constraint&lt;br /&gt;
m   = 5; %mass in kg&lt;br /&gt;
c   = 10;  %spring stiffness in N/m&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
n=80; %Number of collocation points&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
%Setup&lt;br /&gt;
&lt;br /&gt;
toms t t_f            %independant variables&lt;br /&gt;
p = tomPhase(&#039;p&#039;, t, t_0, t_f, n);&lt;br /&gt;
setPhase(p);&lt;br /&gt;
tomStates x v        &lt;br /&gt;
tomControls u&lt;br /&gt;
&lt;br /&gt;
%initial states&lt;br /&gt;
xi = [x_0; v_0];&lt;br /&gt;
&lt;br /&gt;
%initial guess&lt;br /&gt;
x0 = {t_f == 10&lt;br /&gt;
    collocate({u == 0&lt;br /&gt;
                 })&lt;br /&gt;
     icollocate({x1 == xi(1)&lt;br /&gt;
                 x2 == xi(2)&lt;br /&gt;
                 })};&lt;br /&gt;
&lt;br /&gt;
%Box constraints&lt;br /&gt;
cbox = {-umm &amp;lt;= collocate(u) &amp;lt;= umm&lt;br /&gt;
        };&lt;br /&gt;
&lt;br /&gt;
%Boundary constraints&lt;br /&gt;
cbnd = {initial({   x == xi(1); &lt;br /&gt;
                    v == xi(2);&lt;br /&gt;
                    })&lt;br /&gt;
        final({     x == 0;&lt;br /&gt;
                    v == 0;&lt;br /&gt;
                    })};&lt;br /&gt;
                &lt;br /&gt;
% ODE&#039;s&lt;br /&gt;
&lt;br /&gt;
dx  = v;&lt;br /&gt;
dv  = 1./m.*(u-c*x);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ceq = collocate({&lt;br /&gt;
        dot(x) == dx&lt;br /&gt;
        dot(v) == dv&lt;br /&gt;
        });&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
objective = t_f;    &lt;br /&gt;
    &lt;br /&gt;
%% Solve the problem&lt;br /&gt;
    options = struct;&lt;br /&gt;
    options.name = &#039;cushioned oscillation&#039;;&lt;br /&gt;
    solution = ezsolve(objective, {cbox, cbnd, ceq}, x0, options);&lt;br /&gt;
&lt;br /&gt;
    tfopt = subs(t_f,solution);&lt;br /&gt;
    xopt = subs(x1,solution);&lt;br /&gt;
    vopt = subs(v,solution);&lt;br /&gt;
    uopt = subs(u,solution);&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
%Plotting solution&lt;br /&gt;
&lt;br /&gt;
figure(1)&lt;br /&gt;
subplot(3,1,1);&lt;br /&gt;
ezplot(x); legend(&#039;x&#039;);&lt;br /&gt;
xlabel(&#039;time&#039;);&lt;br /&gt;
ylabel(&#039;position in m&#039;);&lt;br /&gt;
title(&#039;Position&#039;);&lt;br /&gt;
&lt;br /&gt;
subplot(3,1,2);&lt;br /&gt;
ezplot(v); legend(&#039;v&#039;);&lt;br /&gt;
xlabel(&#039;time&#039;);&lt;br /&gt;
ylabel(&#039;velocity in m/s&#039;);&lt;br /&gt;
title(&#039;Velocity&#039;);&lt;br /&gt;
&lt;br /&gt;
subplot(3,1,3);&lt;br /&gt;
ezplot(u); legend(&#039;u&#039;);&lt;br /&gt;
xlabel(&#039;time&#039;);&lt;br /&gt;
title(&#039;Control&#039;);&lt;br /&gt;
&lt;br /&gt;
disp(&#039;Final Time&#039;);&lt;br /&gt;
disp(solution.t_f)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:TomDyn/PROPT]]&lt;/div&gt;</summary>
		<author><name>MaxWolff</name></author>
	</entry>
	<entry>
		<id>https://mintoc.de/index.php?title=Cushioned_Oscillation&amp;diff=1272</id>
		<title>Cushioned Oscillation</title>
		<link rel="alternate" type="text/html" href="https://mintoc.de/index.php?title=Cushioned_Oscillation&amp;diff=1272"/>
		<updated>2016-01-18T10:04:57Z</updated>

		<summary type="html">&lt;p&gt;MaxWolff: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The Cushioned Oscillation is a simplified model of time optimal &amp;quot;stopping&amp;quot; of an oscillating object attached to a spring by applying a control and moving it back into the relaxed position and no velocity.&lt;br /&gt;
&lt;br /&gt;
== Model formulation == &lt;br /&gt;
&lt;br /&gt;
An object with mass &amp;lt;math&amp;gt; m &amp;lt;/math&amp;gt; is attached to a spring with stiffness constant &amp;lt;math&amp;gt; c &amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If the resetting spring force is proportional to the deviation &amp;lt;math&amp;gt;x=x(t)&amp;lt;/math&amp;gt;, an oscillation, induced by an external force &amp;lt;math&amp;gt;u(t)&amp;lt;/math&amp;gt;, satisfies:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;               m\dot v (t) + cx(t) = u(t)&amp;lt;/math&amp;gt;   (which is equivalent to &amp;lt;math&amp;gt;\dot v (t) = \frac{1}{m}(u(t) - cx(t))&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;x(t)&amp;lt;/math&amp;gt; denotes the deviation to the relaxed position and &amp;lt;math&amp;gt; v(t)=\dot x (t) &amp;lt;/math&amp;gt; the velocity of the oscillating object.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Through external force, the object has been put into an initial state :&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;(x(0),v(0)) = (x_0,v_0)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The goal is to reset position and velocity of the object as fast as possible, meaning:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;(x(t_f),v(t_f)) = (0,0)&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
with the objective function:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\min\limits_{t_f} t_f&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Optimal Control Problem (OCP) Formulation ==&lt;br /&gt;
&lt;br /&gt;
The above results in the following OCP &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; 		\begin{array}{llr}&lt;br /&gt;
 		\min\limits_{x,v,u,t_f}  &amp;amp; t_f\\ &lt;br /&gt;
&lt;br /&gt;
			 		s.t. &amp;amp; 	 \dot x (t) = v(t), &amp;amp; \forall t \in [0,t_f]\\&lt;br /&gt;
&lt;br /&gt;
					 	 &amp;amp;	\dot v (t)= \frac{1}{m}(u(t) - cx(t)),  &amp;amp; \forall t \in [0,t_f]\\&lt;br /&gt;
\\&lt;br /&gt;
                                                     &lt;br /&gt;
&amp;amp; x(0)=x_0,\\&lt;br /&gt;
&lt;br /&gt;
&amp;amp; v(0)=v_0,\\&lt;br /&gt;
&lt;br /&gt;
&amp;amp; x(t_f)=0,\\&lt;br /&gt;
&lt;br /&gt;
&amp;amp; v(t_f)=0,\\&lt;br /&gt;
&lt;br /&gt;
\\&lt;br /&gt;
&amp;amp; -u_{mm} \le u(t) \le u_{mm},  &amp;amp; \forall t \in [0,t_f]\\&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
					 	&lt;br /&gt;
 		\end{array}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Parameters and Reference Solution ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The following parameters were used, to create the reference solution below, with an almost optimal final time &amp;lt;math&amp;gt; t_f = 8.98 s&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; m=5, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; c=10, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; x_0=2, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; v_0=5, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; u_{mm}=5&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;Reference solution plots&amp;quot; widths=&amp;quot;180px&amp;quot; heights=&amp;quot;140px&amp;quot; perrow=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
 Image:Ref_sol_plot_cushioned_oscillation_m5.png| States and Controls&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The OCP was solved within MATLAB R2015b, using the TOMLAB Optimization Package. PROPT reformulates such problems with the direct collocation approach (n=80 collocation points) and automatically finds a suiting solver included in the TOMLAB Optimization Package (in this case, SNOPT was used).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Source Code ==&lt;br /&gt;
&lt;br /&gt;
The MATLAB script can be found in:&lt;br /&gt;
&lt;br /&gt;
[[Category:TomDyn/PROPT]] [[Cushioned Oscillation (PROPT)]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
[[Category:MIOCP]]&lt;/div&gt;</summary>
		<author><name>MaxWolff</name></author>
	</entry>
	<entry>
		<id>https://mintoc.de/index.php?title=File:Ref_sol_plot_cushioned_oscillation_m5.png&amp;diff=1271</id>
		<title>File:Ref sol plot cushioned oscillation m5.png</title>
		<link rel="alternate" type="text/html" href="https://mintoc.de/index.php?title=File:Ref_sol_plot_cushioned_oscillation_m5.png&amp;diff=1271"/>
		<updated>2016-01-18T10:04:33Z</updated>

		<summary type="html">&lt;p&gt;MaxWolff: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>MaxWolff</name></author>
	</entry>
	<entry>
		<id>https://mintoc.de/index.php?title=Cushioned_Oscillation&amp;diff=1252</id>
		<title>Cushioned Oscillation</title>
		<link rel="alternate" type="text/html" href="https://mintoc.de/index.php?title=Cushioned_Oscillation&amp;diff=1252"/>
		<updated>2016-01-13T00:08:58Z</updated>

		<summary type="html">&lt;p&gt;MaxWolff: /* Model formulation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The Cushioned Oscillation is a simplified model of time optimal &amp;quot;stopping&amp;quot; of an oscillating object attached to a spring by applying a control and moving it back into the relaxed position and no velocity.&lt;br /&gt;
&lt;br /&gt;
== Model formulation == &lt;br /&gt;
&lt;br /&gt;
An object with mass &amp;lt;math&amp;gt; m &amp;lt;/math&amp;gt; is attached to a spring with stiffness constant &amp;lt;math&amp;gt; c &amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If the resetting spring force is proportional to the deviation &amp;lt;math&amp;gt;x=x(t)&amp;lt;/math&amp;gt;, an oscillation, induced by an external force &amp;lt;math&amp;gt;u(t)&amp;lt;/math&amp;gt;, satisfies:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;               m\dot v (t) + cx(t) = u(t)&amp;lt;/math&amp;gt;   (which is equivalent to &amp;lt;math&amp;gt;\dot v (t) = \frac{1}{m}(u(t) - cx(t))&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;x(t)&amp;lt;/math&amp;gt; denotes the deviation to the relaxed position and &amp;lt;math&amp;gt; v(t)=\dot x (t) &amp;lt;/math&amp;gt; the velocity of the oscillating object.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Through external force, the object has been put into an initial state :&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;(x(0),v(0)) = (x_0,v_0)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The goal is to reset position and velocity of the object as fast as possible, meaning:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;(x(t_f),v(t_f)) = (0,0)&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
with the objective function:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\min\limits_{t_f} t_f&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Optimal Control Problem (OCP) Formulation ==&lt;br /&gt;
&lt;br /&gt;
The above results in the following OCP &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; 		\begin{array}{llr}&lt;br /&gt;
 		\min\limits_{x,v,u,t_f}  &amp;amp; t_f\\ &lt;br /&gt;
&lt;br /&gt;
			 		s.t. &amp;amp; 	 \dot x (t) = v(t), &amp;amp; \forall t \in [0,t_f]\\&lt;br /&gt;
&lt;br /&gt;
					 	 &amp;amp;	\dot v (t)= \frac{1}{m}(u(t) - cx(t)),  &amp;amp; \forall t \in [0,t_f]\\&lt;br /&gt;
\\&lt;br /&gt;
                                                     &lt;br /&gt;
&amp;amp; x(0)=x_0,\\&lt;br /&gt;
&lt;br /&gt;
&amp;amp; v(0)=v_0,\\&lt;br /&gt;
&lt;br /&gt;
&amp;amp; x(t_f)=0,\\&lt;br /&gt;
&lt;br /&gt;
&amp;amp; v(t_f)=0,\\&lt;br /&gt;
&lt;br /&gt;
\\&lt;br /&gt;
&amp;amp; -u_{mm} \le u(t) \le u_{mm},  &amp;amp; \forall t \in [0,t_f]\\&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
					 	&lt;br /&gt;
 		\end{array}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Parameters and Reference Solution ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The following parameters were used, to create the reference solution below, with an almost optimal final time &amp;lt;math&amp;gt; t_f = 16.66 s&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; m=10, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; c=10, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; x_0=2, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; v_0=5, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; u_{mm}=5&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;Reference solution plots&amp;quot; widths=&amp;quot;180px&amp;quot; heights=&amp;quot;140px&amp;quot; perrow=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
 Image:Ref_sol_plot_cushioned_oscillation.png| States and Controls&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The OCP was solved within MATLAB R2015b, using the TOMLAB Optimization Package. PROPT reformulates such problems with the direct collocation approache and automatically finds a suiting solver included in the TOMLAB Optimization Package (in this case, SNOPT was used).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Source Code ==&lt;br /&gt;
&lt;br /&gt;
The MATLAB script can be found in:&lt;br /&gt;
&lt;br /&gt;
[[Category:TomDyn/PROPT]] [[Cushioned Oscillation (PROPT)]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
[[Category:MIOCP]]&lt;/div&gt;</summary>
		<author><name>MaxWolff</name></author>
	</entry>
	<entry>
		<id>https://mintoc.de/index.php?title=Cushioned_Oscillation_(PROPT)&amp;diff=1251</id>
		<title>Cushioned Oscillation (PROPT)</title>
		<link rel="alternate" type="text/html" href="https://mintoc.de/index.php?title=Cushioned_Oscillation_(PROPT)&amp;diff=1251"/>
		<updated>2016-01-13T00:07:22Z</updated>

		<summary type="html">&lt;p&gt;MaxWolff: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Below you can find the MATLAB file that was used to create the reference solution and its plot.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;matlab&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
%% Cushioned Oscillation&lt;br /&gt;
% (c) Maximilian von Wolff&lt;br /&gt;
% &lt;br /&gt;
%% Problem Setup&lt;br /&gt;
%&lt;br /&gt;
%&lt;br /&gt;
%&lt;br /&gt;
%Problem Parameters&lt;br /&gt;
t_0  = 0;&lt;br /&gt;
&lt;br /&gt;
x_0 = 2;  %starting position&lt;br /&gt;
v_0 = 5;  %starting velocity in m/s&lt;br /&gt;
umm = 5;  %control constraint&lt;br /&gt;
m   = 10; %mass in kg&lt;br /&gt;
c   = 10;  %spring stiffness in N/m&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
n=80; %Number of collocation points&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
%Setup&lt;br /&gt;
&lt;br /&gt;
toms t t_f            %independant variables&lt;br /&gt;
p = tomPhase(&#039;p&#039;, t, t_0, t_f, n);&lt;br /&gt;
setPhase(p);&lt;br /&gt;
tomStates x v        &lt;br /&gt;
tomControls u&lt;br /&gt;
&lt;br /&gt;
%initial states&lt;br /&gt;
xi = [x_0; v_0];&lt;br /&gt;
&lt;br /&gt;
%initial guess&lt;br /&gt;
x0 = {t_f == 10&lt;br /&gt;
    collocate({u == 0&lt;br /&gt;
                 })&lt;br /&gt;
     icollocate({x1 == xi(1)&lt;br /&gt;
                 x2 == xi(2)&lt;br /&gt;
                 })};&lt;br /&gt;
&lt;br /&gt;
%Box constraints&lt;br /&gt;
cbox = {-umm &amp;lt;= collocate(u) &amp;lt;= umm&lt;br /&gt;
        };&lt;br /&gt;
&lt;br /&gt;
%Boundary constraints&lt;br /&gt;
cbnd = {initial({   x == xi(1); &lt;br /&gt;
                    v == xi(2);&lt;br /&gt;
                    })&lt;br /&gt;
        final({     x == 0;&lt;br /&gt;
                    v == 0;&lt;br /&gt;
                    })};&lt;br /&gt;
                &lt;br /&gt;
% ODE&#039;s&lt;br /&gt;
&lt;br /&gt;
dx  = v;&lt;br /&gt;
dv  = 1./m.*(u-c*x);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ceq = collocate({&lt;br /&gt;
        dot(x) == dx&lt;br /&gt;
        dot(v) == dv&lt;br /&gt;
        });&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
objective = t_f;    &lt;br /&gt;
    &lt;br /&gt;
%% Solve the problem&lt;br /&gt;
    options = struct;&lt;br /&gt;
    options.name = &#039;cushioned oscillation&#039;;&lt;br /&gt;
    solution = ezsolve(objective, {cbox, cbnd, ceq}, x0, options);&lt;br /&gt;
&lt;br /&gt;
    tfopt = subs(t_f,solution);&lt;br /&gt;
    xopt = subs(x1,solution);&lt;br /&gt;
    vopt = subs(v,solution);&lt;br /&gt;
    uopt = subs(u,solution);&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
%Plotting solution&lt;br /&gt;
&lt;br /&gt;
figure(1)&lt;br /&gt;
subplot(3,1,1);&lt;br /&gt;
ezplot(x); legend(&#039;x&#039;);&lt;br /&gt;
xlabel(&#039;time&#039;);&lt;br /&gt;
ylabel(&#039;position in m&#039;);&lt;br /&gt;
title(&#039;Position&#039;);&lt;br /&gt;
&lt;br /&gt;
subplot(3,1,2);&lt;br /&gt;
ezplot(v); legend(&#039;v&#039;);&lt;br /&gt;
xlabel(&#039;time&#039;);&lt;br /&gt;
ylabel(&#039;velocity in m/s&#039;);&lt;br /&gt;
title(&#039;Velocity&#039;);&lt;br /&gt;
&lt;br /&gt;
subplot(3,1,3);&lt;br /&gt;
ezplot(u); legend(&#039;u&#039;);&lt;br /&gt;
xlabel(&#039;time&#039;);&lt;br /&gt;
title(&#039;Control&#039;);&lt;br /&gt;
&lt;br /&gt;
disp(&#039;Final Time&#039;);&lt;br /&gt;
disp(solution.t_f)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:TomDyn/PROPT]]&lt;/div&gt;</summary>
		<author><name>MaxWolff</name></author>
	</entry>
	<entry>
		<id>https://mintoc.de/index.php?title=Cushioned_Oscillation_(PROPT)&amp;diff=1250</id>
		<title>Cushioned Oscillation (PROPT)</title>
		<link rel="alternate" type="text/html" href="https://mintoc.de/index.php?title=Cushioned_Oscillation_(PROPT)&amp;diff=1250"/>
		<updated>2016-01-13T00:06:52Z</updated>

		<summary type="html">&lt;p&gt;MaxWolff: Created page with &amp;quot;Below you can find the MATLAB file that was used to create the reference solution and its plot.  &amp;lt;source lang=&amp;quot;matlab&amp;quot;&amp;gt;  %% Cushioned Oscillation % (c) Maximilian von Wolff %...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Below you can find the MATLAB file that was used to create the reference solution and its plot.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;matlab&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
%% Cushioned Oscillation&lt;br /&gt;
% (c) Maximilian von Wolff&lt;br /&gt;
% &lt;br /&gt;
%% Problem Setup&lt;br /&gt;
%&lt;br /&gt;
%&lt;br /&gt;
%&lt;br /&gt;
%Problem Parameters&lt;br /&gt;
t_0  = 0;&lt;br /&gt;
&lt;br /&gt;
x_0 = 2;  %starting position&lt;br /&gt;
v_0 = 5;  %starting velocity in m/s&lt;br /&gt;
umm = 5;  %control constraint&lt;br /&gt;
m   = 10; %mass in kg&lt;br /&gt;
c   = 10;  %spring stiffness in N/m&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
n=80; %Number of collocation points&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
%Setup&lt;br /&gt;
&lt;br /&gt;
toms t t_f            %independant variables&lt;br /&gt;
p = tomPhase(&#039;p&#039;, t, t_0, t_f, n);&lt;br /&gt;
setPhase(p);&lt;br /&gt;
tomStates x v        &lt;br /&gt;
tomControls u&lt;br /&gt;
&lt;br /&gt;
%initial states&lt;br /&gt;
xi = [x_0; v_0];&lt;br /&gt;
&lt;br /&gt;
%initial guess&lt;br /&gt;
x0 = {t_f == 10&lt;br /&gt;
    collocate({u == 0&lt;br /&gt;
                 })&lt;br /&gt;
     icollocate({x1 == xi(1)&lt;br /&gt;
                 x2 == xi(2)&lt;br /&gt;
                 })};&lt;br /&gt;
&lt;br /&gt;
%Box constraints&lt;br /&gt;
cbox = {-umm &amp;lt;= collocate(u) &amp;lt;= umm&lt;br /&gt;
        };&lt;br /&gt;
&lt;br /&gt;
%Boundary constraints&lt;br /&gt;
cbnd = {initial({   x == xi(1); &lt;br /&gt;
                    v == xi(2);&lt;br /&gt;
                    })&lt;br /&gt;
        final({     x == 0;&lt;br /&gt;
                    v == 0;&lt;br /&gt;
                    })};&lt;br /&gt;
                &lt;br /&gt;
% ODE&#039;s&lt;br /&gt;
&lt;br /&gt;
dx  = v;&lt;br /&gt;
dv  = 1./m.*(u-c*x);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ceq = collocate({&lt;br /&gt;
        dot(x) == dx&lt;br /&gt;
        dot(v) == dv&lt;br /&gt;
        });&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
objective = t_f;    &lt;br /&gt;
    &lt;br /&gt;
%% Solve the problem&lt;br /&gt;
    options = struct;&lt;br /&gt;
    options.name = &#039;cushioned oscillation&#039;;&lt;br /&gt;
    solution = ezsolve(objective, {cbox, cbnd, ceq}, x0, options);&lt;br /&gt;
&lt;br /&gt;
    tfopt = subs(t_f,solution);&lt;br /&gt;
    xopt = subs(x1,solution);&lt;br /&gt;
    vopt = subs(v,solution);&lt;br /&gt;
    uopt = subs(u,solution);&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
%Plotting solution&lt;br /&gt;
&lt;br /&gt;
figure(1)&lt;br /&gt;
subplot(3,1,1);&lt;br /&gt;
ezplot(x); legend(&#039;x&#039;);&lt;br /&gt;
xlabel(&#039;time&#039;);&lt;br /&gt;
ylabel(&#039;position in m&#039;);&lt;br /&gt;
title(&#039;Position&#039;);&lt;br /&gt;
&lt;br /&gt;
subplot(3,1,2);&lt;br /&gt;
ezplot(v); legend(&#039;v&#039;);&lt;br /&gt;
xlabel(&#039;time&#039;);&lt;br /&gt;
ylabel(&#039;velocity in m/s&#039;);&lt;br /&gt;
title(&#039;Velocity&#039;);&lt;br /&gt;
&lt;br /&gt;
subplot(3,1,3);&lt;br /&gt;
ezplot(u); legend(&#039;u&#039;);&lt;br /&gt;
xlabel(&#039;time&#039;);&lt;br /&gt;
title(&#039;Control&#039;);&lt;br /&gt;
&lt;br /&gt;
disp(&#039;Final Time&#039;);&lt;br /&gt;
disp(solution.t_f)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>MaxWolff</name></author>
	</entry>
	<entry>
		<id>https://mintoc.de/index.php?title=Cushioned_Oscillation&amp;diff=1249</id>
		<title>Cushioned Oscillation</title>
		<link rel="alternate" type="text/html" href="https://mintoc.de/index.php?title=Cushioned_Oscillation&amp;diff=1249"/>
		<updated>2016-01-13T00:02:33Z</updated>

		<summary type="html">&lt;p&gt;MaxWolff: /* Source Code */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The Cushioned Oscillation is a simplified model of time optimal &amp;quot;stopping&amp;quot; of an oscillating object attached to a spring by applying a control and moving it back into the relaxed position and no velocity.&lt;br /&gt;
&lt;br /&gt;
== Model formulation == &lt;br /&gt;
&lt;br /&gt;
An object with mass &amp;lt;math&amp;gt; m &amp;lt;/math&amp;gt; is attached to a spring with stiffness constant &amp;lt;math&amp;gt; c &amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If the resetting spring force is proportional to the deviation &amp;lt;math&amp;gt;x=x(t)&amp;lt;/math&amp;gt;, an oscillation induced by an external force &amp;lt;math&amp;gt;u(t)&amp;lt;/math&amp;gt; satisfies:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;               m\dot v (t) + cx(t) = u(t)&amp;lt;/math&amp;gt;   (which is equivalent to &amp;lt;math&amp;gt;\dot v (t) = \frac{1}{m}(u(t) - cx(t))&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;x(t)&amp;lt;/math&amp;gt; denotes the deviation to the relaxed position and &amp;lt;math&amp;gt; v(t)=\dot x (t) &amp;lt;/math&amp;gt; the velocity of the oscillating object.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Through external force, the object has been put into an initial state :&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;(x(0),v(0)) = (x_0,v_0)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The goal is to reset position and velocity of the object as fast as possible, meaning:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;(x(t_f),v(t_f)) = (0,0)&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
with the objective function:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\min\limits_{t_f} t_f&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Optimal Control Problem (OCP) Formulation ==&lt;br /&gt;
&lt;br /&gt;
The above results in the following OCP &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; 		\begin{array}{llr}&lt;br /&gt;
 		\min\limits_{x,v,u,t_f}  &amp;amp; t_f\\ &lt;br /&gt;
&lt;br /&gt;
			 		s.t. &amp;amp; 	 \dot x (t) = v(t), &amp;amp; \forall t \in [0,t_f]\\&lt;br /&gt;
&lt;br /&gt;
					 	 &amp;amp;	\dot v (t)= \frac{1}{m}(u(t) - cx(t)),  &amp;amp; \forall t \in [0,t_f]\\&lt;br /&gt;
\\&lt;br /&gt;
                                                     &lt;br /&gt;
&amp;amp; x(0)=x_0,\\&lt;br /&gt;
&lt;br /&gt;
&amp;amp; v(0)=v_0,\\&lt;br /&gt;
&lt;br /&gt;
&amp;amp; x(t_f)=0,\\&lt;br /&gt;
&lt;br /&gt;
&amp;amp; v(t_f)=0,\\&lt;br /&gt;
&lt;br /&gt;
\\&lt;br /&gt;
&amp;amp; -u_{mm} \le u(t) \le u_{mm},  &amp;amp; \forall t \in [0,t_f]\\&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
					 	&lt;br /&gt;
 		\end{array}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Parameters and Reference Solution ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The following parameters were used, to create the reference solution below, with an almost optimal final time &amp;lt;math&amp;gt; t_f = 16.66 s&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; m=10, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; c=10, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; x_0=2, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; v_0=5, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; u_{mm}=5&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;Reference solution plots&amp;quot; widths=&amp;quot;180px&amp;quot; heights=&amp;quot;140px&amp;quot; perrow=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
 Image:Ref_sol_plot_cushioned_oscillation.png| States and Controls&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The OCP was solved within MATLAB R2015b, using the TOMLAB Optimization Package. PROPT reformulates such problems with the direct collocation approache and automatically finds a suiting solver included in the TOMLAB Optimization Package (in this case, SNOPT was used).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Source Code ==&lt;br /&gt;
&lt;br /&gt;
The MATLAB script can be found in:&lt;br /&gt;
&lt;br /&gt;
[[Category:TomDyn/PROPT]] [[Cushioned Oscillation (PROPT)]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
[[Category:MIOCP]]&lt;/div&gt;</summary>
		<author><name>MaxWolff</name></author>
	</entry>
	<entry>
		<id>https://mintoc.de/index.php?title=Category:TomDyn/PROPT&amp;diff=1248</id>
		<title>Category:TomDyn/PROPT</title>
		<link rel="alternate" type="text/html" href="https://mintoc.de/index.php?title=Category:TomDyn/PROPT&amp;diff=1248"/>
		<updated>2016-01-12T23:52:40Z</updated>

		<summary type="html">&lt;p&gt;MaxWolff: Created page with &amp;quot;TomDyn/PROPT is an Optimal Control Software that allows OCP formulations with DAE&amp;#039;s and ODE&amp;#039;s in mostly just one MATLAB file and solves them, using direct collocation and NLP...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;TomDyn/PROPT is an Optimal Control Software that allows OCP formulations with DAE&#039;s and ODE&#039;s in mostly just one MATLAB file and solves them, using direct collocation and NLP solvers such as SNOPT, KNITRO, CPLEX and CONOPT.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
TomDyn Website - http://tomdyn.com/index.html&lt;/div&gt;</summary>
		<author><name>MaxWolff</name></author>
	</entry>
	<entry>
		<id>https://mintoc.de/index.php?title=Cushioned_Oscillation&amp;diff=1247</id>
		<title>Cushioned Oscillation</title>
		<link rel="alternate" type="text/html" href="https://mintoc.de/index.php?title=Cushioned_Oscillation&amp;diff=1247"/>
		<updated>2016-01-12T23:33:40Z</updated>

		<summary type="html">&lt;p&gt;MaxWolff: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The Cushioned Oscillation is a simplified model of time optimal &amp;quot;stopping&amp;quot; of an oscillating object attached to a spring by applying a control and moving it back into the relaxed position and no velocity.&lt;br /&gt;
&lt;br /&gt;
== Model formulation == &lt;br /&gt;
&lt;br /&gt;
An object with mass &amp;lt;math&amp;gt; m &amp;lt;/math&amp;gt; is attached to a spring with stiffness constant &amp;lt;math&amp;gt; c &amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If the resetting spring force is proportional to the deviation &amp;lt;math&amp;gt;x=x(t)&amp;lt;/math&amp;gt;, an oscillation induced by an external force &amp;lt;math&amp;gt;u(t)&amp;lt;/math&amp;gt; satisfies:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;               m\dot v (t) + cx(t) = u(t)&amp;lt;/math&amp;gt;   (which is equivalent to &amp;lt;math&amp;gt;\dot v (t) = \frac{1}{m}(u(t) - cx(t))&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;x(t)&amp;lt;/math&amp;gt; denotes the deviation to the relaxed position and &amp;lt;math&amp;gt; v(t)=\dot x (t) &amp;lt;/math&amp;gt; the velocity of the oscillating object.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Through external force, the object has been put into an initial state :&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;(x(0),v(0)) = (x_0,v_0)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The goal is to reset position and velocity of the object as fast as possible, meaning:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;(x(t_f),v(t_f)) = (0,0)&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
with the objective function:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\min\limits_{t_f} t_f&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Optimal Control Problem (OCP) Formulation ==&lt;br /&gt;
&lt;br /&gt;
The above results in the following OCP &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; 		\begin{array}{llr}&lt;br /&gt;
 		\min\limits_{x,v,u,t_f}  &amp;amp; t_f\\ &lt;br /&gt;
&lt;br /&gt;
			 		s.t. &amp;amp; 	 \dot x (t) = v(t), &amp;amp; \forall t \in [0,t_f]\\&lt;br /&gt;
&lt;br /&gt;
					 	 &amp;amp;	\dot v (t)= \frac{1}{m}(u(t) - cx(t)),  &amp;amp; \forall t \in [0,t_f]\\&lt;br /&gt;
\\&lt;br /&gt;
                                                     &lt;br /&gt;
&amp;amp; x(0)=x_0,\\&lt;br /&gt;
&lt;br /&gt;
&amp;amp; v(0)=v_0,\\&lt;br /&gt;
&lt;br /&gt;
&amp;amp; x(t_f)=0,\\&lt;br /&gt;
&lt;br /&gt;
&amp;amp; v(t_f)=0,\\&lt;br /&gt;
&lt;br /&gt;
\\&lt;br /&gt;
&amp;amp; -u_{mm} \le u(t) \le u_{mm},  &amp;amp; \forall t \in [0,t_f]\\&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
					 	&lt;br /&gt;
 		\end{array}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Parameters and Reference Solution ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The following parameters were used, to create the reference solution below, with an almost optimal final time &amp;lt;math&amp;gt; t_f = 16.66 s&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; m=10, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; c=10, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; x_0=2, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; v_0=5, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; u_{mm}=5&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;Reference solution plots&amp;quot; widths=&amp;quot;180px&amp;quot; heights=&amp;quot;140px&amp;quot; perrow=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
 Image:Ref_sol_plot_cushioned_oscillation.png| States and Controls&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The OCP was solved within MATLAB R2015b, using the TOMLAB Optimization Package. PROPT reformulates such problems with the direct collocation approache and automatically finds a suiting solver included in the TOMLAB Optimization Package (in this case, SNOPT was used).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Source Code ==&lt;br /&gt;
&lt;br /&gt;
The MATLAB script can be found in:&lt;br /&gt;
&lt;br /&gt;
[[Category:TomDyn/PROPT]] [[Cushioned Oscillation]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
[[Category:MIOCP]]&lt;/div&gt;</summary>
		<author><name>MaxWolff</name></author>
	</entry>
	<entry>
		<id>https://mintoc.de/index.php?title=Cushioned_Oscillation&amp;diff=1246</id>
		<title>Cushioned Oscillation</title>
		<link rel="alternate" type="text/html" href="https://mintoc.de/index.php?title=Cushioned_Oscillation&amp;diff=1246"/>
		<updated>2016-01-12T23:33:24Z</updated>

		<summary type="html">&lt;p&gt;MaxWolff: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The Cushioned Oscillation is a simplified model of time optimal &amp;quot;stopping&amp;quot; of an oscillating object attached to a spring by applying a control and moving it back into the relaxed position and no velocity.&lt;br /&gt;
&lt;br /&gt;
== Model formulation == &lt;br /&gt;
&lt;br /&gt;
An object with mass &amp;lt;math&amp;gt; m &amp;lt;/math&amp;gt; is attached to a spring with stiffness constant &amp;lt;math&amp;gt; c &amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If the resetting spring force is proportional to the deviation &amp;lt;math&amp;gt;x=x(t)&amp;lt;/math&amp;gt;, an oscillation induced by an external force &amp;lt;math&amp;gt;u(t)&amp;lt;/math&amp;gt; satisfies:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;               m\dot v (t) + cx(t) = u(t)&amp;lt;/math&amp;gt;   (which is equivalent to &amp;lt;math&amp;gt;\dot v (t) = \frac{1}{m}(u(t) - cx(t))&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;x(t)&amp;lt;/math&amp;gt; denotes the deviation to the relaxed position and &amp;lt;math&amp;gt; v(t)=\dot x (t) &amp;lt;/math&amp;gt; the velocity of the oscillating object.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Through external force, the object has been put into an initial state :&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;(x(0),v(0)) = (x_0,v_0)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The goal is to reset position and velocity of the object as fast as possible, meaning:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;(x(t_f),v(t_f)) = (0,0)&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
with the objective function:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\min\limits_{t_f} t_f&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Optimal Control Problem (OCP) Formulation ==&lt;br /&gt;
&lt;br /&gt;
The above results in the following OCP &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; 		\begin{array}{llr}&lt;br /&gt;
 		\min\limits_{x,v,u,t_f}  &amp;amp; t_f\\ &lt;br /&gt;
&lt;br /&gt;
			 		s.t. &amp;amp; 	 \dot x (t) = v(t), &amp;amp; \forall t \in [0,t_f]\\&lt;br /&gt;
&lt;br /&gt;
					 	 &amp;amp;	\dot v (t)= \frac{1}{m}(u(t) - cx(t)),  &amp;amp; \forall t \in [0,t_f]\\&lt;br /&gt;
\\&lt;br /&gt;
                                                     &lt;br /&gt;
&amp;amp; x(0)=x_0,\\&lt;br /&gt;
&lt;br /&gt;
&amp;amp; v(0)=v_0,\\&lt;br /&gt;
&lt;br /&gt;
&amp;amp; x(t_f)=0,\\&lt;br /&gt;
&lt;br /&gt;
&amp;amp; v(t_f)=0,\\&lt;br /&gt;
&lt;br /&gt;
\\&lt;br /&gt;
&amp;amp; -u_{mm} \le u(t) \le u_{mm},  &amp;amp; \forall t \in [0,t_f]\\&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
					 	&lt;br /&gt;
 		\end{array}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Parameters and Reference Solution ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The following parameters were used, to create the reference solution below, with an almost optimal final time &amp;lt;math&amp;gt; t_f = 16.66 s&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; m=10, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; c=10, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; x_0=2, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; v_0=5, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; u_{mm}=5&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;Reference solution plots&amp;quot; widths=&amp;quot;180px&amp;quot; heights=&amp;quot;140px&amp;quot; perrow=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
 Image:Ref_sol_plot_cushioned_oscillation.png| States and Controls&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The OCP was solved within MATLAB R2015b, using the TOMLAB Optimization Package. PROPT reformulates such problems with the direct collocation approache and automatically finds a suiting solver included in the TOMLAB Optimization Package (in this case, SNOPT was used).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Source Code ==&lt;br /&gt;
&lt;br /&gt;
The MATLAB script can be found in:&lt;br /&gt;
&lt;br /&gt;
[[Category:TomDyn/PROPT]] [[Cushioned Oscillation]]&lt;br /&gt;
&lt;br /&gt;
 == References ==&lt;br /&gt;
&lt;br /&gt;
[[Category:MIOCP]]&lt;/div&gt;</summary>
		<author><name>MaxWolff</name></author>
	</entry>
	<entry>
		<id>https://mintoc.de/index.php?title=Cushioned_Oscillation&amp;diff=1245</id>
		<title>Cushioned Oscillation</title>
		<link rel="alternate" type="text/html" href="https://mintoc.de/index.php?title=Cushioned_Oscillation&amp;diff=1245"/>
		<updated>2016-01-12T23:32:33Z</updated>

		<summary type="html">&lt;p&gt;MaxWolff: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The Cushioned Oscillation is a simplified model of time optimal &amp;quot;stopping&amp;quot; of an oscillating object attached to a spring by applying a control and moving it back into the relaxed position and no velocity.&lt;br /&gt;
&lt;br /&gt;
== Model formulation == &lt;br /&gt;
&lt;br /&gt;
An object with mass &amp;lt;math&amp;gt; m &amp;lt;/math&amp;gt; is attached to a spring with stiffness constant &amp;lt;math&amp;gt; c &amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If the resetting spring force is proportional to the deviation &amp;lt;math&amp;gt;x=x(t)&amp;lt;/math&amp;gt;, an oscillation induced by an external force &amp;lt;math&amp;gt;u(t)&amp;lt;/math&amp;gt; satisfies:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;               m\dot v (t) + cx(t) = u(t)&amp;lt;/math&amp;gt;   (which is equivalent to &amp;lt;math&amp;gt;\dot v (t) = \frac{1}{m}(u(t) - cx(t))&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;x(t)&amp;lt;/math&amp;gt; denotes the deviation to the relaxed position and &amp;lt;math&amp;gt; v(t)=\dot x (t) &amp;lt;/math&amp;gt; the velocity of the oscillating object.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Through external force, the object has been put into an initial state :&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;(x(0),v(0)) = (x_0,v_0)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The goal is to reset position and velocity of the object as fast as possible, meaning:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;(x(t_f),v(t_f)) = (0,0)&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
with the objective function:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\min\limits_{t_f} t_f&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Optimal Control Problem (OCP) Formulation ==&lt;br /&gt;
&lt;br /&gt;
The above results in the following OCP &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; 		\begin{array}{llr}&lt;br /&gt;
 		\min\limits_{x,v,u,t_f}  &amp;amp; t_f\\ &lt;br /&gt;
&lt;br /&gt;
			 		s.t. &amp;amp; 	 \dot x (t) = v(t), &amp;amp; \forall t \in [0,t_f]\\&lt;br /&gt;
&lt;br /&gt;
					 	 &amp;amp;	\dot v (t)= \frac{1}{m}(u(t) - cx(t)),  &amp;amp; \forall t \in [0,t_f]\\&lt;br /&gt;
\\&lt;br /&gt;
                                                     &lt;br /&gt;
&amp;amp; x(0)=x_0,\\&lt;br /&gt;
&lt;br /&gt;
&amp;amp; v(0)=v_0,\\&lt;br /&gt;
&lt;br /&gt;
&amp;amp; x(t_f)=0,\\&lt;br /&gt;
&lt;br /&gt;
&amp;amp; v(t_f)=0,\\&lt;br /&gt;
&lt;br /&gt;
\\&lt;br /&gt;
&amp;amp; -u_{mm} \le u(t) \le u_{mm},  &amp;amp; \forall t \in [0,t_f]\\&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
					 	&lt;br /&gt;
 		\end{array}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Parameters and Reference Solution ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The following parameters were used, to create the reference solution below, with an almost optimal final time &amp;lt;math&amp;gt; t_f = 16.66 s&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; m=10, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; c=10, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; x_0=2, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; v_0=5, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; u_{mm}=5&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;Reference solution plots&amp;quot; widths=&amp;quot;180px&amp;quot; heights=&amp;quot;140px&amp;quot; perrow=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
 Image:Ref_sol_plot_cushioned_oscillation.png| States and Controls&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The OCP was solved within MATLAB R2015b, using the TOMLAB Optimization Package. PROPT reformulates such problems with the direct collocation approache and automatically finds a suiting solver included in the TOMLAB Optimization Package (in this case, SNOPT was used).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Source Code ==&lt;br /&gt;
&lt;br /&gt;
The MATLAB script can be found in:&lt;br /&gt;
&lt;br /&gt;
[[Category:TomDyn/PROPT]] [[Cushioned Oscillation]]&lt;br /&gt;
&lt;br /&gt;
[[Category:MIOCP]]&lt;/div&gt;</summary>
		<author><name>MaxWolff</name></author>
	</entry>
	<entry>
		<id>https://mintoc.de/index.php?title=Cushioned_Oscillation&amp;diff=1244</id>
		<title>Cushioned Oscillation</title>
		<link rel="alternate" type="text/html" href="https://mintoc.de/index.php?title=Cushioned_Oscillation&amp;diff=1244"/>
		<updated>2016-01-12T23:29:00Z</updated>

		<summary type="html">&lt;p&gt;MaxWolff: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The Cushioned Oscillation is a simplified model of time optimal &amp;quot;stopping&amp;quot; of an oscillating object attached to a spring by applying a control and moving it back into the relaxed position and no velocity.&lt;br /&gt;
&lt;br /&gt;
== Model formulation == &lt;br /&gt;
&lt;br /&gt;
An object with mass &amp;lt;math&amp;gt; m &amp;lt;/math&amp;gt; is attached to a spring with stiffness constant &amp;lt;math&amp;gt; c &amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If the resetting spring force is proportional to the deviation &amp;lt;math&amp;gt;x=x(t)&amp;lt;/math&amp;gt;, an oscillation induced by an external force &amp;lt;math&amp;gt;u(t)&amp;lt;/math&amp;gt; satisfies:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;               m\dot v (t) + cx(t) = u(t)&amp;lt;/math&amp;gt;   (which is equivalent to &amp;lt;math&amp;gt;\dot v (t) = \frac{1}{m}(u(t) - cx(t))&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;x(t)&amp;lt;/math&amp;gt; denotes the deviation to the relaxed position and &amp;lt;math&amp;gt; v(t)=\dot x (t) &amp;lt;/math&amp;gt; the velocity of the oscillating object.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Through external force, the object has been put into an initial state :&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;(x(0),v(0)) = (x_0,v_0)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The goal is to reset position and velocity of the object as fast as possible, meaning:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;(x(t_f),v(t_f)) = (0,0)&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
with the objective function:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\min\limits_{t_f} t_f&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Optimal Control Problem (OCP) Formulation ==&lt;br /&gt;
&lt;br /&gt;
The above results in the following OCP &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; 		\begin{array}{llr}&lt;br /&gt;
 		\min\limits_{x,v,u,t_f}  &amp;amp; t_f\\ &lt;br /&gt;
&lt;br /&gt;
			 		s.t. &amp;amp; 	 \dot x (t) = v(t), &amp;amp; \forall t \in [0,t_f]\\&lt;br /&gt;
&lt;br /&gt;
					 	 &amp;amp;	\dot v (t)= \frac{1}{m}(u(t) - cx(t)),  &amp;amp; \forall t \in [0,t_f]\\&lt;br /&gt;
\\&lt;br /&gt;
                                                     &lt;br /&gt;
&amp;amp; x(0)=x_0,\\&lt;br /&gt;
&lt;br /&gt;
&amp;amp; v(0)=v_0,\\&lt;br /&gt;
&lt;br /&gt;
&amp;amp; x(t_f)=0,\\&lt;br /&gt;
&lt;br /&gt;
&amp;amp; v(t_f)=0,\\&lt;br /&gt;
&lt;br /&gt;
\\&lt;br /&gt;
&amp;amp; -u_{mm} \le u(t) \le u_{mm},  &amp;amp; \forall t \in [0,t_f]\\&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
					 	&lt;br /&gt;
 		\end{array}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Parameters and Reference Solution ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The following parameters were used, to create the reference solution below, with an almost optimal final time &amp;lt;math&amp;gt; t_f = 16.66 s&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; m=10, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; c=10, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; x_0=2, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; v_0=5, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; u_{mm}=5&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;Reference solution plots&amp;quot; widths=&amp;quot;180px&amp;quot; heights=&amp;quot;140px&amp;quot; perrow=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
 Image:Ref_sol_plot_cushioned_oscillation.png| States and Controls&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The OCP was solved within MATLAB R2015b, using the TOMLAB Optimization Package. PROPT reformulates such problems with the direct collocation approache and automatically finds a suiting solver included in the TOMLAB Optimization Package (in this case, SNOPT was used).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:MIOCP]]&lt;/div&gt;</summary>
		<author><name>MaxWolff</name></author>
	</entry>
	<entry>
		<id>https://mintoc.de/index.php?title=File:Ref_sol_plot_cushioned_oscillation.png&amp;diff=1243</id>
		<title>File:Ref sol plot cushioned oscillation.png</title>
		<link rel="alternate" type="text/html" href="https://mintoc.de/index.php?title=File:Ref_sol_plot_cushioned_oscillation.png&amp;diff=1243"/>
		<updated>2016-01-12T23:28:06Z</updated>

		<summary type="html">&lt;p&gt;MaxWolff: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>MaxWolff</name></author>
	</entry>
	<entry>
		<id>https://mintoc.de/index.php?title=Cushioned_Oscillation&amp;diff=1242</id>
		<title>Cushioned Oscillation</title>
		<link rel="alternate" type="text/html" href="https://mintoc.de/index.php?title=Cushioned_Oscillation&amp;diff=1242"/>
		<updated>2016-01-12T23:25:08Z</updated>

		<summary type="html">&lt;p&gt;MaxWolff: Resetting an oscillating object in shortest time&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The Cushioned Oscillation is a simplified model of time optimal &amp;quot;stopping&amp;quot; of an oscillating object attached to a spring by applying a control and moving it back into the relaxed position and no velocity.&lt;br /&gt;
&lt;br /&gt;
== Model formulation == &lt;br /&gt;
&lt;br /&gt;
An object with mass &amp;lt;math&amp;gt; m &amp;lt;/math&amp;gt; is attached to a spring with stiffness constant &amp;lt;math&amp;gt; c &amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If the resetting spring force is proportional to the deviation &amp;lt;math&amp;gt;x=x(t)&amp;lt;/math&amp;gt;, an oscillation induced by an external force &amp;lt;math&amp;gt;u(t)&amp;lt;/math&amp;gt; satisfies:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;               m\dot v (t) + cx(t) = u(t)&amp;lt;/math&amp;gt;   (which is equivalent to &amp;lt;math&amp;gt;\dot v (t) = \frac{1}{m}(u(t) - cx(t))&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;x(t)&amp;lt;/math&amp;gt; denotes the deviation to the relaxed position and &amp;lt;math&amp;gt; v(t)=\dot x (t) &amp;lt;/math&amp;gt; the velocity of the oscillating object.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Through external force, the object has been put into an initial state :&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;(x(0),v(0)) = (x_0,v_0)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The goal is to reset position and velocity of the object as fast as possible, meaning:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;(x(t_f),v(t_f)) = (0,0)&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
with the objective function:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\min\limits_{t_f} t_f&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Optimal Control Problem (OCP) Formulation ==&lt;br /&gt;
&lt;br /&gt;
The above results in the following OCP &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; 		\begin{array}{llr}&lt;br /&gt;
 		\min\limits_{x,v,u,t_f}  &amp;amp; t_f\\ &lt;br /&gt;
&lt;br /&gt;
			 		s.t. &amp;amp; 	 \dot x (t) = v(t), &amp;amp; \forall t \in [0,t_f]\\&lt;br /&gt;
&lt;br /&gt;
					 	 &amp;amp;	\dot v (t)= \frac{1}{m}(u(t) - cx(t)),  &amp;amp; \forall t \in [0,t_f]\\&lt;br /&gt;
\\&lt;br /&gt;
                                                     &lt;br /&gt;
&amp;amp; x(0)=x_0,\\&lt;br /&gt;
&lt;br /&gt;
&amp;amp; v(0)=v_0,\\&lt;br /&gt;
&lt;br /&gt;
&amp;amp; x(t_f)=0,\\&lt;br /&gt;
&lt;br /&gt;
&amp;amp; v(t_f)=0,\\&lt;br /&gt;
&lt;br /&gt;
\\&lt;br /&gt;
&amp;amp; -u_{mm} \le u(t) \le u_{mm},  &amp;amp; \forall t \in [0,t_f]\\&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
					 	&lt;br /&gt;
 		\end{array}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Parameters and Reference Solution ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The following parameters were used, to create the reference solution below, with an almost optimal final time &amp;lt;math&amp;gt; t_f = 16.66 s&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; m=10, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; c=10, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; x_0=2, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; v_0=5, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; u_{mm}=5&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;Reference solution plots&amp;quot; widths=&amp;quot;180px&amp;quot; heights=&amp;quot;140px&amp;quot; perrow=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
 Image:ref_sol_plot_cushioned_oscillation.png| States and Controls&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The OCP was solved within MATLAB R2015b, using the TOMLAB Optimization Package. PROPT reformulates such problems with the direct collocation approache and automatically finds a suiting solver included in the TOMLAB Optimization Package (in this case, SNOPT was used).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:OCP]]&lt;/div&gt;</summary>
		<author><name>MaxWolff</name></author>
	</entry>
</feed>